Turning Trash into Treasure: Accelerating Inference of Large Language Models with Token Recycling

Xianzhen Luo, Yixuan Wang, Qingfu Zhu, Zhiming Zhang, Xuanyu Zhang, Qing Yang, Dongliang Xu

TL;DR

Token Recycling (TR) is a novel, training-free speculative decoding method that accelerates Large Language Model (LLM) inference by reusing previously discarded candidate tokens. By storing these "trash" tokens in a tiny (<2MB) adjacency matrix, TR dynamically constructs draft trees for future generations, achieving a consistent ~2x speedup across various model sizes while outperforming existing training-free methods by over 30%.

What Problem Does This Paper Address?

The fundamental bottleneck in LLM inference is latency, largely driven by the memory-bound nature of auto-regressive decoding. Because LLMs generate text one token at a time, billions of parameters must be transferred from high-bandwidth memory to the accelerator cache at every single step.

Speculative decoding mitigates this by using a "guess-and-verify" paradigm: a smaller, faster mechanism drafts several subsequent tokens, and the main LLM verifies them in parallel in a single forward pass. However, existing drafting methods face a harsh trade-off:

  1. Tuning-based methods (like Medusa or draft models) require expensive, model-specific training.
  2. Retrieval-based, training-free methods (like REST or Lookahead) either require massive storage, suffer from slow retrieval times, or struggle to adapt dynamically to new contexts.

Furthermore, standard decoding strategies only keep the top-1 token at each step, completely discarding the rest of the calculated probability distribution (the candidate tokens). The authors observe that these rejected tokens actually contain valuable local semantic patterns that frequently reoccur later in the generation process.

Figure 1: A comparison of typical speculative decoding and Token Recycling (TR). Typical methods draft some tokens and verify them in parallel in one decoding step. Unlike other methods that discard candidate tokens, TR stores them in an adjacency matrix. In future genera- tions, draft tokens are retrieved from the matrix which is updated with new candidate tokens. TR effectively recycles tokens in the decoding process.

Methods

Token Recycling introduces a plug-and-play framework that recycles these discarded candidate tokens using three main stages:

  1. Adjacency Matrix Initialization: TR maintains a lightweight adjacency matrix $M \in V^{|V| \times k}$, where $V$ is the vocabulary size and $k$ (set to 8) is the number of top candidate tokens stored for each word. To prevent cold-start inefficiencies, TR uses a "hot start" strategy, inheriting the matrix from previous queries to leverage prior linguistic knowledge.
  2. Draft Tree Retrieval: When a token is generated, TR uses a Breadth-First-Search (BFS)-like algorithm to look up its top-$k$ continuations in the matrix, building a static, imbalanced draft tree. Nodes positioned earlier in the layers are given more children to prioritize the most probable paths.
  3. Verification and Update: The draft tree is verified in parallel using tree attention. Crucially, both accepted and rejected tokens from the forward pass are used to overwrite and update the adjacency matrix in parallel via fast, uncontrolled CUDA operations.
Figure 1: A comparison of typical speculative decoding and Token Recycling (TR). Typical methods draft some tokens and verify them in parallel in one decoding step. Unlike other methods that discard candidate tokens, TR stores them in an adjacency matrix. In future genera- tions, draft tokens are retrieved from the matrix which is updated with new candidate tokens. TR effectively recycles tokens in the decoding process.

Datasets

The authors evaluated Token Recycling across general and specialized domains using two primary benchmarks:

  • SpecBench: A comprehensive benchmark covering diverse tasks including Multi-turn Conversation (MT), Translation (Trans), Summarization (Sum), Question Answering (QA), Mathematical Reasoning (Math), and Retrieval-Augmented Generation (RAG). This was tested using Vicuna (7B, 13B, and 33B).
  • MBPP (Mainly Basic Python Problems): A popular dataset for code generation, which typically features high structural redundancy. This was tested using Code Llama (7B, 13B, and 34B).

Key Insights and Ideas

  • Trash is Treasure: The most significant insight is that rejected tokens are highly informative. Including candidate tokens from rejected paths significantly boosts the Mean Accepted Tokens (MAT) compared to only saving candidates from accepted tokens (e.g., jumping from 1.63 to 2.69 on SpecBench).
  • Embrace the Chaos (Uncontrolled Updates): When updating the matrix in parallel, duplicate tokens in a sequence can cause write conflicts in CUDA. Rather than adding complex, latency-inducing control logic to resolve these conflicts, TR simply lets CUDA overwrite them arbitrarily. The authors found that the speed benefit of avoiding overhead far outweighs any minor statistical variations.
  • Efficiency over Scale: A simple $V \times k$ matrix requires less than 2MB of memory, yet it performs dynamically on par with or better than complex neural draft networks that require hundreds of megabytes.

Key Results

Token Recycling achieves state-of-the-art (SOTA) performance among training-free methods:

  • Consistent Speedups: TR delivers an approximate 2x speedup across all evaluated LLM sizes (7B to 33B/34B) on general tasks, and up to 2.34x speedup on code generation tasks due to higher code redundancy.
  • Outperforming Training-Based Methods: On SpecBench, TR (speedup of 2.03x on 7B) outperformed Medusa-1 (1.65x), a widely recognized method that requires explicit training.
  • Competitive with Heavyweights: When compared against Eagle1 and Eagle2 (SOTA train-dependent frameworks), TR achieved 91.23% of Eagle2's acceleration performance while utilizing a mere 0.39% of its memory footprint (1.95MB vs 500MB).
Figure 3: Effects of tree breadth, depth and updating strategies on MAT and Tokens/s are in (a), (b), and (c).

Limitations and Future Work

The primary limitation acknowledged by the authors is the use of a static tree structure for drafting. While a static tree enables highly efficient parallel preprocessing and layer traversal, it cannot adapt its shape to the specific confidence levels of different tokens during inference.

For future work, the authors suggest exploring dynamic tree structures that can adaptively adjust their depth and breadth at each decoding step, potentially unlocking even higher acceptance rates without sacrificing TR's signature low overhead.

Summary updated

Abstract

Massive parameters of LLMs have made inference latency a fundamental bottleneck. Speculative decoding represents a lossless approach to accelerate inference through a guess-and-verify paradigm. Some methods rely on additional architectures to guess draft tokens, which need extra training before use. Alternatively, retrieval-based training-free techniques build libraries from pre-existing corpora or by n-gram generation. However, they face challenges like large storage requirements, time-consuming retrieval, and limited adaptability. Observing that candidate tokens generated during the decoding process are likely to reoccur in future sequences, we propose Token Recycling. It stores candidate tokens in an adjacency matrix and employs a breadth-first-search (BFS)-like algorithm to construct a draft tree, which is then validated through tree attention. New candidate tokens from the decoding process are then used to update the matrix. Token Recycling requires \textless2MB of additional storage and achieves approximately 2x speedup across all sizes of LLMs. It significantly outperforms existing train-free methods by 30\% and even a widely recognized training method by 25\%.
BibTeX
@inproceedings{luo2025turning,
  author = {Xianzhen Luo and Yixuan Wang and Qingfu Zhu and Zhiming Zhang and Xuanyu Zhang and Qing Yang and Dongliang Xu},
  title = {{Turning Trash into Treasure: Accelerating Inference of Large Language Models with Token Recycling}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2025},
}
Figure