Skip to content

EMPIRIC — agents that write physics-engine extensions as code to learn unknown dynamics

EMPIRIC is an agent that treats a conventional physics engine as a fixed base and writes only the missing physics as code — subclassing the simulator to add forces, constraints, and hidden state (glue cure times, airflow decay, deformable fill levels) and then fitting the parameters of its own program from a small number of real experiments. Across five simulated domains (Bridge, Balloons, Boil, Fan, Domino) with 5 seeds each, EMPIRIC solves 25/25 tasks, matching an oracle given the true dynamics, while coding-agent baselines (direct, standalone sim per WorldCoder, scene-aware per SimFoundry) solve 14-16/25 on the same Claude Opus 5 backbone. The method transfers to a real robot that learns a decaying wind force and two unknown domino masses from two gusts and plans a knock-down with a predicted-vs-observed error of 9.9 cm vs 10.1 ± 2.3 cm. The accompanying RoboDisco suite contributes 22 physics-rich robot environments (glue, heat, wind, magnets, lasers, hidden wiring) each shipped with a solved task and a one-line reproduction command.

  • Writing only the physics the base engine lacks — as readable Python subclassing the simulator — generalizes better than letting the agent regenerate the whole world model: on 5 domains × 5 seeds, EMPIRIC solves 25/25 while a WorldCoder-style standalone-simulator baseline solves 16/25 and a direct coding agent reaches 16/25 even when given the scene assets and engine code [Fig. results-bar-chart].
  • The agent’s learned programs are small, auditable, and parameter-fittable: in Bridge, the agent writes a weld rule that fuses two glued end faces once they touch, with a docstring recording its experimental observations (glue levels 0 → 0.2 → 0.4 → 1.0 as the nozzle is held in place), and parameters (largest gap that still cures, lateral offset tolerance) fitted from recorded block poses [simulator.py excerpt].
  • The learning loop is a 6-step act → write-or-revise → infer-parameters → infer-hidden-state → rehearse → check cycle, with belief maintained over both program parameters and hidden state (e.g. per-joint cure progress), and plans selected by running the likeliest draw from the posterior [Fig. 2 learning loop].
  • Models transfer to unseen test configurations within each domain: a Bridge span one block longer than any training example, a Balloons cascade that turns a corner, a Boil task with two jugs instead of one — each solved by the same program learned from early experiments [Fig. 3 recorded runs].
  • Sim-to-real holds for programs the agent writes about unseen physics: on a real robot facing a fan whose wind pattern and both domino masses are unknown, EMPIRIC infers a decaying post-fan wind force from two gusts and plans a sequence that knocks the green domino 9.9 cm against a predicted 10.1 ± 2.3 cm.
  • Ablations isolate the two load-bearing design choices: removing explicit uncertainty over program parameters drops 25 → 21, and removing the harness-fitting step drops 25 → 20, suggesting both the Bayesian posterior and the parameter-fit loop are necessary for the gap to oracle-dynamics [Fig. results-bar-chart].
  • RoboDisco contributes a 22-environment benchmark suite for world-model learning and causal discovery, with task domains spanning glue, heat, wind, magnets, lasers, and hidden wiring — released as one-line-runnable environments with reference solutions.

Starting from a conventional physics simulator (contact, friction, rigid body dynamics as given), EMPIRIC writes a Python subclass that adds the missing physics as new forces, constraints, and hidden state variables. The agent runs the 6-step loop: (1) Act — execute a plan or targeted experiment on the real system; (2) Write/revise the simulator program and the predicates it uses to check skill outcomes; (3) Infer a Bayesian posterior over program parameters (e.g. glue cure time); (4) Infer the current hidden state (e.g. cure progress on each joint); (5) Rehearse candidate plans under samples from the posterior and execute the most likely successful plan, or run a diagnostic experiment; (6) Check each skill outcome with the learned predicates — a failed check halts the plan. The Bayesian treatment of program parameters distinguishes EMPIRIC from pure code-generation baselines (WorldCoder-style, direct-agent) which produce a single point-estimate program and have no mechanism to represent uncertainty about physics constants.

  • 25/25 on 5 simulated domains × 5 seeds, matching oracle dynamics; coding-agent baselines score 14-16/25 even with scene + engine access.
  • Ablation ladder: EMPIRIC 25, oracle 25, no-explicit-uncertainty 21, no-harness-fitting 20, direct agent (CaP-X style) 16, standalone sim (WorldCoder style) 16, direct + scene (SimFoundry style) 14 — all on Claude Opus 5.
  • Real robot: infers decaying wind force and two unknown domino masses from two gusts; predicted knock distance 10.1 ± 2.3 cm, observed 9.9 cm.
  • Test-time generalization within domain: longer bridge spans, cornered balloon cascades, two-jug boiling all solved from programs learned on simpler initial experiments.

EMPIRIC stakes out a new cell of the Simulator-in-the-Loop Refinement design space: where SIMPACT: Simulation-Enabled Action Planning using Vision-Language Models has the VLM author the full simulator per episode and reason over rollouts, EMPIRIC keeps a fixed base engine and only writes deltas as readable code with Bayesian uncertainty over its parameters — closer to how a physicist writes a term in a Hamiltonian than how a VLM writes a scene from scratch. This is also the first filed artifact that pairs world-model-as-code with explicit parameter posteriors, connecting World Foundation Models to the auto-research self-improvement thread in AI-for-AI Research where the agent is doing physics discovery rather than architecture search. Compared with Enabling Robust Cloth Manipulation via Inference-Time Simulator-in-the-Loop Refinement SILR (handcrafted physics simulator + MPPI) and DriftWorld: Fast World Modeling through Drifting DriftWorld (learned video WFM + best-of-N), EMPIRIC’s bet is that interpretable code with uncertainty generalizes better than either a frozen analytic simulator or a frozen learned WFM — the 25/25 vs 14-16/25 gap on the WorldCoder/SimFoundry baselines is the sharpest datapoint on file in favor of the “write deltas, not the whole model” position.