Enhancing Fine-Grained Vulnerability Detection With Reinforcement Learning
The rapid growth of vulnerabilities has significantly accelerated the development of automated vulnerability detection methods, especially those based on data-driven models. However, most of them primarily focus on extracting accurate code representations while overlooking the complex vulnerability patterns among vulnerable statements, thereby leaving room for improvement. To overcome this limitation, we present a novel reinforcement learning framework (<italic xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">RLFD</i>) for detecting vulnerabilities at a fine-grained level. <italic xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">RLFD</i> redefines the detection task as a sequential decision-making process and then employs reinforcement learning to automatically learn vulnerability-relevant structures from code snippets. Moreover, by designing reward functions aligned with fine-grained evaluation metrics, <italic xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">RLFD</i> focuses on the co-existence relations among statements from a global perspective, enabling the model to capture complex interactions that lead to vulnerabilities. Additionally, the framework utilizes CodeBERT-HLS for code representation, ensuring consistency with the state-of-the-art method while highlighting the improvements brought by the proposed reinforcement learning-based approach. Comprehensive experiments show that our method achieves a locating precision (IoU) of 69.7% and a Top-5% Acc of 67.7% on the <italic xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">big_vul</i> dataset, outperforming the state-of-the-art method by an overall 3.4% improvement in IoU. Notably, our method achieves up to a 19.7% increase in IoU for specific categories, e.g., CWE-416 (use-after-free).
Authors
- Yuan Jiang (ORCID: https://orcid.org/0000-0002-3052-1320)
- Tiantian Wang (ORCID: https://orcid.org/0000-0003-2958-8066)
- Zhichen Qu
- Christoph Treude (ORCID: https://orcid.org/0000-0002-6919-2149)
- Xiaohong Su (ORCID: https://orcid.org/0009-0009-8713-4186)
Institutions
- Harbin Institute of Technology (CN)
- Heilongjiang Institute of Technology (CN)
- Singapore Management University (SG)
Publication Details
- Journal
- IEEE Transactions on Software Engineering
- Published
- 2025-08-29
- DOI
- https://doi.org/10.1109/tse.2025.3603400
- Citations
- 2
- Primary Topic
- Network Security and Intrusion Detection
- Type
- article
- Field-Weighted Citation Impact
- 2.97