[Paper Review] DefectHunter: A Novel LLM-Driven Boosted-Conformer-based Code Vulnerability Detection Mechanism
DefectHunter combines structural code graphs with a Conformer-based architecture and LLM embeddings to detect vulnerabilities, achieving notable accuracy gains over baselines on CWE, QEMU, and FFmpeg datasets.
One of the most pressing threats to computing systems is software vulnerabilities, which can compromise both hardware and software components. Existing methods for vulnerability detection remain suboptimal. Traditional techniques are both time-consuming and labor-intensive, while machine-learning-based approaches often underperform when applied to complex datasets, due to their inability to capture high-dimensional relationships. Previous deep-learning strategies also fall short in capturing sufficient feature information. Although self-attention mechanisms can process information over long distances, they fail to capture structural information. In this paper, we introduce DefectHunter, an innovative model for vulnerability identification that employs the Conformer mechanism. This mechanism fuses self-attention with convolutional networks to capture both local, position-wise features and global, content-based interactions. Furthermore, we optimize the self-attention mechanisms to mitigate the issue of excessive attention heads introducing extraneous noise by adjusting the denominator. We evaluated DefectHunter against ten baseline methods using six industrial and two highly complex datasets. On the QEMU dataset, DefectHunter exhibited a 20.62\% improvement in accuracy over Pongo-70B, and for the CWE-754 dataset, its accuracy was 14.64\% higher. To investigate how DefectHunter comprehends vulnerabilities, we conducted a case study, which revealed that our model effectively understands the mechanisms underlying vulnerabilities.
Motivation & Objective
- Motivate robust vulnerability detection in code beyond traditional static/dynamic analyses and plain deep learning.
- Propose a Conformer-based architecture that fuses local (convolutional) and global (self-attention) feature extraction for code structures.
- Leverage structural code graphs (AST/CFG/DFG) and semantic code embeddings from pre-trained LLMs to improve detection.
- Evaluate against multiple industrial and complex datasets to demonstrate performance gains over baselines and analyze component contributions.
Proposed method
- Use structural information processing to derive AST, CFG, and DFG representations from code snippets.
- Embed code tokens with a pre-trained code model to obtain Code Sequence Embeddings (CSEs).
- Adopt a Conformer-based block that merges convolutional modules with multi-head self-attention and modified positional encodings.
- Modify the attention denominator in softmax to reduce noise from excessive attention heads in multi-head attention.
- Train a multi-layer perceptron classifier on fused structural and semantic features to predict vulnerabilities.
Experimental results
Research questions
- RQ1How does integrating structural code graphs with semantic embeddings affect vulnerability detection performance?
- RQ2What gains does the Conformer architecture provide over standard Transformer-based approaches in this domain?
- RQ3How do ablations of Conformer components (AST/CFG/DFG, attention-modifications, and LLM usage) affect performance on diverse datasets?
Key findings
- DefectHunter achieves higher accuracy than baselines on CWE datasets, with ACCs up to 0.9141–0.9999 across specific CWE types.
- On FFmpeg and QEMU datasets, DefectHunter attains ACCs of 0.6653 and 0.6459 respectively, outperforming several baselines in many metrics.
- Compared to Pongo-70B, DefectHunter shows a 14.64 percentage point improvement in ACC on CWE datasets and a 20.62 percentage point improvement on QEMU.
- Ablation results show Conformer and LLM components substantially contribute to performance, with notable drops when removing AST/DFG/CFG or Conformer modules.
- DefectHunter demonstrates that a smaller, well-tuned model can outperform larger LLM-based approaches in vulnerability detection.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.