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

Fuente: arXiv
Enregistré dans:
Détails bibliographiques
Auteurs principaux: Luo, Xianzhen, Wang, Yixuan, Zhu, Qingfu, Zhang, Zhiming, Zhang, Xuanyu, Yang, Qing, Xu, Dongliang
Format: Preprint
Publié: 2024
Sujets:
Accès en ligne:
Tags: Ajouter un tag
Pas de tags, Soyez le premier à ajouter un tag!
_version_ 1866916755830472704
author Luo, Xianzhen
Wang, Yixuan
Zhu, Qingfu
Zhang, Zhiming
Zhang, Xuanyu
Yang, Qing
Xu, Dongliang
author_facet Luo, Xianzhen
Wang, Yixuan
Zhu, Qingfu
Zhang, Zhiming
Zhang, Xuanyu
Yang, Qing
Xu, Dongliang
contents 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\%.
format Preprint
id arxiv_https___arxiv_org_abs_2408_08696
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Turning Trash into Treasure: Accelerating Inference of Large Language Models with Token Recycling
Luo, Xianzhen
Wang, Yixuan
Zhu, Qingfu
Zhang, Zhiming
Zhang, Xuanyu
Yang, Qing
Xu, Dongliang
Computation and Language
Machine Learning
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\%.
title Turning Trash into Treasure: Accelerating Inference of Large Language Models with Token Recycling
topic Computation and Language
Machine Learning
url https://arxiv.org/abs/2408.08696