跳到正文
arXiv cs.AI· Lukas Twist, Helen Yannakoudakis, Jie M. Zhang·· 2 小时前AI 评分53

arXiv 论文实证研究代码生成中的推理轨迹溢出

Reasoning-Trace Overflow in Code Generation: An Empirical Study of Explicit Reasoning Models

AI 导读

Lukas Twist 等人的 arXiv 论文研究了小规模开源权重推理模型在代码生成中的推理轨迹溢出,即模型耗尽输出预算却仍未产出可用代码。在七个模型、六个代码基准、固定 32k token 输出预算下,作者发现溢出在简单函数级任务上罕见,但在更难的基准和特定模型家族上常见,多个模型与基准组合中超过半数生成耗尽全部预算仍在推理,且多数与重复推理循环相关。

正文 · 原文

View PDF HTML (experimental)

Abstract:Explicit reasoning can help language models generate code, but it also introduces a practical risk: the model may spend so much of its output budget reasoning that it never produces usable code. We study this behaviour in relatively small open-weight reasoning models, framing it as reasoning-trace overflow. Across seven models and six code benchmark settings, we measure how much of a fixed 32k-token output budget is spent on reasoning, whether that reasoning improves pass@1, and whether lightweight inference-time controls can mitigate overflow. Our results show that the value of reasoning is highly conditional. Overflow is rare on simpler function-level tasks, but becomes common on harder code-generation benchmarks and for particular model families: on several model--benchmark pairs, more than half of generations exhaust the full 32k-token budget while still reasoning. Most complete overflow is associated with repetitive reasoning loops, although substantial long reasoning also occurs without looping. Disabling reasoning can therefore be competitive for overflow-prone models, simply because it ensures that an answer is produced. At the same time, reasoning remains valuable for stronger models on harder algorithmic and code-understanding tasks. Finally, prompt steering can substantially reduce overflow for some models but is inconsistent, while budgeted transitions provide more direct control and can improve both performance and token efficiency for overflow-prone models. These findings suggest that explicit reasoning should be treated as a controllable resource for code generation, rather than an always-on capability.
Comments: 12 pages, 6 figures, 1 table
Subjects: Artificial Intelligence (cs.AI); Software Engineering (cs.SE)
Cite as: arXiv:2611.06095 [cs.AI]
  (or arXiv:2611.06095v1 [cs.AI] for this version)
  https://doi.org/10.48550/arXiv.2611.06095

arXiv-issued DOI via DataCite (pending registration)

Submission history

From: Lukas Twist [view email]
[v1] Wed, 4 Nov 2026 07:42:05 UTC (1,264 KB)

来源:arXiv cs.AI · arxiv.org