Fine-Grained Reasoning Enhanced Vulnerability Patch Generation with Multi-View Fix Knowledge
With the rapid advancement of deep learning, numerous large language models (LLMs) have been developed, achieving remarkable performance across a wide range of code generation tasks. However, in the domain of vulnerability patch generation, existing approaches suffer from two critical limitations: (1) limited reasoning capability, which hampers the modeling of fine-grained fix logic; and (2) insufficient utilization of fix knowledge, with minimal consideration of vulnerability intent. To address these challenges, we propose FraMe, a novel automated approach that integrates F ine-g r ained re a soning paths with M ulti-vi e w fix knowledge to enhance LLM-based vulnerability patch generation. FraMe consists of two modules: stepwise fix-reasoning path collection and multi-view knowledge augmented patch generation. The first module extracts detailed vulnerability–fix context and constructs augmented prompt templates to generate stepwise fix-reasoning paths, enabling the model to capture fine-grained fix logic. The second module leverages multi-view fix knowledge from a vulnerability knowledge graph to model vulnerability intent and supplement code semantics, thereby facilitating the selection of effective few-shot examples and enabling the LLM to generate more accurate patches. We evaluated FraMe on a widely used real-world C/C++ vulnerability dataset. Experimental results demonstrate that FraMe consistently outperforms both existing prompting methods and non-LLM-based techniques, achieving an improvement of 9.4% in the Correct metric at a beam size of 10 compared with the best baseline. The source code and datasets are available at https://github.com/VulDet/FraMe .
Authors
- Guoqing Zhu (ORCID: https://orcid.org/0009-0001-8153-2636)
- Yang Xiao (ORCID: https://orcid.org/0009-0005-8009-2252)
- Cuiyun Gao (ORCID: https://orcid.org/0000-0001-8513-6836)
- Miaomiao Shao (ORCID: https://orcid.org/0009-0003-1827-2821)
- Yuxin Ding (ORCID: https://orcid.org/0009-0000-0155-875X)
Institutions
- Chinese Academy of Sciences (CN)
- Harbin Institute of Technology (CN)
Publication Details
- Journal
- ACM Transactions on Software Engineering and Methodology
- Published
- 2026-11-16
- DOI
- https://doi.org/10.1145/3861081
- Primary Topic
- Software Engineering Research
- Type
- article
- Field-Weighted Citation Impact
- 0.00