LLM Security Evaluation: The Truth About Recall

    This article breaks down why high token consumption does not equal effective security evaluation for large language models. It separates aggregate recall, single-run recall, stable hits, precision, and cost per effective hit, then outlines a reproducible evaluation design and practical deployment advice for teams that need explainable, repeatable, and operable results.

    1. Background: Why Burning More Tokens Does Not Mean Better Evaluation

    Once large language models entered the security analysis workflow, evaluation consumption scale was often treated as proof of capability. In reality, token consumption only reflects inference effort and does not directly translate into detection capability. Security evaluation cares about three things on a given sample set: whether the model can reliably surface real risks, whether false positives stay under control, and whether the cost is acceptable.

    Two observations from the original data are worth abstracting. First, one general-purpose LLM achieved the highest aggregate recall across three summarized runs, detecting 28 out of 32 samples, compared with the 25 to 26 commonly seen in other approaches. Second, the same model detected only 17 samples in a single run, and only 10 samples were detected in all three runs, which points to insufficient consistency. Meanwhile, a lightweight approach detected 25 samples in its official version, just one fewer than the leading approach, at roughly 70% lower cost. Together, these findings lead to one conclusion: evaluation must distinguish aggregate capability, single-run capability, stable capability, and capability per unit of cost.

    2. Metric Breakdown: Recall Is Not a Single Number

    2.1 Aggregate Recall vs. Single-Run Recall

    Aggregate recall treats the union of multiple runs as the result, which can amplify incidental hits. Single-run recall is closer to a real pipeline, because production alerts usually run only once. The larger the gap between the two, the more the results depend on sampling randomness.

    2.2 Stable Hits and Consistency

    Stable hits refer to the number of samples detected in every run, and they are the core measure of operability. If only 10 samples are stable hits, most alerts are not reproducible and on-call staff will struggle to trust them.

    2.3 Precision and the Cost of False Positives

    Focusing only on recall encourages a “report more to win” mindset. In practice, precision, false positive rate, and alert convergence ratio should be observed at the same time so that the security team is not drowned in noise.

    2.4 Cost Measurement

    Cost should be converted into “cost per effective hit” rather than unit price alone. The example calculation logic is as follows:

    1. single-run cost per effective hit = single-run inference cost / single-run stable hits
    2. aggregate cost per effective hit = total cost of three runs / stable hits across three runs

    3. Evaluation Design: Making Results Reproducible

    Fix the sample set, fix the prompt template, fix the decoding parameters, and repeat at least three times. Samples should cover known vulnerabilities, weak configurations, suspicious scripts, abnormal logs, and other types, with difficulty tiers annotated. Record the sample ID of every hit to form a hit matrix, which is required to calculate stable hits and the fluctuation range.

    1. {
    2. "sample_id": "S-017",
    3. "runs": [true, false, true],
    4. "stable": false,
    5. "latency_ms": 4200,
    6. "tokens": 18500
    7. }

    4. Interpreting Results: Three Risks Behind High Recall

    The first is the randomness risk: high aggregate recall but low single-run recall leads to a large experience gap after launch. The second is the homogenization risk: the model may only be good at a certain type of sample, so tiered recall is needed to expose weak spots. The third is the cost overrun risk: long context and multi-turn reasoning amplify consumption, so a token budget and truncation strategy should be set.

    5. Engineering Recommendations

    On the process side, a layered architecture of “rule-based pre-filtering + model review + human confirmation” places the model in high-value stages. On the data side, build a continuously updated sample library and regression set. On the operations side, use logging services and monitoring alerts to track recall, false positives, and latency. On the deployment side, prefer container platforms that scale elastically and object storage for samples and results, avoiding a one-time large-scale investment.

    6. Conclusion

    The goal of evaluation is not to pick the model that burns the most tokens, but to find the best combination of effectiveness, consistency, and cost. Putting aggregate recall, single-run recall, stable hits, and cost per unit on the same table is what makes a technical decision explainable, reproducible, and operable.