PhySimCode: A Benchmark and Evaluation Method for Physics Video to Code Generation
Organizations: Carnegie Mellon University · Amazon AGI
Abstract
Multimodal large language models (MLLMs) are good at video understanding and code generation, but it remains unclear whether they can recover the physical laws underlying videos, a capability essential for converting videos into executable simulations and for providing structured physical supervision in robotics. Captioning motion video does not imply that a model has inferred its governing dynamics, estimated quantitative parameters, or can regenerate the observed scene from code. Existing video-physics benchmarks evaluate plausibility, property estimation, or future-state prediction, but offer limited insight into whether models can translate visual dynamics into runnable simulation code. We introduce PhySimCode, a benchmark for physics video-to-code generation: given only a raw video, a model must infer the relevant physics, recover parameter values, and generate runnable Python that reproduces the input video. The dataset contains 160.6K procedurally generated samples spanning 162 physics phenomena across analytic SciPy simulations and PyBullet-rendered rigid-body, articulated, fluid, and contact-rich scenes; each sample bundles the simulation code, physical parameters, rendered video, and a structured chain-of-thought covering observations, laws, ODEs, numerical methods, and validation checks. We evaluate ten state-of-the-art closed- and open-source MLLMs along physical-law correctness, simulation equivalence, code executability, and parameter recovery. Models reliably state physics laws (4.27-4.93/5) yet score only 1.51-2.47/5 on inferring them from video, and the best system (Claude Sonnet 4.6) recovers just 7.7% of ground-truth parameters within , exposing a substantial video-to-simulation gap. The 2,430-video evaluation set is available at https://huggingface.co/datasets/SourajaKundu123/PhySimCode and the evaluation code at https://github.com/SourajaKundu/PhySimCode
Figures & tables
| Stage | Evaluation / Measurement |
|---|---|
| (i) Video understanding | Appearance equivalence (human), DINOv2/VideoCLIP (Table 4 ) |
| (ii) Physics understanding | Law correctness & equivalence (Table 3 ); parameter recovery (Tables 5 , 9 ) |
| (iii) Programming | Compilation; execution; video generation; CodeBLEU (Table 5 ) |
| End-to-end | Physical plausibility & equivalence (Table 4 ) |
Appendix figures & tables15 assets
Supplementary material from the paper’s appendix.
Appendix
| Physical Law Correctness | Physical Law Equivalence | |||||
| Model | Formula | Overall | Name | Statement | Formula | Overall |
| New frontier models | ||||||
| Claude Fable 5.1 | 4.40 | 4.33 | 3.47 | 3.13 | 2.90 | 3.00 |
| GPT-6 Astra | 4.73 | 4.50 | 3.27 | 2.87 | 2.63 | 2.80 |
| Grok 4.6 | 4.40 | 4.23 | 2.87 | 2.53 | 2.30 | 2.40 |
| Kimi K3 | 4.40 | 4.37 | 3.57 | 2.63 | 2.40 | 2.67 |
| Patchwise Video Similarity | ||
| Model | DINOv2 sim. | VideoCLIP sim. |
| New frontier models | ||
| Claude Fable 5.1 | 0.855 | 0.881 |
| GPT-6 Astra | 0.902 | 0.896 |
| Grok 4.6 | 0.781 | 0.869 |
| Kimi K3 | 0.863 | 0.903 |
| Param. Estimation | Code Generation and Execution | ||||||
|---|---|---|---|---|---|---|---|
| Model | Acc. ( 20%) | CoT | Code | Compile | No Errors | Video Save | CodeBLEU |
| New frontier models | |||||||
| Claude Fable 5.1 | 18.18% | 100.0 | 100.0 | 100.0 | 100.0 | 100.0 | 0.240 |
| GPT-6 Astra | 5.19% | 100.0 | 100.0 | 100.0 | 100.0 | 100.0 | 0.240 |
| Grok 4.6 | 9.09% | 100.0 | 100.0 | 100.0 | 100.0 | 100.0 | 0.237 |
| Kimi K3 | 12.99% | 100.0 | 100.0 | 100.0 | 100.0 | 100.0 | 0.244 |
| Model | Parse | Avg pred | Avg | Mean frac | Mean frac | Global | End-to-end |
|---|---|---|---|---|---|---|---|
| fails | params | matched | reported | within | accuracy | recovery | |
| claude_sonnet_4_6 | 0 | 7.7 | 3.29 | 0.460 | 0.171 | 0.185 | 0.0769 |
| gemini_2_5_pro | 96 | 5.5 | 2.83 | 0.399 | 0.150 | 0.170 | 0.0606 |
| gemma_3_12b_it | 330 | 4.8 | 1.94 | 0.281 | 0.130 | 0.163 | 0.0398 |
| glm_4_1v_9b_thinking | 420 | 4.0 | 1.93 | 0.273 | 0.147 | 0.199 | 0.0484 |
| gpt_5_mini | 465 | 8.4 | 3.17 | 0.426 | 0.139 | 0.178 | 0.0713 |
| Metric | Claude Sonnet 4.6 | GPT-5 Mini | Gap (GPT Claude) |
|---|---|---|---|
| Law equivalence – Overall | +0.27 | +0.30 | +0.03 |
| Law validity – Overall | +0.02 | ||
| CodeBLEU | +0.000 | ||
| Runs without error | pp | pp | pp |
| Video save | pp | pp | +0.6 pp |
| Param. Est. Acc. ( ) | +0.76 pp | pp | pp |
| Metric | ||
|---|---|---|
| CodeBLEU | +1.000 | 0 |
| Law validity - Statement | +0.976 | 0 |
| Runs without error | +0.976 | 0 |
| Law validity - Name | +0.952 | 0 |
| Law validity - Overall | +0.905 | 0.002 |
| Video save | +0.905 | 0.002 |
| Statistical parameters | Value |
|---|---|
| Median | 0.98 |
| Middle 50% (IQR) | [0.93, 1.05] |
| 90th / 95th percentile | 1.17 / 1.22 |
| Full range | [0.48, 2.12] |
| Parameters above 1.5 / below 0.6 | 3 / 4 (of 108) |
| Objects per category | – | – | ||
|---|---|---|---|---|
| SciPy | 61 | 9 | 1 | 0 |
| Kubric | 38 | 14 | 15 | 7 |
| Experiment | Samples | Seeded | |
|---|---|---|---|
| complex_collision_plane | 2 | 2500 | |
| accelerating_cart_sliding_mass | 4 | 2000 | |
| balls_in_basin | 4 | 2000 | |
| disk_spinoff | 7 | 1500 | |
| block_on_sphere_basin | 13 | 1300 | |
| molecule_2 | 12 | 1200 |
| Experiment | Var | Col | Samples | |
|---|---|---|---|---|
| multi_physics_arena | 47 | 5000 | ||
| tumbling_dice | 19 | 3705 | ||
| bouncing_balls_arena | 16 | 3120 | ||
| balloon_tether_wall_pull | 15 | 2925 | ||
| turntable_mirror_blocks | 12 | 2340 | ||
| rope_pendulum_swing | 14 | 2100 |
| Model | Frames | Param. Acc. | Naming Recall | Value Acc. | No Errors | Video Save | CodeBLEU | Prompt Tok. |
|---|---|---|---|---|---|---|---|---|
| Qwen | 8 | 5.84% | 0.384 | 0.155 | 78.4% | 82.7% | 0.203 | 2,327 |
| Qwen | 16 | 6.23% | 0.387 | 0.165 | 75.3% | 80.9% | 0.206 | 2,863 |
| Qwen | 32 | 6.31% | 0.399 | 0.168 | 71.0% | 72.8% | 0.206 | 3,937 |
| Qwen | 60* | 6.07% | 0.409 | 0.157 | 75.3% | 80.9% | 0.206 | 5,468 |
| Qwen | 80 | 5.76% | 0.408 | 0.143 | 77.8% | 80.2% | 0.208 | 6,190 |
| InternVL | 8 | 3.12% | 0.247 | 0.126 | 48.1% | 65.4% | 0.194 | 3,905 |
Physical Reasoning in Video
Physical reasoning in video studies how models infer, predict, and generate motion and interactions consistent with physical laws.
See all 74 papers