BanditSpec: Adaptief Speculatief Decoderen via Bandit-algoritmen
BanditSpec: Adaptive Speculative Decoding via Bandit Algorithms
May 21, 2025
Auteurs: Yunlong Hou, Fengzhuo Zhang, Cunxiao Du, Xuan Zhang, Jiachun Pan, Tianyu Pang, Chao Du, Vincent Y. F. Tan, Zhuoran Yang
cs.AI
Samenvatting
Speculatieve decodering is naar voren gekomen als een populaire methode om de inferentie van Large Language Models (LLM's) te versnellen, terwijl hun superieure tekstgeneratieprestaties behouden blijven. Eerdere methoden gebruiken ofwel een vaste configuratie voor speculatieve decodering, ongeacht de prefix-tokens, of trainen draft-modellen offline of online om ze af te stemmen op de context. Dit artikel stelt een trainingsvrij online leerframework voor om de configuratie van de hyperparameters voor speculatieve decodering adaptief te kiezen terwijl de tekst wordt gegenereerd. We formuleren eerst dit hyperparameter-selectieprobleem als een Multi-Armed Bandit-probleem en bieden een algemeen speculatief decoderingsframework genaamd BanditSpec. Verder worden twee bandit-gebaseerde hyperparameter-selectiealgoritmen, UCBSpec en EXP3Spec, ontworpen en geanalyseerd in termen van een nieuwe grootheid, het stoppende tijdspijt. We begrenzen dit spijt zowel onder stochastische als adversariële beloningsinstellingen. Door een informatie-theoretisch onmogelijkheidsresultaat af te leiden, wordt aangetoond dat de spijtprestatie van UCBSpec optimaal is tot universele constanten. Ten slotte tonen uitgebreide empirische experimenten met LLaMA3 en Qwen2 aan dat onze algoritmen effectief zijn in vergelijking met bestaande methoden, en dat de doorvoer dicht bij de orakel beste hyperparameter ligt in gesimuleerde real-life LLM-serverscenario's met diverse invoerprompts.
English
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.