Generalization-Enhanced Code Vulnerability Detection via Multi-Task Instruction Fine-Tuning

Xiaohu Du, Ming Wen, Jiahao Zhu, Zifan Xie, Bin Ji +3 more
6/6/2024
cs.CRcs.AIcs.CL

No official code found. Best implementation: CGCL-codes/VulLLM (79 stars, MIT, last commit 2025-10-29).

Abstract

Code Pre-trained Models (CodePTMs) based vulnerability detection have achieved promising results over recent years. However, these models struggle to generalize as they typically learn superficial mapping from source code to labels instead of understanding the root causes of code vulnerabilities, resulting in poor performance in real-world scenarios beyond the training instances. To tackle this challenge, we introduce VulLLM, a novel framework that integrates multi-task learning with Large Language Models (LLMs) to effectively mine deep-seated vulnerability features. Specifically, we construct two auxiliary tasks beyond the vulnerability detection task. First, we utilize the vulnerability patches to construct a vulnerability localization task. Second, based on the vulnerability features extracted from patches, we leverage GPT-4 to construct a vulnerability interpretation task. VulLLM innovatively augments vulnerability classification by leveraging generative LLMs to understand complex vulnerability patterns, thus compelling the model to capture the root causes of vulnerabilities rather than overfitting to spurious features of a single task. The experiments conducted on six large datasets demonstrate that VulLLM surpasses seven state-of-the-art models in terms of effectiveness, generalization, and robustness.

View on arXivView PDF

Code Implementations(1)

CGCL-codes/VulLLMCommunity100%
MIT

An implementation of the ACL 2024 Findings paper "Generalization-Enhanced Code Vulnerability Detection via Multi-Task Instruction Fine-Tuning".

7919C, C++Jun 3, 202411 months agoMIT

Similar Papers

Cite this paper

@article{du2024generalizationenhanced,
  title  = {Generalization-Enhanced Code Vulnerability Detection via Multi-Task Instruction Fine-Tuning},
  author = {Xiaohu Du and Ming Wen and Jiahao Zhu and Zifan Xie and Bin Ji and Huijun Liu and Xuanhua Shi and Hai Jin},
  year   = {2024},
  eprint = {2406.03718},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2406.03718v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2406.03718.svg)](https://codeofpaper.com/paper/2406.03718)

Discussion