# Towards Green Text Generation: Memory-Based Speculative Decoding

Memory-based drafting makes speculative decoding save energy again with fast verifiers

Antal van den Bosch · arXiv · 2026-11-12

- **Problem** Speculative decoding saves time and energy only when drafting is cheap. With a KV cache on the verifier, neural draft models lose their edge because each draft token needs its own sequential forward pass.
- **Method** Olifant is a draft model that predicts the next token from a four-token window using a memory-based classifier. Instead of running a neural network, it looks up a stored trie built with TiMBL's IGTree algorithm.
- **Results** With a KV cache, Olifant's legal-text draft reaches 1.25× throughput over cached plain decoding, with 93 J per 100 tokens, the lowest energy in the study.

![Table 1: Throughput and speedup (local Mistral-7B verifier, no KV cache), 100 prompts per task. Speedup relative to plain. olifant-fw = olifant-fineweb; olifan…](https://refivu.com/papers/d0d9e634-398d-4df3-9710-8a24455c2ce9/figures/figure-6e27a25603e1dae28fd28c0f906281a7.png?thumb=512)

**Table 1** : Throughput and speedup (local Mistral-7B verifier, no KV cache), 100 prompts per task. Speedup relative to plain. olifant-fw = olifant-fineweb; olifant- wiki = olifant-wikitext; olifant-pub = olifant-pubmed; olifant-eur = olifant-eurlex. Bold: best per task.

[Original paper](https://arxiv.org/abs/2611.16714v1) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Antal van den Bosch · Towards Green Text Generation: Memory-Based Speculative Decoding · Original paper figure · Extracted the figure area from page 5 of the original PDF.

## Why drafting cost matters once verifiers get faster

Generation with a large language model moves one token at a time, so each token waits for the one before it. Speculative decoding attacks this wait by letting a cheap draft model propose several tokens ahead. A high acceptance rate therefore yields many tokens per verifier call, and that is where the wall-clock speedup comes from.

Speed is only part of the picture, because every verifier pass also draws power. For on-device generation, the energy of each pass sets the footprint, not just its latency. Medical and legal applications often can't send text to a cloud API for confidentiality reasons. The authors say these are the domains where they measured the largest efficiency gains.

They evaluate each draft model on both throughput and energy per generated token, under two verifier regimes.

The cost of a verifier pass depends on whether a KV cache is kept. A KV cache stores the attention keys and values of tokens already processed, so each new token only needs attention for itself. Without a cache, the verifier re-encodes the full sequence on every pass, so extra draft tokens are nearly free. With a cache, each draft position carries real cost, and the cache is paid for in accelerator memory.

The two regimes give opposite answers to how long a draft should be. They also disagree on which draft models are viable at all. Memory-based drafting, at about 0.2 ms per token from CPU RAM, stays profitable in both regimes.

## How Olifant turns a trie into a draft

Olifant answers a draft request by looking up a stored answer rather than running a network. TiMBL's IGTree algorithm compresses a set of (context window, next token) instances into a trie. The trie's levels follow information gain, so the most predictive context position sits at the top.

At query time, the decoder walks a single path from the root, matching the context tokens level by level in that fixed order. The less informative positions are ignored in that lookup.

Training prunes the trie, so nodes whose majority label agrees with their parent are not stored. This pruning typically shrinks the trie by about 95% and leaves lookups of stored contexts unchanged. Olifant models read the last w context tokens, with w=4, from the Mistral SentencePiece tokeniser. The instance bases occupy 145 MB for eurlex and 4.6 GB for fineweb of CPU RAM.

A standalone prediction takes 0.16 to 0.25 ms for the Olifant variants, against 0.09 ms for the 4-gram lookup. TinyLlama-1.1B needs 254 ms per token on CPU, so it is far slower per prediction. Unlike the in-session 4-gram model, which counts over the running session, Olifant is trained offline and stays fixed at inference time.

## One speculative step under each verifier regime

Each step begins when Olifant receives the last four context tokens, since its windows have width w=4. Mistral-7B-v0.1 runs in float16 on the M1 Max GPU through MPS, and it reads the context plus k draft tokens in one pass. The logits at positions ctx−1 to ctx+k−1 are compared greedily with the draft tokens, and the longest agreeing prefix is accepted.

Without a cache, that single pass yields k+1 token predictions, and no state carries over between steps.

With the cache, Mistral prefills the context once and keeps its KV cache alive across steps. After a rejection, the cache shrinks back to the accepted prefix, so the next step starts from valid states. The first draft token is checked against the previous step's logits, which were already computed. The k-token verification pass is therefore paid only when that first draft token is accepted.

Acceptance compares exact token IDs, so in exact arithmetic the cached decoder matches plain greedy decoding by construction.

A rejection fast path keeps a failed step no more costly than a plain step. Under float16 on MPS, shape-dependent kernel differences occasionally make the outputs diverge. A k-token pass gains only when the first token is accepted, and the threshold sits near 20–25% first-token acceptance. Domain-unmatched strategies land at break-even, 0.9–1.1×, because their 5–20% acceptance is too low.

Olifant-eurlex keeps a margin on legal text, reaching 1.25× at k=3 and 1.26× at k=5 (20.6 tps). Its 38.1% acceptance on legal text is the same in both regimes, so the draft model's behaviour doesn't depend on the regime.

## Speedups when every draft is nearly free

Without a KV cache, almost every draft strategy beats plain decoding on every task at every k, with one exception. The exception is olifant-pubmed on general text at k=3, which reaches 0.96×. The domain-matched olifant-eurlex reaches 2.06× at k=3 with 38.1% acceptance, and 2.43× at k=8 with 19.9% acceptance. The 4-gram baseline benefits most from this regime, reaching 1.42× on general text at k=8.

Speedup for olifant-eurlex rises with draft length, from 2.06× at k=3 to 2.28× at k=5 and 2.43× at k=8. Acceptance falls from 38.1% to 19.9% over the same range, so the draft gets less accurate as it gets longer. Mean accepted length still grows from 1.13 to 1.53 tokens per step, and throughput rises from 4.73 to 5.55 tps.

The neural draft moves the other way, from 1.15–1.20× at k=3 down to 1.01–1.07× at k=8. Each TinyLlama draft token needs its own sequential forward pass on the accelerator, so drafting isn't free. The gain from larger k is bounded, though. Extending the sweep to k in {12, 16, 24} for olifant-eurlex shows throughput peaking at k=8 and settling near 2.2× beyond.

Mean accepted length keeps growing, from 1.53 to 1.62 tokens per step, but the extra draft tokens weigh more against the ∼150-token context. That makes k=8 the practical optimum in this regime.

Greedy verification keeps output quality unchanged, because each accepted draft token is the verifier's own greedy choice. The authors trace the residual gap from 1.0 to floating-point nondeterminism on MPS, which affects all strategies equally. So the uncached speed and energy gains cost nothing in output quality.

## Speedups when each draft position costs something

Once the verifier keeps a KV cache, the plain baseline itself gets much faster. Plain decoding rises from 2.3–2.8 tps to 16.3–16.9 tps with the cache. The 18% gap between legal and general text shrinks to 3% once caching is on. Against that faster baseline, every speculative gain is smaller, and the gains fall as k grows.

The domain-matched olifant-eurlex still beats cached plain decoding on legal text. It reaches 1.25× at k=3 and 1.26× at k=5, running at 20.6 tps at k=5. Its legal acceptance stays at 38.1% in both regimes, so the draft behaves the same whatever the verifier does.

Domain-unmatched strategies sit at break-even, between 0.9× and 1.1×. Their 5–20% acceptance is too low to produce a positive margin. The rejection fast-path protects them from losses at k=3. TinyLlama drops from a 1.15–1.20× gain uncached to 0.29–0.47× of cached plain decoding. Each speculative step spends more time drafting k tokens one at a time than the cached verifier spends checking them.

Table 2 gives the full cached sweep, and Figure 1 (right) plots the legal curves on the uncached axis. With a cache, each draft position carries real verification cost, so drafting cost becomes the deciding factor.

## Energy per token and the time-energy split

Energy per token is computed from whole-system power sampled at 1 Hz with macOS powermetrics. The authors divide the mean power over the generation window by tokens generated and scale to 100 tokens. Mean system power stays between 16 and 31 W across the 63 uncached configurations, with a median near 28 W. The neural draft is the exception: its energy ratios of 1.19 to 1.40 run ahead of its speedups of 1.01 to 1.20.

With a KV cache, plain decoding costs 96 to 106 J per 100 tokens, about one tenth of the uncached cost. Power now depends on the draft: mean draw rises from 16.4 W for plain decoding to 22.1 W for olifant-eurlex at k=8. Dense k-token verification passes load the accelerator harder than one-token steps, so time and energy decouple. At k=8, olifant-eurlex on legal text is 1.16× faster than plain decoding yet spends 1.18× more energy.

At k=3 the same draft is 1.25× faster and 1.09× more energy-efficient, at 93 J per 100 tokens, the lowest in the study. The energy-optimal draft length is therefore shorter than the speed-optimal one.

![Table 4: Cached-regime energy (J/100 tokens; lower is better) and energy ratio vs. cached plain at the same k, derived from the timestamped throughput sweep jo…](https://refivu.com/papers/d0d9e634-398d-4df3-9710-8a24455c2ce9/figures/figure-2fba4b5753e5cda9ebdc14a98ae722e1.png?thumb=512)

**Table 4** : Cached-regime energy (J/100 tokens; lower is better) and energy ratio vs. cached plain at the same k, derived from the timestamped throughput sweep joined with the 1 Hz power log; 100 prompts per cell. Only high-acceptance domain-matched drafting (olifant- eurlex on legal, k≤5 ) saves energy; ratios below 1.00 indicate an energy cost despite any speed gain. Bold: best per task.

[Original paper](https://arxiv.org/abs/2611.16714v1) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)

TinyLlama reverses its uncached position in the cached regime, moving from a 1.2 to 1.4× energy saver to a 2.5 to 3.8× energy cost. Its cached cost lands at 243 to 382 J per 100 tokens, and the deficit deepens as k grows. The authors attribute this to two effects at once: doubled wall time and a second neural network occupying the accelerator.

Figure 2 ranks the strategies by tokens per Joule, and cached olifant-eurlex at k=3 reaches 1.07 tok/J at the top.

## Break-even acceptance in each regime

The standard break-even condition sets the acceptance a draft needs before a speculative step pays off. It takes the form acc\_rate break-even ≈ k/(k+1), assuming that verifying k draft tokens costs as much as generating them one by one. That gives 75% at k=3 and 89% at k=8, so drafts need nearly every token accepted. The required acceptance rises with draft length, which makes long drafts harder to justify under this model.

Without KV caching, the marginal cost of extra draft positions is small, because full-context attention dominates each forward pass. The break-even threshold therefore nearly vanishes, and any non-zero acceptance yields a speedup. Every uncached energy ratio exceeds 1.0, and this regime suits deployments that re-invoke the verifier on the full sequence.

Larger k stays better up to a plateau, and the regime forgives low-acceptance drafts.

With KV caching, Equation 1 predicts that none of the draft models survive, since no strategy approaches 75% acceptance. The rejection fast-path heuristic softens this prediction, because failed steps cost no more than plain steps. A k-token verification pass can only add gains from extra accepted tokens on steps where the first token is accepted.

Empirically, the threshold sits near 20 to 25% first-token acceptance, and below it strategies flatline at break-even in Table 2. Only olifant-eurlex on legal text reaches 38%, and that is where a genuine margin appears.

The authors state this holds at any acceptance rate, so raising acceptance wouldn't rescue the TinyLlama draft. Memory-based drafting, by contrast, stays profitable in both regimes because its drafting cost is negligible.

## Energy to build the drafts

Compiling the largest Olifant instance base, fineweb with 1.089 billion tokens, took about six hours on the evaluation machine. Summed over those six hours, the compilation comes to roughly half a megajoule. Olifant's training is a single CPU pass, so the authors count no backpropagation and no accelerator time. The smaller corpora cost less to compile.

Because the savings per generation are large, the build cost is small next to the inference energy it removes.

Pretrained models spread that cost across many downstream uses, so the comparison is less lopsided per user. The authors still argue that a memory-based draft's lifecycle energy is dominated by inference, not training.

## Olifant against the in-session 4-gram and retrieval drafts

The in-session 4-gram baseline builds its frequency table from the running context, including tokens the verifier has just produced. Olifant does the opposite: it learns offline from a corpus and stays frozen during inference. On matched legal text, Olifant reaches 38.1% acceptance against 24.7% for the 4-gram. At k=8, Olifant reaches a 2.43× speedup, while the 4-gram reaches 1.20×.

On unmatched domains, the 4-gram's online adaptation closes most of the gap.

Olifant works on Mistral's SentencePiece tokens, the same units the verifier uses. Its drafts therefore slot into the verification step without any representation mismatch. The 4-gram predicts whitespace-delimited words, and only the first sub-token survives the text-fallback path. That structural mismatch caps the 4-gram's acceptance, whatever its word-level accuracy.

Both are exact-match designs, so they draft nothing when the current context doesn't occur in their source. Its prefix backoff ignores the least informative window positions, so it predicts for every context at the price of one token per query.

## Method or text: which one drives acceptance

The authors ask whether the legal advantage comes from Olifant or from the legal text itself. They measured redundancy in the evaluation texts, since decoding is output-preserving and every draft model sees the same text. Table 5 reports three measures over each task's 100 generations, computed on Mistral tokens. The within-text repetition rate counts how many of a text's token 4-grams already appeared earlier in that same text.

The gzip ratio serves as a model-free summary, where lower values mean more redundancy.

Within documents, legal text is the least repetitive of the three tasks, at 12.1%. Medical text reaches 21.2% and general text 29.6%, so within-generation repetition can't explain the acceptance ordering. Across documents, however, 73.6% of legal 4-grams recur in other legal texts. Medical and general text reach only 14.9% and 26.7% on the same measure.

![Table 5: Redundancy of the evaluation texts (100 gen- erations per task, Mistral tokens). Within-text: mean fraction of a text’s token 4-grams already seen ear…](https://refivu.com/papers/d0d9e634-398d-4df3-9710-8a24455c2ce9/figures/figure-056f1038d7ce791e6c07407fc8eced35.png?thumb=512)

**Table 5** : Redundancy of the evaluation texts (100 gen- erations per task, Mistral tokens). Within-text: mean fraction of a text’s token 4-grams already seen earlier in the same text. Cross-doc.: mean fraction of a text’s dis- tinct 4-grams that also occur in another text of the same task. gzip: compression ratio of the task’s concatenated text (lower = more redundant).

[Original paper](https://arxiv.org/abs/2611.16714v1) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)

To isolate the method, the authors compare draft models on identical legal texts at k=3. Acceptance spans from 7.5% for olifant-pubmed to 38.1% for olifant-eurlex. The 4-gram baseline accepts 24.7% and the neural draft 21.1% on the same texts. Since the text stays fixed and only the draft model changes, the gap comes from the draft model.

Task differences and draft-model differences are therefore both real and separable.

## Which constraints bound these results

The whole study runs on one Mac Studio with an Apple M1 Max and 32 GB RAM, so every number comes from a single platform. The verifier is also a single model, Mistral-7B-v0.1, run on MPS in float16. A server-class GPU would lower per-token verifier latency further, but it would bring a higher energy footprint. Faster verification would raise the relative cost of drafting, so the cached-regime compression would likely sharpen.

The authors didn't test other verifier sizes or families, so the cost-model analysis remains untested beyond Mistral-7B.

Energy figures are whole-system readings, taken with background load kept low during measurement. Repeat measurements of the plain configuration agreed within 2% in both regimes. These readings support relative comparisons on identical hardware, and they don't support absolute claims across platforms. The uncached energy grid spans 63 configurations, with 30 prompts per cell.

Every measurement uses greedy verification at batch size one. Temperature sampling and batched serving remain untested, and the reported margins may shift under either one. Batched serving would change the drafting budget again, which the authors leave to future work.

The session-adaptive hybrid, which pairs a trained instance base with a recency component, is left for future work. Eurlex is the smallest corpus at 94M tokens, yet it produced the best draft model, so the scaling axis remains unexplored.

## Paper info

- **Authors**: Antal van den Bosch
- **Venue**: arXiv · Preprint
- **First published**: 2026-11-12
- **Added**: 2026-11-13
- **Updated**: 2026-11-12
- **Version**: v1
- **arXiv**: 2611.16714
- **Category**: cs.CL
- **Original paper terms**: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)
- **What we show**: Paper info, commentary and permitted figures from the original paper

[Original paper ↗](https://arxiv.org/abs/2611.16714v1) · [PDF ↗](https://arxiv.org/pdf/2611.16714v1)

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

## Abstract

Speculative decoding accelerates text generation with large language models by letting a cheap draft model propose tokens that a large verifier checks in a single forward pass. We introduce Olifant, a draft model built on a memory-based classifier. It predicts the next token from a four-token window in under 0.3 ms on CPU, requiring no GPU, no backpropagation, and no accelerator memory. We measure throughput and energy under two verifier regimes on consumer hardware. Without a KV cache, drafting is nearly free: a domain-matched Olifant model reaches 38.1% acceptance on EU legal text, delivering 2.43x throughput and 2.51x lower energy per token than the neural verifier model alone. With a KV-cached verifier, itself a ~10x energy saver, drafting costs matter: a TinyLlama draft model halves throughput and triples energy despite high acceptance, whereas Olifant still yields 1.25x throughput and the lowest energy in the study (93 J per 100 tokens, 14x below the uncached baseline). We further show that KV caching decouples time from energy: verification of longer drafts raises power draw, shifting the energy-optimal draft length below the speed-optimal one. Speculative decoding is not dead in the age of fast verifiers, provided drafting is nearly free.

## Quote from the paper

Antal van den Bosch (2026). Towards Green Text Generation: Memory-Based Speculative Decoding. arXiv:2611.16714v1. https://arxiv.org/abs/2611.16714v1

**BibTeX**

```
@misc{bosch2026towards,
  title = {{Towards Green Text Generation: Memory-Based Speculative Decoding}},
  author = {Antal van den Bosch},
  year = {2026},
  eprint = {2611.16714},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.16714v1}
}
```

## Other paper commentary

- [The Noise Floor of a Quantization Comparison: Engine, restart, batch and kernel drift, measured against 8-bit and 4-bit effects in two decision models](https://refivu.com/en/papers/90daa962-d240-4d1b-8049-acc2b3e6195c-the-noise-floor-of-a-quantization-comparison-engine.md)
- [Neural Compression for Scientific Particle Data: Perspectives on How Learning Can Help](https://refivu.com/en/papers/54659143-795e-405b-ba95-cbdbdf75eee4-neural-compression-for-scientific-particle-data-perspectives.md)
- [Robust and Communication-Efficient Federated Learning from Non-IID Data](https://refivu.com/en/papers/8cfbbb74-26ed-46b1-9bcb-908c177043d6-robust-and-communication-efficient-federated-learning-from.md)
- [Relational Knowledge Distillation](https://refivu.com/en/papers/bc94c76c-131e-4c9c-80c8-1c9bc90a7da4-relational-knowledge-distillation.md)
- [ThiNet: A Filter Level Pruning Method for Deep Neural Network Compression](https://refivu.com/en/papers/13501147-4289-4a98-981e-919e37e87fc7-thinet-a-filter-level-pruning-method-for-deep.md)
- [EAST: An Efficient and Accurate Scene Text Detector](https://refivu.com/en/papers/c3f94c0a-3560-4b29-930f-6e881b662882-east-an-efficient-and-accurate-scene-text-detector.md)
- [Mind the Accuracy-Approval Gap: How Users Evaluate Sycophantic AI in Everyday Tasks](https://refivu.com/en/papers/d62f0b2a-4b25-4637-8d3b-cd531c6a07d1-mind-the-accuracy-approval-gap-how-users-evaluate.md)
- [Pretraining Data Statistics Shape the Phases of Learning Entity Comparison in Language Models](https://refivu.com/en/papers/d3386662-50ed-4e67-b429-1af214567cba-pretraining-data-statistics-shape-the-phases-of-learning.md)
- [Shortcuts or Memorisation? Revisiting Data Corruption in Natural Language Understanding with Large Language Models](https://refivu.com/en/papers/47df16a6-990c-4da2-8525-44fedd241d7b-shortcuts-or-memorisation-revisiting-data-corruption-in.md)
- [Detection Is Not Early Warning: Evaluating Token-Level Alarms on Language Model Failures](https://refivu.com/en/papers/a122ecba-1df3-4dbc-8d8e-5a9f7551225f-detection-is-not-early-warning-evaluating-token-level.md)
- [Fog-FWL: A Large-Scale Full-Waveform LiDAR Dataset for Recovering Fog-Hidden Objects](https://refivu.com/en/papers/a693efcf-4c23-4056-b199-4d5ec95df3c3-fog-fwl-a-large-scale-full-waveform-lidar.md)
- [Sprint3D: Accelerating End-to-End 3D Asset Generation through Pipeline Optimization](https://refivu.com/en/papers/4658f8c6-5af1-4a7b-a864-964272e880f1-sprint3d-accelerating-end-to-end-3d-asset-generation.md)

## Terms in this paper

- [KV cache](https://refivu.com/en/terms/cbf2f6d2bcc1-kv-cache)
- [ROUGE-L](https://refivu.com/en/terms/b00e147f8ed4-rouge-l)
- [speculative decoding](https://refivu.com/en/terms/2496d9bbec40-speculative-decoding)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/d0d9e634-398d-4df3-9710-8a24455c2ce9-towards-green-text-generation-memory-based-speculative)
