feat(pipe): correction-token hedged wait-window drafting (M25_CORRHEDGE, lossless)#32
Open
463464q435q43 wants to merge 1 commit into
Open
feat(pipe): correction-token hedged wait-window drafting (M25_CORRHEDGE, lossless)#32463464q435q43 wants to merge 1 commit into
463464q435q43 wants to merge 1 commit into
Conversation
…GE, lossless)
On novel text the chain coordinator idles ~1 ring RTT per round waiting
for the verify reply, and on a partial accept the verifier hands back
exactly one nameable token: the correction r[n]. The drafter's ranked
candidates concentrate real mass on that coordinate, so while the parent
frame is in flight the coordinator pre-drafts K-token continuations from
the top-mass (rejection depth j, rank r) correction candidates - branch
set {(3,2),(2,2),(1,2),(1,3),(1,4)} from a measured per-depth rank
profile - and ships them as ordinary verify frames at start = anchor+j
in DESCENDING-start order (stage KV is crop-to-start: lower-start writes
would corrupt deeper branches' hypotheses), followed by a RESTORE frame
(exact parent copy) that rewrites the parent rows bit-identically.
On a partial accept whose correction matches a sent branch, that branch's
already-in-flight reply IS the next round - two rounds' commits for ~one
RTT; a RESEND frame repairs the hit branch's rows. Misses drain LAZILY,
overlapped with the next round's flight (a synchronous drain was measured
at 0.73x with the same healthy hit rate - the lazy drain is what makes
the mechanism pay). Every commit stays verifier-greedy on a bit-identical
ring prefix, so output byte-identity with flag OFF is structural.
Coordinator + EAGLE drafter only (draft_topk / propose_ahead / fetch_hedge;
the committed drafter cache is never mutated by hedge drafts); zero new
wire ops, stages untouched. n-gram-matched rounds have no candidate
ranking and hedge nothing (master path). Default OFF = master bit-exact.
Measured on a scattered-EU WAN 5-stage RTX 5090 ring (274.8 ms loop RTT,
MiniMax-M2.5 NVFP4, EAGLE-3 novel/reasoning cell, K=8 depth 4,
interleaved n=3/arm, pre-registered): paired ON/OFF ratio 1.20 (95% CI
1.07-1.33), hedge hit rate 0.273, output sha byte-identical across all
7 runs (72 real correction splices, zero corruption). Replicated
same-session at 11.66 +/- 0.36 tok/s vs 10.87 +/- 0.79 pristine anchor.
CPU tests (tests/test_corrhedge.py): real drafter math on a tiny random
EAGLE head (draft_topk == chain, propose_ahead self-consistency, cache
immutability, hybrid contract) + a coordinator-loop mock against a
stateful crop-to-start ring where any protocol bug produces hostile
garbage and fails the losslessness assert (flag-OFF bit-exact, 5
acceptance profiles, independent hit-accounting oracle, 40 fuzz trials).
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.
PR: Correction-token hedged wait-window drafting (
M25_CORRHEDGE) — lossless, +20% on the novel/EAGLE cellTarget:
leyten/shardmaster (based on182e93b, applies clean — verified locally).Branch:
mosaic/correction-hedge· Files:phase0/m25_pipe.py(+121),phase0/eagle_draft.py(+124),tests/test_corrhedge.py(new, 543 lines, CPU-only).Motivation
On novel text the EAGLE chain path runs depth-1 (the drafter needs the verified hidden state), so
the coordinator idles ~1 full ring RTT per round. Optimistically continuing the drafter's own
proposal past the frontier is void on the chain protocol — every partial accept commits a
verify-produced correction token the drafter cannot name in advance (we measured this
dead-end explicitly: full-proposal continuation 0.959 ± 0.114, pre-registered kill fired). But the
correction is the one nameable coordinate: given a rejection at depth j, the verifier's
correction lands in the drafter's rank-2..4 candidates with measured conditional mass ≈ 0.44
(rank profile measured per-depth on our ring). Hedging the wait window on those candidates
converts idle RTT into a second committed round whenever the hedge hits.
Mechanism (zero new wire ops, stages untouched)
Per novel round, while the parent verify frame is in flight:
draft_topkrecords per-step top-4 target-space candidates alongside the normal chain(rank-1 IS the chain — byte-identical drafting).
propose_ahead, committed drafter cachenever mutated) for the 5 highest-mass (rejection-depth j, rank r) branches
{(3,2),(2,2),(1,2),(1,3),(1,4)}and ships them as ordinary verify frames atstart = anchor + j, in descending-start order — stage KV is crop-to-start, solower-start writes would corrupt deeper branches' hypotheses.
after the hedge block the ring state is exactly post-parent, so a miss costs nothing but the
wasted frames (which ride the B=1 idle window).
r[n]matches a sent branch, that branch'salready-in-flight reply is the next round: two rounds' commits for ~one RTT. A RESEND
frame repairs the hit branch's rows.
v1 with a synchronous drain measured 0.73× with the same healthy hit rate — the drain
was the cost, not the hedges. (v1 raw data preserved; the fix was registered before v2 ran.)
Every commit stays verifier-greedy on a bit-identical ring prefix, so output byte-identity with
the flag OFF is structural. n-gram-matched rounds have no candidate ranking and hedge nothing
(master path). Default OFF = master bit-exact.
Measured results (pre-registered, blind-priced band)
Regime: MiniMax-M2.5 NVFP4, B=1, scattered-EU WAN 5-stage RTX 5090 ring, 274.8 ms loop RTT,
engine
182e93b, EAGLE-3 novel/reasoning cell (measured q1 = 0.566 class), K=8 depth 4,max-new 256. Receipt
mosaic-m25wan-ring2-hedge-moat-20260707.CI excludes parity). Hedge hit rate 0.2727.
correction-splices, zero corruption; ON internally deterministic 3/3 (identical hedge
trajectory).
receipt before any A/B ran (band [1.1666, 1.2647] × [0.2295, 0.3544]; blind point prediction
1.2114, off by <1%).
mosaic-m25wan-ring2-ra-record-20260707,mosaic-m25wan-ring2-ra2-20260707): hedge-ON 11.664 ± 0.360 (n=5) and 11.484 ± 0.147 (n=8),byte-identical every run (13/13), vs pristine anchor 10.87 ± 0.79; ON-vs-clean-OFF-pool
ratios 1.195 and 1.179 — three consecutive landings within ~2% of the original 1.1993.
(Both replication sessions ran slow — same-session pristine-path levels below the anchor
band — so the ON rows are quoted as replications of the ratio, not as absolute records;
a pre-registered record attempt on this cell did not clear its absolute bar, stated honestly.)
throughput (measured speedup 1.208 ± 0.055 ≈ the 5-branch point) — reply-queue slot cost eats
the marginal mass. W=5 is the right default;
M25_HEDGE_Wexists in our joint build but isNOT included in this PR (kept minimal).
Caveats we state up front
n-gram-matched rounds. Gains scale with loop RTT — on a ~105 ms tight ring the idle window is
~2.6× smaller and so is the expected win.
drafter's mass profile (measured 0.4439 coverable at K=8); this is a solid +20%, not a 2×.
pair should re-derive it (the
by_branchhistogram in the result row is there for exactly this).Verification protocol
python3 -m pytest tests/test_corrhedge.py -q— CPU-only: real drafter math on a tiny randomEAGLE head (draft_topk == chain, propose_ahead self-consistency laws, committed-cache
immutability under hostile fuzz, hybrid matched/novel contract) + a coordinator-loop mock
against a stateful crop-to-start ring that computes replies from its own mutated rows, so
any protocol bug (wrong send order, missing RESTORE/RESEND, bad start) produces hostile
garbage and fails the losslessness assert. Independent hit-accounting oracle; 40 fuzz trials.
M25_CORRHEDGEunset and=1;sha256outputs — identical.The result row's
hedgeblock reports rounds_hedged / hits / by_branch for mechanism review.License / transfer
Contributed under the repository's Apache-2.0 license, no strings attached. Claims are ours
(Mosaic Intelligence), receipt-backed (raw per-run JSONs retained, including the v1 negative);
happy to share artifacts or support a maintainer replication before merge.
Prepared 2026-07-07 by the authors (Mosaic Intelligence).