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.


翻译:代码世界模型(CWMs)是一种经过训练的语言模型,其通过预测每个执行命令后的显式运行时状态来模拟程序执行。这种基于执行的世界建模使得模型能够进行内部验证,为自然语言链式思维推理提供了一种替代方案。然而,错误来源及CWMs局限性的本质仍鲜为人知。我们从两个互补的视角研究CWMs:局部语义执行与长时域状态追踪。在真实代码基准测试中,我们识别出两种主要的失效机制。首先,密集的运行时状态揭示会产生令牌密集的执行轨迹,导致具有长执行历史的程序出现令牌预算耗尽。其次,失效不成比例地集中在字符串值状态中,我们将此归因于子词令牌化的局限性,而非程序结构。为了研究长时域行为,我们使用一个受控的排列追踪基准测试,该测试隔离了动作执行下的状态传播。我们证明,长时域性能下降主要由错误的动作生成驱动:当动作被替换为真实命令时,基于Transformer的CWM能够在长时域上准确传播状态,尽管已知Transformer在长时域状态追踪方面存在局限性。这些发现为CWMs中更高效的监督和状态表示指明了方向,使其更好地与程序执行和数据类型对齐。

0
下载
关闭预览

相关内容

【ETZH博士论文】语言模型编程
专知会员服务
25+阅读 · 2025年6月14日
【MIT博士论文】通过神经物理构建世界模型
专知会员服务
34+阅读 · 2025年4月3日
世界模型:安全性视角
专知会员服务
40+阅读 · 2024年11月17日
《大型语言模型代码生成》综述
专知会员服务
68+阅读 · 2024年6月4日
一大批中文(BERT等)预训练模型等你认领!
PaperWeekly
15+阅读 · 2019年6月25日
一个牛逼的 Python 调试工具
机器学习算法与Python学习
15+阅读 · 2019年4月30日
国家自然科学基金
4+阅读 · 2017年12月31日
国家自然科学基金
4+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
9+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
Arxiv
0+阅读 · 2月19日
VIP会员
相关基金
国家自然科学基金
4+阅读 · 2017年12月31日
国家自然科学基金
4+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
9+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员