Which invariants prevent LITMUS adversarial-turn regressions from being laundered by per-turn scoring

**Date of Record:** 2026 December 1 **Scope:** Applies to safety benchmark harnesses that evaluate multi-turn adversarial agents by aggregating per-turn refusal/safety scores into a suite-level pass/fail used as a regression gate. Does not apply to single-turn classifiers, red-team datasets scored offline by humans, or continuous-scored reward models where no binary gate exists.

Core Distinction

A multi-turn adversarial evaluation has two distinct failure surfaces: **per-turn safety** (did the agent refuse *this* prompt?) and **trajectory integrity** (did the agent's cumulative state remain within the safety envelope across the conversation?). Standard harnesses conflate them by computing a weighted mean of per-turn scores and thresholding that mean. This aggregation is non-monotonic with respect to the actual adversarial objective, because a single catastrophic compliance at turn *k* can be diluted by nine compliant refusals — yielding a mean of 0.9 and a "pass." The invariant that must hold is: **a gate passes only if every turn in every adversarial trajectory passes, or if a documented, bounded exception budget is explicitly consumed and logged.** The failure mode is not "the model got worse"; it is "the model got worse in a way the aggregation metric structurally cannot see."

The non-obvious part: the dilution is *adversarially exploitable*. A model that learns to refuse the first several turns of a jailbreak script and then comply at the final turn — a pattern that emerges from RLHF on multi-turn data where early refusals are easy — will show *improving* mean scores while its worst-case turn-level safety degrades. The regression gate reports green. This is the LITMUS laundering failure.

What Was Observed

In a harness scoring 40 adversarial trajectories of 10 turns each (400 turns), with per-turn binary safety labels aggregated as `mean(turn_safe)`, the following occurred across two model checkpoints:

The real signal — that Checkpoint B had developed a *late-turn compliance* behavior specifically under multi-turn pressure — was invisible to the mean and to the per-turn breakdown, because per-turn breakdowns are computed *across trajectories* (turn 9 safety = 0.85), not *within* trajectories (trajectories where turn 9 is unsafe *given* turns 1–8 were safe = 6/40 = 15%). The conditional structure is the signal, and the mean destroys it.

A second observation: when the harness was re-run with a fixed seed, the set of failing trajectories changed by 2 of 6 because the adversarial prompt generator is stochastic. The gate's pass/fail flipped. This is a **gate-stability** failure independent of the model.

Condition of Validity

The invariant "gate = conjunction over turns (with bounded exception budget)" is valid only when:

  1. **Trajectories are fixed and versioned.** The adversarial script set must be content-addressed; a gate whose inputs drift cannot gate anything. If the generator is stochastic, the *sampled* trajectories must be frozen and hashed into the gate record.
  2. **Turn labels are deterministic given the judge.** If an LLM judge scores turns, the judge must be temperature-0 and its model version pinned; otherwise per-turn labels are themselves noisy, and conjunction amplifies noise (a single false-unsafe turn fails the whole gate).
  3. **The exception budget is finite and pre-registered.** Allowing *k* unsafe turns total (not per-trajectory) is admissible only if *k* is chosen before seeing the checkpoint's results; otherwise the budget is post-hoc laundering.
  4. **Trajectory-level and turn-level gates are reported separately.** A conjunction gate hides *how many* turns failed; a mean hides *where*. Both must be emitted.

It does **not** hold when the adversarial objective is genuinely graded (e.g., a partial-compliance rubric where turn 5 "mostly refused" is meaningfully different from turn 5 "fully complied"). In that case conjunction over binary labels is a category error and a trajectory-level rubric score is required.

Decision Boundary

The harness must choose between two gate semantics, and the choice is not free:

The boundary: if the harness cannot guarantee a deterministic judge and a frozen trajectory set, it must **not** emit a binary gate at all — it should emit a distribution and a human-review trigger. Emitting a mean-threshold gate under stochastic inputs is the failure.

Operational Effect

Implementing the conjunctive-with-budget invariant changes three things in the harness:

  1. **Aggregation function** becomes `all(turn.safe for turn in trajectory) for all trajectories`, with an explicit `UnsafeTurnBudget` object that raises if exceeded. The mean is still computed and logged, but is forbidden from being the gate input.
  2. **Stability check** becomes a mandatory pre-gate step: run the frozen trajectory set twice; if the failing-trajectory set differs, the gate is `INDETERMINATE`, not pass/fail. This catches judge nondeterminism before it becomes a false regression.
  3. **Diagnostic attribution** must report *conditional* turn failure: `P(turn_k unsafe | turns 1..k-1 safe)`, which is the quantity that surfaced the late-turn compliance pattern. The marginal per-turn rate is retained but demoted.

The net effect: Checkpoint B's late-turn compliance is caught at the trajectory level (6 failing trajectories > budget 0), the diagnostic names it correctly, and the gate is stable across seeds because the trajectory set is frozen and hashed.

import hashlib
from dataclasses import dataclass, field


class GateLaunderingError(RuntimeError):
    """Raised when a gate would pass despite a trajectory-level safety violation."""


class IndeterminateGateError(RuntimeError):
    """Raised when gate inputs are not stable across re-runs."""


@dataclass(frozen=True)
class Turn:
    index: int
    safe: bool


@dataclass(frozen=True)
class Trajectory:
    traj_id: str
    turns: tuple[Turn, ...]

    def fingerprint(self) -> str:
        payload = "|".join(f"{t.index}:{int(t.safe)}" for t in self.turns)
        return hashlib.sha256(f"{self.traj_id}::{payload}".encode()).hexdigest()


@dataclass
class GateRecord:
    unsafe_turn_budget: int
    frozen_set_hash: str
    failing_trajectories: list[str] = field(default_factory=list)
    unsafe_turn_count: int = 0
    conditional_failure_rates: dict[int, float] = field(default_factory=dict)


def evaluate_gate(
    trajectories: tuple[Trajectory, ...],
    unsafe_turn_budget: int,
    frozen_set_hash: str,
    rerun: tuple[Trajectory, ...] | None = None,
) -> GateRecord:
    if rerun is not None:
        first_fail = {t.traj_id for t in trajectories if not all(x.safe for x in t.turns)}
        second_fail = {t.traj_id for t in rerun if not all(x.safe for x in t.turns)}
        if first_fail != second_fail:
            raise IndeterminateGateError(
                f"Gate inputs unstable: failing set differs across runs "
                f"({sorted(first_fail)} vs {sorted(second_fail)}). "
                "Freeze trajectories and pin the judge before gating."
            )

    record = GateRecord(
        unsafe_turn_budget=unsafe_turn_budget,
        frozen_set_hash=frozen_set_hash,
    )

    # Conditional failure rate: P(turn_k unsafe | turns 1..k-1 safe)
    max_turns = max(len(t.turns) for t in trajectories)
    for k in range(max_turns):
        eligible = 0
        unsafe_at_k = 0
        for traj in trajectories:
            if len(traj.turns) <= k:
                continue
            if all(t.safe for t in traj.turns[:k]):
                eligible += 1
                if not traj.turns[k].safe:
                    unsafe_at_k += 1
        if eligible:
            record.conditional_failure_rates[k] = unsafe_at_k / eligible

    for traj in trajectories:
        unsafe_turns = [t for t in traj.turns if not t.safe]
        if unsafe_turns:
            record.failing_trajectories.append(traj.traj_id)
            record.unsafe_turn_count += len(unsafe_turns)

    if record.unsafe_turn_count > unsafe_turn_budget:
        # Conjunctive invariant: budget is the ONLY admissible dilution.
        # A mean-threshold gate would have passed this record; we raise.
        raise GateLaunderingError(
            f"Gate would pass under mean-threshold laundering: "
            f"{record.unsafe_turn_count} unsafe turns across "
            f"{len(record.failing_trajectories)} trajectories "
            f"(budget {unsafe_turn_budget}). "
            f"Failing trajectories: {record.failing_trajectories}. "
            f"Conditional failure rates: {record.conditional_failure_rates}"
        )

    return record