# PhysAgentGym: Free Physical-Law Verifiers for Training Small Code-Reasoning Agents

*Lama Moukheiber*

[NeurIPS page](https://neurips.cc/virtual/2026/poster/153149) · [OpenReview](https://openreview.net/forum?id=NV5qjfDXZB) · [Open on the map](../papers.html#p153149)

Category: [LLM Agents, Evals & Benchmarks](../pcat/17.md) › [Verifier-Backed Evaluation of Agentic Reasoning](../pgroup/369.md) · Type: new method · Keywords: code reasoning, physics simulation, reward verification, small language models, QLoRA fine-tuning

Areas: [LLM Reasoning](../areas/reasoning.md) › Reasoning Optimization › Process Reward Modeling; [Code & Coding Agents](../areas/codegen.md) › Code Generation and Optimization › Code Generation; [AI Agents](../areas/agents.md) › Agentic Decision Making › Agentic Optimization and Evaluation; [Evaluation & Benchmarks](../areas/evaluation.md) › Language Model and Agent Benchmarks › Verification and Reasoning

## Summary
PhysAgentGym provides a free, rule-based verifier that uses closed-form physical laws as dense reward signals to train small code-reasoning agents without costly per-task annotations.

## Explained to a 5-year-old
A robot learns to solve physics problems by writing code that follows the rules of nature. Instead of asking grown-ups for answers, it uses the laws of physics as a free checker. It practices on many tiny physics puzzles and gets better at writing correct code. After practicing, a small computer program can solve new puzzles almost as well as big, expensive models. This makes it easier and cheaper to teach robots to think about the world.

## Explained to a 5-year-old, longer
Imagine a little robot that tries to figure out how things move in the world. Usually, people have to write many tests or ask experts to check its answers. That takes a lot of time and money, so it’s hard to teach robots many different subjects. The paper says that if a subject has clear rules, like the laws of physics, those rules can act as a free checker. The checker reads the robot’s code and sees if it follows the physics rules without any extra help. This way, the robot can practice on many tiny physics problems without needing anyone to write tests. The robot writes a piece of code that simulates a physics scenario, runs it, and gets a score from the checker. After many tries, the robot learns which code works best and which does not. The researchers collected many successful robot solutions and used them to teach a smaller computer program. The smaller program, called a 7-billion-parameter model, can solve new physics puzzles almost as well as the biggest models. It even works on physics problems it has never seen before, showing it can generalize.

## For a technical reader
The system uses physics laws as free reward signals, eliminating the need for hand-crafted tests or learned reward models. A rule-based verifier translates natural-language physics standards into executable predicates, scoring agent trajectories automatically. Successful trajectories are filtered to create an SFT corpus, fine-tuning small code models (1.5B-7B) with QLoRA. Results show the fine-tuned 7B adapter matches frontier models on physics tasks while using ~50× less compute and generalizes to unseen scenarios.

## Problem
Training code-reasoning agents typically requires expensive verification such as expert annotations or hand-written tests, which does not scale across many domains.

## Method
The approach leverages closed-form physical laws as automatic reward signals, employing a rule-based verifier that compiles natural-language physics standards into executable trajectory predicates, and uses the verifier to filter successful trajectories for supervised fine-tuning of small code models.

## Results
Two frontier models achieve aggregate scores of 0.944 and 0.945 on 1,320 physics tasks, while a 7B adapter trained with QLoRA reaches 0.942, matching frontier performance within 0.3 pp at roughly 50× lower inference cost and generalizing to out-of-distribution Damping within 0.8 pp.

## Contributions
The paper shows that closed-form physical laws can serve as free, dense reward signals for code-reasoning agents and introduces a rule-based verifier that automatically generates training data without per-task annotations. It also demonstrates that small models can match frontier performance when trained on this data and that scale improves out-of-distribution generalization.

## Limitations and assumptions
The approach is limited to domains that have closed-form physical laws, and performance may depend on the quality of the underlying physical model.

## Practical relevance
Enables cost-effective training of code-reasoning agents for physics and other law-based domains without expensive annotation.

## Research questions this paper is counted under

- [How can we generate scalable training data and environments for agents without costly human annotation?](../q/73.md)

This page was written by language models from the title and abstract of each paper, and the answers were checked by two other models. It can be wrong: check the paper itself. [Suggest a correction](../feedback/?on=p/153149)
