Share your thoughts, 1 month free Claude Pro on usSee more
WorkDL logo mark

BanditSpec: Adaptive Speculative Decoding via Bandit Algorithms

About

Speculative decoding has emerged as a popular method to accelerate the inference of Large Language Models (LLMs) while retaining their superior text generation performance. Previous methods either adopt a fixed speculative decoding configuration regardless of the prefix tokens, or train draft models in an offline or online manner to align them with the context. This paper proposes a training-free online learning framework to adaptively choose the configuration of the hyperparameters for speculative decoding as text is being generated. We first formulate this hyperparameter selection problem as a Multi-Armed Bandit problem and provide a general speculative decoding framework BanditSpec. Furthermore, two bandit-based hyperparameter selection algorithms, UCBSpec and EXP3Spec, are designed and analyzed in terms of a novel quantity, the stopping time regret. We upper bound this regret under both stochastic and adversarial reward settings. By deriving an information-theoretic impossibility result, it is shown that the regret performance of UCBSpec is optimal up to universal constants. Finally, extensive empirical experiments with LLaMA3 and Qwen2 demonstrate that our algorithms are effective compared to existing methods, and the throughput is close to the oracle best hyperparameter in simulated real-life LLM serving scenarios with diverse input prompts.

Yunlong Hou, Fengzhuo Zhang, Cunxiao Du, Xuan Zhang, Jiachun Pan, Tianyu Pang, Chao Du, Vincent Y. F. Tan, Zhuoran Yang• 2025

Related benchmarks

TaskDatasetResultRank
Instruction FollowingAlpaca--
173
Speculative DecodingPython
MAT5.44
30
Speculative DecodingChemistry
MAT5.11
30
Speculative DecodingMATH
Match Rate5.75
30
Speculative DecodingBiology
MAT5.22
30
Speculative DecodingMedQA
Match Rate (MAT)4.46
30
Speculative DecodingCNN_DM
MAT3.33
30
Speculative DecodingSQL
MAT5.71
30
Code GenerationHumanEval
MAT Score5.46
15
Mathematical ReasoningGSM8K
MAT (Accuracy)5.05
15
Showing 10 of 16 rows

Other info

Follow for update