CodeWAM: A Code World Action Model for End-to-End Autonomous Driving
Authors: Zhisheng Chen, Jinpeng Wang, Beicheng Lou, Zhengwei Xie, Hao Wu, Rui Qian, Kun Wang, Vivian W. H. Wong
Organizations: Nanyang Technological University · Tsinghua University · Independent Researcher · University of Science and Technology of China · Fudan University · University of Florida
Driving world models anticipate action consequences through representations of how the world evolves. For autonomous driving, these representations must capture both the surrounding scene and the ego vehicle's motion under a candidate plan. We propose CodeWAM, a driving world model that incorporates executable code as part of its world representation. Code represents ego dynamics by expressing how the vehicle state evolves under plan execution, while a learned visual model captures scene-dependent consequences. Executing the code produces a candidate-conditioned motion sequence, which is evaluated relative to the prior plan and recorded motion history. The resulting execution consequences and learned scene outcomes jointly represent the candidate's future, enabling the planner to assess both what a plan may lead to and how the vehicle transitions into that future. The selected plan becomes part of the next decision's execution context, linking successive choices within the model. CodeWAM achieves 93.6 PDMS on NAVSIM v1 navtest, 92.1 EPDMS on v2 navtest, and 50.6 EPDMS on NAVHARD. Further experiments demonstrate improved pairwise execution consistency and gains on Hydra-MDP and DrivoR without additional training, supporting executable code as a complementary representation for driving world models.
Figures & tables
Figure 1: Comparison of driving world model paradigms. (a–c) Predictive representations support planning through future video, latent prediction, or future conditioning. (d) CodeWAM explicitly models candidate execution from current states with executable ego dynamics, combining the resulting motion consequences with learned scene outcomes for trajectory selection.
Figure 2: Overview of CodeWAM. For each candidate plan proposed by the policy, a program rolls out the motion the ego vehicle produces from its current state, and the resulting motion is compared with the previous plan and with the recorded history to obtain the execution consequence. A learned scene model predicts, from multi-view images, the consequence of the same candidate in the scene. The two enter a joint utility, and the plan selected at this step becomes the execution context of the next one.
NAVSIM v1 metrics (%) ↑
Method
Venue
Sensors
Ego
NC
DAC
EP
TTC
Comfort
PDMS
End-to-End Methods
UniAD [ 12 ]
CVPR’23
6 × C
✓
97.8
91.9
78.8
92.9
100.0 1st
83.4
TransFuser [ 4 ]
TPAMI’23
3 × C+L
✓
97.7
92.8
79.2
92.8
100.0 1st
84.0
iPad [ 10 ]
RA-L’26
4 × C
✓
98.6
98.3
88.0 2nd
94.9
100.0 1st
91.7 2nd
WoTE [ 17 ]
ICCV’25
3 × C+L
✓
98.5
96.8
81.9
94.9
99.9 2nd
88.3
Table 1: Comparison on NAVSIM v1 navtest. All metrics are percentages ( ↑ ). C: camera; L: LiDAR; MV-C: multi-view cameras; Ego: ego-state input. Colors and superscripts mark the 1st , 2nd , and 3rd distinct values per metric across all methods; ties share a rank.
NAVSIM v2 metrics (%) ↑
Method
Venue
Sensors
Ego
NC
DAC
DDC
TLC
EP
TTC
LK
HC
EC
EPDMS
End-to-End Methods
TransFuser [ 4 ]
TPAMI’23
3 × C+L
✓
96.9
89.9
97.8
99.7 3rd
87.1
95.4
92.7
98.3 1st
87.2
76.7
DriveSuprim [ 32 ]
AAAI’26
3 × C
✗
97.5
96.5
99.4
99.6
88.4 3rd
96.6
95.5
98.3 1st
77.0
83.1
DiffusionDrive [ 19 ]
CVPR’25
3 × C+L
✓
98.2
95.9
99.4
99.8 2nd
87.5
97.3
96.8
98.3 1st
87.7 2nd
84.5
Artemis [ 8 ]
RA-L’26
3 × C+L
✓
98.3 3rd
95.1
98.6
99.8 2nd
81.5
97.4
96.5
98.3 1st
–
83.1
Table 2: Comparison on NAVSIM v2 navtest under the corrected, single-stage non-reactive protocol. EPDMS and its nine components are percentages ( ↑ ). Colors and superscripts mark the 1st , 2nd , and 3rd distinct values per metric across all methods; ties share a rank.
Method
Sensors
Stage
NC
DAC
DDC
TLC
EP
TTC
LK
HC
EC
EPDMS
WorldDrive [ 9 ]
SV
S1 S2
97.3 1st 91.4 1st
89.1 2nd 82.0 2nd
97.6 91.0 2nd
99.7 2nd 98.5 2nd
60.5 53.1
96.8 1st 90.6 1st
87.7 52.3 2nd
93.1 93.3
60.0 62.8 3rd
34.9 2nd
DiffusionDrive [ 19 ]
MV
S1 S2
96.8 2nd 80.1 3rd
86.0 3rd 72.8 3rd
98.8 3rd 84.4 3rd
99.3 98.4 3rd
84.0 2nd 85.9 1st
95.8 3rd 76.6 3rd
96.7 2nd 46.4 3rd
97.6 1st 96.3 1st
79.6 1st 72.8 2nd
27.5 3rd
LTF [ 4 ]
MV
S1 S2
96.2 3rd 77.7
79.5 70.2
99.1 2nd 84.2
99.5 3rd 98.0
84.1 1st 85.1 2nd
95.1 75.6
94.2 3rd 45.4
97.5 2nd 95.7 2nd
79.1 2nd 75.9 1st
23.1
CodeWAM (Ours)
MV
S1 S2
95.6 89.9 2nd
96.4 1st 88.1 1st
100.0 1st 94.4 1st
100.0 1st 98.9 1st
80.4 3rd 80.7 3rd
96.1 2nd 86.4 2nd
97.1 1st 60.8 1st
96.9 3rd 94.5 3rd
75.2 3rd 58.6
50.6 1st
Table 3: Two-stage planning on NAVSIM. S1 and S2 report stage-specific components; EPDMS is the overall score ( ↑ , %). MV/SV: multi-/single-view cameras. Colors and superscripts indicate the top three values within each stage, and separately for EPDMS.
L2 (m) ↓
Method
Venue
Sensors
Ego
1s
2s
3s
Avg.
UniAD [ 12 ]
CVPR
6 × C
✓
0.48
0.96
1.65
1.03
VAD-Base [ 13 ]
ICCV
6 × C
✓
0.41
0.70
1.05
0.72
GenAD [ 38 ]
ECCV
6 × C
✓
0.36 3rd
0.83
1.55
0.91
VLP [ 23 ]
CVPR
6 × C
✓
0.30 1st
0.53 2nd
0.84 2nd
0.55 2nd
ReAL-AD [ 21 ]
ICCV
6 × C
✓
0.30 1st
0.48 1st
0.67 1st
0.48 1st
Table 4: Open-loop planning on nuScenes validation; CodeWAM is zero-shot. L2 (m) is averaged up to each horizon ( ↓ ). Colors and superscripts mark the top three distinct values; ties share a rank.
Figure 3: Qualitative planning on NAVSIM v2 navtest. Each row shows a front-camera observation and bird’s-eye plans from Latent-WAM, SimWAM, and CodeWAM. Green denotes the recorded human trajectory and red the predicted plan; badges report frame EPDMS on [0,1] . CodeWAM obtains nonzero scores in all four selected cases, where both baselines score zero.
EPDMS ↑
Pairwise EC (%) ↑
k
Learned
+ Exec.
Learned
+ Exec.
1
39.99
39.99
45.2
45.2
2
44.46
44.84
–
–
4
44.56
45.04
43.5
47.9
8
50.96
52.48
42.9
50.3
16
54.19
56.34
42.8
54.1
Table 5: Candidate-count study with frozen DrivoR proposals. EPDMS follows corrected NAVHARD two-stage evaluation; pairwise EC is diagnostic. A dash denotes missing data.
Figure 4: Two-stage decisions on NAVHARD. Each pair of rows shows a real stage-1 observation followed by a synthetic stage-2 observation, with plans from Latent-WAM, SimWAM, and CodeWAM. Red denotes planned motion. Badges report frame EPDMS, with green indicating ≥0.8 and orange lower values. CodeWAM retains nonzero stage-2 scores in both examples; these badges are not combined two-stage scores.
Figure 5: Zero-shot transfer to nuScenes without fine-tuning. Each row shows camera and bird’s-eye views of CodeWAM’s prediction (red) and recorded human trajectory (dashed green), followed by pointwise L2 error in meters at 0.5-second intervals up to 3 s. Image badges average these six errors; they do not report the average of the three horizon-averaged metrics in Table 4 .
Figure 6: Consecutive decisions at 0.5-second intervals. Rows compare Latent-WAM, SimWAM, and CodeWAM; red shows the current plan and purple each method’s preceding plan. Badges report frame EPDMS. Below, planned speed profiles accompany the largest threshold-normalized EC difference, where values above one indicate inconsistency. CodeWAM passes all three continuity checks, while both baselines fail them.
Planner
Original
+ Exec.
Gain
Hydra-MDP
41.16
43.35
+2.19
DrivoR
54.56
56.70
+2.14
Table 6: Execution evaluation without retraining: corrected NAVHARD two-stage EPDMS ( ↑ ). Gains are score-point differences relative to the original planner.
Appendix figures & tables10 assets
Supplementary material from the paper’s appendix.
Appendix
Figure 7: Effects of successive planning components on NAVSIM v2 navtest. After the front-camera view, columns show the default policy plan, scene-score maximization, calibrated gain, the execution program, and local search, with components added cumulatively. From top to bottom, the examples show correction of an off-road proposal, rejection of an overrated alternative, resolution of execution inconsistency, and recovery through refinement. Green denotes recorded human motion and red the selected plan. Badges report frame EPDMS on [0,1] ; footer values report dataset-level navtest EPDMS in percent.
Figure 8: Examples resolved at different steps of the planning procedure. Scene scoring first produces a nonzero frame score in the top row, the execution program in the middle row, and local search in the bottom row. Refinement further improves the middle-row score from 0.95 to 0.97. Column order, trajectory colors, and score conventions follow Figure 7 ; footer values summarize navtest performance rather than these three examples.
Figure 9: Cases benefiting from local candidate refinement. The four variants preceding local search receive zero frame EPDMS, with off-road annotations in rows 1, 3, and 4 and collision/TTC annotations in row 2. Full CodeWAM obtains 1.00, 1.00, 0.95, and 0.99, respectively. These selected cases illustrate how refinement can recover from failures that remain after candidate re-selection. Column order, trajectory colors, and frame-versus-dataset score conventions follow Figure 7 .
Figure 10: Learned ranking and execution continuity in four scenes. In (a), darker blue indicates a higher learned candidate score and red marks the learned argmax. In (b), green and gray distinguish candidates that pass or fail the continuation test; counts give the number passing out of 34 candidates. The purple band denotes the plan issued 0.5 s earlier. In (c), blue shows the final CodeWAM plan and badges report frame EPDMS on [0,1] . The learned argmax fails the continuation test in every displayed scene despite the presence of compatible alternatives.
Figure 11: Additional candidate-selection examples on a bend, a curved urban road, and an intersection approach, using the columns and colors of Figure 10 . From top to bottom, 25, 24, and 25 of the 34 candidates pass the continuation test, while the learned argmax fails it in each case. Final CodeWAM plans achieve frame EPDMS of 1.00, 1.00, and 0.97. Continuation counts measure compatibility with the preceding plan; EPDMS also accounts for scene-dependent consequences.
Figure 12: Consecutive planning through a bend. Columns advance from t to t+1.5 s in 0.5-second steps; rows compare Latent-WAM, SimWAM, and CodeWAM. Red shows the current plan and purple the same method’s preceding plan; badges report frame EPDMS. Lower panels (a–c) show planned speed profiles in m/s, with shading marking departures from the preceding plan. Panel (d) reports the largest threshold-normalized EC difference; values above one indicate inconsistency. CodeWAM remains below this threshold at all three updates, while both baselines exceed it.
Figure 13: Another planning window through the bend, using the layout and conventions of Figure 12 . Both baselines fail the continuity test at all three updates. CodeWAM adjusts its planned speed while keeping the largest threshold-normalized EC difference below one and frame EPDMS at 1.00 throughout the window. The example shows that consistent decisions can accommodate changes in planned motion.
Figure 14: Consecutive decisions during a right turn, using the layout and conventions of Figure 12 . All three methods predict the same broad maneuver, but their planned speed profiles and cross-plan differences vary. CodeWAM passes all three continuity checks with frame EPDMS of 0.86–0.87. SimWAM reaches 0.94 at t+1.0 s but fails consistency at t+0.5 s and t+1.5 s, illustrating that a higher individual-frame score need not imply consistent successive decisions.
Figure 15: Additional NAVHARD second-stage comparisons. Each row pairs a synthetic observation with plans from Latent-WAM, SimWAM, and CodeWAM. Red lines mark planned trajectories; salmon and blue boxes denote the ego vehicle and other vehicles. Badges report frame EPDMS on [0,1] , with green indicating ≥0.8 and orange lower values. CodeWAM obtains nonzero scores in all six selected cases. These scores describe individual stage-2 plans, not the combined two-stage NAVHARD result.
Figure 16: Additional zero-shot predictions on nuScenes. Each row shows the camera observation, a bird’s-eye comparison with recorded human motion, and pointwise L2 error in meters at 0.5-second intervals from 0.5 to 3 s. Red denotes CodeWAM and dashed green the human trajectory. Image badges average the six errors within each example. The curves show both increasing long-horizon error and non-monotonic deviations; these per-example means differ from the average of the three horizon-averaged metrics in Table 4 .