LLM Vulnerability Detection: Recall Benchmarks and Model Selection
An evaluation consuming more than 11.7 billion tokens highlights the trade-offs between vulnerability detection recall, consistency, and inference cost. This article examines the reported results, explains the limits of three-run aggregate recall, and outlines model selection strategies for layered security auditing and cloud-based workflows.
Introduction: The Potential and Challenges of LLM-Based Security Auditing
As software supply chain risks grow, traditional static application security testing (SAST) and dynamic application security testing (DAST) face challenges with complex business logic and deep call chains. Large language models (LLMs), with their ability to interpret code semantics and reason about program behavior, are emerging as another tool for security auditing.
However, integrating an LLM into a security pipeline raises practical questions. How effectively does it identify vulnerabilities in real-world code? How consistently does it reproduce its findings? And how should teams balance recall against inference cost?
An evaluation consuming more than 11.7 billion tokens offers insight into these questions. Its reported results illustrate both the potential of LLM-based vulnerability detection and the engineering trade-offs involved in choosing a model.
Evaluation Background and Methodology
A security research team conducted a large-scale evaluation of mainstream LLMs for vulnerability detection. Rather than relying on a handful of API calls, the evaluation consumed more than 11.7 billion tokens to assess performance in complex code environments.
1. Evaluation Metrics
The evaluation focused on two metrics:
- Recall: The proportion of known vulnerabilities in the test set that a model successfully identified. This measures detection coverage within the evaluated dataset.
- Consistency: The extent to which a model repeatedly identifies the same vulnerability across independent inference runs. Because model outputs can vary, strong recall in one run does not necessarily imply reliable performance in an operational pipeline.
These metrics capture different aspects of detection quality. A model may identify many vulnerabilities across repeated attempts while failing to reproduce those findings reliably in any individual run.
2. Three-Run Aggregation
The evaluation used a three-run aggregation method. Each model processed the same test samples in three independent inference runs, and the union of the findings became its final aggregate recall.
Under this method, a vulnerability counted as detected if the model identified it in at least one run. This approximates a multi-pass auditing strategy that an enterprise might use at a critical security review stage.
Aggregate recall should therefore be distinguished from single-run recall and repeatability: it measures the coverage achieved across multiple attempts, not the reliability of any one attempt.
Key Findings and Benchmark Results
1. High Aggregate Recall Does Not Guarantee Consistency
One frontier model achieved the strongest reported aggregate result, detecting 28 of 32 vulnerabilities across three runs. Other comparable frontier models generally detected 25–26 of 32.
Its individual results were less consistent:
- The first run identified only 17 vulnerabilities.
- Only 10 vulnerabilities were identified in all three runs.
This gap between aggregate coverage and repeatable detection is important for deployment. A model can achieve strong coverage when its findings are combined across several runs, yet still miss many vulnerabilities during a single automated scan.
The source analysis suggests that shifting attention to context or sensitivity to temperature settings may contribute to this variation. The reported counts, however, do not establish a specific cause.
For security pipelines that depend on one inference pass, aggregate recall alone can overstate the detection coverage available in routine operation.
2. A Lower-Cost Model Delivers Competitive Recall
Another, more cost-effective model achieved 25 of 32 in its production release, while its reported inference cost was approximately 70% lower.
This result falls within the reported 25–26 range for comparable frontier models, although it remains three detections below the highest aggregate score of 28.
For enterprise audits covering millions of lines of code, inference cost can determine whether frequent, large-scale scanning is practical. A model that approaches frontier-level detection coverage at substantially lower cost may be a useful choice for broad, recurring audits.
The selection decision should therefore consider not only the highest recall score, but also how much coverage a team can afford to run across its repositories and review cycles.
3. Limits of the Evaluation
The evaluation did not include some of the latest proprietary models. It therefore does not establish the current upper limit of LLM vulnerability detection, particularly for highly complex zero-day vulnerability discovery.
The models and research team are also unnamed in the source material. These results are best treated as evidence of recall, consistency, and cost trade-offs rather than as a definitive product ranking.
Organizations should validate candidate models against their own codebases and threat models before adopting the reported conclusions as selection criteria.
Model Selection and Engineering Practices
Choosing an LLM for security auditing requires more than comparing headline recall scores. Teams must also account for repeatability, inference cost, and integration with existing security tools.
1. Balance Recall and Consistency
Repeated inference and cross-validation can help address inconsistent detection.
A lower Temperature setting, combined with multiple model calls, can be used to reduce output variability and collect findings across runs. Taking the union of those findings can improve overall coverage relative to a single pass.
Union aggregation and voting serve different purposes: a union retains findings from any run, while voting emphasizes findings supported by multiple runs. Teams should distinguish broader coverage from repeated agreement when interpreting the results.
LLMs can also complement rule-based and dataflow-based static analysis. For example, a model can review SAST alerts to help confirm findings and filter false positives. This combines established analysis techniques with semantic reasoning rather than treating the LLM as a replacement for the existing toolchain.
2. Use a Cost-Driven, Layered Detection Architecture
A layered architecture can allocate model capacity according to audit scope and code sensitivity:
- Broad, frequent scanning: Use a cost-effective model to scan the full codebase at relatively low cost, focusing on common vulnerabilities and lower-risk issues.
- Targeted, in-depth auditing: Use a higher-recall frontier model for sensitive modules, such as authentication logic, payment interfaces, and cryptographic code. Multiple inference passes can improve coverage of complex logic vulnerabilities.
This approach reserves more expensive inference for areas where deeper review is most valuable, while keeping broad scanning economically practical. Multiple passes improve coverage but do not guarantee that every vulnerability will be found.
3. Build a Cloud-Based Security Audit Pipeline
Cloud infrastructure can support multi-model orchestration within an audit workflow. The source article cites the Baidu AI Cloud Qianfan platform as one example; suitability and availability should be checked for the intended deployment region.
A unified API gateway can route audit requests to different models according to the security requirements of each repository. This allows teams to adjust the balance between inference cost and detection coverage.
The source also describes using Baidu AI Cloud object storage and logging services to maintain a vulnerability knowledge base. Retrieval-augmented generation (RAG) can then supply relevant historical vulnerability information as model context, with the aim of improving recall for business-specific security patterns.
These infrastructure choices should be assessed against the organization’s deployment requirements rather than assumed to be universally available.
Outlook: More Capable, More Reliable Security Auditing
The reported evaluation shows that LLMs have potential to play a substantial role in security auditing, but consistency and cost remain important constraints.
As model architectures and security-focused fine-tuning mature, LLM-assisted workflows may extend beyond detection to proposing code fixes and assessing whether those fixes address the underlying vulnerability. This could support shift-left security and more automated remediation workflows.
For now, security teams should maintain their own model evaluation benchmarks and reassess candidates as models change. The practical objective is not simply to select the highest aggregate recall score, but to build an auditing workflow that balances detection coverage, repeatability, and cost for the organization’s code and threat model.
