Automated Vulnerability Repair Based on Retrieval-Augmented Generation

As software scale continues to grow and complexity increases, vulnerabilities have become a significant issue affecting system security and stability. In recent years, advancements in machine learning and natural language processing technologies have made automated vulnerability repair an increasingly effective solution to this problem. However, existing automated vulnerability repair methods often lack a sufficient understanding of code context, making it difficult to handle complex vulnerabilities. As a result, the repair performance is often suboptimal, and these methods suffer from limited generalization capabilities. To address these issues, we propose VulRag, an automated vulnerability repair method based on Retrieval-Augmented Generation. This method leverages existing vulnerability repair samples as a knowledge base and retrieves the most similar vulnerability repair processes to assist the large language model in better understanding and repairing vulnerabilities. Additionally, we design four prompt templates to guide the model in utilizing the retrieved knowledge to generate repair code. Experimental results show that VulRag outperforms the best baseline method, achieving relative improvements of 7.9% and 17.3% in EM and BLEU scores, respectively.

Authors

Institutions

Publication Details

Published
2025-04-18
DOI
https://doi.org/10.1109/iseae64934.2025.11041756
Primary Topic
Network Security and Intrusion Detection
Type
article
Field-Weighted Citation Impact
0.00

Funders

Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Automated Vulnerability Repair Based on Retrieval-Augmented Generation

Yu Qiao, Stephen Z. D. Cheng, Yi Zhu, Zhicheng Huang
Network Security and Intrusion Detection
article

Automated Vulnerability Repair Based on Retrieval-Augmented Generation

Yu Qiao, Stephen Z. D. Cheng, Yi Zhu, Zhicheng Huang
article en

Abstract

As software scale continues to grow and complexity increases, vulnerabilities have become a significant issue affecting system security and stability. In recent years, advancements in machine learning and natural language processing technologies have made automated vulnerability repair an increasingly effective solution to this problem. However, existing automated vulnerability repair methods often lack a sufficient understanding of code context, making it difficult to handle complex vulnerabilities. As a result, the repair performance is often suboptimal, and these methods suffer from limited generalization capabilities. To address these issues, we propose VulRag, an automated vulnerability repair method based on Retrieval-Augmented Generation. This method leverages existing vulnerability repair samples as a knowledge base and retrieves the most similar vulnerability repair processes to assist the large language model in better understanding and repairing vulnerabilities. Additionally, we design four prompt templates to guide the model in utilizing the retrieved knowledge to generate repair code. Experimental results show that VulRag outperforms the best baseline method, achieving relative improvements of 7.9% and 17.3% in EM and BLEU scores, respectively.

Jiangsu Normal University (CN)
National Natural Science Foundation of China
Openalex Percentile: Top 84%
Network Security and Intrusion Detection
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.