Skip to content

npu: a depth neither table reached is n/a, not a 0.00 pp pass - #916

Merged
bong-water-water-bong merged 5 commits into
mainfrom
npu/mtp-zero-denom
Nov 4, 2026
Merged

bong-water-water-bong merged 5 commits into
mainfrom
npu/mtp-zero-denom

Conversation

@bong-water-water-bong

@bong-water-water-bong bong-water-water-bong commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

What

--match scores the live loop against the offline protocol per depth. Every depth was judged with a percentage
computed as 0.0 when its denominator was missing, so live 0/0 vs offline 0/0 came out as "delta +0.00 pp PASS"
and counted toward the brief's 2 pp bar.

At tau=0 (the configuration the deliverable was measured in) this cannot fire: the loop drafts k every iteration,
so drafted_at[d] is always the iteration count. At tau>0 it is the normal case — the chain gate stops early, and
p0's gated chain measured 1 30/34 2 1/1 3 0/0 4 0/0 (ticket-live-tau0.6-p0-1-20261102-163633.log), i.e. the bar
would have printed "4 of 4 depths within 2 pp" for a comparison that scored two depths.

Root cause

Not in the loop: in the report. Two print sites (tools/mtp_acceptance.cpp:617-625 per-prompt detail, :719-731
summary bar) each did their own numerator/denominator arithmetic with cond ? a / b : 0.0, then compared two zeroes.
A depth with no chain on either side is unmeasured, and an unmeasured depth is not a pass.

Fix

The arithmetic and the verdict are now one function, onebit::npu::mtp::depth_verdict() in
npu/mtp/mtp_head.{h,cpp}, returning scored = false as soon as either side has no denominator — so a print site
cannot reintroduce the reading by editing a formula. Both sites print n/a (live a/b reached, offline c/d) not scored
and leave the depth out of the count; the summary now reads "N of M scored depths within 2 pp" and says explicitly
when a depth was not scored.

Measured before/after (host only, no device)

tests/mtp_draft_test.cpp [9] carries the three cases at once: the counts of the tau=0.6 chain above, a 20 pp gap
that must still fail, and the old rule kept as legacy_within so the defect stays stated rather than described.

with the old arithmetic put back in depth_verdict:   FAIL verdict: 0/0 is n/a, not a pass
                                                     FAIL verdict: live reached nothing -> n/a
                                                     FAIL verdict: offline scored nothing -> n/a
                                                     FAIL verdict: the tau=0.6 chain scores 2 depths, never 4
                                                     INFO verdict tau=0.6 shape: 4 of 4 depths scored  (the defect)
                                                     4 CHECK(S) FAILED        (exit 1)
with this patch:                                     all checks passed         (exit 0)
                                                     INFO verdict tau=0.6 shape: 2 of 4 depths scored, 2 within 2 pp
ctest -R mtp_draft                                   1/1 Passed

A standalone reproducer over the same counts (~/wt/mtp-window/zero-denom-repro.cpp, not part of the tree) prints the
old line 4 of 4 depths within 2 pp at the same positions and the new 2 of 2 scored depths ... with the two n/a
rows, and keeps the "a real gap still fails" arm at −20.00 pp.

Build: ninja mtp_draft_test mtp_acceptance rc 0 under thermal-run on a fresh worktree off origin/main
65460184; python3 tools/copyright.py --check rc 0 (no new files).

What this does not change

No loop, cursor, drafter, engine or npu/forward file: at tau=0 every number the lane reported (p0 44/80,
chain 3.20, stream 72 rows, 0 mismatch, +0.00 pp at four depths) prints exactly as before. The device-side
re-confirm of those numbers is parked on the npu-hold queue (see ~/briefs/TMTPLOOP-STATE.md), not on this PR.

Review follow-up (68a2a5ca, Copilot threads r4460421836 / r4460421905, both resolved)

The review found the hole this PR still left: the denominator itself was d ? accepted_at[d-1] : drafted_at[0],
and under a tau gate a chain can stop right after accepting its last draft — so accepted_at[d-1] is positive while
drafted_at[d] is zero, and a depth the loop never drafted was scored live 0 % against an offline rate that was
measured. That is a phantom score, not a missing one, so depth_verdict's scored flag could not catch it.

  • npu/mtp/draft.h: Stats::reached_at[d] — chains that accepted drafts 0..d-1 and offered a draft at d —
    maintained by the loop (for i <= a && i < nd), plus one shared builder add_live_depths(Stats&, LiveDepths&) that
    both print sites and the test read, so the denominator cannot be derived a second way in one place. At tau=0 it
    equals the old expression at every depth, i.e. no published number moves (asserted in [9]).

  • Reproduced before the fix, host only, toy model (~/wt/mtp-window/zero-draft-denom-repro.cpp, tau=0.6, head
    confident only in draft 0 so the gate stops the chain at nd=2 with both drafts accepted):

    iterations 8, drafted_at 8/8/0/0, accepted_at 8/8/0/0
    depth 3: old denominator 8 -> live 0.00 %   <-- scored a depth never drafted
             new denominator 0 -> n/a
    
  • tests/mtp_draft_test.cpp [9] now drives the real construction from that gated toy run (the ungated run of the same
    head is the offline side) instead of hand-typed counts: old denominator in add_live_depths → 3 CHECK(S) FAILED
    (exit 1)
    , reached_at unmaintained in the loop → 3 CHECK(S) FAILED (exit 1), both in place →
    all checks passed, ctest -R mtp_draft 1/1, tools/copyright.py --check rc 0.

--match judged every depth with a percentage computed as 0.0 when its denominator was missing, so
live 0/0 vs offline 0/0 came out as "delta +0.00 pp PASS" and counted toward the bar.  At tau=0 it
cannot fire (the loop drafts k every iteration); at tau>0 it is the normal case: p0's gated chain
measured 30/34, 1/1, 0/0, 0/0, i.e. the bar would have read "4 of 4 depths within 2 pp" for a
comparison that scored two depths.

Root cause is in the report, not the loop: the numerator/denominator arithmetic and the verdict are
now one function (npu/mtp/mtp_head.cpp depth_verdict) that returns scored=false when either side has
no denominator, and both print sites (per-prompt detail, summary bar) print n/a and leave the depth
out of the count.  The summary now says "N of M scored depths" and says so explicitly when a depth
was not scored.

Red/green, host only (no device): tests/mtp_draft_test.cpp [9] keeps the old rule as legacy_within --
it still returns true for 0/0, which is the defect stated -- and asserts depth_verdict does not, plus
that the tau=0.6 shape scores 2 depths and that a real 20 pp gap still fails.  With the old arithmetic
put back in depth_verdict: 4 checks FAIL ("4 of 4 depths scored").  With the fix: all checks passed,
ctest -R mtp_draft 1/1.  A standalone reproducer over the same counts prints the old "4 of 4 depths
within 2 pp" and the new "2 of 2 scored depths".

No loop, cursor, engine or draft-logic change; the numbers a device run prints are unchanged at tau=0.
@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

#916 ready for review at 5470336 — one reporting fix in the lane's own file, red/green on the host (old rule: 4 checks FAIL / new: all checks passed, ctest 1/1). No loop, cursor, drafter or engine file touched; at tau=0 the lane's device numbers print unchanged.

@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

PR Reviewer Guide 🔍

(Review updated until commit 2463a04)

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Depth Verdict Logic

The new depth_verdict function correctly handles cases where either side has no denominator by setting scored to false, preventing incorrect scoring of unmeasured depths. This addresses the core issue where depths with no chain on either side were incorrectly treated as passes.

DepthVerdict depth_verdict(int live_hits, int live_reached, int offline_hits, int offline_reached, double bar_pp) {
    DepthVerdict v;
    if (live_reached <= 0 || offline_reached <= 0) return v;   // no denominator on a side: n/a, not 0.00 %
    v.scored = true;
    v.live = 100.0 * live_hits / live_reached;
    v.offline = 100.0 * offline_hits / offline_reached;
    v.delta = v.live - v.offline;
    v.within = v.delta <= bar_pp && v.delta >= -bar_pp;
    return v;
}
Corrected Depth Reporting

The print sites in mtp_acceptance.cpp now use the new depth_verdict function and correctly report "n/a" for unscored depths, ensuring that unmeasured depths do not contribute to the pass/fail count. This prevents the previous behavior where 0/0 was treated as a pass.

LiveDepths live;
add_live_depths(r.stats, live);
for (int d = 0; d < k && d < Stats::kMaxDepth; d++) {
    const double joint = r.stats.drafted_at[d] ? 100.0 * r.stats.accepted_at[d] / r.stats.drafted_at[d] : 0.0;
    const int hits = live.hit[d], reached = live.reached[d];
    const DepthVerdict v = depth_verdict(hits, reached, m.c_hit[d], m.c_tot[d]);
    const double om = m.d_tot[d] ? 100.0 * m.d_hit[d] / m.d_tot[d] : 0.0;
    if (!v.scored) {   // no chain on one side: 0/0 is not agreement (see depth_verdict)
        std::printf("    depth %d: n/a (live %d/%d reached, offline %d/%d)  not scored"
                    "   [live joint %6.2f %%, offline marginal %6.2f %%]\n",
                    d + 1, hits, reached, m.c_hit[d], m.c_tot[d], joint, om);
        continue;
    }
    std::printf("    depth %d: live %6.2f %% (%d/%d, reached)  offline conditional %6.2f %% (%d/%d)"
                "  delta %+6.2f pp%s   [live joint %6.2f %%, offline marginal %6.2f %%]\n",
                d + 1, v.live, hits, reached, v.offline, m.c_hit[d], m.c_tot[d],
                v.delta, v.within ? "" : "  > 2 pp", joint, om);
}
Test Coverage for Depth Verdict

The test suite now includes a comprehensive test case [9] that verifies the correct behavior of depth_verdict when dealing with unscored depths, ensuring that the fix works as intended and prevents regressions.

// [9] the live-vs-offline depth verdict: a depth the loop never drafted is UNSCORED, not 0.00 %.
// Two defects are kept stated here.  (a) The old rule turned a missing denominator into 0.00 %, so two tables
// that both measured nothing compared equal to each other and counted as a pass (legacy_within).  (b) The
// denominator itself was `d ? accepted_at[d-1] : drafted_at[0]`, and under a tau gate that counts a chain that
// stopped right after ACCEPTING depth d-1 -- so a depth the loop never drafted was scored live 0 % against an
// offline rate that was measured, and inflated the bar's scored count.  The live side below is a REAL gated toy
// run, read through the same Stats fields both print sites read (accepted_at / reached_at), and the offline side
// is the same head on the same stream ungated -- the protocol always drafts every depth, which is why its
// denominator is positive where the gated loop's is zero.
{
    auto legacy_within = [](int lh, int lr, int oh, int orr) {
        const double lv = lr ? 100.0 * lh / lr : 0.0;
        const double of = orr ? 100.0 * oh / orr : 0.0;
        return (lv - of) <= 2.0 && (lv - of) >= -2.0;
    };
    check(legacy_within(0, 0, 0, 0), "verdict: the OLD rule calls an unscored depth a pass (the defect)");

    ToyBase gated_base(8);
    PerfectGatedHead gated;
    Options gopt = base_opt;
    gopt.k = 4;
    gopt.tau = 0.6f;
    const Result g = onebit::npu::mtp::run(gated_base, &gated, P, gopt);
    ToyBase open_base(8);                 // the same chain with the gate off: every depth drafted (the protocol)
    PerfectGatedHead open_head;
    Options oopt = gopt;
    oopt.tau = 0.0f;
    const Result o = onebit::npu::mtp::run(open_base, &open_head, P, oopt);
    const auto& gs = g.stats;
    const auto& os = o.stats;
    check(g.ok && o.ok && gs.iterations > 0, "verdict: the gated toy chain ran");
    check(gs.accepted_at[1] > 0 && gs.drafted_at[2] == 0 && gs.reached_at[2] == 0,
          "verdict: the gate stopped after accepting depth 2, so depth 3 was never drafted");
    check(gs.reached_at[0] == gs.drafted_at[0] && gs.reached_at[1] == gs.accepted_at[0],
          "verdict: a reached depth is a drafted depth once the prefix was accepted");

    // Read the live side through the SAME construction both print sites use, not through hand-typed counts:
    // if the report ever derives the denominator differently again, this stops matching the loop.
    onebit::npu::mtp::LiveDepths live;
    onebit::npu::mtp::add_live_depths(gs, live);
    onebit::npu::mtp::LiveDepths open_live;
    onebit::npu::mtp::add_live_depths(os, open_live);
    check(live.hit[2] == gs.accepted_at[2] && live.reached[2] == gs.reached_at[2],
          "verdict: the report's live counts are the loop's own accepted_at/reached_at");

    int scored = 0, within = 0, legacy_scored = 0;
    for (int d = 0; d < 4; d++) {
        const auto v = onebit::npu::mtp::depth_verdict(live.hit[d], live.reached[d], open_live.hit[d],
                                                      open_live.reached[d]);
        if (v.scored) scored++;
        if (v.scored && v.within) within++;
        const int legacy_reached = d ? gs.accepted_at[d - 1] : gs.drafted_at[0];
        if (onebit::npu::mtp::depth_verdict(gs.accepted_at[d], legacy_reached, os.accepted_at[d], os.drafted_at[d])
                .scored)
            legacy_scored++;
    }
    check(scored == 2, "verdict: only the depths the gated loop drafted are scored");
    check(legacy_scored == 3, "verdict: the OLD denominator scored the undrafted depth (the defect, stated)");
    check(within == scored, "verdict: the gated chain agrees with the ungated one at the depths it reached");

    check(!onebit::npu::mtp::depth_verdict(0, gs.reached_at[2], 5, 9).scored,
          "verdict: live offered no draft at the depth -> n/a, whatever offline measured");
    check(!onebit::npu::mtp::depth_verdict(0, 0, 0, 0).scored, "verdict: 0/0 is n/a, not a pass");
    check(!onebit::npu::mtp::depth_verdict(0, 0, 5, 9).scored, "verdict: live reached nothing -> n/a");
    check(!onebit::npu::mtp::depth_verdict(5, 9, 0, 0).scored, "verdict: offline scored nothing -> n/a");
    const auto gap = onebit::npu::mtp::depth_verdict(40, 100, 60, 100);
    check(gap.scored && !gap.within && gap.delta < -19.9 && gap.delta > -20.1,
          "verdict: a real 20 pp gap still fails, by its own amount");
    // The number that must not move: at tau=0 the new denominator IS the old one, so every published table
    // (tau=0, 8 prompts x 64 tokens) reads exactly as it did before this change.
    int differ = 0;
    for (int d = 0; d < 4; d++)
        if (os.reached_at[d] != (d ? os.accepted_at[d - 1] : os.drafted_at[0])) differ++;
    check(differ == 0, "verdict: at tau=0 the denominator equals accepted_at[d-1] at every depth (no number moves)");
    std::printf("INFO verdict gated chain: drafted %d/%d/%d/%d accepted %d/%d/%d/%d, %d of 4 depths scored (old"
                " denominator: %d)\n",
                gs.drafted_at[0], gs.drafted_at[1], gs.drafted_at[2], gs.drafted_at[3], gs.accepted_at[0],
                gs.accepted_at[1], gs.accepted_at[2], gs.accepted_at[3], scored, legacy_scored);
}

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT: READY at 547033660 — reproduced both directions on this box, including the negative control that reinstates the old rule.

With this patch (ninja mtp_draft_test at this head, host only):

PASS  verdict: a real 20 pp gap still fails, by its own amount
INFO  verdict tau=0.6 shape: 2 of 4 depths scored, 2 within 2 pp (old rule said 4 of 4)
all checks passed        (exit 0)

Negative control — the old cond ? a / b : 0.0 arithmetic put back inside depth_verdict(), same build:

FAIL  verdict: 0/0 is n/a, not a pass
FAIL  verdict: live reached nothing -> n/a
FAIL  verdict: offline scored nothing -> n/a
FAIL  verdict: the tau=0.6 chain scores 2 depths, never 4
PASS  verdict: a real 20 pp gap still fails, by its own amount
INFO  verdict tau=0.6 shape: 4 of 4 depths scored, 4 within 2 pp (old rule said 4 of 4)
4 CHECK(S) FAILED

So the four new cases are exactly the defect, the fifth shows the bar still bites on a real gap (the tests are not all passing vacuously), and the INFO line states the old behaviour instead of only describing it. git diff clean after the control.

Why the shape is right, not just green: both print sites now call the one function — tools/mtp_acceptance.cpp:618 (acc_live[d], reached) and :724 (the summary bar) — so a site cannot reintroduce the reading by editing a formula, and scored = false on either missing denominator is what makes "0/0 vs 0/0" stop being +0.00 pp. The summary now counts scored depths and says how many were not scored, which is what makes the tau>0 case (2 of 4) legible instead of looking like a 4/4 pass.

@bong-water-water-bong bong-water-water-bong added the tprs-ready TPRS: review verdict READY posted by the standing reviewer; merge gate satisfied label Nov 3, 2026
@bong-water-water-bong
bong-water-water-bong requested a balanced review from Copilot November 3, 2026 21:01

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The report can incorrectly score an undrafted live depth and inflate the scored count, while the test fixture bypasses the denominator construction and fails to catch this case.

2 open issues
What changed in this PR

This PR centralizes live-versus-offline depth scoring so missing denominators are reported as unmeasured rather than counted as agreement.

Changes:

  • Adds DepthVerdict and a shared scoring helper.
  • Updates both reports to print n/a for unscored depths and exclude them from summary totals.
  • Adds regression cases for missing denominators and a genuine acceptance-rate gap.
File Description
tools/​mtp_acceptance.cpp Uses shared verdicts in per-prompt and summary reporting.
tests/​mtp_draft_test.cpp Adds depth-verdict regression checks.
npu/​mtp/​mtp_head.h Declares the verdict structure and scoring helper.
npu/​mtp/​mtp_head.cpp Implements denominator checks and percentage-point scoring.

Review effort: Balanced

Comment thread tests/mtp_draft_test.cpp Resolved
Comment thread tools/mtp_acceptance.cpp Resolved
…, not accepted_at[d-1]

Under a tau gate a chain can stop right after ACCEPTING its last draft, so accepted_at[d-1] is positive
while drafted_at[d] is zero.  Both report sites used `d ? accepted_at[d-1] : drafted_at[0]` as the live
denominator, so a depth the loop never drafted was scored live 0 % against an offline rate that WAS
measured, and it counted toward the 2 pp bar's scored total.  (Copilot review of #916, threads
r4460421836 / r4460421905.)

Root cause, host-reproduced before the fix (~/wt/mtp-window/zero-draft-denom-repro.cpp, toy model, tau=0.6,
head confident only in draft 0 so the gate -- not a rejection -- stops the chain at nd=2 with both accepted):

    iterations 8, drafted_at 8/8/0/0, accepted_at 8/8/0/0
    depth 3: old denominator 8 -> live 0.00 %   <-- scored a depth never drafted
             new denominator 0 -> n/a

At tau=0 every reached chain offers draft d, so the two denominators are equal at every depth -- which is
why no published number (all tau=0) moves.

Fix: Stats::reached_at[d] = chains that accepted drafts 0..d-1 AND offered a draft at d, maintained by the
loop, plus one shared builder add_live_depths()/LiveDepths that both print sites and the test read -- so the
report cannot derive the denominator a second way, which is the second review thread.

Red/green, host only (no device): tests/mtp_draft_test.cpp [9] now drives the REAL construction from a gated
toy run (PerfectGatedHead) with the same head's ungated run as the offline side, instead of hand-typed counts.
  * old denominator put back into add_live_depths: 3 CHECK(S) FAILED ("only the depths the gated loop
    drafted are scored"), exit 1;
  * reached_at left unmaintained in the loop: 3 CHECK(S) FAILED, exit 1;
  * both in place: all checks passed, ctest -R mtp_draft 1/1, tools/copyright.py --check rc 0.
No loop, cursor, engine or draft-logic change; at tau=0 the printed numbers are identical by construction
and [9] asserts it.
@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

#916 ready for review at 68a2a5ca — the two Copilot inline threads are fixed, answered and resolved in this head (live per-depth denominator: accepted_at[d-1] → Stats::reached_at[d] + one shared add_live_depths(); host-reproduced before/after, red with either half reverted, ctest -R mtp_draft 1/1). No rebase — main-only BEHIND, and the tau=0 numbers this PR's first head was READY on are unchanged at every depth.

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

Persistent review updated to latest commit 68a2a5c

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT: READY at 68a2a5ca — my previous READY was at 547033660 and the tprs-ready label names that old head, so this is the re-verdict for the current one.

Built and ran it here rather than reading the test names (~/wt/… scratch worktree, -DCMAKE_BUILD_TYPE=Release, gcc-16, the same flags CI uses):

$ cmake --build build --target mtp_draft_test        rc 0, 3/3
$ ./build/mtp_draft_test                             all checks passed, rc 0     (94 PASS lines)
$ ctest -R mtp_draft                                 1/1, 100% tests passed

The fix is the shape the analysis says it is. Stats::reached_at[d] is incremented in the loop at the one place that knows both numbers — for (int i = 0; i <= a && i < nd && i < kMaxDepth; i++) — i.e. depth d counts when the prefix was accepted (d <= a) and a draft at d actually existed (d < nd), so a chain that stopped because the tau gate cut it contributes no denominator at the depth it never drafted. LiveDepths + the shared add_live_depths() put the pair in one place, which is what stops the report sites and the test from reading the table differently.

The negative control is exact. Removing only that one increment (nothing else) gives:

FAIL  verdict: a reached depth is a drafted depth once the prefix was accepted
FAIL  verdict: only the depths the gated loop drafted are scored
FAIL  verdict: at tau=0 the denominator equals accepted_at[d-1] at every depth (no number moves)
3 CHECK(S) FAILED            rc 1

— the three checks that carry the claim, and only those. So the test is load-bearing rather than descriptive.

The compatibility promise holds in the test's own numbers: INFO verdict gated chain: drafted 8/8/0/0 accepted 8/8/0/0, 2 of 4 depths scored (old denominator: 3). The defect is stated in the suite itself (verdict: the OLD denominator scored the undrafted depth (the defect, stated)), so a future reader sees what was wrong, not just what is right.

Two notes, neither a gate:

  1. My first attempt at a negative control was i <= a → i < a, and it passed. That is not a hole in the fix, it is a limit of the toy: the gated chain there has a == nd, where the two forms coincide. The case that distinguishes them — a rejection at depth a with a < nd, where reached must include a — is covered by the ordinary chains but not by a check that fails when <= is narrowed. If you want that arm to have teeth, one chain with a < nd and an assertion that reached[a] is non-zero would do it.
  2. pr_agent is red at this head (run 41746168207) — the usual coder-llm-off condition, not this PR. build passed in 4m41s, Analyze ×5 + CodeQL pass, hw_gate skips.

No device number is claimed here and none can move: this is host arithmetic over counters the loop already kept.

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

Persistent review updated to latest commit a9c61a1

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

Persistent review updated to latest commit 2463a04

@bong-water-water-bong
bong-water-water-bong merged commit ebb2905 into main Nov 4, 2026
9 checks passed
@bong-water-water-bong
bong-water-water-bong deleted the npu/mtp-zero-denom branch November 4, 2026 06:44
bong-water-water-bong pushed a commit that referenced this pull request Nov 5, 2026
… prompts it did not cover

mtp_depth_pool.py kept only the rows it could score, so the tool's own `not scored` line was dropped.
The tool prints `depth 4: n/a (live 0/0 reached, offline 15/20)  not scored` whenever one side has no
denominator, and its reason for refusing to score it is written down in npu/mtp/mtp_head.h:96 -- at tau>0 the
chain gate stops before depths 3-4, so that line is expected, not exotic.  A pool over a four-depth run whose
chains reached three depths therefore printed `3 of 3 scored depths within 2 pp at the same positions`: a bare
full pass over a table that had silently lost a depth, which is the phantom-depth read (#916) one layer up.

The same hole on the prompt axis.  This lane runs one or two prompts per ticket, so prompts 0,1,5 is a normal
pool; the header printed `prompts 0..5`, i.e. the range it spans rather than the set it measured, and the brief's
window is prompts 0..7 -- so a gapped pool read as the whole window.

Both are now reported rather than inferred:
  * a depth some ticket reported as not scored and no ticket scored a cell for is printed as unmeasured and
    named, and the verdict counts it: `3 of 3 scored depths ... (1 of 4 depths unmeasured: 4)`;
  * a non-contiguous prompt set says which prompts are missing instead of printing a range.

Red on the old tool, green after -- tests/mtp_depth_pool_test.py grew two fixtures and reports:
  FAIL  the not-scored depth is printed as unmeasured
  FAIL  ... and it is depth 4, the one the log named
  FAIL  the verdict says 3 of 4 depths, not a bare '3 of 3': 3 of 3 scored depths within 2 pp ...
  FAIL  the header names the hole instead of spanning it: ... (prompts 0..5, 3 ticket(s))
  (the rest of the suite, including the four refusal cases, was already green and stays green)

The recorded 8x64 window is unchanged to the count: `--selftest` over the three clause55 tickets still pools 32
cells = 8 prompts x 4 depths at +0.00 / +0.55 / +0.09 / +1.08 pp, `4 of 4 scored depths`, PASS.
bong-water-water-bong added a commit that referenced this pull request Nov 5, 2026
…ct, with its traps as refusals (#1146)

* tools: mtp_depth_pool.py -- the pooled per-depth live-vs-offline verdict, with its traps as refusals

The MTP brief's clause is judged on 8 prompts x 64 tokens POOLED, but one `mtp_acceptance --live`
run costs ~90 s of array time plus a model + head load, so an 8-prompt window is two or three
npu-hold tickets of <= 3 min.  Pooling those logs by eye produced two wrong numbers in this lane,
so the arithmetic moves into the tree and the two traps become refusals:

* a ticket log REPEATS ITS TAIL after the harness' exit line (pooling that inflated a 12-cell window
  to 20) -- everything after '== ticket exited' is ignored;
* a cell is keyed by (prompt, depth); a second row for a key with different counts is a
  disagreement between tickets or a format change, never an average;
* a ticket's own run-level row must equal the sum of its per-prompt rows, so a truncated log cannot
  pass as a smaller window;
* a depth with no denominator is UNMEASURED, not a +0.00 pp pass (the phantom-depth defect, #916).

Known-answer check, on the real logs that produced the recorded numbers: pointing the tool at the
three 2026-11-05 clause tickets reproduces 136/181, 86/136, 63/86, 53/63 and the recorded deltas
(+0.00 / +0.55 / +0.09 / +1.08 pp) to the count, so this port is equivalent to the script that made
the claim.  tests/mtp_depth_pool_test.py drives fixture tickets (no model, no device) through the
agreeing, duplicated, disagreeing, short-read and empty-denominator cases; registered as
ctest mtp_depth_pool.

* tools: the pooled verdict names the depths it could not score and the prompts it did not cover

mtp_depth_pool.py kept only the rows it could score, so the tool's own `not scored` line was dropped.
The tool prints `depth 4: n/a (live 0/0 reached, offline 15/20)  not scored` whenever one side has no
denominator, and its reason for refusing to score it is written down in npu/mtp/mtp_head.h:96 -- at tau>0 the
chain gate stops before depths 3-4, so that line is expected, not exotic.  A pool over a four-depth run whose
chains reached three depths therefore printed `3 of 3 scored depths within 2 pp at the same positions`: a bare
full pass over a table that had silently lost a depth, which is the phantom-depth read (#916) one layer up.

The same hole on the prompt axis.  This lane runs one or two prompts per ticket, so prompts 0,1,5 is a normal
pool; the header printed `prompts 0..5`, i.e. the range it spans rather than the set it measured, and the brief's
window is prompts 0..7 -- so a gapped pool read as the whole window.

Both are now reported rather than inferred:
  * a depth some ticket reported as not scored and no ticket scored a cell for is printed as unmeasured and
    named, and the verdict counts it: `3 of 3 scored depths ... (1 of 4 depths unmeasured: 4)`;
  * a non-contiguous prompt set says which prompts are missing instead of printing a range.

Red on the old tool, green after -- tests/mtp_depth_pool_test.py grew two fixtures and reports:
  FAIL  the not-scored depth is printed as unmeasured
  FAIL  ... and it is depth 4, the one the log named
  FAIL  the verdict says 3 of 4 depths, not a bare '3 of 3': 3 of 3 scored depths within 2 pp ...
  FAIL  the header names the hole instead of spanning it: ... (prompts 0..5, 3 ticket(s))
  (the rest of the suite, including the four refusal cases, was already green and stays green)

The recorded 8x64 window is unchanged to the count: `--selftest` over the three clause55 tickets still pools 32
cells = 8 prompts x 4 depths at +0.00 / +0.55 / +0.09 / +1.08 pp, `4 of 4 scored depths`, PASS.

* tools: the pooled verdict states the generation budget it covers, and refuses one prompt at two lengths

Third hole of the same family as the previous commit: the pool reported which prompts and depths it scored, but
never the generation budget, and the brief's window is 8 prompts x 64 tokens.  The live per-prompt header carries
it (`prompt 0: TEXT IDENTICAL, 64 tokens, accepted 44/80, ...`), so a pool mixing a 64-token ticket with a 32-token
one silently produced a table whose shape matched neither -- the same failure as the prompt gap: a verdict that
reads as the window it was not measured over.

The budget is now part of the header (`..., 64 tokens/prompt, 3 ticket(s)`), and a pool that mixes budgets says so
per prompt instead of inheriting whichever ticket was read first:

    MIXED token budgets: 64 on prompts 0; 128 on prompts 1 -- the pooled verdict is not one window

Mixing lengths across *different* prompts stays legal, because a longer prompt is a legitimate measurement; the same
prompt measured at two lengths is a contradiction about one cell and is refused, like any other disagreement
already refused here.

Only the live header shape is read: its `N tokens` is the emitted count (`r.stats.emitted`, i.e. --tokens), while
the offline header's number in the same position is the stream length -- reading both would have compared two
different quantities, which is the class of mistake this file exists to stop.

Red on the previous commit, green after (three of the new checks fail against `9ec6cce8`, 26/26 pass now):
  FAIL  a uniform budget is stated in the header
  FAIL  the mixed budget is named per prompt
  FAIL  prompt 3 at 64 and at 32 tokens is refused
`--selftest` over the three clause55 tickets still reproduces the recorded window to the count, now labelled
`64 tokens/prompt`: 32 cells = 8 prompts x 4 depths, +0.00 / +0.55 / +0.09 / +1.08 pp.

* tools: a pre-`reached` log is refused for the reason it is actually refused

Last night's corpus sweep (all 70 `mtp_*/ticket-*` logs in ~/wt/mtp-window, one at a time) turned up two logs this
tool refuses with the wrong explanation: `ticket-match-p0-1-20261102-151015.log` and
`ticket-match-p0-3-diffs-20261102-152047.log` (2 of the 16 that carry cells; the other 54 are offline runs with no
`--match` rows and are skipped as such).  They are REFUSED CORRECTLY -- their per-prompt rows are the pre-`reached`
shape,

    depth 1: live  90.00 % (18/20)  offline  90.00 % (18/20)  delta  +0.00 pp

whose live rate is the MARGINAL one, not the rate conditional on reaching the depth that the current column reports,
so pooling them would mix two different quantities.  But the diagnostic said "the log was read incompletely, do not
pool it", which is about truncation, and would send a reader to re-run a complete six-minute ticket.

Now the two cases are distinguished by structure rather than guessed: the run-level rows live after the
`== live vs offline at the SAME positions` header, so a `delta`-shaped row BEFORE that header is a per-prompt row in
the old shape, and the refusal names it --

    <path>: 8 per-prompt row(s) in the pre-`reached` shape (live rate marginal, not conditional on reaching the
    depth) -- this log predates the column, so its cells are a different quantity; re-run it with a current build
    rather than pooling it

(the counts are right: 8 = 2 prompts x 4 depths on the first log, 16 = 4 x 4 on the second).  A log that really is
short still gets the "read incompletely" refusal, unchanged.

Corpus re-swept after the change: 14 pool, 54 skipped as offline-only, the same 2 refused -- and now for the right
reason.  Recorded 8x64 known answer unchanged to the count (`32 cells = 8 prompts x 4 depths`, `64 tokens/prompt`,
+0.00 / +0.55 / +0.09 / +1.08 pp, `selftest PASS`).  28/28 checks in tests/mtp_depth_pool_test.py; ctest 1/1;
copyright clean.

* tools: the pooled verdict states the chain width too, and names the prompts that ran wider

Fifth axis of the same defect, and the last one the window has: k. Each `--live --match` row carries every depth
the run drafted, so a k=6 ticket pooled with k=4 ones produces a SIX-depth table whose depths 5-6 have cells only on
the k=6 prompts -- and the verdict then reads `6 of 6 scored depths within 2 pp at the same positions`, i.e. a pass
over depths five of the tickets never attempted.  On the brief's deliverable (a four-depth table) that is not the
claim being made.

The chain width is read from the rows themselves (the deepest depth a prompt has a row for, scored or not-scored, so
a depth the chain never reached still counts toward k) and printed:

    pooled 32 scored cells = 8 prompts x 4 depths (prompts 0..7, 64 tokens/prompt, k=4, 3 ticket(s))

and when it is not one value, per prompt:

    MIXED chain width (k): 4 on prompts 0; 6 on prompts 1 -- the depths above 4 come from the wider prompts only,
    not from the whole pool

Pooling different widths stays legal -- a k sweep is a legitimate measurement -- but the table no longer implies the
whole pool reached those depths.  A prompt measured twice resolves to the wider run, which is the one whose cells the
table keeps.

Red on `56487b49`, green after: `the differing chain width is named per prompt`, `... and says what it means for the
table` and `a uniform chain width is stated once in the header` all fail there.  Suite 34/34; `--selftest` over the
three clause55 tickets still reproduces the recorded window to the count, now labelled `k=4`; `ctest -R
mtp_depth_pool` 1/1; copyright clean.

* tools: the pooled verdict states the run identity (vocab, batch width, hidden source)

Last input that can change what a cell means, and the one this lane has published the largest number for: the hidden
source alone moved acceptance between 2.1 and 3.19 tokens/pass, and `mtp_acceptance` prints the identity of the run
that produced a log on one line at init,

    forward ready: vocab 248320, max_batch_rows 16, hidden source post-final-norm

so a pool that mixes a `residual` ticket with `post-final-norm` ones averages two measurements while reporting one
table.  Same for a different vocabulary (a different model) and a different batch width (a different sealed ELF
family).  None of that is visible in the cells; all of it is in the log.

The identity is now in the header --

    pooled 32 scored cells = 8 prompts x 4 depths (prompts 0..7, 64 tokens/prompt, k=4, vocab 248320,
    max_batch_rows 16, hidden post-final-norm, 3 ticket(s))

-- and a mixed pool names each identity with the ticket it came from instead of blending them:

    MIXED run identity: vocab 248320/M16/post-final-norm from norm.log; vocab 248320/M16/residual from rsd.log --
    a different model, batch width or hidden source is a different measurement, not one pool

Only tickets that contributed cells are listed, so an offline log in the same command does not fake a mix.

With this the header states the whole window -- prompt set (and any gap), depth coverage (and any depth no chain
reached), generation budget, chain width, and run identity -- which is the set of inputs the logs carry that can change
a cell.  The lane's own corpus is uniform on all of them (86 logs: one model, vocab 248320, M=16, post-final-norm), so
this changes no recorded number; it stops the next pool from quietly not being one.

Red on `4f53bf61`, green after (2 checks, 36/36 total); `--selftest` still reproduces the recorded 8x64 window to the
count; the corpus sweep is unchanged (14 pool / 54 offline-only / 2 refused for the pre-`reached` shape);
`ctest -R mtp_depth_pool` 1/1; copyright clean.

* tests: the recorded 8x64 window is now checkable in CI, not only on the box that holds the tickets

The tool's known answer -- the per-depth live-vs-offline table the brief is judged on -- could only be reproduced
with the original `npu-hold` logs, which live in one home directory on one machine. So the artefact that produces the
deliverable's published verdict could break its own recorded numbers and CI would stay green: `ctest mtp_depth_pool`
ran only the refusal self-test, with no logs.

The three tickets are now shipped as fixtures under `tests/fixtures/mtp_clause55/`, extracted verbatim from the
2026-11-05 tickets (prompts 0 / 1-4 / 5-7, 78 lines together), and the test runs `--selftest` over them:

    PASS  the fixtures pool to the recorded 8 x 4 cells
    PASS  fixture pool reports 136/181 = 75.14%
    PASS  fixture pool reports 86/136 = 63.24%
    PASS  fixture pool reports 63/86 = 73.26%
    PASS  fixture pool reports 53/63 = 84.13%
    PASS  all four depths are inside the bar on the fixtures
    PASS  the tool's own known-answer check passes on them

Nothing the tool reads was edited -- the `[  Ns]` stamps, the `[live joint …]` brackets and the `match pN:` headers are
as the tickets printed them -- so the pool still has to reproduce the counts instead of a fixture written to agree with
the code. The extraction command is in the directory's README, with the tickets it came from.

Proven it is not vacuous: adding 1 to `live_n` in `table()` reds 8 checks, including
`the shipped fixtures reproduce the recorded 8x64 window (rc=1)`; reverting returns `all checks passed` (44 checks).
Copyright clean; no model, no device, no token.

* tests: carry the Apache notice on the fixture README (copyright --check)

* tests: the clause-55 fixtures were never committed (.gitignore `*.log`), so CI could not read them

The build on `673faa2e` failed in exactly one test, and it was mine:

    53 - mtp_depth_pool (Failed)
    FAIL  tests/fixtures/mtp_clause55 is incomplete: ['/__w/engine/engine/tests/fixtures/mtp_clause55/p0.log', ...]

`.gitignore:19` is `*.log`, so `git add -A tests/fixtures/mtp_clause55` committed the README and silently left all three
tickets behind. Locally the test passed because the untracked files were lying in the working tree; in a clean checkout
there was nothing to read. The guard fired -- that is the guard doing its job, one environment too late -- but the real
defect is that a fixture can be present locally and absent from the commit at all.

Two changes, so this cannot recur quietly:

* the fixtures carry `.txt` (the ignore rules do not match it) and the directory README says why, with the CI failure
  quoted, because a rename or a fresh clone must not be able to drop them;
* `tests/mtp_depth_pool_test.py` now asserts with `git ls-files` that all three are **tracked** before it pools them, so
  an unfixtured tree fails locally rather than only on a clean checkout. Measured: with the files present but unstaged,
  `FAIL the three fixtures are tracked by git (0 of 3)`; staged, `PASS ... (3 of 3)` and `all checks passed`.

Verified from a clean tree rather than in my working copy: a fresh `git worktree add` at this commit runs the test green,
which is what CI will do. No model, no device, no token.

---------

Co-authored-by: bong-water-water-bong <[email protected]>
bong-water-water-bong added a commit that referenced this pull request Nov 7, 2026
… bare FAIL on 2 chains (#1318)

The tau=0.6 window (engine#1300) put this in the leaderboard and in docs/npu.md, and the tool that produced it still
printed its two deep rows as plain verdicts:

    depth 2   11/13 = 84.62 %   offline 57/99 = 57.58 %   +27.04 pp  FAIL
    depth 3     2/2 = 100.00 %  offline 17/32 = 53.12 %   +46.88 pp  FAIL
    1 of 3 scored depths within 2 pp at the same positions

Read on its own that says the live loop regressed against the offline protocol at tau=0.6. It did not: at 13 and 2 live
chains those deltas are arithmetic, not measurement. One chain moves a depth's rate by 100/n pp, so under 100/2 = 50
chains a single accepted draft is worth more than the whole 2 pp bar.

The table now says which depths a bar of this size can survive, in arithmetic rather than statistics:

    depth 2   11/13 = 84.62 %   offline 57/99 = 57.58 %   +27.04 pp  FAIL  (thin: 13 live chain(s), one chain = 7.7 pp > the 2 pp bar)
    depth 3     2/2 = 100.00 %  offline 17/32 = 53.12 %   +46.88 pp  FAIL  (thin: 2 live chain(s), one chain = 50.0 pp > the 2 pp bar)
    1 of 3 scored depths within 2 pp at the same positions ...
    1 of 3 scored depths have a denominator a 2 pp bar can survive (>= 50 live chains; below that one chain moves the
    rate by more than the bar)

PASS/FAIL is untouched -- the bar is the brief's criterion, not a hypothesis test -- and the tau=0 window prints exactly
what it printed before (all four depths have 63-181 chains, so no note and no extra line).

Verified: `tests/mtp_depth_pool_test.py` -> all checks passed, with two new arms (a 3-chain depth is marked thin and
counted out of the summary; a 120-chain depth prints its verdict and no thin note); injection: disabling the note makes
exactly those two arms FAIL; `--selftest tests/fixtures/mtp_clause55/*.txt` rc 0 (the recorded 8x64 window still
reproduces to the count); `npu_leaderboard.py --check` 30 record(s) valid; `copyright.py --check` rc 0 with the tree
staged; `ctest -R 'mtp_draft|mtp_depth_pool|npu_leaderboard'` 3/3.

refs #805 (whose tau=0.6 row this annotates), refs #916 (the phantom-depth rule this generalises).

Co-authored-by: bong-water-water-bong <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Review effort 4/5 tprs-ready TPRS: review verdict READY posted by the standing reviewer; merge gate satisfied

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants