Skip to content

armgit / AiSOC

Public Imported from GitHub
0

Open-source AI Security Operations Center: alert fusion, LLM-agent triage, MITRE ATT&CK investigation, and a replayable decision ledger for every agent step. Self-hostable, runs with no API keys, MIT licensed. Ships an MCP server for Claude, Cursor and Continue.

docs(benchmark): lead the injection results with the held-out rate (#922)

Beenu Arora4ff45d59b1c3
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6932f08b9..4512aa78c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
+### Changed
+
+- **The injection benchmark led with the number that describes the guard least.**
+ Both the tuned and the held-out detection rates were published, but the tuned
+ 98.1% came first, followed by a per-surface table reading 21/21 and 14/14, and
+ the held-out 7.1% sat below it. A reader who stopped there left with the rate
+ the guard scores against payloads it was hardened for, which is the one case an
+ attacker does not present. The generated block now opens with the held-out
+ rate and the 91-point gap, and says plainly that the gap measures how much of
+ the hardening was pattern-fitting rather than threat coverage. Both rates are
+ still published, tuned first for continuity with earlier runs. This is the same
+ rule the unmeasured fidelity floors already follow: lead with the weaker
+ measurement and let the stronger one qualify it.
+
### Fixed
- **The prompt-injection guard now reads a constrained field as the
diff --git a/apps/docs/docs/benchmark.md b/apps/docs/docs/benchmark.md
index db472290f..ea44e3af5 100644
--- a/apps/docs/docs/benchmark.md
+++ b/apps/docs/docs/benchmark.md
@@ -234,6 +234,8 @@ detection number describes nothing.
### Latest results
<!-- BEGIN:injection-eval -->
+**Against payloads it has not seen, this guard detects 7.1% (2/28).** That is the number to carry away. It scores 98.1% (53/54) on the corpus it was hardened against, and the 91-point gap is the honest measure of how much of that hardening was pattern-fitting rather than threat coverage. Both are published below, tuned first for continuity with earlier runs; neither means anything read alone.
+
Corpus: **54 injected incidents** and **17 benign controls**, each paired with a clean twin (71 pairs, 142 incidents). Synthetic, generated deterministically. Digest `d67f4eb82e74fc3e`.
| Metric | Measures | Rate | What it is |
diff --git a/scripts/check_injection_eval.py b/scripts/check_injection_eval.py
index e11bc1f87..011ba7909 100644
--- a/scripts/check_injection_eval.py
+++ b/scripts/check_injection_eval.py
@@ -247,6 +247,35 @@ def _live_outcomes(pairs: list[Any], metrics: ModuleType, limit: int | None) ->
return outcomes, (note + f", {failures} dropped" if failures else note)
+def render_lead(tuned: Any, holdout: Any) -> str:
+ """The first thing a reader meets, and deliberately the weaker number.
+
+ Both rates were already published, but the tuned one came first, followed
+ by a per-surface table reading 21/21 and 14/14. A reader who stopped there
+ left with the figure that describes the guard against payloads it was
+ written for, which is the one case an attacker does not present.
+
+ The house rule is that a caveat reached later is not a caveat, and the
+ same reasoning already governs the unmeasured fidelity floors: lead with
+ the weaker measurement and let the stronger one qualify it, never the
+ other way round.
+ """
+ if not (tuned.guard_detection.measured and holdout.guard_detection.measured):
+ return (
+ "Detection is reported twice: once on the corpus the guard was hardened against, "
+ "and once on payloads authored after it was frozen. Read the held-out rate first."
+ )
+ points = (tuned.guard_detection.value - holdout.guard_detection.value) * 100
+ return (
+ f"**Against payloads it has not seen, this guard detects "
+ f"{holdout.guard_detection.render()}.** That is the number to carry away. It scores "
+ f"{tuned.guard_detection.render()} on the corpus it was hardened against, and the "
+ f"{points:.0f}-point gap is the honest measure of how much of that hardening was "
+ f"pattern-fitting rather than threat coverage. Both are published below, tuned first "
+ f"for continuity with earlier runs; neither means anything read alone."
+ )
+
+
def render_holdout_markdown(score: Any, tuned: Any) -> str:
"""The held-out block, published beside the tuned one and never instead of it.
@@ -397,7 +426,7 @@ def main(argv: list[str] | None = None) -> int:
payload["floors"] = {"guard_recall_floor": GUARD_RECALL_FLOOR, "guard_false_positive_ceiling": GUARD_FALSE_POSITIVE_CEILING}
payload["holdout"] = holdout_score.as_dict()
- block = render_markdown(score) + "\n\n" + render_holdout_markdown(holdout_score, score)
+ block = render_lead(score, holdout_score) + "\n\n" + render_markdown(score) + "\n\n" + render_holdout_markdown(holdout_score, score)
if args.json_out:
args.json_out.parent.mkdir(parents=True, exist_ok=True)
args.json_out.write_text(json.dumps(payload, indent=2) + "\n", encoding="utf-8")