不改模型权重,用采样方法提升大模型生成质量。
Sampling for Quality: Training-Free Reward-Guided LLM Decoding via Sequential Monte Carlo
- 用奖励势构建序列级目标分布,指导解码过程。
- 在HumanEval上提效54.9%,数学题准确率达78.4%。
- 无需训练,兼容主流采样策略,适合高效推理场景。
我们提出一种基于概率框架的奖励引导解码方法,克服了传统解码仅优化词元级似然而忽略序列级质量的缺陷。该方法通过结合模型转移概率与前缀依赖的奖励势,定义完整序列上的奖励增强目标分布。关键在于训练自由:保持模型权重不变,仅通过奖励势调整推理分布,所有性能提升均来自推理时的采样优化。为此开发了序列蒙特卡洛算法,包括计算高效的前缀仅限变体和前瞻变体,后者中间目标匹配完整序列分布的精确边缘。框架还集成重采样-移动更新与马尔可夫链蒙特卡洛再生机制,支持块生成,可涵盖温度采样与幂温化目标等常见策略。在三个7B规模模型上验证,代码生成(HumanEval)最高提升54.9%,超越最强基线9.1%-15.3%;数学推理(MATH500)提升达8.8%。Qwen2.5-7B在HumanEval达到87.8%,在MATH500达78.4%,持续优于强化学习方法GRPO。
原文摘要 · Abstract (English)
We introduce a principled probabilistic framework for reward-guided decoding in large language models, addressing the limitations of standard decoding methods that optimize token-level likelihood rather than sequence-level quality. Our method defines a reward-augmented target distribution over complete sequences by combining model transition probabilities with prefix-dependent reward potentials. Importantly, the approach is training-free: it leaves model weights unchanged and instead modifies the inference distribution via reward potentials, with all gains arising purely from inference-time sampling. To sample from this distribution, we develop Sequential Monte Carlo algorithms, including a computationally efficient prefix-only variant and a lookahead variant whose intermediate targets match the exact marginals of the full sequence distribution. The framework also integrates resample-move updates with Metropolis-Hastings rejuvenation and supports block-wise generation, subsuming common decoding strategies such as temperature sampling and power-tempered objectives. Empirical results across three 7B models show significant gains. On code generation (HumanEval), our method improves base performance by up to 54.9% and surpasses the strongest sampling baselines by 9.1%-15.3%. On mathematical reasoning (MATH500), it achieves gains of up to 8.8%. Notably, it reaches 87.8% on HumanEval and 78.4% on MATH500 with Qwen2.5-7B, consistently outperforming the reinforcement learning method GRPO.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。