arXiv:2505.15141cs.LGcs.AI2025-05ICML被引 15

用博弈算法动态调整大模型推理参数,提升生成速度且不损失质量。

BanditSpec: Adaptive Speculative Decoding via Bandit Algorithms

  • 将超参选择建模为多臂赌博机问题,实现在线自适应配置。
  • 在真实场景中达到接近最优配置的吞吐量,实测性能超越现有方法。
  • 无需训练,适合部署于多样化输入的实时大模型服务场景。

推测解码已成为加速大语言模型(LLMs)推理的流行方法,可在保持高质量文本生成的同时提升速度。以往方法要么采用固定配置,要么通过离线或在线训练对齐草稿模型与上下文。本文提出一种无需训练的在线学习框架,根据生成过程中的前缀内容自适应选择推测解码的超参数。我们将该问题建模为多臂赌博机问题,构建通用框架BanditSpec。设计了两种基于赌博机的超参数选择算法:UCBSpec和EXP3Spec,基于新定义的停止时间遗憾进行分析。在随机与对抗性奖励设置下,给出了该遗憾的上界。通过信息论不可能性结果表明,UCBSpec的遗憾表现对常数意义下最优。大量实验基于LLaMA3和Qwen2验证,所提算法在模拟真实服务场景中显著优于现有方法,吞吐量接近理想最优超参数配置。

原文摘要 · Abstract (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.

推理加速在线学习大模型博弈算法

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。