让大模型自动调整生成策略,提升准确率并节省计算资源。
Learning Adaptive LLM Decoding
- 用强化学习训练轻量级解码适配器,动态选择采样策略。
- 在MATH和CodeContests上,准确率提升最高达10.2%。
- 适合需要高效推理的部署场景,尤其关注计算资源约束。
大语言模型的解码通常依赖固定的采样超参数(如温度、top-p),但不同提示和解码步骤间任务难度与不确定性差异显著。本文提出学习自适应解码策略,在推理时根据可用计算资源动态选择采样方式。不微调语言模型本身,而是引入基于强化学习和可验证终端奖励(如数学与编程任务正确性)的轻量级解码适配器。序列级将解码建模为上下文老虎机问题:策略根据提示嵌入和并行采样预算选择解码策略(如贪婪、top-k、min-p)。token级则建模为部分可观测马尔可夫决策过程(POMDP),策略基于内部模型特征和剩余token预算选择采样动作。在MATH和CodeContests基准上的实验表明,所学适配器提升了准确率-预算权衡:在固定token预算下,token级适配器使Pass@1准确率最高提升10.2%;在固定并行采样条件下,序列级适配器带来2-3%增益。消融分析验证了序列与token级适应的贡献。
原文摘要 · Abstract (English)
Decoding from large language models (LLMs) typically relies on fixed sampling hyperparameters (e.g., temperature, top-p), despite substantial variation in task difficulty and uncertainty across prompts and individual decoding steps. We propose to learn adaptive decoding policies that dynamically select sampling strategies at inference time, conditioned on available compute resources. Rather than fine-tuning the language model itself, we introduce lightweight decoding adapters trained with reinforcement learning and verifiable terminal rewards (e.g. correctness on math and coding tasks). At the sequence level, we frame decoding as a contextual bandit problem: a policy selects a decoding strategy (e.g. greedy, top-k, min-p) for each prompt, conditioned on the prompt embedding and a parallel sampling budget. At the token level, we model decoding as a partially observable Markov decision process (POMDP), where a policy selects sampling actions at each token step based on internal model features and the remaining token budget. Experiments on the MATH and CodeContests benchmarks show that the learned adapters improve the accuracy-budget tradeoff: on MATH, the token-level adapter improves Pass@1 accuracy by up to 10.2% over the best static baseline under a fixed token budget, while the sequence-level adapter yields 2-3% gains under fixed parallel sampling. Ablation analyses support the contribution of both sequence- and token-level adaptation.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。