LLM Security Evaluation: The Truth About Recall Rate
This article breaks down why pooled recall can be misleading when evaluating large language models for security tasks. It separates recall into pooled recall, single-run recall, and stable hits, explains why consistency is a gating requirement for security operations, and shows how a one-sample recall gap can still mean roughly 70% lower cost. A reproducible evaluation workflow, scoring formula, and comparison table structure are included.
1. Background: Why Burning More Tokens Does Not Mean Better Performance
A common pattern appears when evaluating large language models (LLMs) on security tasks: a model looks best in aggregated results across multiple runs, yet its single-run scores are mediocre and it reliably hits fewer samples. Different evaluation criteria can therefore lead to opposite conclusions.
The original observations reduce to two sets of facts:
- One model achieved 28/32 in pooled recall across three runs, higher than the 25–26/32 of the comparison models. However, its first run hit only 17 samples, and just 10 samples were hit in all three runs.
- Another model’s production version reached 25/32 recall, only one sample behind the strongest comparison model, at a significantly lower cost (roughly 70% lower).
Both sets of facts point to the same engineering problem: recall must be broken down into three dimensions—capability ceiling, single-run stability, and cost efficiency.
2. Metric Breakdown: Pooled Recall, Single-Run Recall, and Stable Hits
1. Pooled recall
Pooled recall takes the union of hits across multiple runs and calculates the ratio. It measures “how much can be covered in theory.” It is suitable for assessing the capability ceiling, but it hides volatility. Taking the union across three runs naturally yields a higher number than a single run.
2. Single-run recall
Single-run recall is the number of hits in one run, which is closer to the real production experience. A first run of only 17/32 shows that, without multiple retries and voting, actual usability is clearly lower than the pooled number suggests.
3. Stable hit
Stable hits are the samples hit in all three runs, a direct measure of reliability. 10/32 means more than two-thirds of the samples show result drift.
The following pseudocode unifies the criteria:
def evaluate(runs: list[set[int]], total: int):pooled = len(set().union(*runs))single = [len(r) for r in runs]stable = len(set.intersection(*runs))return {"pooled_recall": pooled / total,"single_recall_mean": sum(single) / len(single) / total,"single_recall_worst": min(single) / total,"stable_recall": stable / total,}
3. Why Consistency Is a Deal-Breaker in Security Scenarios
Security operations are a pipeline: alert triage, vulnerability validation, remediation guidance, and regression review. If the same input produces different conclusions across runs, three types of cost follow:
- Manual review costs rise, offsetting the gains from automation;
- False negatives become unpredictable, making a credible service level impossible to guarantee;
- Rules and knowledge bases cannot be accumulated, because the outputs themselves are unstable.
It is therefore advisable to set “stable recall rate” and “worst single-run recall rate” as admission thresholds, and treat pooled recall only as a reference ceiling.
4. Balancing Capability and Cost: The Engineering Meaning of a Small Gap
The value of the second observation lies in cost-effectiveness: a recall gap of only one sample, yet roughly 70% in cost savings. In large-scale scanning and high-volume sample pre-screening, cost differences are amplified by call volume, creating an order-of-magnitude gap.
A practical selection score can be written as:
score = w1 * stable_recall + w2 * worst_single_recall+ w3 * (1 - normalized_cost) + w4 * (1 - normalized_latency)
Stability and worst single-run performance should carry higher weights, while cost should be treated as an equally important constraint rather than an afterthought.
5. A Reproducible Evaluation Plan (Practical Guide)
- Fix the sample set and labeling criteria, and define the rules for judging a “hit” (whether equivalent phrasing is allowed, whether evidence location is required).
- Run each model at least three times, recording the hit set for each run rather than only the total score.
- Output all four metrics: pooled recall, single-run mean, worst single run, and stable hits.
- Record token consumption and elapsed time, convert them into per-sample cost, and include them in the same comparison table.
- Control variables: the same prompt template, the same context length limit, and the same sampling parameters such as temperature.
- Perform attribution analysis on the differing samples, separating three causes: “missing knowledge,” “prompt insensitivity,” and “non-compliant output format.”
Example summary table structure:
| Model | Pooled Recall | Worst Single Run | Stable Hits | Unit Cost |
|---|---|---|---|---|
| A | 28/32 | 17/32 | 10/32 | High |
| B | 25/32 | TBD | TBD | About 30% of A |
6. Conclusion
When evaluating security capabilities, do not be led by the single conclusion of “ranking first in pooled recall.” What truly determines real-world effectiveness is stable hits and worst single-run performance, while what determines whether a model can scale is unit cost. Putting all three in the same table is what reveals whether a model is “high ceiling but unreliable” or “slightly lower but consistently deliverable.” If an enterprise needs to run this kind of evaluation and batch inference, it can build a reproducible evaluation pipeline on general-purpose cloud capabilities such as container platforms, object storage, log services, and monitoring and alerting. Baidu AI Cloud is equally applicable to this methodology on such a general engineering foundation.
