Beyond Single Bugs: Benchmarking Large Language Models for Multi-Vulnerability Detection

Chinmay Pushkar, Sanchit Kabra, Dhruv Kumar, Jagat Sesh Challa · DOI

Introduction

As Large Language Models (LLMs) become integral to automated software security audits, the methods used to evaluate them must evolve. Traditional benchmarks often simplify vulnerability detection into a binary classification task—determining if a small code snippet is "safe" or "vulnerable." However, real-world software security is rarely so binary. Vulnerabilities frequently cluster within large, complex files, requiring an auditor to identify multiple flaws of varying types simultaneously. This paper introduces a new benchmark designed to evaluate LLMs' ability to detect multiple vulnerabilities within a single file, uncovering significant performance limitations as code complexity and bug density increase.

Methodology: The Stress-Test Pipeline

To simulate realistic auditing scenarios, the researchers developed a systematic pipeline for "adversarial injection." Using an "Oracle" LLM (Qwen2.5-32B), they first performed feasibility mapping on clean code from the CodeParrot GitHub corpus to identify locations where vulnerabilities could be injected without disrupting the code's core logic.

The researchers then injected combinations of the MITRE 2024 Top-25 Common Weakness Enumerations (CWEs) into files ranging from 7,500 to 10,000 tokens. This length was specifically chosen to test the models' long-context attention and avoid the "lost in the middle" phenomenon. The resulting dataset comprises 40,000 files across four major programming languages: C, C++, Python, and JavaScript. Crucially, the dataset features controlled densities of 1, 3, 5, or 9 vulnerabilities per file. This allows for the calculation of a new metric: the ExactFile Score, representing the percentage of files where a model identifies the exact set of vulnerabilities perfectly.

The Multi-Vulnerability Performance Gap

The study identifies a pronounced "count bias" in LLMs: the tendency for a model to cease its search after identifying a few initial flaws. As the density of vulnerabilities increases, performance metrics like the F1-score and Recall plummet across all tested models.

Model performance significantly degrades as the number of vulnerabilities per file increases, illustrating a clear 'performance cliff.'

For instance, Llama-3.3-70B, the top-performing model, achieves an F1-score of 0.97 on single-vulnerability tasks in C. However, this score drops to 0.63 when the file contains nine vulnerabilities. This "giving up" effect is further quantified by the Mean Absolute Error (MAE) in vulnerability counts, which increased by over 200% as density rose, indicating that models systematically under-report the total number of threats.

Language-Specific Vulnerability Detection

The benchmark revealed that the programming language itself significantly impacts model robustness. C++ emerged as the most challenging language, likely due to its complex syntax and manual memory management, which increase the "cognitive load" on the model's context window.

Recall scores vary significantly by language, with Python showing a unique improvement in recall at higher vulnerability densities.

While most languages followed a standard degradation curve, Python exhibited an "anomaly." Models often struggled with single bugs in Python but showed improved recall in high-density settings. The authors suggest that multiple flaws in Python might trigger stronger "association networks" within the model, leading to more aggressive and accurate predictions. In contrast, C++ saw a sharp collapse; for example, Qwen2.5-72B's recall dropped from 81.4% in 1-vulnerability files to significantly lower levels as density increased.

Conclusion

The findings highlight a critical gap between current LLM capabilities and the requirements of real-world security auditing. Even state-of-the-art models suffer from count and selection biases, often finding only the "low-hanging fruit" while missing deeper, clustered vulnerabilities. To address these limitations, the authors advocate for hybrid systems that combine the reasoning capabilities of LLMs with the exhaustive nature of traditional static analysis tools. Future work will focus on expanding the benchmark to include zero-day exploits and domain-specific logic flaws to further refine AI-driven security audits.

Summary updated

BibTeX
@misc{pushkar2025beyond,
  author = {Chinmay Pushkar and Sanchit Kabra and Dhruv Kumar and Jagat Sesh Challa},
  title = {{Beyond Single Bugs: Benchmarking Large Language Models for Multi-Vulnerability Detection}},
  year = {2025},
  eprint = {2512.22306},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2512.22306},
}
Figure