arXiv(opens in a new tab)cs.AIOct 2026Cited by 1 paper on PaperVantage

Manuscript Offprint

arXiv:2610.17288

PhysCodeGym: Benchmarking Coding Agents for Physically Verifiable 4D Reconstruction

Shuai Shao, Jinchen He, Cunxin Fan, Zihan Guo, Shijian Wang, Qihan Ren, Kangning Zhang, Zunnan Xu, Haoyuan Li, Hao Wang, Jianghao Lin, Weiwen Liu, Weinan Zhang

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Shuai Shao1,∗,†^{1,*,\dagger}, Jinchen He1,∗^{1,*}, Cunxin Fan1,∗^{1,*}, Zihan Guo2,3,∗,‡^{2,3,*,\ddagger}, Shijian Wang4^{4}, Qihan Ren1^{1}, Kangning Zhang1^{1}, Zunnan Xu5^{5}, Haoyuan Li2^{2}, Hao Wang6^{6}, Jianghao Lin1,‡^{1,\ddagger}, Weiwen Liu1,‡^{1,\ddagger}, Weinan Zhang1,‡^{1,\ddagger}

1^{1}Shanghai Jiao Tong University 2^{2}Sun Yat-sen University 3^{3}Shanghai Innovation Institute

4^{4}Southeast University 5^{5}Nanyang Technological University 6^{6}Carnegie Mellon University

Recon. Reference

Rigid body

Figure

Rotating arm triggering a domino cascade

Recon. Reference

Liquid

Milk pouring into a glass

Deformable

Recon. Reference

Figure

Uncovered teapot → Cloth draping → Covered teapot

Wind-driven

Recon. Reference

Figure

Flags fluttering in wind

Figure 1. PhysCodeGym benchmarks coding agents on 156 video-to-Blender reconstruction tasks spanning rigid-body, liquid, deformable, and wind-driven motion. Examples pair reference frames (top) with agent reconstructions (bottom). Evaluation measures visual fidelity, dynamic behavior, and physical validity.

Abstract

Building physical simulations from video requires coding

agents to translate observations into executable models and refine them through tool use. We introduce PhysCodeGym, a benchmark for physically verifiable 4D reconstruction with 156 tasks covering rigid-body, liquid, deformable, and wind-driven motion. Agents autonomously inspect videos, write and run Blender programs, and revise their scenes using simulation feedback. Six metrics combine rule-based

*Equal contribution. All four co-first authors agree that each may list their own name first when presenting this work.

†^{\dagger}Project lead. shaoshuai.ederson@sjtu.edu.cn.

1^{1}Co-corresponding authors. Weinan Zhang: wnzhang@sjtu.edu.cn.

measurements with rubric-based judgments to assess visual and physical reconstruction quality. Program inspection, scene measurements, and counterfactual interventions test physical consistency under original and modified conditions. Experiments with frontier coding agents reveal a tradeoff between artifact quality and completion across reasoning-effort settings, while harness comparisons and agent traces link verification behavior with reconstruction performance. Case studies show that matching visible objects and events can coexist with physical defects. Counterfactual tests further expose latent contact and support failures in reconstructions that pass ordinary physical checks, highlighting the gap between reproducing observations and building reliable physical models. Code is available at https://github.com/ShaoShuai0605/PhysCodeGym.

1. Introduction

Physics-aware reconstruction enables the creation of simulation-ready objects and scenes for applications in animation [55], gaming [22], manufacturing [57], and robot learning [34]. Specialized methods estimate scene geometry and physical properties within predefined representations and simulation pipelines [9, 30, 52, 53]. More recently, coding agents have emerged as a promising path forward by generating executable scene programs and revising them through execution and visual feedback [49, 61].

Recent frontier models, such as GPT-6 Astra, demonstrate substantially improved capabilities in executable 4D scene construction, creating an urgent need to quantitatively assess their physical fidelity. We argue that a benchmark for this purpose should meet three requirements. First, broad interaction coverage should span diverse processes such as contact, fluid flow, and deformation [5]. Second, hybrid assessments should combine rule-based checks with rubric-based judgments [59]. Rule-based checks provide precise measurements but are limited to predefined criteria. Rubric-based judgments can assess broader task requirements [29, 43], though they may miss physical violations [32, 36]. Third, agreement with observed motion and appearance does not ensure correct behavior under altered physical conditions [6, 8, 45, 49, 60, 64], motivating factual and counterfactual evaluation. For example, hardcoded motion trajectories may make balls appear to collide even when contact is disabled. While prior benchmarks cover subsets of these design choices, we argue that considering them jointly provides a holistic view of the capabilities and limitations of frontier coding agents in 4D reconstruction.

To this end, we introduce PhysCodeGym, a benchmark for evaluating coding agents on physically verifiable 4D reconstruction (Fig. 1). Given a reference video, an agent writes a standalone Blender script to create an editable scene and render its animation. Our benchmark comprises 156 tasks spanning rigid-body, liquid, deformable, and wind-driven dynamics, with scenarios involving collisions, suspension, pouring, and cloth deformation.

To enable systematic evaluation across all 156 tasks (Sec. 4.3), we provide object checklists, 578 timestamped event annotations, and task-specific physical requirements. The evaluation protocol combine these annotations with LLM-based and rule-based judges to compute six metrics. Five assess the submitted video for structural and perceptual similarity, object accuracy, event completion, and motion overlap. To support event completion scoring, we specify failure and uncertainty criteria and aggregate three independent judgments per submission by majority vote. The sixth metric, physical validity, is assessed through a task-specific measurement that combines code and scene inspection with frame-by-frame analysis of native states, contacts, and forces. The scoring further incorporates counterfactual checks, in which copies of the scene are rerun under altered physical conditions. For example, our protocol redirects a billiard ball toward the table edge to check whether it falls after losing support. To verify that our protocol reliably detects physical violations, we perform manual checks by perturbing submitted scenes and injecting known defects.

We evaluate nine coding agents to characterize their strengths and failure modes in 4D physical reconstruction. We find that, while these agents can reconstruct recognizable objects, they often struggle to accurately capture motion and physical interactions (Tab. 2). Moreover, reconstructions with perfect object and event scores can violate physical constraints, including energy conservation (Sec. 5.2). Our harness-level comparison further reveals that, at high effort, Codex achieves higher visual and event scores, while Claude Code has slightly higher motion overlap (Fig. 5). Reasoning effort presents an additional tradeoff: low effort completes more tasks and leads overall under a fixed budget, whereas max effort scores higher among successful tasks (Sec. 5.2).

Our contributions are:

• A benchmark for coding agents that building physical simulations. PhysCodeGym uses 156 tasks to test coding agents’ ability to build physics-aware Blender scenes. The tasks cover gravity and support, contact and friction, fluids, deformation, and wind-driven motion.

• A protocol for joint visual and physical evaluation. We combine LLM-based and rule-based judges with factual and counterfactual checks. Our diagnostic cases include reconstructions that pass object and event checks but fail native-scene audits or targeted interventions.

• An empirical study of coding agents for physical reconstruction. We evaluate leading agents on PhysCodeGym and study how their results vary with harness choice and configured reasoning effort. We highlight their strengths, failure modes and shortcut behaviors, informing future development of physically aware coding agents.

Table 1. Comparison of programmatic scene generation and reconstruction benchmarks. Task distinguishes generation (Gen.) from reconstruction (Recon.); Input specifies the conditioning modality and source (Syn.: synthetic). Visual Eval. assesses rendered appearance or spatial layout. Under Behavioral Fidelity, Event Eval. checks target actions or outcomes, and Motion Alignment compares motion against a reference. Under Physical Implementation, Internal Physics Checks inspect scene structures, physical parameters, or simulation states, and Mechanism Dependence uses matched physical interventions to test whether the modeled mechanisms drive the observed behavior. Harness lists reported execution workflows or interfaces. √ included, √ limited scope, × not evaluated under the column definition.

BenchmarkTaskInputVisual Eval.Behavioral FidelityPhysical ImplementationHarness
Event Eval.Motion AlignmentInternal Physics ChecksMechanism Dependence
Code4D [67]Gen.Text✓✕✕✕✕Multi-agent code loop
4DBuildBench [32]Gen.Text✓✓✕✓✕Multi-agent MCP
PhysCodeBench [56]Gen.Text✓✓✕✓✕Direct codegen. / SMRF
SceneActBench [68]Recon.Syn. frames✓✕✓✕✕Shared MCP
VisPhyBench [31]Recon.Syn. frames✓✕✓✓✕Codegen. + repair
MPMWorlds [26]Recon.Syn. video✓✕✓✕✕Scaffolded codegen.
BVB [48]Recon.Real video✓✕✓✕✕Mini-BVB
4DCodeBench [45]Recon.Real + Syn. video✓✓✓✓✕Native CLIs / Stirrup
OursRecon.Video✓✓✓✓✓Native CLIs (all models)

References (57)