arXiv:2505.11225cs.CLcs.AI2025-05AAAI被引 18

让大模型学会越写越短:通过历史记录优化推理长度

HAPO: Training Language Models to Reason Concisely via History-Aware Policy Optimization

  • 基于历史最优长度动态调整奖励,鼓励模型逐步压缩正确答案
  • 在数学题上实现33%-59%长度减少,准确率仅下降2%-5%
  • 适合追求高效推理、降低生成成本的研究者与应用开发

尽管延长测试时输出长度可显著提升大语言模型的推理能力与表现,但常导致输出冗长且增加推理开销。此前方法多采用通用预算约束或逐查询长度优化,未利用训练中对同一问题的历史交互信息。本文提出历史感知策略优化(HAPO),为每个问题维护一个历史状态(如之前正确回答的最小长度),并设计基于该状态的长度奖励函数,激励模型发现比以往更简洁的正确解法。该奖励机制避免过度惩罚较短的错误回答,以促进向更高效解法的探索。结合正确性奖励,HAPO联合优化准确性与效率。我们使用HAPO训练了DeepSeek-R1-Distill-Qwen-1.5B、DeepScaleR-1.5B-Preview和Qwen-2.5-1.5B-Instruct,并在多个涵盖不同难度的数学基准上评估。实验表明,HAPO有效提升模型的简洁推理能力,在准确率仅下降2%-5%的前提下,实现33%-59%的输出长度缩减。

原文摘要 · Abstract (English)

While scaling the length of responses at test-time has been shown to markedly improve the reasoning abilities and performance of large language models (LLMs), it often results in verbose outputs and increases inference cost. Prior approaches for efficient test-time scaling, typically using universal budget constraints or query-level length optimization, do not leverage historical information from previous encounters with the same problem during training. We hypothesize that this limits their ability to progressively make solutions more concise over time. To address this, we present History-Aware Policy Optimization (HAPO), which keeps track of a history state (e.g., the minimum length over previously generated correct responses) for each problem. HAPO employs a novel length reward function based on this history state to incentivize the discovery of correct solutions that are more concise than those previously found. Crucially, this reward structure avoids overly penalizing shorter incorrect responses with the goal of facilitating exploration towards more efficient solutions. By combining this length reward with a correctness reward, HAPO jointly optimizes for correctness and efficiency. We use HAPO to train DeepSeek-R1-Distill-Qwen-1.5B, DeepScaleR-1.5B-Preview, and Qwen-2.5-1.5B-Instruct, and evaluate HAPO on several math benchmarks that span various difficulty levels. Experiment results demonstrate that HAPO effectively induces LLMs' concise reasoning abilities, producing length reductions of 33-59% with accuracy drops of only 2-5%.

大模型推理简洁生成强化学习数学推理

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