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.
Code World Model: Building World Models for Computation
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.
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.
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.
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.
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
- role atJacob Kahn is researcher at
FAIR“I'm a researcher at FAIR Meta.”
YouTube Unverified1 source· Talk
- featureCode World Model: Predicts program execution and transitions between program states
“We want to predict program execution”
YouTube Unverified1 source· Talk
- usesCode World Model uses
GitHub
“We gathered a huge amount of GitHub data.”
YouTube Unverified1 source· Talk
- uses
“we do this joint RL and agentic reasoning setup”
YouTube Unverified1 source· Talk
- metricCode World Model: 32 billion parameters; dense transformer
“it's a 32-billion-parameter dense transformer”
YouTube Unverified1 source· Talk
- usesCode World Model uses Bash
“CWM is a bash-oriented model.”
YouTube Unverified1 source· Talk
- featureCode World Model: Can trace functions line by line and predict local variable values
“I can give it a function and have it trace that function line by line with very high accuracy.”
YouTube Unverified1 source· Talk
- featureCode World Model: model made availablemodel made available
“the model is available on Hugging Face”
YouTube Unverified1 source· Talk










