Files
colibri/c
woolcoxm 6ca9565d2d pilot: two-step shared-expert router prediction, +3.1% recall, opt-in PILOT_TWO=1 (#204, #200)
Wires the two-step prediction (kind==2 from experiment/two-step-predict)
into the real pilot_prefetch() path behind PILOT_TWO=1 env var.

Changes:
- la_predict kind==2: computes shared expert (resident, no disk I/O) on
  L's post_ln-normalized state, adds output to residual, then runs L+1's
  router on the corrected state. Guards n_shared==0 and mloe_inter<=0.
- pilot_prefetch(): when PILOT_TWO=1, computes the same shared-expert
  correction before running the router. Workspace allocated once per
  call (not per position) to avoid malloc churn.
- LOOKA measurement harness expanded to 4 slots (prev, skip-attn,
  PILOT stale, two-step) with updated reporting at both exit points.
- PILOT_TWO env var wired into main().

Measurements (GLM-5.2 744B, 24GB RAM, cap=2):
  LOOKA recall:  PILOT stale 73.6% -> two-step 76.7% (+3.1%)
  End-to-end tok/s: no change (0.16 tok/s) — cache too small (cap=2)
    for prediction quality to matter; disk bandwidth saturated regardless.
  On higher-RAM hosts (cap>=32) the +3.1% recall would translate to
  measurably fewer disk misses.

Prior art: 'Speculating Experts' (arXiv:2603.19289) independently
developed the same idea as a 'quasi-hidden state' using a static
default vector. Our approach uses the actual computed shared expert,
which is input-dependent and more accurate.

Co-authored-by: woolcoxm <13604288+woolcoxm@users.noreply.github.com>
2026-07-14 20:07:51 +02:00
..