Module ladder

Module ladder 

Source
Expand description

K-vs-batch ladder (task #35): per-step draft count as a function of the number of active sequences.

Fixed K=4 (3 drafts) over n >= 8 sequences MEASURED as a collapse to a ~55 tok/s plateau at every C (cap=16 sweep, 2026-07-28): n*(K+1) verify rows of SUPERLINEAR per-sequence GDN plus graph-key churn. The ladder shrinks the per-sequence draft count as concurrency grows so the verify row total stays small while the weight-read amortization of the batched verify keeps growing with n: n <= 4 -> 3 drafts (4 rows/seq, today’s proven regime, bit-for-bit), n <= 8 -> 3 drafts (4 rows/seq, R = 32), n <= 16 -> 1 draft (2 rows/seq, R = 32 at n=16 — single chunk; wave 19, taken back from 16:2 when the measured p1 fell below the rung’s break-even — see the default-ladder comment), n <= 32 -> 1 draft (2 rows/seq, R = 64 at n=32).

★ This module is the STATIC ladder and the floor. Since wave 28 the n=16 rung is chosen at RUNTIME from the observed accept statistics by spark_server::scheduler::adaptive_rung — a static value cannot be right for both traffic regimes, because the second-token conditional accept is bimodal (~0.54 prose / 0.877 tool-shaped) and moves the break-even across the rung. ATLAS_MTP_STATIC_RUNG (PRESENCE) pins the static value here; so does an explicit ATLAS_MTP_K_LADDER.

★ The depth step-down that used to sit at n>4 was an artifact of the mtp_step chunk cap, NOT of GDN depth cost: rows=4 was capped at 4 sequences, so an 8-wide batch ran TWO serialized 4-wide verify forwards (2x the weight reads per step). Every “8:3 collapses” measurement (57.9 on 2026-07-28, and 62.6 when re-measured this session) recorded that chunking, not depth-3 at width 8. Raising the cap to the row-buffer bound makes the true 8-wide K=4 step the BEST measured point at C=8. ★ The n=16 rung took three rounds to earn its place, and its history is the record of a COST curve, not of a depth curve. It measured a loss (16:1 -> 128.4 vs a 131.9 MTP-off control) after the three eager-cost fixes (b93982d9 k-parameterized cross-seq GDN conv/WY, a83627a2 propose widened to n=16, fa373bf4 batched Phase-A bootstrap), then exact PARITY (131.93 vs 131.42) after the accept lift (36d340a0 per-sequence drafter prefill lifted p1 at n=16 to 0.797, making break-even 1.797x against a measured ~1.79x). 296b9674’s three per-row verify cuts took the implied cost to ~1.55x, and the SAME 16:1 shape then measured 152.01 tok/s over two serves against a same-session MTP-off control of 131.40 (+15.7%), p1 0.78-0.86, tok_step ~1.83. ★ The historical “depth at n=16 is dead” numbers (16:2 -> 94.1, 16:3 -> 120.76) recorded the CHUNK CAP, not depth — the same artifact class as the 8:3 story below (rows=3/4 chunks were hardcoded to 8 seqs, so a 16-wide depth batch ran TWO serialized 8-wide verifies). With the cap derived from the row budget (fixer r2 2026-07-30), TRUE single-chunk 16:2 measures 194-196 tok/s at C=16 vs a 184-185 same-session 16:1 control (+6%) with D-Cut OFF (tok_step 2.44-2.50, p1 0.81-0.85) — but 176-179 (-4%) with D-Cut pruning AT DEPTH (ragged pruning at nd=2 fragments the GDN runs and sheds winning drafts). The wave-11 implementer grid re-measured the full depth set at n=16 on one binary: 16:2 = 195.0/187.6 > 16:3 = 190.9/187.9 > 16:1 = 184.5/184.1 (K=4’s extra 16 rows cost more than the +0.46 tok/step they buy; p3_cond unstable 0.51-0.75). 16:2 is therefore the DEFAULT rung, paired with the D-Cut-at-depth policy that makes it safe: mtp_dcut::dcut_width_cap holds pruning to batches of <= 8 sequences, so the n=16 verify runs the exact uniform single-chunk [3; 16] shape that measured the win, while the C=8 D-Cut win (+2.6%) is untouched.

At n<=8, measured C=8 on binary 9bef3b49 (this ladder + the raised chunk cap), one fresh serve per config: 8:3 95.84 (range 94.9-96.6, 8 reps) > 8:2 93.30 (92.5-94.0) — disjoint, reproduced on a second serve at 95.68. Accept telemetry at n=8: p1 0.793, tok_step 2.606 (vs 0.780 / 2.301 at 8:2).

Overrides:

  • ATLAS_MTP_K_LADDER="4:3,8:2,16:1" — comma-separated n_max:drafts steps, VALUE-parsed once per process. Draft counts clamp to [1, num_drafts] (the CLI --num-drafts remains the ceiling, so "4:4,..." parses to the full configured draft count).
  • ATLAS_NO_MTP_K_LADDER — PRESENCE check (house convention, =0 is NOT off): disables the ladder entirely (fixed num_drafts at every n) AND drops the super::mtp_max_seqs default back to 4, restoring the pre-ladder adaptive policy (batched K=4 MTP at C<=4, MTP-off above).

Functions§

mtp_ladder_disabled
PRESENCE check for ATLAS_NO_MTP_K_LADDER. Read once per process.
mtp_ladder_drafts
The per-step draft count for n_active concurrent sequences.
mtp_max_seqs
SSOT for the multi-sequence MTP cap (ATLAS_MTP_MAX_SEQS; default 32 with the K-vs-batch ladder, 4 under ATLAS_NO_MTP_K_LADDER). Value-parsed, not presence-checked. Lives beside the ladder (moved from speculative.rs, originally scheduler/mod.rs) because the two are one policy: the model-side single-sequence MTP structures (catchup ring, refeed labels, carry slot) gate on the same value the scheduler gates dispatch on.