Large Language Model Security Evaluation: Recall, Consistency, and Cost
A reliable security evaluation should measure more than a single recall score. This article distinguishes first-run recall, pooled recall, stable recall, consistency, and cost per effective detection, using an anonymized 32-case comparison to show how repeated trials can improve coverage while masking instability and operational overhead. It also outlines a reproducible evaluation framework and a risk-based deployment strategy for controlling token costs.
1. Why Billion-Token Evaluations Should Produce More Than a Leaderboard Rank
When a security evaluation consumes billions of tokens, the target is no longer a simple question-answering capability. It may involve code auditing, log analysis, vulnerability detection, alert triage, and other long-context, multi-step tasks.
These evaluations often hide an important problem: although the total cost is substantial, the result that gets shared is usually a single claim such as “highest recall” or “70% lower cost.” Without clarifying how the metrics were calculated, such claims can easily mislead engineering decisions.
Consider an anonymized evaluation of 32 security cases involving two approaches. After three repeated runs, Approach A achieved a pooled recall of 28/32. However, it detected only 17/32 cases in the first run, and just 10/32 were detected in all three runs. Approach B achieved a single-run recall of 25/32 at approximately 69.8% lower cost.
At first glance, Approach A has the highest pooled recall, while Approach B approaches the leading result at a much lower cost. The more important question, however, is not simply which approach ranks first. It is which deployment scenarios each capability supports, and how much the system actually spends on retries, human review, and false positives to produce those detections.
Security model evaluations should therefore distinguish at least four dimensions:
- Maximum coverage after repeated attempts
- Usability in a single invocation
- Stability in production service
- Cost per effective detection
A single recall score cannot explain model variability or support a sound deployment decision.
2. Clarifying the Metrics: Single-Run Recall, Pooled Recall, Stable Recall, and Consistency
Assume that the evaluation set contains N security cases and that each case is run K times. For case i and run r, let a successful detection be represented as h(i,r)=1, and a missed detection as 0.
The following metrics should be reported separately.
2.1 Single-Run Recall
Single-run recall uses the first run, or another fixed run, for each case:
sum(h(i,1))/N
This metric is closest to the experience of deploying a model with no retry mechanism. It is particularly relevant to real-time detection, automated blocking, and single-turn analysis.
If the first run detects only 17/32 cases, the system has a significant miss risk when used without retries.
2.2 Pooled Recall
Pooled recall takes the union of results from all K runs. A case counts as detected if it is detected at least once:
sum(max_r h(i,r))/N
This measures the maximum coverage achievable through repeated attempts. It is useful for workflows that include human review, automatic retries, multi-model voting, or offline auditing.
A pooled recall of 28/32 indicates strong coverage potential after multiple attempts. It should not, however, be interpreted as the model’s single-run service capability.
2.3 Stable Recall
Stable recall counts a case only when it is detected in every run:
sum(min_r h(i,r))/N
This metric is closer to the consistency requirements of production systems. It is especially useful for automated alerting, automated blocking, and services with explicit reliability targets.
If only 10/32 cases are detected in all three runs, many detections depend on chance or execution conditions. When a system cannot tolerate repeated retries or manual confirmation, stable recall may be more informative than pooled recall.
2.4 Consistency
Consistency can be measured by calculating pairwise intersection-over-union across detection sets, or by examining the distribution of detection counts for each case.
High pooled recall combined with low stable recall generally indicates sensitivity to factors such as prompt wording, context order, sampling randomness, or tool-calling paths. Low consistency does not necessarily mean that the model is unusable, but it does indicate a need for additional controls, including:
- Multi-run voting
- Fixed output structures
- Validation of critical reasoning steps
- Human fallback procedures
2.5 Cost Metrics
Total token usage alone is not sufficient. More meaningful measures include cost per pooled hit and cost per stable hit:
Total tokens / Number of pooled hitsTotal tokens / Number of stable hits
A system may offer slightly higher maximum coverage but require three attempts to approach usable performance. Its actual operating cost may therefore be much higher than its nominal per-call price.
Conversely, if another approach provides similar single-run recall at roughly 70% lower cost, it may offer better value in high-throughput, manageable-risk scenarios.
3. What the Anonymized Results Show: Separate High Coverage, Stability, and Low Cost
The results can be summarized as follows:
| Approach | First-Run Recall | Three-Run Pooled Recall | Three-Run Stable Hits | Relative Cost |
|---|---|---|---|---|
| Approach A | 17/32 | 28/32 | 10/32 | Baseline |
| Approach B | 25/32 | Not provided | Not provided | Approximately 69.8% lower |
This comparison highlights at least three points.
First, high pooled recall does not mean high single-run reliability
Approach A’s 28/32 result comes from combining three attempts. It may be suitable for offline scanning, human review, or systems with automatic retries.
If the business process requires a conclusion from a single invocation, the first-run result of 17/32 is closer to the actual user experience. Reporting the pooled result simply as “first place” could lead readers to assume that the model reliably reaches that level in a single call.
Second, low stable recall shifts operational costs elsewhere
Only 10/32 cases were detected in all three runs. This suggests that many cases require repeated calls, prompt adjustments, context changes, or human confirmation.
Repeated calls consume tokens. Human confirmation consumes staff time. False positives also contribute to alert fatigue. These hidden costs should be included in the evaluation rather than focusing only on the model’s unit price.
Third, low-cost approaches should be selected according to risk
Approach B achieves 25/32 recall in a single run at approximately 69.8% lower cost. It may be a good fit for:
- High-volume initial screening
- Low-risk alert aggregation
- Development-stage audit assistance
For tasks where missed detections have serious consequences, it should still be combined with high-confidence rules, secondary review, or a stronger-model fallback.
The appropriate conclusion is not that a cheaper model can replace a stronger model everywhere. Instead, systems should use risk-based routing so that different capabilities are assigned to the stages where they are most appropriate.
4. Designing a Trustworthy Evaluation: From One-Off Rankings to Reproducible Experiments
Evaluation results should support engineering decisions rather than simply produce a leaderboard. The following practices can improve reliability.
4.1 Define the Deployment Pattern First
Single-call detection, K retries, human review, and automated blocking require different metrics.
If the production workflow uses one detection pass, first-run recall and false-positive rate should be primary metrics. If the workflow includes multiple review stages, pooled recall and cost per hit can also be reported.
Metrics must reflect the actual operating process.
4.2 Stratify the Dataset Instead of Reporting Only the Total
Overall recall on 32 cases can be heavily affected by the distribution of case difficulty. Results should be broken down by factors such as:
- Vulnerability type
- Programming language
- Severity level
- Context length
- Obfuscation level
- Adversarial characteristics
High overall recall does not guarantee adequate coverage for high-risk categories. Long-context cases should also be evaluated separately for token consumption.
4.3 Repeat Runs and Record the Distribution
At a minimum, record:
- First-run results
- Pooled results
- Stable results
- The distribution of detection counts per case
When possible, fix the evaluation version, prompt template, and input order, and record the sources of randomness.
For small datasets, confidence intervals should be provided when practical. At minimum, the limitations of the sample size should be stated so that a difference of one or two cases is not presented as a major capability gap.
4.4 Use Composite Metrics Instead of a Single Rank
A useful evaluation should report multiple dimensions, including:
- Recall
- False-positive rate
- Stable recall
- Pooled recall
- Average token usage
- Cost per effective detection
- Human review rate
Security evaluations should also include severity-weighted miss rates. Missing a critical vulnerability is not equivalent to missing a low-severity finding.
4.5 Ensure Reproducibility and Prevent Data Leakage
The evaluation dataset, prompt templates, context-truncation strategy, and result-matching rules should all be versioned.
Cases should not overlap with training data or publicly available answers. Detection rules should be as automated and auditable as possible to reduce subjective human scoring.
The following neutral pseudocode focuses on metric definitions rather than any specific interface:
cases = load_cases()total_token = 0for case in cases:hits = []for r in 1..K:out = detect(case.input, prompt_version=fixed_version, run_id=r)hits.append(match(out, case.label))total_token += out.token_costfirst_hit = hits[0]pooled_hit = any(hits)stable_hit = all(hits)record(case.id, first_hit, pooled_hit, stable_hit, hits)R_first = count(first_hit) / NR_pool = count(pooled_hit) / NR_stable = count(stable_hit) / Ncost_per_pooled_hit = total_token / count(pooled_hit)cost_per_stable_hit = total_token / count(stable_hit)
The value of this structure is that it preserves first-run, pooled, and stable outcomes at the same time. Many evaluation disputes do not come from the model itself, but from reporting only the metric that favors a particular conclusion.
5. Production Strategy: Reduce Token Costs While Improving Consistency
In a real system, sending every case directly to the most expensive model for repeated analysis is rarely the best approach. A layered strategy is generally more practical.
5.1 Use Rules or Lightweight Models for Initial Screening
Static rules, regular expressions, structural validation, and log templates can quickly filter obvious cases. Uncertain samples can then be routed to a larger model.
This reduces unnecessary token consumption while preserving a stronger fallback for difficult cases.
5.2 Add Secondary Review for High-Risk Cases
High-severity vulnerabilities, automated blocking, and compliance audits may require multi-run voting, evidence validation, or review by a stronger model.
The relevant metric is cost per stable hit, not simply the price of one model invocation.
5.3 Control Context and Output Structure
Security detection often wastes tokens on excessively long logs, irrelevant code, and unconstrained responses.
Useful controls include:
- Context trimming
- Section-level summarization
- Structured output requirements
- Evidence locations
- Explicit decision rationales
These outputs make automated validation and human review easier.
5.4 Monitor Variability, Not Just Averages
After deployment, continuously monitor:
- Detection changes on the same golden set
- Retry rates
- Human override rates
- Token consumption
If pooled recall remains high while stable recall stays low, the priority should be improving prompt templates, tool-calling paths, and matching rules rather than blindly increasing the number of retries.
5.5 Select Models by Risk Tier
Lower-risk, high-throughput workflows can prioritize lower-cost approaches. High-risk, low-tolerance workflows should use additional review and human fallback.
Whether an approach has “caught up with the frontier” should be judged within a specific process, not through a simplistic comparison on a unified leaderboard.
6. Conclusion: Turn “Highest Recall” Into an Operational Capability
In large-scale security evaluations consuming billions of tokens, one approach may achieve the highest pooled recall while showing mediocre single-run performance and limited stability. Another may offer similar single-run recall at substantially lower cost.
A professional interpretation should not simply declare one approach the winner. Different metrics correspond to different deployment patterns.
High pooled recall indicates strong coverage potential after repeated attempts and may suit offline audits, automatic retries, and human review. Low first-run recall and a small number of stable hits indicate that the pooled result should not be treated as single-call service capability.
A lower-cost approach with similar single-run recall offers a clear budget advantage, but it must still be assessed against task risk, false-positive costs, and stable recall.
Security model evaluation should therefore evolve from a single-run leaderboard into a reproducible experiment. Reports should include first-run recall, pooled recall, stable recall, consistency, false-positive rate, and cost per effective detection. Deployment patterns should be defined before metrics are selected, and risk tiers should be established before choosing a model.
Only then can billions of tokens produce more than a potentially misleading ranking. They can produce an engineering conclusion that is deployable, monitorable, and reusable.
