Language models can write short programs that control household robots, run them in a simulator, read the errors, and fix the code. Every published system that does this well uses a very large proprietary model. Separately, a body of work on "emergent" reasoning shows that small models get worse, not better, when asked to check and correct their own work. We propose to test whether that failure belongs to small models or to the feedback they are given. Our hypothesis is that small models fail at self-repair mainly because ordinary error signals ("task failed", or a stack trace from deep inside a simulator) make them search the whole program for the fault. If each physical precondition (hand must be empty, cupboard must be open, top object must be cleared) is written into the generated program as a runtime check, the simulator names the exact failing step and the physical reason. The model then only has to fix one small piece.
The two-sentence version is this. We compile physical preconditions into assertions inside robot control programs and restrict repairs to local edits at the failing assertion. We then measure, across model sizes from under 1B to about 70B parameters, whether this moves the scale at which iterative self-repair starts to help. The result matters beyond robotics. It separates two readings of the "reasoning threshold": a fixed internal capacity limit, or a limit on how well the model can locate its own errors. Only the second can be engineered around.
Core Claim
The scale at which self-correction begins to pay off is not a fixed property of the model. It depends on how much error-finding the feedback leaves to the model. When feedback both localizes the fault to one step and states its physical cause, the scale floor for useful repair should drop well below the 2B to 7B range reported for self-verification and one-pass repair. When feedback is coarse, the floor should stay where prior work puts it.
A simple independence model shows why. Suppose a program has $k$ physically dependent steps, each written correctly with probability $p$, and the model can fix a single identified faulty step with probability $q$ per repair round. Open-loop success is then $p^k$. With $R$ rounds of localized repair it becomes
$$ S_{\text{local}} = \big(1-(1-p)(1-q)^R\big)^k, $$
because each step fails only if it is written wrong and every local repair of it also fails. With coarse feedback the model must first find the faulty step among $k$ candidates, so the useful per-round repair probability shrinks toward $q/k$ or below. That turns a mild requirement on $q$ into a harsh one as tasks get longer. This is the compounding-probability account of emergence described in the file. Here it is applied to the repair process rather than to generation. The model predicts that localization matters most for long tasks and for small models. It also predicts that assertion-level feedback should flatten the curve of success against scale, rather than simply shift it upward.
The contribution of inductive bias alignment here is structural. It is not a learned human prior bolted on. Human function learning breaks signals into a small grammar of interpretable parts (Schulz). Relational bottlenecks restore extrapolation in transformers that otherwise fail at it (Cohen et al.). Both motivate constraining the hypothesis space instead of enlarging the model. We apply that lesson to the space of edits. Programs follow a fixed compositional form, one subroutine per subgoal, with each primitive action wrapped by its declared preconditions. Repairs are drawn from a small grammar: insert an action that achieves the precondition before the failing call, reorder two sibling calls, rebind an object argument, or split a subroutine. This is how people describe fixing a plan ("open it first", "put that down before picking this up"). We treat it as a hypothesis to test, not an assumption.
Relation to Prior Work
The mechanism combines two lines that have not met. Code-refinement systems for robots debug generated Python against simulator exceptions and task-completion checks. RobotGPT uses separate ChatGPT agents to write code, write evaluation assertions on final state, and correct up to three times in PyBullet. LearnAct has GPT-4 grow and revise Python macro-actions after failures in AlfWorld. Code as Policies writes such programs open-loop with Codex. All three check whole-task outcomes or raw tracebacks rather than per-step physical preconditions, and none varies model size. We borrow their program-as-policy representation and their refinement loop. What we change is the feedback channel and the edit space.
Precondition-recovery systems supply the other half. CAPE shows that explicit causal feedback about a failed precondition, unlike a generic failure message, raises VirtualHome plan correctness from 28.89% to 49.63%. ConceptAgent feeds predicate violations into a tree search in which an 8B model beats a 70B model using plain step-by-step reasoning. Both operate on discrete action tokens, not editable programs. Neither maps where the benefit disappears as models shrink. These papers motivate our claim that explicit causes matter, and CAPE's finding is the strongest evidence for it.
The scaling papers constrain the design and set the null hypothesis. Backward self-verification hurts accuracy at 0.4B and 1.3B and helps only around 7B and above (Weng et al.). One-pass program repair stops tracking explanation quality below about 2B (Koutcheme et al.). Learning from self-generated explanations of past errors helps 7B models but hurts Gemma-2B (Self-AMPLIFY). If our intervention leaves these floors unchanged, the capacity reading wins.
E²CL complicates this picture. A 77M model trained on error corrections beats a 783M model trained only on successes. That suggests small models can repair when trained to, though only over symbolic actions. Finally, Ellis's Bayesian program induction re-weights LLM-proposed Python hypotheses with a prior fit to human choices. It is single-pass, abstract, and run on a frontier model. We take from it the idea of constraining program hypotheses in human-aligned ways. We do not attempt its fitted human prior, which would need behavioral data we do not have for embodied repairs.
Research Program
We will build a compiler that turns each environment's action model into guarded primitives. In VirtualHome and AlfWorld, every action such as grab, open, or put-in is wrapped so that, before executing, it checks the simulator state against the action's preconditions. The compiler derives these from the environment's own rules, the same kind of rules that the Embodied Agent Interface uses to flag trajectory-feasibility errors. It does not hand-write new ones. When a check fails, the program halts and reports three things: the subroutine and line, the violated predicate, and the offending objects. For example: "line 9 in serve_drink: grab(mug) requires a free hand; the hand holds plate."
A model is prompted to write a program in the fixed compositional form. It then runs a repair loop in which it must choose one operator from the edit grammar and fill in its arguments. The rest of the program is frozen, and the loop runs up to a fixed number of rounds.
The core study is a factorial sweep. One factor is model size, using a single open model family with checkpoints from below 1B to about 70B so that architecture and data stay roughly fixed. The second is feedback type, at four levels: none, generic failure, raw traceback, and localized precondition assertion. The third is edit space, either free rewrite or grammar-restricted. For every cell we measure the repair gain, meaning final success minus round-0 success. From this we estimate the smallest size at which the gain is reliably positive.
A second study addresses the "scaffold versus real capacity" question raised in the file. We fine-tune small models on repair trajectories collected under localized feedback. We then test them under coarse feedback only. If their ability to find their own errors has improved, the gain should persist partly. If the assertions were only an external crutch, it should vanish.
Baselines
The naive reference is single-shot program generation at each model size with no repair, scored for task success and for the share of failures that are physical-feasibility violations. This sets $p^k$ empirically and shows how much any loop adds.
The most important competitor is best-of-N resampling at matched compute. The same model draws independent programs until the total generated tokens equal those spent by the repair loop, and a program is accepted if it passes execution. Below the reasoning floor, resampling may beat repair, because fresh samples avoid the error-reinforcement that iterative prompting is known to cause (Srivastava et al.). Our method counts as beating it only if, at the same token budget and the same model size, localized repair reaches higher success. We will report this crossover per size.
The strongest existing method on AlfWorld is LearnAct, which reports 72.2% success with GPT-4 against 54.7% for ReAct with Reflexion. We will re-implement its unrestricted code-revision loop on each open model with the same prompts, round limit, and token budget as ours. No reported result was found on Lacuna for LearnAct-style refinement with models under 7B, so that part of the curve is new measurement. On VirtualHome, the reference is CAPE's reported 49.63% plan correctness with explicit precondition feedback. We will re-run CAPE's symbolic corrective-action scheme on the same open models. This isolates the question of whether code with edit grammar adds anything beyond explicit causal feedback. As a ceiling, we will report a frontier model zero-shot on the Embodied Agent Interface, where o1-preview averages 74.9%.
Two ablations isolate the key ingredient. The first keeps the assertion's predicate text but removes the line and subroutine location, so it separates "why" from "where". The second keeps full localized feedback but allows free rewrites, which tests whether the edit grammar matters. All tuning, meaning prompt variants and round limits, gets the same small search budget in every condition, chosen on a held-out task split.
Why not just…?
Why not just use a bigger model? Scale helps but does not close the physical gap. On the Embodied Agent Interface, o1-preview reaches only 74.9%, and trajectory-feasibility errors account for 45.2% of failures. RobotGPT reports direct GPT-3.5 control at 38.5%, and as low as 8% on harder tasks. Our question is also a different one: what makes the capability available below that scale. The frontier ceiling is reported alongside, not treated as the target.
Why not just give CAPE-style explicit feedback without code? This is a real threat. CAPE's gain may already capture most of what localized assertions provide. The matched CAPE baseline settles it. If symbolic corrective actions with explicit causes match our programs at every size, the conclusion is that feedback content, not program structure, lowers the floor. We would then drop the code-specific claims. We expect code to win on long tasks, where reusable subroutines prevent the same precondition error from recurring. The per-task-length analysis tests exactly that.
Why not just resample instead of repairing? For the smallest models this may well be right, given Weng et al.'s finding that self-verification hurts at 0.4B and 1.3B. The matched-compute best-of-N baseline is designed to find where repair overtakes resampling. A shift of that crossover toward smaller models under localized feedback is our main result. No shift is the main negative result.
Why not just fine-tune small models on error corrections, as E²CL does? E²CL shows this works for symbolic actions, and we include it as the second study rather than as a rival. The question is whether training under localized feedback produces error-finding that transfers to coarse feedback. Plain fine-tuning without the assertion channel is run as its own condition, so the contribution of each can be separated.
Proposed Experiments and Decisive Checks
We evaluate on VirtualHome tasks scored by plan correctness and executability, as CAPE does. We also evaluate on AlfWorld success rate, with Embodied Agent Interface feasibility diagnostics counting missing steps, extra steps, and precondition violations. Long-horizon tasks are split by number of dependent steps so the $k$-dependence of the independence model can be checked directly.
The first decisive check is the threshold plot: repair gain against log model size, one curve per feedback type. The hypothesis is supported if the localized-assertion curve turns positive at least one model size earlier than the traceback and generic curves, and beats matched best-of-N there. It is refuted if all curves cross zero at the same size.
The second check is whether the "where" ablation removes most of the benefit at small sizes but little at large ones. That is what the localization account predicts, and it would argue against a simple story in which smaller models just need more information.
The third is the transfer test from the second study. There, lasting gains under coarse feedback would indicate the floor itself moved, while their absence would mean the assertions are only a scaffold. Either outcome answers the scale-versus-feedback tension identified in the file.
References
- Probing the Compositionality of Intuitive Functions
- Beyond Transformers for Function Learning
- RobotGPT: Robot Manipulation Learning From ChatGPT
- Empowering Large Language Model Agents through Action Learning
- Code as Policies: Language Model Programs for Embodied Control
- CAPE: Corrective Actions from Precondition Errors using Large Language Models
- ConceptAgent: LLM-Driven Precondition Grounding and Tree Search for Robust Task Planning and Execution
- Large Language Models are Better Reasoners with Self-Verification
- Using Program Repair as a Proxy for Language Models' Feedback Ability in Programming Education
- Self-AMPLIFY: Improving Small Language Models with Self Post Hoc Explanations
- E²CL: Exploration-based Error Correction Learning for Embodied Agents
- Human-like Few-Shot Learning via Bayesian Reasoning over Natural Language
- Embodied Agent Interface: Benchmarking LLMs for Embodied Decision Making
- Do Users Write More Insecure Code with AI Assistants?