WhoBuilt

Code World Model: Building World Models for Computation

Dec 17, 2025· 17 min· 15K views·Watch on YouTube

Speaker

Jacob Kahn, a researcher at FAIR Meta, explains how the Code World Model predicts code execution and how it is trained and used at the AI Engineer event.

Model execution, not just code syntax

Kahn describes CWM’s goal as predicting future observations from past observations and actions, so a model can reason about possible outcomes. Instead of treating code only as tokens, CWM uses structured execution traces with steps, local variables, and memory. He gives counting the Rs in “strawberry” as a simple example of tracing a program line by line.

Build a model that can imagine execution

Kahn frames both program execution and agent decisions as transitions from a state, through an action, to a new state. A model could generate execution traces without running the program, letting an agent consider outcomes before using the real environment. CWM is a 32-billion-parameter dense transformer, trained on several trillion pretraining tokens and further tuned for code, reasoning, and agent use.

Train agents in a Bash environment

CWM works in a terminal-oriented setup, where an agent receives a GitHub issue and uses Bash to inspect and change repository files. The team combines supervised fine-tuning with reinforcement learning and rejection-sampled traces from failed coding attempts. Its asynchronous training system queues model checkpoints and trajectories, and Kahn says it processes about 200 billion tokens during post-training.

Use execution traces for debugging and analysis

Kahn says CWM can trace functions and predict local variable values, which could support a neural debugger. A user can sketch code structure and leave parts unspecified; the model can use the implied execution to fill in details. He also describes approximating program behavior, such as whether a program halts, and reasoning about expensive functions or distributed systems without executing them.

Open the model for others to build on

Kahn says CWM is available on Hugging Face, with inference code on GitHub and a technical report covering training and data. He encourages developers to experiment with the model and its execution-tracing capabilities.

Takeaways

  • Represent program behavior as state transitions and execution traces to give models more structure than source tokens alone.
  • Let coding agents simulate likely outcomes before spending time on real tool calls or expensive execution.
  • A Bash-based environment can train agents to work with repositories using familiar engineering workflows.
  • Use incomplete code sketches to express intent and structure when exact implementation details are still unclear.

Mentioned in this talk

Search inside this talk

What was claimed 8

Related talks