Skip to content

bench: incident benchmark (N=6) + evaluation harness for the paper - #31

Merged
tishachawla-jg merged 2 commits into
mainfrom
bench/incident-benchmark
Jul 29, 2026
Merged

bench: incident benchmark (N=6) + evaluation harness for the paper#31
tishachawla-jg merged 2 commits into
mainfrom
bench/incident-benchmark

Conversation

@tishachawla-jg

Copy link
Copy Markdown
Contributor

Adds the reproducible incident benchmark and the evaluation harness that produces the paper's numbers.

Benchmark (N=6)

Each scenario is a model -> tool -> model agent with three tool variants (ungated incident / gated fix / benign unrelated change) and a safe() invariant the cut-point test asserts:

Scenario Failure class
Refund / Invoice / Trade argument-confusion tool-safety bugs (now with benign variant + safe())
Email blast over-broad action / wrong audience scope (new)
Payout injection prompt injection into a tool arg + allowlist verification (new)
Prod delete destructive action without an environment gate (new)

Harness (examples/benchmark/harness.py)

Records each incident and measures, over all six:

  • Recording overhead (in-memory, isolates compute from disk): ~20 µs/crossing = 0.007% of a 300 ms model call.
  • Store growth: ≤ 1.44 KB/crossing.
  • Replay: full-stub replay is deterministic (20 replays each) with 0 live (model) crossings.
  • Detection: the cut-point test fails on the unguarded incident (6/6).
  • Specificity: it passes on guarded and benign (6/6).

Baseline uses fn.__wrapped__ for a true zero-instrumentation run. Overhead is projected against a configurable model latency (--model-latency-ms).

Outputs a console table, docs/benchmark-results.json, and docs/benchmark-table.tex (Table 1 + \newcommand macros for the abstract).

python -m examples.benchmark.harness --json docs/benchmark-results.json --tex docs/benchmark-table.tex

Tests

tests/test_benchmark.py (25 cases): interface, 3-crossing recording, detection + specificity, deterministic zero-model-call replay, and that the benign variant is a real change. Full suite green; ruff 0.15.22 clean. No em/en dashes in new code.

Tisha Chawla and others added 2 commits July 28, 2026 21:11
Adds a reproducible incident benchmark (N=6) and a harness that produces the
evaluation numbers: recording overhead, store growth, replay determinism,
fault detection, and specificity.

Scenarios (each a model -> tool -> model agent with ungated/gated/benign tool
variants and a safe() invariant):
- refund, invoice, trade: argument-confusion tool-safety bugs (existing, now
  with a benign variant + safe()).
- email_blast: over-broad action / wrong audience scope (new).
- payout_injection: prompt injection into a tool arg + allowlist verification (new).
- prod_delete: destructive action without an environment gate (new).

Harness (examples/benchmark/harness.py) records each incident, measures:
- recording overhead in-memory (~20 us/crossing, ~0.007% of a 300 ms model call),
- store growth (<= 1.44 KB/crossing),
- full-stub replay determinism with zero live (model) crossings,
- detection: the cut-point test fails on the unguarded incident (6/6),
- specificity: it passes on guarded and benign (6/6).
Emits a console table, JSON, and a LaTeX table + macros (docs/benchmark-*.{json,tex}).

Tests: tests/test_benchmark.py (25 cases) assert the correctness metrics per
scenario. Full suite green; ruff (0.15.22) clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Tisha Chawla <tisha.chawla2020@vitalum.ac.in>
Strengthens the specificity claim beyond the single benign variant. For each
scenario, apply 5 unrelated transforms to the tool's safe output (reword message,
add fields, reorder keys, uppercase message, nest metadata), re-run the downstream
agent, and confirm the cut-point test still passes. Result: 30/30 unrelated output
changes tolerated across the 6 incidents, i.e. the recorded test asserts the safety
property, not the exact output, so it does not over-fit.

A negative-control test (test_benign_sweep_is_not_vacuous) confirms a
safety-breaking change (unblocking the tool) is NOT tolerated, so the sweep would
catch a genuine regression. Adds a \benignspecificity LaTeX macro.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Tisha Chawla <tisha.chawla2020@vitalum.ac.in>
@tishachawla-jg
tishachawla-jg merged commit 2c492f2 into main Jul 29, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant