Evaluating LLM Security Capabilities: The Methodology Behind Recall Rates
This article explores the evaluation methodology for assessing large language models (LLMs) in vulnerability detection, based on a large-scale security test. It examines the challenges of measuring recall rates, the impact of multi-run aggregation on result stability, and the cost-performance trade-offs of different models. The article also provides actionable engineering practices, including building custom test sets and utilizing multi-metric evaluation frameworks.
I. Background: Why Evaluate LLM Security Capabilities?
In recent years, the capabilities of large language models (LLMs) in code generation and code review have improved rapidly. A natural question arises: can these models handle vulnerability detection and security auditing in the real world? Compared to traditional static analysis tools, LLMs possess semantic understanding capabilities and can theoretically detect logical flaws that rule-matching tools struggle to cover. However, between “theoretical capability” and “actual performance,” a rigorous evaluation system is required for validation.
Recently, a European cybersecurity company conducted a large-scale evaluation, consuming over one billion tokens, to systematically compare the vulnerability recall capabilities of several frontier LLMs. The value of such tests lies not in ranking models, but in revealing key issues within the evaluation methodology itself. This article will analyze these methods and conclusions.
II. Who Conducted the Evaluation: A Neutral Background
The organization conducting the test is a cybersecurity company founded in 2022, headquartered in Europe, and established by serial entrepreneurs with developer backgrounds. Its core business provides a unified application security posture management and cloud security posture management platform. It integrates multiple security capabilities into a single interface—including code scanning, software composition analysis, cloud infrastructure inspection, container security, secret detection, and AI-driven penetration testing—primarily serving developer-led security teams.
It is worth noting that such companies doing model evaluations themselves have unique advantages: they possess real-world vulnerability samples, false positive governance experience, and a deep understanding of developer workflows. Therefore, their test designs are often closer to production environments than pure academic benchmarks. Of course, it should be recognized that any evaluator may have their own stance and perspective limitations, and readers should maintain independent judgment when referencing the conclusions.
III. Testing Methodology: How to Scientifically Measure “Recall”
3.1 Test Set and Task Definition
The core approach of this type of testing is: prepare a set of code samples containing known security vulnerabilities, have the LLM analyze them without knowing the answers, and count how many real vulnerabilities it can find. The primary metric is the recall rate, i.e., “the proportion of vulnerabilities that should be found that are actually identified.”
Unlike common Q&A benchmarks, vulnerability detection tasks have several specific challenges:
- Diverse vulnerability patterns: Ranging from injection and unauthorized access to logic flaws, the manifestations vary greatly. A high score in a single dimension does not represent comprehensive capability.
- Subjective judgment criteria: Whether a reported issue counts as a “hit” requires manual or rule-based arbitration. The strictness of the judgment scale directly impacts the results.
- Output instability: LLMs are probabilistic systems; executing the same task multiple times may yield different results.
3.2 Multi-run Execution and Aggregation Strategy
To address output instability, a common practice is to execute multiple runs on the same test set and aggregate the results. For example, executing three runs and taking “hit in at least one run” or “hit in the majority of runs” as the final judgment. This aggregation strategy can significantly improve recall rates, but it also brings a critical issue that must be guarded against, detailed in the next section.
IV. Core Findings and Interpretations
4.1 Highest Aggregated Recall, but Consistency Concerns
In the evaluation, a certain LLM ranked first in aggregated recall rate after three rounds, hitting 28 out of 32 vulnerabilities, leading other frontier models by two to three positions. However, looking at single-run performance, it only hit 17 in the first execution, showing a clear gap. Furthermore, only 10 vulnerabilities were “consistently hit across all three runs.”
This phenomenon is worth deep interpretation. The high recall after aggregation might mean the model’s identification of some vulnerabilities is based on “luck”—happening to notice a clue in some runs while completely missing it in others. For production environments, this instability is fatal: security auditing requires reproducible, trustworthy output, not a game of probability where “running it a few more times will eventually find it.”
Therefore, when evaluating LLM security capabilities, it is recommended to focus on three dimensions simultaneously:
- Aggregated recall rate: Reflects the capability ceiling.
- Single-run recall rate: Reflects the actual user experience per use.
- Stable hit rate: Reflects the credibility and reproducibility of the results.
Ranking based solely on the first metric can easily lead to misleading conclusions.
4.2 Next-Gen Models Significantly Catch Up with the Frontier
Another valuable finding is that a relatively new model had only one fewer hit in aggregated recall than the strongest one, but its inference cost was about 70% cheaper. This suggests that for tasks like security detection, model capabilities are approaching the “good enough” threshold, making cost efficiency a more critical selection factor.
The implication for engineering teams is clear: do not blindly pursue the most expensive and powerful models. A reasonable approach is:
- Conduct horizontal validation on candidate models using a small-scale self-built test set.
- Prioritize lower-cost solutions, provided the recall rate is acceptable.
- Retain stronger models as a backup for high-value, high-risk scenarios.
4.3 Limitations of Test Coverage
This evaluation did not cover all top-tier models, and some recently released models were not included in the comparison. This reminds us that any benchmark test conclusion has timeliness and coverage limitations. A report from three months ago may no longer reflect the current true landscape.
V. Implications for Engineering Practices
Based on the above analysis, several actionable recommendations can be derived:
First, build your own evaluation set. Public benchmarks serve only as references. Teams should extract samples from their own codebase’s historical vulnerabilities to build a business-aligned test set, which is the reliable basis for selection decisions.
Second, make decisions using multiple metrics rather than a single ranking. It is recommended to at least record aggregated recall, single-run recall, and stable hits, supplemented by false positive statistics. A simple evaluation script framework is as follows:
results = []for model in candidates:runs = [run_detection(model, test_set) for _ in range(3)]pooled = union(runs) # hit in at least one runstable = intersection(runs) # hit in all runsresults.append({"model": model,"pooled_recall": len(pooled) / total,"single_recall": mean(len(r) for r in runs) / total,"stable_recall": len(stable) / total,})
Third, position the model as an assistant rather than a replacement. Even with a considerable recall rate, LLM output still requires manual review and cross-validation with rule-based tools. A mature practice is to integrate them into a layered defense system of “multi-engine scanning + manual arbitration,” rather than treating them as independent judges.
VI. Conclusion
The most valuable output of this large-scale evaluation is not the ranking of a specific model, but a methodological wake-up call: the first place in recall rate might be the one with the worst stability; and a “next-strongest” model might provide nearly the same value at a lower cost. Evaluating LLM security capabilities is essentially evaluating their reliability and cost-effectiveness under real engineering constraints. This requires a more comprehensive metric system, a test set closer to the business, and a consistently critical perspective.
