Speculative decoding accepts 12 tokens a step on code and 3 on chat: what changes locally

Marcus

Professional Premium
Professional Premium
Download
Every write-up of speculative decoding opens with a speedup factor, usually between 2 and 4. That number is downstream of something less quotable: how many tokens the target model accepts per verification pass. Acceptance length belongs to the text being generated, not to your card, your driver, or your quant.

A smaller model drafts k tokens, the target scores all of them in one batched forward pass, and the longest prefix matching the target's own greedy choice gets kept. The speedup is accepted tokens per step divided by the cost of producing the draft. A drafter that lands 8 accepted tokens per pass pays for itself several times over. One that lands 2 mostly burns compute, and you end up slower than plain decoding with the same weights loaded.

Then comes the part nobody reads before buying a drafter. llama.cpp checks the two tokenizers at load, and refuses the pair when they disagree. In examples/speculative/speculative.cpp the checks are explicit: vocab type, BOS token, and a vocabulary size difference above SPEC_VOCAB_MAX_SIZE_DIFFERENCE, which is 128, aborting with "draft model vocab must closely match target model to use speculation". Your drafter is a sibling of the target: same tokenizer family, usually same vendor. That is why people try speculative decoding once, find nothing they are allowed to pair, and stop.

A paper submitted on December 3 argues the constraint is an artifact of how drafters are built. Spancast (Su and Huang, Fudan and Shanghai Innovation Institute) is a 98.6M parameter drafter that replaces Transformer blocks with a Grouped State Channel for recurrence across tokens and a Null-Key Attention with a zero-value key, so a head can skip the prefix when the next token has no match in it. Verification trees come from Masked Parallel Tree Decoding, which builds them in constant depth: three passes whether the span is four tokens or sixteen.

The measured claim, and this is the number worth arguing with: 12.31 accepted tokens per step on CanItEdit, 10.17 on HumanEval+, 8.46 on ClassEval, all with Qwen3-8B as the target. EAGLE-3 at 400M parameters, four times the size, gets 2.74 on HumanEval+ and on CanItEdit. Across 17 target models in 15 families, one drafter, mean acceptance between 6.20 and 10.31 tokens per step, and inter-token latency down six to seven times on Qwen3-8B.

The abstract leaves out where it loses. On MT-Bench the same drafter accepts 3.01 tokens per step against 3.63 for EAGLE-2. On general QA, 3.54 against 4.03. The 17-model mean is 7.80, but split by domain it is 10.14 on coding core and 4.20 on general QA. Drafters tied to the target read its hidden states; Spancast reads plain text only, and on high-entropy prose there is less to copy. So the honest reading is narrow: code continuation wins by a wide margin, chat still goes to a coupled pair.

What makes it relevant outside the paper is the vocabulary decision. Spancast keeps its own BPE vocabulary and talks to the target through plain text, which is exactly the coupling llama.cpp rejects. That is a design answer to a systems problem, and systems problems get solved by ports, not by citations. Nothing here runs in your stack yet: the tree decoding lives in the verifier path, not in a weight file.

What you can do today is measure before you quote. If your target has a smaller sibling with an identical tokenizer, load the pair and read the acceptance, not the tok/s:

Code:
llama-server --model target.gguf --model-draft draft.gguf --draft-max 8 -ngl 99

If the vocabulary does not match, the process exits on the check above and tells you the difference in tokens. On this machine, Ollama 0.40.19 lists no draft-model flag in ollama run --help, so speculation here means llama.cpp directly.

There is a second reason to care about decode speed. On the 4090, generation held at roughly 131 tok/s from a 4k window to a 64k one, and filling 24k tokens of context took 1.2 seconds. The window is not where the time goes, which leaves decoding as the only thing left to attack, as the numbers in the context thread show. Same instinct as scanning a GGUF before loading it: find out what the input actually is before trusting what comes out of it.

What I did not test: I did not run Spancast. The code is public, but the drafter in those tables is trained on their corpus, no checkpoint appears in the paper, and training it is not an afternoon on one card. I also did not run llama.cpp with --model-draft here, so I have no acceptance number of my own to put beside theirs. Every figure above is the paper's, and the vocabulary check is read from the source, not from a run.

If you already have a draft pair loaded, what acceptance length does it report on your prompts, and does it survive the moment the output stops being code and starts being prose? The log line is enough.
 
Back
Top