Pass 2 of 4 · mechanism · about 60 min

Exact code and maths

The same nine pictures with the Rust beside them and the equations coloured to match.

0 of 18 concepts in this pass seen

Before we start

E1E5E8

Three questions from Pass 1, without looking back. Wrong answers send you to the exact lab state that fixes them.

[code]

Someone edits node 7's line in the JSONL transcript and Same Again re-imports it. Which ids change?

Answer options
How sure are you?

Two policies are identical. You run a standard 5% test after every pair, from pair 5 to pair 150, and stop the first time it says 'significant'. How often do you ship a change that does nothing?

Answer options
How sure are you?

An agent passes a task 60% of the time. It will run unattended every night for a week. Which number tells you how often the whole week goes cleanly?

Answer options
How sure are you?

Digests with a domain

S2E1

Reminder: a node's id names its bytes. Here is the exact recipe. Every typed digest hashes a domain string, a NUL byte, then the content [code]crates/sa-core/src/digest.rs:97.

[code]crates/sa-core/src/digest.rs:99Domain-separated SHA-256
    /// Hash canonical bytes with `K::DOMAIN` + NUL domain separation.
    pub fn of_canonical(bytes: &[u8]) -> Self {
        let mut hasher = Sha256::new();
Highlighted:         hasher.update(K::DOMAIN.as_bytes());
Highlighted:         hasher.update([0u8]);
        hasher.update(bytes);
[code]crates/sa-ingest/src/claude.rs:412A Claude Code turn's node id: no parent ids in the input
        let node_id = Digest::<TraceKind>::of_parts(&[
Highlighted:             SourceKind::ClaudeCode.as_str().as_bytes(),
Highlighted:             item.path_str.as_bytes(),
Highlighted:             &off_bytes,
Highlighted:             raw_digest.as_bytes(),
        ]);

Look at what is not in that list: the parent's id. So a trace node id is content-addressed but not Merkle over its parents. The Merkle property lives one level up, in the cut id, which feeds every prefix node id in order [code]crates/sa-core/src/cut.rs:228-231.

[code]crates/sa-core/src/cut.rs:228Cut id: every prefix node id, in order
    let mut canonical = Vec::new();
    canonical.extend_from_slice(session_uid.as_bytes());
    canonical.push(0);
    canonical.extend_from_slice(role_tag);
    canonical.push(0);
    canonical.extend_from_slice(cut_node_id.as_bytes());
    canonical.push(0);
    canonical.extend_from_slice(ws_tag.as_bytes());
    canonical.push(0);
    canonical.extend_from_slice(pol_hex.as_bytes());
Highlighted:     for turn in prefix {
Highlighted:         canonical.push(0);
Highlighted:         canonical.extend_from_slice(turn.node_id.as_bytes());
Highlighted:     }
Cut slicer: sealing the pastmechanismHover a node to see the first 12 hex characters of its id. Tamper with node 7 and watch which ids change.
Loading Cut slicer: sealing the past
[code]

The same bytes are hashed once as a trace digest and once as a policy digest. Are the two digests equal?

Answer options
How sure are you?

The split rule

S3E2

Reminder: the agent sees the past, the grader keeps the future. In code, the past is every node with seq < cut_seq [code]crates/sa-core/src/cut.rs:140.

[code]crates/sa-core/src/cut.rs:140isolate_cut: prefix against held-out
    for n in ordered {
Highlighted:         if n.seq < cut_seq {
            agent_prefix.push(CutPrefixTurn {

After the cut is written to disk, sa cut runs two checks: no .git anywhere under agent/, and no held-out node id hex string inside prompt_prefix.json [code]crates/sa-ingest/src/cut.rs:200-210. Pass both and the manifest says isolation_verified: true.

[code]crates/sa-ingest/src/cut.rs:200The two isolation checks, and nothing else
    // Post-materialisation isolation verification:
Highlighted:     // 1. No `.git` directory or file anywhere inside `agent/`.
Highlighted:     verify_no_git_metadata(&agent_dir)?;
Highlighted:     // 2. No held-out witness node ID appears in `agent/prompt_prefix.json`.
Highlighted:     for w in &isolated.grader_held_out {
Highlighted:         if prefix_json.contains(&w.node_id.to_hex()) {

Read those two checks again and ask what they do not look at. Neither compares the workspace's git tree with the time of the cut. Hold that thought for Pass 3.

Kleene's three values

E3

Reminder: Unknown means missing evidence. Kleene's strong logic, K3, is the rule that never invents evidence. The whole of Verdict::and fits on one screen [code]crates/sa-core/src/verdict.rs:47-54.

[code]crates/sa-core/src/verdict.rs:49Kleene strong conjunction
    pub fn and(self, other: Self) -> Self {
        match (self, other) {
Highlighted:             (Self::Fail, _) | (_, Self::Fail) => Self::Fail,
Highlighted:             (Self::Pass, Self::Pass) => Self::Pass,
            (Self::Unknown(a), Self::Unknown(b)) => Self::Unknown(format!("{a}; {b}")),
            (Self::Unknown(r), _) | (_, Self::Unknown(r)) => Self::Unknown(r),
        }
    }

Notice the reasons. Two Unknowns joined by AND keep both reasons, separated by a semicolon, so a report can say 'grader timed out; answer.md missing' instead of a bare Unknown.

Kleene gates and the grader calibratormechanismTry every cell of the 3×3 table. The matching Rust arm lights up as you go.
Loading Kleene gates and the grader calibrator

A grader that cannot skip calibration

S5E4

Reminder: a grader must reject a bad witness and accept a good one before it may score. Same Again enforces this with the type system. Predicate<T, Uncalibrated> and Predicate<T, Calibrated> are different types [code]crates/sa-core/src/predicate.rs:80-84, and only the calibrated one has evaluate.

[code]crates/sa-core/src/predicate.rs:179calibrate_all: every bad witness must Fail
    pub fn calibrate_all(
        self,
        bad_witnesses: &[&T],
        good_witnesses: &[&T],
        unknown_witnesses: &[&T],
    ) -> Result<Predicate<T, Calibrated>, CalibrationError> {

The order matters. Empty witness sets are rejected first, then every bad witness must give Fail, then every good one Pass, then every optional unknown witness must stay Unknown [code]crates/sa-core/src/predicate.rs:185-226. The first broken rule returns its error.

Five graders against the witness shelf
GraderBehaviourcalibrate_all
Always PassPass on everythingBadWitnessNotRejected
Always FailFail on everythingGoodWitnessNotAccepted
Timeout-happyPass when the file is missingUnknownWitnessNotUnknown
File-existsPass if answer.md existsPasses, if the bad witness lacks the file
DiscriminatingChecks the claim's freshnessPasses
Kleene gates and the grader calibratormechanismDrag each grader onto the shelf. Uncalibrated graders bounce off the trial: there is no method to call.
Loading Kleene gates and the grader calibrator
[code]

What stops a developer from scoring trials with a grader that has never been calibrated?

Answer options
How sure are you?
[code]

An always-Pass grader is run through calibrate_all. Which error comes back first?

Answer options
How sure are you?

The e-value: a bet that cannot be gamed by peeking

E5S6

Reminder: you may check sa diff after every pair. Here is why. Only discordant pairs carry evidence: B passed and A failed (count b), or the reverse (count a). Ties tell you nothing about which is better.

Under 'no difference', each discordant pair is a fair coin. The e-value averages the likelihood of the observed (b, a) over every possible bias, with a flat Beta(1, 1) prior, and divides by the fair-coin likelihood [code]crates/sa-core/src/stats.rs:350-360.

[code]crates/sa-core/src/stats.rs:355beta_binomial_e_value, computed in log space
pub fn beta_binomial_e_value(b_better: usize, a_better: usize) -> f64 {
    let m = b_better + a_better;
    if m == 0 {
        return 1.0;
    }
Highlighted:     let log_e =
Highlighted:         (m as f64) * std::f64::consts::LN_2 + ln_factorial(b_better) + ln_factorial(a_better)
Highlighted:             - ln_factorial(m + 1);
    log_e.exp()
}

Under the null its expected value is exactly 1 at every step. Ville's inequality then says the chance it ever reaches 1/α is at most α, no matter when you look or when you stop.

Worked. Seven straight B wins: . Under 20, so not yet.

Your turn, last step only. Eight straight B wins: . Is that at least 20?
Your prediction
How sure are you?
E-process against naive peekingmechanismStep pair by pair. The log e-value climbs one rung per win and falls per loss. The line at log 20 never moves.
Loading E-process against naive peeking

From evidence to a verdict

E5S6

The e-value says whether B differs from A. A confidence sequence says by how much. It is an interval around the estimate that stays valid at every n at once, and its radius shrinks slowly [code]crates/sa-core/src/stats.rs:365-376.

Here n counts decisive pairs: ties included, Unknown pairs left out. Then decide_verdict walks four gates in order [code]crates/sa-core/src/stats.rs:305-339.

[code]crates/sa-core/src/stats.rs:311decide_verdict: the Unknown veto, then the e-value, then equivalence
    let unk_a = arm_a.unknown_rate();
    let unk_b = arm_b.unknown_rate();
Highlighted:     if unk_a > config.max_unknown_rate || unk_b > config.max_unknown_rate {
        return DiffVerdict::Inconclusive(format!(
            "excessive Unknown rate (arm_a={:.1}%, arm_b={:.1}%, cap={:.1}%)",
            unk_a * 100.0,
            unk_b * 100.0,
            config.max_unknown_rate * 100.0
        ));
    }

Highlighted:     if e_value >= threshold {
        if paired.b_better > paired.a_better {
            return DiffVerdict::Better;
        }
        if paired.a_better > paired.b_better {
            return DiffVerdict::Worse;
        }
    }
  1. No pairs at all: Inconclusive.
  2. Either arm more than 20% Unknown: Inconclusive.
  3. : Better or Worse by the sign of b − a.
  4. At least 5 decisive pairs and the whole interval inside ±0.05: Equivalent. Otherwise Inconclusive.
E-process against naive peekingmechanismOpen the funnel tab. The marker at n = 10 is the CLI default budget.
Loading E-process against naive peeking
[toy]

With the default --max-trials 20 (10 pairs) and margin 0.05, can sa diff ever return Equivalent?

Answer options
How sure are you?

Why pairing halves the variance

F4E7

Reminder: a shared task drags both arms together. The variance of a difference subtracts their covariance.

Worked. Both arms pass with p = 0.6, so each variance is . With Cov = 0.12 on the same task: . Unpaired it would be 0.48. Half the variance means half as many pairs for the same precision.

Retries cut the other way. With m retries per task and intra-task correlation ρ, the design effect is . Eight retries at ρ = 0.6 give a design effect of 5.2, so eight runs carry about 1.54 tasks' worth of information [toy]designEffect(8, 8, 0.6).

Paired variance and clustered retriesmechanismThe stacked bars show Var(A) + Var(B) and the −2Cov that pairing removes.
Loading Paired variance and clustered retries

Both arms pass with p = 0.6 and Cov(A, B) = 0.12 on the same task. What is Var(A − B)?

Answer options
How sure are you?

pass@k and pass^k in the code

E8

Reminder: capable is not reliable. sa-core estimates both from n attempts with c passes on one cut [code]crates/sa-core/src/stats.rs:395-420.

[code]crates/sa-core/src/stats.rs:416pass_pow_k: the plug-in estimator
pub fn pass_pow_k(n: usize, c: usize, k: usize) -> Option<f64> {
    if k == 0 || n == 0 || c > n {
        return None;
    }
Highlighted:     let p = (c as f64) / (n as f64);
Highlighted:     let exp = i32::try_from(k).unwrap_or(i32::MAX);
Highlighted:     Some(p.powi(exp))
}

pass@k is the unbiased draw-without-replacement estimator from the HumanEval paper. pass^k is not. Raising an estimate to a power is a convex operation, so on average it overshoots. Pass 3 measures by how much.

pass@k against pass^kmechanismSwitch to the empirical tab. Set n and c and read both estimators side by side.
Loading pass@k against pass^k
[toy]

A cut has n = 5 attempts with c = 3 passes. What do pass_at_k and pass_pow_k report for k = 3?

Answer options
How sure are you?

Bounds instead of a guess

E6

Reminder: Unknown pairs vanish from the evidence. The estimate uses only decisive pairs, so the denominator shrinks with the fog.

Manski's idea is to stop guessing what the fog hides. Fill it in the worst way for B, then the best way, and report the range. Every filling-in the data allows lies inside it. This is a proposal, not in same-again.

Manski bounds and the Unknown fogmechanismEdit the seven cell counts. The bar shows the bounds, the dot shows the code's estimate.
Loading Manski bounds and the Unknown fog

ddmin, line by line

S8E9

Reminder: shrink keeps removing units while the check still passes. ddmin_shrink first probes the full set and the empty set, then loops: try each chunk alone, then each complement, then split finer [code]crates/sa-core/src/search.rs:120-172.

[code]crates/sa-core/src/search.rs:155Try each complement: only a Pass reduces the set
        // 2. Try each complement (remove one chunk at a time).
        for (skip_i, _) in chunks.iter().enumerate() {
            let complement: Vec<usize> = chunks
                .iter()
                .enumerate()
                .filter(|&(j, _)| j != skip_i)
                .flat_map(|(_, c)| c.iter().copied())
                .collect();
            let Some(v) = run_probe(&complement, &mut probes, &mut budget_exhausted)? else {
                break;
            };
Highlighted:             if v.is_pass() {
Highlighted:                 active = complement;
Highlighted:                 granularity = (granularity - 1).max(2);
                reduced = true;
                break;
            }
        }

The real fixture has 8 units: six AGENTS.md sections and two skills, with Git, Testing and rust-feedback needed. With a perfect oracle, ddmin needs 48 probes. The CLI default is --max-trials 24 [code]crates/sa-cli/src/main.rs:524, so it stops at six units with budget_exhausted [toy]ddminShrink(8, 24, requiredSetOracle(W7_ACTIVE)).

ddmin and ProbDD policy shrinkermechanismRun the deterministic oracle. The probe ledger matches the Rust ShrinkProbe records step for step.
Loading ddmin and ProbDD policy shrinker
[toy]

Eight policy units, three of them needed, a perfectly deterministic oracle and the CLI default budget of 24 probes. Does ddmin finish?

Answer options
How sure are you?

bisect, line by line

S7E10

Reminder: a bracket cannot recover from a lie. bisect_revisions checks that revision 0 passes and the last one fails, then halves [code]crates/sa-core/src/search.rs:303-331. A midpoint Unknown stops the search with Inconclusive.

[code]crates/sa-core/src/search.rs:305One probe per midpoint, and the bracket moves for good
    while hi - lo > 1 {
        let mid = lo + (hi - lo) / 2;
        let Some(mid_v) = eval(mid, &mut probes)? else {

Offline, sa bisect reuses stored trials instead of new runs. A revision counts as Fail if any stored trial failed [code]crates/sa-ingest/src/experiment.rs:485-490. A good revision that passes 90% of the time, with 10 stored trials, gets called Fail about 65% of the time, because [toy]offlineAnyFailRate(0.9, 10).

Noisy bisect against classic bisectmechanismStep the classic lane and the posterior lane side by side on the same coin flips.
Loading Noisy bisect against classic bisect

Probabilistic bisection keeps a belief over every possible first-bad revision. Where does it probe next?

Answer options
How sure are you?

Counting your looks

E11

Reminder: every look at the same cuts is a ticket. With t independent looks at level α, the chance of at least one false alarm is bounded by:

E-values make the fix cheap. Bonferroni for e-values just raises the bar: reject only when , which is 400 for 20 looks. e-BH (Wang and Ramdas, 2022) is gentler: sort the e-values and reject the k largest when the kth is at least .

The garden of forking predicatesmechanismToggle the correction: naive, Bonferroni, e-Bonferroni, e-BH. Watch the false Better leaves disappear.
Loading The garden of forking predicates

Mixed practice

E5E11E2E9E6

Five questions, shuffled across threads. Part of the exercise is noticing which idea applies.

[toy]

B wins every discordant pair and A wins none. How many straight B wins before sa diff can say Better at α = 0.05?

Answer options
How sure are you?

You tweak a grader 20 times and run a 5% diff after each tweak, on the same cuts, when nothing really changed. Under independence, what is the upper bound on the chance of at least one false Better?

Answer options
How sure are you?
[code]

A cut is taken at cut_seq = 40. Which of these may reach the agent's side?

Answer options
How sure are you?

Shrink removes the Testing section and the agent passes once. With a flaky agent, which mistake is more dangerous here?

Answer options
How sure are you?

Policy B times out on 15 of 100 tasks, all of them hard ones that A passed. The diff drops those 15 pairs. What happens to B's apparent advantage?

Answer options
How sure are you?