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

Xianzhen Luo, Yixuan Wang, Qingfu Zhu, Zhiming Zhang, Xuanyu Zhang +2 more
8/16/2024
cs.CLcs.LG

No official code found. Best implementation: hemingkx/Spec-Bench (399 stars, Apache-2.0, last commit 2025-04-22). 1 more below.

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\%.

View on arXivView PDF

Code Implementations(2)

hemingkx/Spec-BenchCommunity100%
Apache-2.0

Spec-Bench: A Comprehensive Benchmark and Unified Evaluation Platform for Speculative Decoding (ACL 2024 Findings)

39949C, RustFeb 21, 20241 years agoApache-2.0

[ACL2025 OralšŸ”„]Turning Trash into Treasure: Accelerating Inference of Large Language Models with Token Recycling

292Shell, PythonFeb 18, 202511 months ago

Similar Papers

Cite this paper

@article{luo2024turning,
  title  = {Turning Trash into Treasure: Accelerating Inference of Large Language Models with Token Recycling},
  author = {Xianzhen Luo and Yixuan Wang and Qingfu Zhu and Zhiming Zhang and Xuanyu Zhang and Qing Yang and Dongliang Xu},
  year   = {2024},
  eprint = {2408.08696},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2408.08696v3}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2408.08696.svg)](https://codeofpaper.com/paper/2408.08696)

Discussion