2025-04-02 · 专家 · 机器学习 · 计算机视觉

Z1: Efficient Test-time Scaling with Code

本文提出了一种基于代码相关推理轨迹的测试时缩放方法,通过移除上下文分隔标签并限制推理标记数量,有效地减少了大型语言模型在解决复杂问题时过度思考的标记消耗,同时保持了推理性能。

更新于 2025-04-21。作者:Zhaojian Yu、Yinghao Wu、Yilun Zhao、Arman Cohan、Xiao-Ping Zhang。

中文摘要

大型语言模型(LLMs)可以通过测试时的计算扩展实现复杂问题的增强解决,但这通常涉及更长的上下文和大量的推理令牌成本。在本文中,我们提出了一种高效的测试时扩展方法,该方法通过在代码相关推理轨迹上训练LLMs,促进它们减少多余的思考令牌,同时保持性能。首先,我们创建了一个名为Z1-Code-Reasoning-107K的精选数据集,包含简单和复杂编程问题及其短和长解决方案轨迹。其次,我们提出了一种新颖的“移位思考窗口”,通过移除上下文限定标记(例如:<think>...</think>)和限制推理令牌来减轻过度思考的开销。使用长和短轨迹数据进行训练并配备移位思考窗口,我们的模型Z1-7B展示了根据问题的复杂度调整其推理水平的能力,并在不同的推理任务中表现出高效的测试时扩展,其性能与R1-Distill-Qwen-7B相当,而其平均思考令牌仅占后者的30%。值得注意的是,仅使用代码轨迹微调的Z1-7B展示了在更广泛的推理任务上的泛化能力(在GPQA Diamond上的表现达到47.5%)。我们对于高效推理诱导的分析也为未来的研究提供了宝贵的见解。

英文摘要

Large Language Models (LLMs) can achieve enhanced complex problem-solving through test-time computing scaling, yet this often entails longer contexts and numerous reasoning token costs. In this paper, we propose an efficient test-time scaling method that trains LLMs on code-related reasoning trajectories, facilitating their reduction of excess thinking tokens while maintaining performance. First, we create Z1-Code-Reasoning-107K, a curated dataset of simple and complex coding problems paired with their short and long solution trajectories. Second, we present a novel Shifted Thinking Window to mitigate overthinking overhead by removing context-delimiting tags (e.g., <think>. . . </think>) and capping reasoning tokens. Trained with long and short trajectory data and equipped with Shifted Thinking Window, our model, Z1-7B, demonstrates the ability to adjust its reasoning level as the complexity of problems and exhibits efficient test-time scaling across different reasoning tasks that matches R1-Distill-Qwen-7B performance with about 30% of its average thinking tokens. Notably, fine-tuned with only code trajectories, Z1-7B demonstrates generalization to broader reasoning tasks (47.5% on GPQA Diamond). Our analysis of efficient reasoning elicitation also provides valuable insights for future research.

解读

一句话总结

本文提出了一种基于代码相关推理轨迹的测试时缩放方法,通过移除上下文分隔标签并限制推理标记数量,有效地减少了大型语言模型在解决复杂问题时过度思考的标记消耗,同时保持了推理性能。

问题1:这篇论文想要解决什么具体问题?

问题2:论文的核心创新点是什么?

问题3:实验结果如何验证了方法的有效性?

问题4:这个研究的实际应用价值是什么?

来源

机器可读索引:llms.txt