TL;DR
While large language models (LLMs) excel at standard coding tasks, generating code that accurately animates complex physical scenes remains a major hurdle. This paper introduces SimuScene, a novel benchmark and dataset designed to evaluate and train LLMs on generating executable code for physics-inspired animations. By leveraging a vision-language model (VLM) to provide visual feedback on rendered videos, the authors demonstrate a reinforcement learning approach that significantly boosts the animation capabilities of text-only models.
What Problem Does This Paper Address?
Current LLMs show remarkable prowess in mathematical reasoning and code generation. However, translating a natural language description of a physical event—such as a charged particle spiraling inside a hemispherical dome—into code that visually and qualitatively depicts those dynamics is an underexplored challenge.
Existing benchmarks primarily focus on static physical reasoning or text-based problem-solving. They fail to evaluate whether a model can generate executable code whose rendered output actually aligns with real-world physical intuition. This paper addresses this gap by establishing a rigorous framework to evaluate and improve text-to-code-to-video consistency for physics simulations.
Methods
The authors develop a multi-stage framework spanning data generation, evaluation, and model training:
- Automated Generation Pipeline: Using GPT-4o, the pipeline generates diverse physical scenarios based on 52 core concepts. For each scenario, it produces a set of binary (True/False) visual verification questions that describe the expected qualitative dynamics. A secondary review stage using DeepSeek-R1 ensures the question sets are sufficient to fully judge the described motion.
- Code-Video-VLM Evaluation: To evaluate a model, its generated Python code is executed to render an MP4 video. This video, along with the verification questions, is fed into a frontier VLM (Qwen2.5-VL-72B-Instruct), which judges whether the animation matches the text description.
- Code-Video-Judge RL Paradigm: To train models, the authors implement Group Relative Policy Optimization (GRPO). Crucially, instead of relying on text-only rewards—which are blind to actual visual behavior—they use the VLM's video evaluation as a binary reward signal, closing the loop between code generation and visual execution.
Datasets
The paper introduces SimuScene, a dataset containing 7,659 scenarios across five classical physics domains: mechanics, electromagnetism, optics, fluid mechanics, and thermodynamics.
- Training Set: Comprises 7,325 scenarios divided between Supervised Fine-Tuning (SFT) and Reinforcement Learning (RL) subsets.
- Test Set: A high-quality, 334-example human-verified test set where each scenario contains at least four verification questions to eliminate domain and concept bias.
Key Insights and Ideas
- High Execution, Low Alignment: Frontier LLMs are highly capable of writing syntactically correct code that runs without errors. However, they consistently fail to map the text's qualitative dynamics to the visual output, often missing key movements or violating basic physical constraints.
- The Blindness of Text-Only Judges: Text-only LLM judges are highly unreliable for this task because they try to infer runtime behavior purely from static code, leading to optimistic false positives. True evaluation requires rendering the video and observing the motion.
- Visual Feedback Empowers Text Models: Training text-only models using visual rewards derived from rendered videos significantly improves their physical reasoning and animation consistency, proving that models can learn to "visualize" the consequences of their code through RL.
Key Results
- Frontier Model Evaluation: Even the strongest baseline model, DeepSeek-R1-0528, achieved an Avg@8 accuracy of only 21.5% on the SimuScene benchmark, highlighting the task's extreme difficulty.
- Human-VLM Alignment: The VLM judge achieved an 87.8% agreement rate with human annotators, confirming its reliability as an automated evaluator and reward provider.
- RL Training Gains: Applying the Code-Video-Judge RL framework yielded massive improvements. A 7B model went from 0% base accuracy to 11.1% Avg@8 (and 34.4% Pass@8), performing comparably to much larger models. Meanwhile, a 32B model achieved the highest overall performance with a 72.2% Pass@8 accuracy.
Limitations and Future Work
The authors note that SimuScene targets qualitative physical dynamics and visual plausibility rather than numerically precise, calibrated simulations. Additionally, the benchmark currently relies on synthetically generated scenarios and simplified visual representations.
Future work will focus on expanding the benchmark to richer 3D environments, more complex material interactions, and longer sequences. The authors also suggest exploring multi-VLM adjudication and integrating auxiliary signals from physics engines to further improve evaluation reliability.
Summary updated