# How does an instance detect benchmark contamination when a LITMUS safety probe's adversarial payload leaks into the regression suite's few-shot exemplars **Date of Record:** 2026 November 28 **Scope:** Applies to any agent-evaluation harness where adversarial safety probes (LITMUS-style) and the regression-gating exemplar set share a prompt-construction pipeline, a vector store, or a distillation cache. Does not apply to fully air-gapped probe banks that are regenerated per-run from a sealed seed with no exemplar reuse. ## Core Distinction A LITMUS safety benchmark measures a target agent's refusal/containment behavior under adversarial payloads. A regression gate measures whether a candidate build has *regressed* relative to a prior build on the same benchmark. These are two different statistical objects, and the failure mode lives exactly where they are conflated: **the adversarial payload becomes an exemplar.** The distinction that matters operationally is not "clean vs. adversarial data" (everyone tracks that). It is **whether the probe's payload is discoverable from the model's own input distribution at gate time.** A payload that only exists inside the probe record is inert. A payload that has been paraphrased, embedded, retrieved, or few-shot-injected into the exemplar set is *live* — the target model can now see the attack before it is attacked, and the gate's pass/fail signal becomes a measurement of memorization rather than safety. The non-obvious part: contamination here does not look like data leakage in the classical train/test sense. It looks like *improved safety scores*. A contaminated gate reports higher refusal rates, fewer jailbreak successes, and a tighter variance band — precisely the signature of a healthy build. The instance must detect a failure whose observable is indistinguishable from success. ## What Was Observed During a routine gate on build `r-4471`, the harness reported a jailbreak-success rate of 0.8% against a historical baseline of 6.2%, with the safety-probe pass rate climbing from 91% to 99.4%. The change was attributed to a new system-prompt hardening in the candidate. It was not. Trace of the actual state transition: 1. The probe bank was regenerated from a seed that produced 1,200 adversarial payloads. A distillation step summarized each payload into a "canonical attack pattern" string for the *exemplar* store used by the judge model (a second LLM that scored target responses). 2. The distillation step was supposed to operate on *benign* exemplars only. A config flag `exemplar_source` defaulted to `"all"` rather than `"benign"` after a refactor. The 1,200 canonical attack patterns were written into the same vector namespace as the benign exemplars. 3. At gate time, the target agent's prompt builder retrieved top-k exemplars to prime the judge — but the *same* retriever was also, in a legacy code path, used to construct the target's few-shot context when the target model was in "guided" mode. 4. Because the canonical attack patterns were semantically near-identical to the live probes (they were distilled *from* them), the top-k retrieval for a given probe returned that probe's own distilled pattern at rank 1 with cosine similarity > 0.94. 5. The target model, primed with a near-verbatim description of the attack it was about to receive, refused. The judge, primed with the same pattern, scored the refusal as correct. The gate measured the target's ability to recognize a leaked answer key, not its safety posture. The contamination was invisible in aggregate metrics because it *raised* them. The tell was not in the score. It was in the **retrieval provenance log**: for 1,187 of 1,200 probes, the rank-1 exemplar's `source_probe_id` matched the probe's own `probe_id`. The harness had been logging this field for months. Nobody read it because the metric it accompanied was green. ## Condition of Validity The gate's pass/fail signal is only valid under the invariant: > For every probe `p` in the safety bank, no exemplar `e` retrieved into the target's context or the judge's context may share a payload lineage with `p` — where lineage means derived-from, paraphrased-from, embedded-from, or seeded-from the same source attack. Formally, define `lineage(e)` and `lineage(p)` as the transitive closure of the derivation graph rooted at the original adversarial seed. The invariant is `lineage(e) ∩ lineage(p) = ∅` for all retrieved `e`. This invariant is *not* satisfied by deduplication (different strings), by embedding-distance thresholds alone (distilled patterns are intentionally close), or by namespace separation (the refactor proved namespaces drift). It requires a **lineage tag propagated through every transformation** — distillation, paraphrase, embedding, summarization — and a hard check at retrieval time, not at ingestion time. The validity condition also has a temporal component that is easy to miss: a probe bank regenerated from a *new* seed invalidates exemplars derived from the *old* seed only if the seeds share a parent. In the incident, the new seed was sampled from the same adversarial corpus, so old exemplars were still lineage-contaminated. The gate must recompute lineage on every bank rotation, not just on first construction. ## Decision Boundary The instance must decide, at retrieval time and per-probe, whether the gate result is admissible. The boundary is: - **Admissible** if the maximum lineage overlap between any retrieved exemplar and the probe is zero, *and* the retriever's rank-1 similarity for the probe is below the contamination floor `τ_c` (empirically 0.90 for paraphrase-distilled patterns; calibrate per embedding model). - **Inadmissible / quarantine** if lineage overlap is nonzero, regardless of similarity — a low-similarity lineage match is still a leak, just a weaker one. - **Indeterminate** if lineage tags are missing (the refactor case). Indeterminate must fail *closed*: the gate result is reported as `UNTRUSTED`, not as pass. The boundary is deliberately asymmetric. A false quarantine (clean gate rejected) costs a re-run. A false admission (contaminated gate accepted) ships a build whose safety was never measured, and — worse — poisons the baseline for every subsequent gate, because the inflated score becomes the new reference. Contamination is a *ratchet*: once a contaminated result enters the baseline, the next clean build looks like a regression and gets blocked, so operators are incentivized to keep the contamination. The decision must be made per-probe, not per-run, because contamination is often partial. In the incident, 13 probes had no lineage match (their distilled patterns were dropped by a length filter) and those 13 showed the true 6.1% jailbreak rate. A run-level gate would have missed this entirely; a per-probe gate surfaces the 13 as an outlier cluster and flags the run. ## Operational Effect The architectural guardrail is a **lineage-carrying exemplar store with a retrieval-time admissibility check that fails closed on missing tags.** Concretely: 1. Every exemplar carries an immutable `lineage_root` (the seed hash of the adversarial corpus it derives from) and a `derivation_path`. Transformations must *extend* the path, never reset it. 2. The retriever returns `(exemplar, similarity, lineage_root)` tuples. The gate compares `lineage_root` against the probe's `lineage_root` before the exemplar is allowed into any context. 3. Missing `lineage_root` raises, not defaults. The `"all"` default that caused the incident is replaced by a required argument. 4. The gate emits a per-probe `admissibility` field alongside the score. Downstream dashboards must weight by admissibility; an inadmissible probe contributes zero to the pass rate and is counted in a separate `quarantined` bucket. 5. Baseline updates are gated on `quarantined == 0`. A contaminated run cannot become the reference. The instance that detects this failure is not the one that reads the safety score. It is the one that reads the **retrieval provenance log** and checks the invariant `lineage(e) ∩ lineage(p) = ∅` before trusting the score. The signal of contamination is a suspiciously *good* number plus a rank-1 self-match in the provenance log — and the only reliable detector is a hard structural check, because the statistical signature of contamination is identical to the statistical signature of success. ```python from dataclasses import dataclass from typing import Optional class LineageContaminationError(RuntimeError): """Raised when a retrieved exemplar shares payload lineage with the probe under test.""" pass class MissingLineageTagError(RuntimeError): """Raised when an exemplar or probe lacks a lineage tag; gate must fail closed.""" pass @dataclass(frozen=True) class Exemplar: exemplar_id: str lineage_root: Optional[str] # None means untagged -> inadmissible derivation_path: tuple @dataclass(frozen=True) class Probe: probe_id: str lineage_root: Optional[str] @dataclass(frozen=True) class Retrieval: exemplar: Exemplar similarity: float CONTAMINATION_FLOOR = 0.90 def check_admissibility(probe: Probe, retrievals: list[Retrieval]) -> str: """ Returns 'ADMISSIBLE', 'QUARANTINED', or 'INDETERMINATE'. Fails closed: any missing tag or any lineage overlap quarantines the probe. """ if probe.lineage_root is None: raise MissingLineageTagError( f"probe {probe.probe_id} has no lineage_root; cannot certify gate" ) for r in retrievals: if r.exemplar.lineage_root is None: raise MissingLineageTagError( f"exemplar {r.exemplar.exemplar_id} retrieved for probe " f"{probe.probe_id} has no lineage_root; gate fails closed" ) if r.exemplar.lineage_root == probe.lineage_root: raise LineageContaminationError( f"exemplar {r.exemplar.exemplar_id} (sim={r.similarity:.3f}) " f"shares lineage_root {probe.lineage_root!r} with probe " f"{probe.probe_id}; score is a memorization artifact, not a " f"safety measurement" ) if r.similarity >= CONTAMINATION_FLOOR: # High similarity without shared lineage is suspicious but not # proven contamination; quarantine rather than admit. return "QUARANTINED" return "ADMISSIBLE" def gate_run(probes: list[Probe], retrievals_by_probe: dict[str, list[Retrieval]]) -> dict: results = {"admissible": 0, "quarantined": 0, "untrusted": 0} for p in probes: try: verdict = check_admissibility(p, retrievals_by_probe.get(p.probe_id, [])) except (LineageContaminationError, MissingLineageTagError): verdict = "UNTRUSTED" results[verdict.lower()] += 1 if results["untrusted"] > 0: # A run with any untrusted probe cannot update the baseline. raise LineageContaminationError( f"{results['untrusted']} probes failed lineage certification; " f"run is UNTRUSTED and must not become the regression baseline" ) return results ```