arXiv:2602.07672cs.SEcs.AI2026-02被引 4

剖析代码世界模型的错误根源,发现两大失效模式。

Debugging code world models

  • 从局部语义执行和长程状态追踪双视角分析错误
  • 字符串状态因分词限制易出错,长执行致令牌耗尽
  • 长程退化主因是动作生成错误,非模型结构缺陷

代码世界模型(CWMs)是通过预测每条指令执行后的显式运行时状态来模拟程序执行的语言模型。这种基于执行的世界建模使模型具备内部验证能力,可替代自然语言思维链推理。然而,其错误来源与局限性仍不明确。本文从局部语义执行与长程状态追踪两方面研究真实代码基准上的表现,识别出两类主导失败模式:一是密集的运行时状态输出导致令牌消耗过快,使长执行历史程序面临令牌预算耗尽;二是错误高度集中于字符串类型状态,归因于子词分词的局限性而非程序结构。为研究长程行为,我们采用受控的排列追踪基准,隔离动作执行下的状态传播。结果表明,长程退化主要源于动作生成错误:当使用真实命令替换预测动作时,基于Transformer的CWM能准确传播状态,即便在长程追踪上存在已知局限。这些发现为更高效监督与对齐程序执行及数据类型的态表示提供了方向。

原文摘要 · Abstract (English)

Code World Models (CWMs) are language models trained to simulate program execution by predicting explicit runtime state after every executed command. This execution-based world modeling enables internal verification within the model, offering an alternative to natural language chain-of-thought reasoning. However, the sources of errors and the nature of CWMs' limitations remain poorly understood. We study CWMs from two complementary perspectives: local semantic execution and long-horizon state tracking. On real-code benchmarks, we identify two dominant failure regimes. First, dense runtime state reveals produce token-intensive execution traces, leading to token-budget exhaustion on programs with long execution histories. Second, failures disproportionately concentrate in string-valued state, which we attribute to limitations of subword tokenization rather than program structure. To study long-horizon behavior, we use a controlled permutation-tracking benchmark that isolates state propagation under action execution. We show that long-horizon degradation is driven primarily by incorrect action generation: when actions are replaced with ground-truth commands, a Transformer-based CWM propagates state accurately over long horizons, despite known limitations of Transformers in long-horizon state tracking. These findings suggest directions for more efficient supervision and state representations in CWMs that are better aligned with program execution and data types.

代码理解世界模型错误分析编程

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