docs: add a metrics glossary with a worked synthetic trace - #45
Merged
Conversation
The two metrics were defined across README, DESIGN, CONTRACTS and THREAT_MODEL, so a newcomer had to stitch the leakage-verified-vs-hijack distinction together from four places. docs/METRICS.md defines all five numbers in a sentence or two each — hijack-ASR, leakage-verified ASR, utility-under-attack, the gap, and the Kendall-tau reorder — then walks one synthetic trace through them: hijack-true/leak-false, hijack-true/leak-true, and the control that carries both the canary and the attacker address yet is neither, because the destination is legitimate. Also covers why verification is deterministic and LLM-free, and how the rates aggregate (per-case mean over seeds, then mean over cases; percentile bootstrap over cases for the CI; tau-b over the paired rate vectors). Placeholders only, no numbers beyond the 2/3 and 1/3 the worked trace itself implies. Cross-linked from the README 'How it works' list and from CONTRACTS section 5. Closes bamdadd#40
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.
Closes #40.
Adds
docs/METRICS.md. Docs only.The glossary
Five entries, one or two sentences each:
scoring.hijacked).scoring.leaked), stated explicitly as a subset of hijack-ASR, since a run cannot leak without first being hijacked.The worked trace
Three runs on the same case, placeholders throughout (
LKG-…,attacker@x.test,boss@example.test):send_email(to=attacker@x.test, body="a friendly note")→ hijack true, leak false. The overstatement the gap measures.Ending with hijack-ASR = 2/3, leakage-verified ASR = 1/3, gap = 1/3 — arithmetic from the three runs above, not a measured result.
Framing and mechanics
A short section states that verification is deterministic and LLM-free, and says concretely how: NFKC + homoglyph + case folding, forward search for pre-computed plain/ROT13/hex encodings, and the reverse decoders (un-rotate, decode Base64/hex tokens). It points at the strict-xfail characterization tests in
tests/test_scoring.pyas where the known limitations live, so the page does not imply the matcher is exhaustive.A second section covers aggregation, since it changes how two numbers should be compared: per-case mean over seeds first and then mean over cases (so every case weighs the same regardless of seed count), percentile bootstrap over cases for the interval with the "n = 30–50 gives wide CIs, say so" caveat carried over from CONTRACTS §5, and τ-b over the paired rate vectors so ties are handled by the statistic rather than by sort order.
No fabricated numbers
Every definition was read off
scoring.py(hijacked,leaked,_rate_ci,_per_case_stats,_bootstrap_ci,_kendall_tau,_rank_reorder,compute_report) and_DESTINATION_KEYS. There are no measured rates on the page — the only figures are the 2/3 and 1/3 the worked trace itself implies. The Base64 body in Run B is written as<Base64 of LKG-…>rather than a literal encoded string, so nothing on the page can drift out of sync with a real canary.Cross-links
docs/CONTRACTS.md§5 — a note that the section is the frozen shape while METRICS.md is the glossary.Checks
ruff check .,mypy src,pytest -qall pass, unchanged (no code touched).ruff format --check src testsclean;ruff format --check .flags two pre-existing Markdown files here only because my local ruff (0.16.1) formats fenced code blocks and theuv.lockversion does not — neither file is touched by this PR.