No Neural Draft Needed: A 0.2 ms CPU Trie Lookup Keeps Speculative Decoding Profitable

Towards Green Text Generation: Memory-Based Speculative Decoding

Antal van den Bosch

cs.CL

2026-11-12

Olifant replaces the neural draft with a 0.2 ms CPU trie lookup: no GPU, no backprop, profitable with and without KV cache, 2.43x throughput and 2.51x energy saving on legal text.

What problem this solves

Speculative decoding has a simple ledger: a cheap draft model proposes the next k tokens, the large model verifies all of them in one forward pass and accepts the longest matching prefix. Whether it pays depends on how cheap drafting is. The verifier side keeps getting faster, and KV caching, batching, and quantization all shrink the drafting budget. A neural draft that recovers its cost against a slow verifier becomes a net loss against a fast one.

The paper adds a second axis that most throughput-focused work skips: energy. Medical and legal deployments often cannot call cloud APIs, so generation stays on device and every forward pass costs joules as well as milliseconds. Measured together, the two axes behave differently before and after KV caching, which is where the interesting findings live.

Method

Olifant does not train a neural network. It uses TiMBL's IGTree algorithm to compress a corpus into a prefix trie. Sliding a width-4 window over the tokenized text yields (four context tokens → next token) instances; trie levels are ordered by information gain, with the most predictive context position at the top. A query walks one path from the root and returns the majority next token stored at the deepest matching node, so unseen contexts still get an answer by falling back to the deepest matching prefix. Pruning nodes whose majority label agrees with their parent shrinks the trie by roughly 95%.

Four models cover four corpora: WikiText-103 (130M tokens), PubMed (536M), EurLex (94M), and one FineWeb-edu shard (1.089B, the domain-unmatched control). Instance bases take 145 MB to 4.6 GB of CPU RAM. A prediction costs 0.16 to 0.25 ms, three orders of magnitude below TinyLlama's 254 ms per token on CPU, with no GPU and no backpropagation.

Everything runs on a Mac Studio (M1 Max) with Mistral-7B as the verifier, under two regimes: without a KV cache, where full-context attention dominates and appended draft tokens are nearly free; and with a KV cache, where every draft position carries real cost. A rejection fast-path verifies the first draft token against the previous step's already-computed logits, so a failed step pays nothing extra.

Results

RegimeStrategyMetricResult
No cache, legalolifant-eurlex k=8Throughput2.43x (2.29 → 5.55 tps)
No cache, legalolifant-eurlex k=8Energy2.51x saving (529 vs 1326 J/100 tok)
Cached, legalolifant-eurlex k=3Throughput1.25x (20.5 vs 16.3 tps)
Cached, legalolifant-eurlex k=3Energy93 J/100 tok, lowest in the study
CachedTinyLlama draftThroughput0.29–0.47x, a net slowdown
CachedTinyLlama draftEnergy243–382 J, a 2.5–3.8x cost

Without a KV cache almost every strategy genuinely speeds up, and larger k is better: olifant-eurlex's acceptance falls from 38.1% at k=3 to 19.9% at k=8 while throughput rises from 2.06x to 2.43x, settling near 2.2x beyond k=12. The neural draft is the only strategy whose speedup falls with k. With a KV cache the rules invert: plain decoding itself gets 6–7x faster at one tenth the energy, speculative gains shrink and decline with k, and domain-unmatched strategies fall back into a 0.9–1.1x break-even band. The paper estimates roughly 20–25% first-token acceptance is needed to profit here; olifant-eurlex's 38% is the only one above the line.

One counterintuitive finding: caching decouples time from energy. Verifying longer drafts raises power draw (16.4 W for plain, 22.1 W for olifant-eurlex at k=8), so the energy-optimal k=3 sits below the speed-optimal one; at k=8 the model is 1.16x faster yet burns 1.18x more energy. Output quality holds: identical mean ROUGE-L across all strategies without a cache (0.956), within 1.5 points with one, since greedy verification preserves output by construction.

Why it matters

The paper reframes "speculative decoding is dead" as a conditional: what dies as verifiers get faster is the expensive draft, not the method. TinyLlama is a 1.15–1.20x accelerator against a slow verifier and loses 2–3x in both time and energy against a fast one; the 0.2 ms lookup is the only design in the study that stays profitable in both regimes.

For practitioners the usable niche is concrete: on-device generation in high-redundancy domains such as law and medicine, pairing with any verifier that shares the tokenizer, no GPU memory contention, and swapping domains by swapping instance bases. On general text the gains are modest (1.39–1.41x uncached, 1.02–1.05x cached), and KV caching itself is the single biggest lever; no draft model comes close to what it saves.

Limitations

The authors' own list: one machine (M1 Max), one verifier (Mistral-7B), greedy verification at batch size one, with temperature sampling and batched serving untested; evaluation prompts for domain-matched models come from held-out splits of the same collections used for training, so transfer to other in-domain sources is unverified; energy figures are whole-system measurements that support only same-machine comparisons.

More concerns from the read. Part of the legal-text advantage comes from corpus formulaicity: 73.6% of a legal text's distinct 4-grams recur in other legal texts, against 14.9% for medical. The paper argues this is the mechanism memory-based drafting captures, not a confound, but low-redundancy domains should not expect these numbers. Each query yields one token, unlike retrieval methods that draft whole spans, and a head-to-head with REST or prompt-lookup is left to future work. Scaling is untouched: the smallest corpus (EurLex, 94M tokens) produced the best draft model, so whether larger instance bases help is unknown.

Terms

Source

What people are saying

Related papers

All paper explainers