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:
- Tuning-based methods (like Medusa or draft models) require expensive, model-specific training.
- 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.
Methods
Token Recycling introduces a plug-and-play framework that recycles these discarded candidate tokens using three main stages:
- 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.
- 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.
- 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.
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).
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