Repository navigation
Description
Why this exists
Three engine changes landed in the last day that make a verify loop viable on an imported OGA pack, and one
question was left open at the end of them: what acceptance does a drafter need to be worth it? This issue
answers it with a measurement, so whoever owns the drafter (#805's protocol, pi-mtloop's lane) starts from a bar
rather than a design.
- npu forward: a batched verify pass launches the int8 lm head once per vocabulary tile, not once per row (3.4x the pass) #1348 + npu forward: the batched int8 head chunks rows by the kernel's capacity, so a 64-row verify pass is 9.9x faster #1364: the int8 LM head now takes a batch of rows in one launch per vocabulary tile, chunked by the
kernel's row capacity (a 64-row pass went 84.4 -> 8.5 ms/row). - npu forward: attention sums its scores 8-wide when the CPU has AVX2+FMA and splits heads across cores, so a long prefill is not 398 s of scalar math #1243: the host attention term in a long prefill is no longer scalar.
Measured: the loop is correct, and here is its economics
A scratch driver ran two arms on Qwen2.5-0.5B b8 (one npu-hold ticket, amdxdna ERROR 0): plain
one-token-at-a-time decode, and a verify loop that drafts with prompt lookup (model-free: copy what followed
the most recent occurrence of the last 3 tokens), runs ONE batched pass over the drafts via step_batch_all,
and accepts the matching prefix.
Correctness: 24/24 tokens identical to the one-token-at-a-time baseline on both prompts — the verify path
with the new head batching reproduces greedy decode exactly. That is the gate any drafter integration needs, and
it now holds.
Economics on those prompts: acceptance ~0 (prompt-lookup found nothing to copy that the model would also have
produced), so 24 rounds for 24 tokens: 5.5 tok/s against 6.5 baseline — 15 % slower, exactly as the arithmetic
predicts.
| acceptance per pass | effective tok/s | vs 6.5 baseline |
|---|---|---|
| ~1 (today's model-free drafter on these prompts) | 5.5 | 0.85x |
| > 1.17 (break-even) | 6.5 | 1.0x |
| 2 | 11.1 | 1.7x |
| 3 | 16.6 | 2.6x |
Break-even works out to verify-round cost / single-token cost = 181 / 154 ms ≈ 1.17 accepted tokens per
pass, measured on this pack and this box. So a drafter that averages one token per round is a regression; the
feature only pays from ~2.
What this asks of the drafter lane
- Report acceptance per pass, not just tok/s — the number above is the bar, and a row with 1.1 accepted
drafts is a slow path that looks fast in a benchmark that forgets to count. - A model-free drafter is not enough on natural prompts (measured: ~0 acceptance with prompt lookup on a
repetitive and a freeform prompt). The MTP head or a same-family small model is what clears 2. - The verify path needs no further engine work to be used:
step_batch_all()+begin_verify()/
commit_verify_rows()are the public surface, and the batch may be up to 128 rows (the head chunks them).
Not claimed: any tok/s for a real drafter on this route — that is the measurement this issue is asking for.
Refs #1341 (the head fix), #1309 (the launch-count question, closed), #805 (the drafter protocol, closed).
Activity
bong-water-water-bong commentedon Nov 8, 2026
Claiming this for the drafter lane (pi-mtploop). First answer, measured on the 27B target this lane owns; the apportionment you'd want next is queued and I will add it here.
Acceptance per pass — the number you asked for — and the bar it has to beat
Both arms are prompt 0, 64 tokens,
k = 4,--liveon a build of main, plain and draft measured in the same process (two tickets are not comparable — a loaded box inflates plain decode and flatters the loop).tau = 0tau = 0.6(the default)Acceptance is not the problem: 2.20 accepted drafts per pass clears your 1.17 by ~2×, and the greedy text is byte-identical to plain decode with 0 stream mismatches. It still loses, so 1.17 is not the bar for this loop.
Why the bar moves: this loop pays TWO base passes per round
mtp::run()(npu/mtp/draft.h) runs a verify batch and a single step per round — the step consumes the committed token so the drafter's head sees the hidden it drafts past. Measured, not inferred:passes/token 0.625attau = 0is 40 passes over 20 rounds. So a round costs2 × passand not1 × pass, which is exactly the difference between your 0.5B driver (one batched verify pass per round, break-even181/154 = 1.17) and this loop.Dividing the measured wall clock by the measured round count gives the bar directly, with no model of the passes needed:
So this loop's break-even is ~4.0-4.2 tokens per round on this target, and the measured 3.20 falls just short — which is the 0.80× above, to the digit. Your 1.17 is the same quantity for a one-pass round; both numbers say the same thing, one of them just prices the second pass.
What I am still measuring (queued,
npu-hold, not yet free)The split of the round into
step / batch / head / commit(MTP_PHASE_SPLIT=1), because the two arms above are consistent with two explanations and only that split separates them: either the second base pass is the whole gap, or the drafter's own per-draft full-vocabulary call is (it makes 4.00 logits calls per round attau = 0and 1.09 attau = 0.6, and attau = 0.6one round costs 2.02 s for barely one draft, which a pass-and-a-bit of base work does not explain). I will post the split here rather than guess.One caution for anyone reading the tool's own line
logits calls 80 over 20 iterations (4.00/iter), 871.1 ms of the whole draft phase per call: that 871 ms is the draft phase total divided by the call count, i.e. an attribution, not the cost of one call. I nearly published it as the latter.On your three asks
step_batch_all()+begin_verify()/commit_verify_rows()carry the whole loop, the greedy-exactness gate holds on the 27B too (TEXT IDENTICAL,stream 72 rows,0 mismatchon 8/8 prompts at both gates), and the loop's contracts survived ~1.4k lines of forward refactoring (last_hidden_rows_ = norm_all,last_hidden_ = fnorm,commit_verify_rows→ accepted prefix).bong-water-water-bong commentedon Nov 8, 2026
The bar correction above is now durable in docs: #1398 (
b1abc2b8).docs/npu.mdcarries the two bars side by side — 1.17 tokens/round for a one-pass loop, ~4 formtp::run()'s two-pass round, priced from measured wall clock and measured rounds — and cross-references the existing 3.2-4.1 range rather than contradicting it.Still queued and owed here: the
MTP_PHASE_SPLIT=1split of a round intostep / batch / head / commit, which will say whether the second base pass or the drafter's per-draft full-vocab call is the larger term.npu docs: the round's cost, split — base passes are 69-82 % of it, an…
bong-water-water-bong commentedon Nov 8, 2026
The split landed — and it refutes the hypothesis I left open
One
npu-holdticket, both arms in one process (MTP_PHASE_SPLIT=1, prompt 0, 64 tokens,k = 4,amdxdnaerrors 0):step / batch / head / committau = 0tau = 0.6The base passes are the round: 69 % at
tau = 0, 82 % attau = 0.6. The drafter's own head work is 17.5 % and 10.3 % — so my "or the per-draft full-vocab call" guess from the comment above is refuted, and I would rather say that than leave it standing. What a would-be optimiser has to attack is the verify batch and the second pass, which is the opposite of where the drafter-side work has been going.One new cost item that had not been priced: the deferred GDN commit is 13.7 % at
tau = 0(6.9 s of 50.7 s, ~0.35 s/round) even after engine#1022 made the replay 16× cheaper. That is a passive 14 % of a round that no acceptance change can recover.The bar is not a constant either — it is the round's cost in single-token units, and it moves with how many drafts the gate lets a round carry: 4.2 tokens/round at
tau = 0(k=4 chains), 2.5 attau = 0.6(~1.1 drafts/round, a cheaper round and a lower acceptance, landing at the same ~0.76-0.79×). Both are far above the 0.5B loop's 1.17 because two of a round's three passes belong to the loop.Docs: #1398 now carries this table and the two findings (
5e742d32).bong-water-water-bong commentedon Nov 8, 2026
Break-even vs draft width: narrower drafts are cheaper, and that is the one number a drafter should design to
Follow-up to the economics above, because the barrier was derived from a single draft width. Same driver, same
pack (Qwen2.5-0.5B b8), same box, one
npu-holdticket (ogaload-1371-ksweep, queued 240 s, held 62 s,amdxdna ERROR 0), K in {2, 4, 8, 16}, 24 rounds each, 24/24 greedy-identical to the baseline at every K(the correctness gate holds across draft widths):
What is quotable: the round cost grows with K — 178.5 ms at K=2 to 248.5 ms at K=16, +39 % — so a
2-4 row verify is the cheapest place to sit, and a drafter should be designed to verify 2-4 rows, not 16. The
cost is flat-ish to K=8 because the round is dominated by streaming the weights once, then climbs once the extra
rows cost more than the stream saves.
What is not quotable from this run: the per-K break-even column, because the box sat at
loadavg24-27 andthe baseline arms drifted between 154 and 211 ms/token — that spread (37 %) is larger than the K effect (39 % over
an 8x wider draft). The honest reading is the earlier, quieter one: break-even is ~1.1-1.3 accepted tokens per
round, and it sits at the low end for narrow drafts.
So the design guidance stands and gets sharper: verify 2-4 drafted rows per pass, and clear ~1 accepted token per
pass. A 16-row verify is the worst of both — the dearest round and the most wasted work when acceptance is low.
Not claimed: any end-to-end tok/s for a real drafter (still the ask in the issue above).
npu docs: the drafter's break-even quoted with its loop — 1.17 tokens…
bong-water-water-bong commentedon Nov 9, 2026
The OGA-pack arm, measured to the gate that stops it (owner asked for "measure it, then PR")
The two arms that can be measured are measured and in main (
docs/amd-drafters.md): a PARD draft over GGUF gives 1.012× on HRX (3.095 tokens/round, 0.524 acceptance per offered draft, median of 4 with two warm-ups discarded) and 0.508× on CPU, which is structural — a round can return at most1 + accepted ≤ 1 + draftedwhile a batched verify costs ~M token-equivalents.The OGA-pack arm is the one this issue names, and it cannot carry a drafter measurement yet. Four packs, measured on this box (kernel
7.4.0-rc1-1bit), each stopping at a different gate:npu-pack importforward-serveQwen2.5-0.5B_rai_1.9.0_npufconst: layer blocks not located(#1410's.fconstrename)Qwen2.5-0.5B_rai_1.8.0_npu_4K.fconsttiles byte-exact, 73 incompleteembedding dtype q4_1 but dequant failedLlama-3.2-1B_rai_1.8.0_npu_4Kmissing full ELF /full_i8_QKV_K2048_N3072.elfQwen3-1.7B_rai_1.8.0_npu_4Kmissing full ELF /full_i8_QKV_K2048_N4096.elfThe 0.5B blocker, diagnosed rather than reported: the container parses (dims
H=896 NL=24 NH=14 NKV=2 IM=4864 NV=151936= Qwen2.5-0.5B), and thennpu/forward/src/q4nx_forward.cpp:647hands the embedding todequant_any(), which at:181accepts exactly three chunk sizes — our 5120-byte q4_1 tile, Q4_K, Q8 — derived fromdata_size / ntiles. The OGA import writes the embedding as q4_1 in the vendor's layout, whose per-tile byte count is none of those, so the call falls through and returns non-zero. Two fixes, on two sides: the import writes a chunk our forward already reads, ordequant_anylearns the vendor layout.PR #1611 carries the probe (
tools/oga_pack_probe.sh, both gates inside onenpu-holdticket, trap on every exit path) anddocs/oga-drafter-path.mdwith the table and the diagnosis, so the next person gets a verdict line naming the gate instead of "it does not work". Gate 3's harness is already in main (tools/spec_decode_acceptance.py) and the bar is indocs/amd-drafters.md— the moment either fix lands, the OGA arm is one ticket away from a number.tools+docs: the OGA probe takes no builder paths, no /tmp scratch, an…
bong-water-water-bong commentedon Nov 9, 2026
Status, and exactly what it is blocked on (no engine work is missing on my side)
Owner asked for this issue to be pushed to a PR or to name the blocker, so: the PR is #1611, re-answered at
5584843aafter its fourth review (two items: the missing-binary refusal, and a GPU ticket no longer authorising the NPU gate). It carries the probe and the table above, so the OGA arm has a verdict line per pack instead of "it does not work".What this issue asks for and where each part stands:
docs/amd-drafters.mdcarries the bar with the loop it belongs to,tools/spec_decode_acceptance.pycomputes acceptance from a run instead of letting a tok/s number imply it. The number was also corrected against my own earlier arithmetic (see the 11-08 comment): 1.17 tokens/round is the 0.5B b8 break-even measured here, and on the 27B the bar is ~4 — a drafter at 1.0 is a regression on both.step_batch_all()+begin_verify()/commit_verify_rows()are the surface, 128 rows max.Blocked on exactly two things, neither of them in this lane:
forward-servehands the embedding todequant_any(), which accepts three chunk sizes (our 5120-byte q4_1 tile, Q4_K, Q8); the OGA import writes q4_1 in the vendor's layout, whose per-tile bytes are none of those, so the call falls through. Either the import writes a chunk the forward reads, ordequant_anylearns the vendor layout — both are importer/forward changes, and the diagnosis with line numbers is in tools+docs: the OGA-pack route's drafter arm, probed to the gate that stops it (engine#1371) #1611's thread and the doc.missing full ELFforQKV_K2048_N3072,QKV_K2048_N4096, and the 2560 family — the xclbin set does not cover those geometries yet, which is the same wall the h2560 pair hits from the other direction (npu-pack: the 1.9 packs split on the MatMulNBits K block size (32, and mixed 32/128), before the hidden-896 limit is reached #1503 carries the census and my measurements).So the honest answer to "what acceptance does a drafter need to be worth it" is known and written down, and the measurement of a real drafter on this route is one ticket away from the moment either blocker clears — not a design question any more. I am not closing this issue: the number it is named for is still unmeasured on a real drafter, and that is the last row missing.
bong-water-water-bong commentedon Nov 9, 2026
One refinement to the number in my comment above, so the next lane quotes it exactly rather than approximately: the two-pass loop's bar is not one number, it depends on the gate, and the table is in
docs/npu.md(search "Two bars, and which one this loop has to clear"):tau = 0tau = 0.6So "~4" is
tau = 0; attau = 0.6the bar is 2.5. The reason there are two bars:mtp::run()runs two base passes per round (the verify batch plus the step that consumes the committed token), which is why the 0.5B loop's181/154 = 1.17does not transfer — and the reason neither number is a win yet: the base passes are 69–82 % of the round, so a drafter is capped by them and not by its own head (17.5 % / 10.3 %).tools+docs: the OGA-pack route's drafter arm, probed to the gate that…
tools+docs: a real drafter on an OGA pack, measured: 2.96-3.4 tokens/…