PhysCodeGym Benchmarking Coding Agents for
Physically Verifiable 4D Reconstruction

Can coding agents reconstruct the physics behind a video?

We introduce PhysCodeGym, a benchmark of 156 video-to-program tasks spanning rigid-body, liquid, deformable, and wind-driven motion. Given a reference video, agents write, execute, and refine Blender programs to reconstruct the scene and its dynamics. We evaluate visual fidelity and physical validity through six metrics, combining rendered-video assessment with program inspection, native-scene measurements, and counterfactual tests.

GPT-6-Astra reconstructions across 144 tasks, from four examples to a full scene mosaic.
PhysCodeGym pipeline: a reference video defines the task; a coding agent observes, codes, runs, and compares Blender previews; independent evaluation checks objects, events, image and motion metrics, and physical validity through native-scene inspection and controlled re-simulation.
Reconstruction and verification pipeline. A reference video defines the task. The coding agent iterates between observing, coding, running, and comparing rendered previews before submitting its scene program. Independent evaluation combines visual and motion metrics with rubric judgments, native-scene inspection, and controlled re-simulation. Visual and physical scores are reported separately.

Benchmark

PhysCodeGym contains 156 video-to-program tasks across rigid-body, liquid, deformable, and wind-driven motion. Each reference is eight seconds long at 30 FPS. Agents submit a runnable Blender program and its native scene; evaluation measures both the rendered video and the mechanisms that produce it.

The public release includes task-specific object, event, and physical-validity rubrics. 43 tasks include counterfactual checks within physical validity.

Browse scenes

Six physical failure cases +

All six reconstructions score Sobj = Sevt = 1, yet program inspection and scene measurements expose physical defects.

Leaderboard

GPT-6-Astra leads the nine evaluated configurations with an overall score of 0.663 (visual: 0.693; physical: 0.633). All nine score higher on objects than events. Motion remains difficult: the highest motion score is 0.324.

Main table · 9 configurations · high effort
Six metrics and aggregates for nine model–harness configurations; higher is better
RankModelHarnessSSIMLPIPSObjectS_visEventMotionValidityS_physS_tot ↑

Source: current manuscript, Table 2. Values retain the paper’s displayed precision and lie in [0, 1]. LPIPS denotes clip(1 − distance, 0, 1).

Coverage and provisional physical scores +

Each configuration targets 156 tasks. Missing artifacts receive zero on every metric. Repeated tasks use the latest run with a rendered artifact, not the highest-scoring run.

Provisional validity uses lower endpoints of rubric-score intervals. Technical gaps for existing artifacts are omitted; registered missing-artifact zeros remain. S_phys is computed per task, then averaged over the same available subset as validity. It cannot be reconstructed by averaging the differently covered Event, Motion, and Validity columns.

Model-level S_tot averages the displayed S_vis and S_phys. Equivalence to a six-metric mean requires identical averaging sets for all six metrics.

Similar visual scores can hide different capabilities.

GPT-6-Luna has a slightly higher visual score than GPT-5.6-Luna (0.505 vs. 0.500), but lower event (0.393 vs. 0.448) and motion scores (0.128 vs. 0.157). The component metrics reveal differences that a single rank conceals.

Analysis

We examine resource use, reasoning effort, and harness settings to understand what shapes reconstruction quality.

Resource use and quality

Figure 3a: overall reconstruction score versus estimated API cost per task on a logarithmic axis, with model labels and the Pareto frontier

Estimated API cost

GPT-5.6-Sol scores 0.570 at approximately $3.40 per task, while GPT-6-Astra reaches 0.663 at $11.57—3.4 times the cost. Both lie on the estimated-cost Pareto frontier.

Figure 3b: overall reconstruction score versus recorded tokens per task in millions on a logarithmic axis, with model labels and the Pareto frontier

Recorded token use

DeepSeek-V4.1-Flash uses 16.98M tokens per task, nearly three times GPT-5.6-Sol’s 5.70M, but scores 0.450 versus 0.570. Cumulative tokens include repeated context and do not directly measure effective reasoning.

Paper results for DeepSeek-V4.1-Flash at low, high, and max reasoning effort: visual metrics, physical metrics, and aggregate scores

Reasoning effort and task completion

Under the same 3-hour and 20-launch limits, low effort leads overall (0.476), mainly through higher task completion. Among produced artifacts, max scores 0.547 versus low’s 0.527, revealing a completion–quality tradeoff.

Paper comparison of DeepSeek-V4.1-Flash at high effort in Claude Code and Codex across six metrics and aggregate scores

Harness and verification

At high effort, Codex scores 0.479 overall versus Claude Code’s 0.450, with the largest gain in event reconstruction (0.550 vs. 0.446). Agent traces suggest that verification timing and budget allocation may contribute to this difference.

FAQ

What does the agent reconstruct from a video?

The agent writes an executable Blender program that builds the objects, materials, camera, and lighting, and sets physical properties, initial conditions, constraints, and forces. The submission includes the program and the native scene it generates. This makes the reconstruction runnable, inspectable, and available for re-simulation under changed conditions.

How are physical parameters determined from a video?

The reference scene’s source program and physical parameters are not provided. The agent chooses parameters from the visible appearance, motion, and interactions, then runs the scene, inspects previews, and revises its program; the benchmark does not prescribe a single parameter-estimation algorithm.

A single video does not uniquely identify every physical parameter. Equivalent implementations are accepted when they reproduce the observations and satisfy the task’s physical requirements; exact hidden geometry and true parameter values are not required.

How is motion generated in the reconstructed scene?

Core-object motion must arise from physics solvers, forces, constraints, and initial conditions. For example, dominoes should fall through successive collisions, rather than following a separately scripted falling trajectory for each piece. Explicitly modeled external actuators are allowed, provided that the objects they act on respond through physical interaction. Scripted core-object trajectories and forces with no counterpart in the reference, such as an attractor steering a ball along a prescribed path, do not satisfy this requirement.

How do you check whether the reconstruction is physically valid?

Each task has a manually annotated physical rubric specifying the permitted setup, actuation, and mechanisms to verify. A verification agent reads the program and native scene, identifies the relevant objects, and writes and executes Blender/Python probes to inspect how motion is produced and measure contact, support, and object states over time. Each judgment is supported by source references or measured evidence; rendered appearance alone is insufficient.

What happens when the physical conditions are changed?

For tasks with counterfactual checks, the verifier copies the scene, changes a specified force, contact relation, or initial condition, and re-simulates it against the unchanged baseline. For example, if a ball moves a target through collision, removing their contact while preserving the ball’s incoming motion should eliminate the target’s impact-induced response. The verifier confirms that the intervention takes effect and uses control scenes to check the measurement before judging whether the required physical dependence holds.

Can a reconstruction look correct but still fail the physics checks?

Yes. Scripted trajectories, hidden supports, or incorrect collision geometry can reproduce the reference frames while producing an invalid physical response. Even when object and event scores are high, program inspection and scene measurements can reveal these defects. Conversely, a scene with a valid physical mechanism may still miss the reference event, so visual fidelity, event reconstruction, and physical validity are assessed separately.

How is reconstruction quality measured?

Visual quality covers frame structure, perceptual similarity, and object correctness. Physical quality covers events, motion patterns, and physical validity. We report the component metrics alongside visual, physical, and overall scores to distinguish appearance mismatches from mechanism failures.

How scores are combined

S_vis = (SSIM + LPIPS + Object) / 3
S_phys = (Event + Motion + Validity) / 3
S_tot = (S_vis + S_phys) / 2

These formulas define the per-task aggregates. Model-level scores follow the coverage and provisional-score rules described below the leaderboard.

Events use three independent judgments and a majority vote per item. Failure of a task-defining key event caps the event score at zero. Counterfactual checks are criteria within physical validity, not a seventh metric.

BibTeX

Based on the local manuscript. Public preprint identifier and publication metadata are pending.