Enhanced Vulnerability Localization: Harmonizing Task-Specific Tuning and General LLM Prompting
Abstract
Large Language Models (LLMs) have shown significant potential for vulnerability localization in software security. However, current LLM-based approaches face a critical dilemma: direct application of general-purpose LLMs lacks crucial domainspecific expertise, while fine-tuning suffers from limited robustness when faced with unfamiliar data. These problems result in subpar performance in vulnerability localization and weak generalization capabilities. To address these limitations, we introduce ENVUL, a novel domain adaptation framework for vulnerability localization. ENVUL improves vulnerability localization by synergizing enhanced task-specific tuning with prompt engineering of general-purpose LLMs. ENVUL incorporates three key innovations for addressing two problems: (1) how to optimize fine-tuning for localization task, and (2) when to wisely choose tuning and prompting. To solve the first problem, we introduce: (a). a context Consolidator that captures rich statement-level code semantic, improving the model's understanding of code context; (b). a semantic Indicator employing attention rectification to highlight patterns indicative of vulnerabilities, focusing the model on critical security signals. To solve the second problem, we introduce a dynamic routing mechanism based on joint-representation similarity analysis that strategically delegates tasks between the fine-tuned model and the general LLM. It ensures ENVUL's robust performance across diverse real-world vulnerability types. Real-world evaluations demonstrate ENVUL's robust expertise in outperforming state-of-the-art vulnerability localization baselines, achieving absolute improvements of $\mathbf{2 2. 7 \% - 3 0. 3 \%}$ in top-1 accuracy. Notably, ENVul exhibits exceptional generalization, achieving $\mathbf{4 3. 6 \% - 5 0 \%}$ higher accuracy on unfamiliar vulnerability types.
BibTeX
@inproceedings{tian2025enhanced,
author = {Wentong Tian and Yuanzhang Lin and Xiang Gao and Hailong Sun},
title = {{Enhanced Vulnerability Localization: Harmonizing Task-Specific Tuning and General LLM Prompting}},
booktitle = {ICSME},
year = {2025},
doi = {10.1109/icsme64153.2025.00020},
}Ask Althea to put this paper to the test.
Loading related content...