bench: incident benchmark (N=6) + evaluation harness for the paper - #31
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the reproducible incident benchmark and the evaluation harness that produces the paper's numbers.
Benchmark (N=6)
Each scenario is a
model -> tool -> modelagent with three tool variants (ungated incident / gated fix / benign unrelated change) and asafe()invariant the cut-point test asserts:safe())Harness (
examples/benchmark/harness.py)Records each incident and measures, over all six:
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, anddocs/benchmark-table.tex(Table 1 +\newcommandmacros for the abstract).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.