b70-optimization-lab

2026-06-23 15:04Z: MTP draft fast top-k bypass

Goal: reduce llama.cpp draft-MTP overhead without changing the promoted Q8 quality lane. This patch bypasses the generic sampler in the MTP draft loop when backend sampling is disabled and uses a direct logits top-k scan instead.

Baseline identity:

Patch artifact:

New source knobs:

The fast path is only used when backend sampling is disabled. It greedily drafts the top-1 token from the direct logits scan, computes the existing p_min gate from a top-k-local softmax, and leaves the verifier/canary discipline unchanged.

Initial 4-GPU Sweep

Stamp: 20260623T150436Z

GPU Label suffix Fast top-k Canary tok/s after TTFT Wall tok/s TTFT ms Delta vs prior
0 fasttopk2 2 384/384 91.138379 71.005378 1592.883 -0.018339
1 fasttopk4 4 384/384 90.385943 70.434578 1604.691 -0.770775
2 fasttopk10 10 384/384 91.276506 71.049234 1596.988 +0.119788
3 fasttopk20 20 384/384 90.987971 70.883177 1596.090 -0.168746

Interpretation: top_k=10 produced a tiny first-pass win, but the gain was too small for submission without a repeat. top_k=2/4/20 were losses.

Exact top_k=10 Repeat

Stamp: 20260623T150833Z

GPU Canary tok/s after TTFT Wall tok/s TTFT ms Delta vs prior
0 384/384 91.618942 71.287464 1593.881 +0.462225
1 384/384 90.479268 70.541099 1599.384 -0.677450
2 384/384 90.861494 70.728135 1603.829 -0.295224
3 384/384 91.226231 71.012737 1597.626 +0.069514

Decision: promote GPU0 repeat as the new single-B70 Q8 filled-long record. The repeat cleared the previous record by about 0.46 tok/s and passed the promotion-depth canary.

Promoted run:

Follow-Up

Do not retest plain top_k=2/4/20 in this exact identity unless another patch changes the draft-loop cost model. The useful neighborhood is now: