Towards Green Text Generation: Memory-Based Speculative Decoding

Antal van den BoscharXiv 2026 · arXiv

TL;DR

The authors introduce Olifant, a memory-based draft model for speculative decoding that runs on a CPU in under 0.3 ms without requiring a GPU or backpropagation. Unlike traditional neural draft models, which can actually increase energy consumption and slow down generation when paired with fast, KV-cached verifiers, Olifant remains profitable in both speed and energy efficiency, particularly in domain-specific tasks like legal and medical text generation.

What Problem Does This Paper Address?

Large Language Model (LLM) text generation is notoriously slow because it is sequential—each token must be generated before the next. Speculative decoding mitigates this by using a cheap "draft" model to propose a sequence of tokens, which a larger "verifier" model then checks in a single parallel pass.

However, most research focuses on wall-clock speed, ignoring the energy cost. On edge devices or consumer hardware, the energy required to run a second neural network (the draft model) can be significant. As verifiers become faster through optimizations like KV caching, the overhead of a neural draft model often outweighs its benefits, leading to a net loss in efficiency. The authors aim to find a "nearly free" drafting method that enables "Green Text Generation."

Methods

The core innovation is Olifant, a draft model built on memory-based learning (specifically TiMBL’s IGTree algorithm).

  • Mechanism: Instead of a neural network, Olifant uses a prefix trie to store (context window $\rightarrow$ next token) instances. It predicts the next token based on a four-token window.
  • Efficiency: Because it is a retrieval-oriented tree, it requires no GPU, no backpropagation, and has a negligible memory footprint on the accelerator. It performs lookups in ~0.2 ms on a CPU.
  • Backoff Strategy: If a specific context wasn't seen during training, the IGTree uses an information-gain-ordered prefix backoff to return the most likely token from the deepest matching prefix.
  • Verification Regimes: The authors test Olifant against two verifier setups: one without a KV cache (where the verifier re-processes the whole sequence) and one with a KV cache (where the verifier only computes attention for new tokens).

Datasets

The authors pre-trained four Olifant variants to test domain-matching:

  • WikiText-103: For general-text prompts.
  • PubMed Summarization: For medical text.
  • EurLex: For legal text.
  • FineWeb-edu: A large, domain-unmatched control model (1.089 billion tokens).

Evaluation was performed using Mistral-7B-v0.1 as the verifier on an Apple M1 Max.

Key Insights and Ideas

  • The "Fast Verifier" Trap: In the age of optimized, KV-cached verifiers, neural draft models like TinyLlama (1.1B) are often too slow. They can cause a 2–3$\times$ slowdown because the time spent drafting exceeds the time saved during verification.
  • Decoupling Time and Energy: In cached regimes, longer drafts increase the power draw of the accelerator. Consequently, the draft length that is fastest (speed-optimal) is often longer than the one that is most energy-efficient (energy-optimal).
  • Domain Formulaicity: Memory-based models thrive in domains with high cross-document redundancy, like legal text. Olifant-eurlex achieved significantly higher acceptance rates (38.1%) on legal text compared to general text, as legal documents often reuse specific phrasing that a trie can easily capture.

Key Results

The study compares Olifant against a plain verifier, an $n$-gram baseline, and a neural draft model (TinyLlama).

  • Uncached Regime: Drafting is "nearly free." The domain-matched Olifant-eurlex reached 2.43$\times$ throughput and 2.51$\times$ lower energy per token than the verifier alone.
  • Cached Regime: The baseline verifier is already $\sim$10$\times$ more energy-efficient. Here, TinyLlama failed, halving throughput. However, Olifant still yielded a 1.25$\times$ speedup and achieved the lowest energy footprint in the entire study (93 J per 100 tokens).
Figure 1: Speedup over plain decoding vs. draft length k on legal text, under the two verifier regimes (shared y-axis). Without a KV cache (left), draft tokens are nearly free and speedup grows with k; with a KV cache (right), each draft position has real verification cost and every curve slopes downward: profit requires high acceptance (domain-matched olifant-eurlex), and the expensive neural draft falls far below break-even (dashed line). k ≥12 uncached points are from a preliminary +D sweep, speedups computed against the same plain baseline.
Figure 1: Speedup over plain decoding vs. draft length $k$. Note how in the KV cache regime (right), the expensive neural draft falls far below the break-even line, while Olifant remains profitable.

Limitations and Future Work

  • Hardware Specificity: All tests were conducted on a single Apple M1 Max platform. Results might vary on server-class GPUs where verification is even faster.
  • Greedy Only: The current implementation uses exact greedy matching. The authors note that extending this to temperature sampling (speculative sampling) is a necessary next step.
  • Static vs. Dynamic: Olifant is a static trained model. The authors suggest a hybrid approach that combines Olifant's domain knowledge with the $n$-gram model's ability to adapt to the current session's specific context.
  • Scaling: Interestingly, the smallest training set (EurLex) produced the best model. The relationship between instance base size and drafting quality remains an open question for future research.

Summary updated

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.
BibTeX
@misc{bosch2026towards,
  author = {Antal van den Bosch},
  title = {{Towards Green Text Generation: Memory-Based Speculative Decoding}},
  year = {2026},
  eprint = {2611.16714},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.16714},
}
Figure