RE-0: Verified Recursive Improvement of Embodied Code-as-Policy Agents through Local On-Policy Distillation
RE-0 recasts self-improvement of embodied Code-as-Policy agents (LLMs that execute long-horizon manipulation by writing and running robot programs) as a locate–verify–weight recursion over student-induced failure histories. A diagnostic agent localizes the earliest plausibly-causal failure boundary in a student rollout; a teacher emits a minimal repair contract; the environment is restored to a saved snapshot and the correction is executed against the student baseline from the same state under shared randomness; only interventions whose paired counterfactual advantage passes a lower-confidence-bound gate become supervision for on-policy distillation (RE-OPD). A finite-sample bound shows per-round student gain is lower-bounded by verified intervention gain up to verification + projection error. Across six long-horizon robosuite tasks, 3–67 verified rows lift base-model success from 4–68% to 62–100%, with the LCB admission gate — not advantage weighting — identified as the load-bearing variable; a 76%→58% regression on one task is caught by the stage-entry criterion rather than silently propagated.
Key claims
Section titled “Key claims”- RE-0 defines local teacher credit on student-induced histories as the expected counterfactual advantage of a bounded teacher correction over the current student from the same snapshot, under shared randomness, with control returning to the student after the segment — not teacher trajectory return or global success rate [§3.1, Eq. 1].
- Repair contracts are proposed by a teacher diagnostic in monotonically-increasing scope and verified in order; only the smallest verified scope is admitted, so “minimal necessary repair” is the smallest scope passing the gate rather than the shortest candidate string [§3.2].
- The counterfactual verifier is a paired same-state LCB with two-layer confidence radius controlling both teacher-candidate and rollout sampling error, allocated across the whole recursion via a Boole union bound for simultaneous coverage [§3.2, Eq. 2].
- A performance-difference-lemma argument shows the hybrid policy’s expected gain satisfies with high probability, where is the verified intervention gain and collects snapshot-restoration and execution-identity errors [§3.2, Eq. 4].
- RE-OPD distills the verified local hybrid into the student via a KL projection that factors exactly into a student-retention term plus a credit-weighted teacher-projection term, where supervision weight is the verified counterfactual advantage [§3.3, Eq. 5].
- The main theorem (Theorem 1): under bounded returns + valid contracts + simultaneous-coverage LCB + bounded occupancy-weighted projection error, per-round student gain is with probability , no global teacher dominance required [§3.3, Eq. 6].
- Cold-start (RE-OPD-cold, teacher in the seat) and refinement (RE-OPD-refine, student in the seat) share all machinery; the guarantee transfers verbatim regardless of who occupies the seat, so even a teacher that cannot complete the task contributes trajectories inheriting verified self-improvement credit [§3.4, Proposition 1 and Corollary 1].
- The load-bearing variable is verified corpus composition, not weighting: on the
liftjournal across three trainer seeds, LCB admission beats unfiltered (6/50, 2/50, 3/50), sign-only () selection (5/50, 4/50, 4/50), and outcome-based teacher-program selection (5/50, 9/50, 4/50) with 11/50, 5/50, 13/50 — all with the identical training recipe [§4.4, Table 2]. - Cold-start lifts base-model success from 4–68% to 62–100% with just 3–67 verified rows across six tasks (
restack62% / 3 rows,lift76% / 7 rows,nut88% / 27 rows,spill100% / 67 rows,door100% / 40 rows,cubestack100% at saturation / no training) [§4.2, Table 1]. - Row count is not monotonic with gain —
restackreaches 62% on 3 rows whilenutneeds 27 — the decisive factor is per-row verified credit, not corpus size [§4.2]. - The same gate used as a measurement instrument produces a monotone teacher-effect ladder before any training: student self-play 0/34 admitted, narrow local experts 0/32 admitted (10% rescue ceiling + deterministic contract-format failures), strong API teacher 4 admitted on 13 events (19–47% rescue rates) [§4.3, Table 6].
- The strict LCB gate costs no sensitivity: admitted events cluster at while abstained events sit at , and sweeping the threshold 0.24 → 0.01 leaves the admitted set unchanged [§4.3, Fig. 3c-d].
- The gate is two-sided: one API-emitted patch dropped the baseline 8/16 → 1/16 () and was rejected — credit assignment is a sign decision on the intervention’s causal effect, not one-directional imitation [§4.3].
- GRPO with terminal rewards fails on the same tasks: entropy collapses from 0.30 → 0.002 and transfers 0–1/50 on non-saturated tasks vs base 8%/68%/4%, retaining only the already-saturated task — sparse terminal reward cannot localize the harmful decision inside a long program [§4.3].
- The outer acceptance criterion catches a regression:
liftadmits one event with thin verified credit (), the projection regresses from 76% to 58% with branch collapse (reproduces at seed 2, 76% → 46%), and the stage-entry check halts the recursion rather than propagating the regressed checkpoint — a measured safety property, not just an upper bound [§4.2, Remark 1]. - Weight-scale and normalization ablations on a fixed verified corpus cannot recover the gain and can induce catastrophic forgetting — isolating the load-bearing variable to what enters the corpus, not how the entered rows are weighted [§4.3, Appendix E].
- The distilled teacher-free student transfers to a dual-arm AgileX PiPER platform zero-shot with no hardware-specific policy edits: 13/20
restack, 12/20nut, 20/20spill, 20/20cubestack, 2/20lift; hardware deployment makes no teacher calls [§4.5, Fig. 4].
Method
Section titled “Method”RE-0 instantiates the locate–verify–weight recursion in three coupled modules operating on student-induced trajectories.
Localization. For each failed rollout , a student-side diagnostic agent inspects runtime exceptions + unrealized expected effects + other structured evidence and outputs the earliest candidate failure history with its full simulation snapshot . If no causally-consistent executable boundary is found, no teacher call fires. A teacher-side diagnostic then emits repair contracts in increasing scope cost — each contract fixes the repair boundary, the allowed program symbols and API surface, and the maximum segment length.
Verification. For each contract in increasing scope order, the environment is restored to . Under shared downstream randomness , the contract-constrained teacher distribution and a student resample are executed, control returns to the student after the segment completes, and the paired counterfactual advantage is the -average of return differences minus a scope cost . A two-layer confidence radius bounds both teacher-candidate and rollout sampling error; a Boole union bound allocates radii across all verified histories in the whole recursion for simultaneous coverage at level . The smallest contract passing both LCB and the execution-safety / program-context / snapshot-identity predicate is admitted. Rewind semantics: the live attempt that localized and the verification pass from the snapshot share the same snapshot, so the first pass is a common data-collection cost that cancels in the per-round bound.
Projection. The verified local hybrid is projected into a teacher-free student via a KL objective that factors into a student-retention term + a credit-weighted teacher-projection term (Eq. 5), with weight equal to the verified LCB advantage. The teacher is black-box (no conditional distributions), so RE-OPD uses the trajectory-level hard estimator — the loss is standard SFT weighted by verified credit, with the identical optimizer family as a plain SFT baseline. The difference from vanilla SFT is not the loss form but what enters it: supervision locations, per-event weights, and the retention term are decided by environment verification, not teacher sampling. After each projection, trajectories are regenerated with the new student and credit is re-allocated on the new occupancy. Termination is structural — if the gate closes almost everywhere (headroom exhausted or teacher effect below the verification noise floor ), Eq. 5 degenerates to retention and the recursion safely abstains.
Measurement guard (Remark 1). The per-round bound guards the credit level; a separate deployment criterion compares a held-out stage-entry evaluation to a threshold and halts if the projection regresses. This is what catches the lift 76% → 58% branch collapse at seed 1 and 76% → 46% at seed 2.
Results
Section titled “Results”- Six long-horizon robosuite tasks (
restack,spill,nut,lift,cubestack,door) spanning single/dual arms, rigid/articulated objects, coarse/fine manipulation. Base-model success spans 4% (lift,nut) to 100% (cubestack). Held-out eval = 50 paired seeds per task with Wilson 95% CIs; collection seeds always disjoint [§4.1]. - Flash-API teacher as single-shot primary policy (no RE-0 loop): 4%/68%/4%/12%/50%/50% across tasks — flat on
restack/liftwhere RE-0 lifts to 62%/76% [§4.2, Table 1]. - RE-OPD-cold:
restack4% → 62% with 3 rows (3/50 → 31/50);spill68% → 100% with 67 rows (34/50 → 50/50);nut4% → 88% with 27 rows (2/50 → 44/50);lift4% → 76% with 7 rows (2/50 → 38/50);door96% → 100% with 40 rows (48/50 → 50/50);cubestackalready saturated at 100%, exempted (no-train) [§4.2, Table 1]. - RE-OPD-refine on
restacklifts 62% → 80%; abstention onspill(already at 100%, admissions empty, Corollary 2 fires at runtime) [§4.2]. - Admissions decay with occupancy — 6/6 at round vs 4/15 at on the restack recursion [§4.2, Fig. 3b].
- Negative result captured by the guard:
liftrefinement admits one event with , projection drops 76% → 58% at seed 1 (branch collapse on resample variability) and 76% → 46% at seed 2; the stage-entry measurement halts recursion and discloses the regressed checkpoint [§4.2, Remark 1, Appendix D note (d)]. - Admission ladder as teacher-effect measurement before any training: student self-play (34 cycles) → 0 admissions; narrow local experts (32 events) → 0 admissions, 10% rescue ceiling + deterministic contract-format failures; strong API teacher → 4 admissions on 13 events, per-event rescue rates 19–47% [§4.3, Table 6].
- Threshold insensitivity: admitted events cluster at , abstained at ; the admitted set is unchanged across threshold sweep 0.24 → 0.01 [§4.3, Fig. 3c-d].
- Gate rejects harm: one API patch dropped baseline 8/16 → 1/16 () and was correctly rejected [§4.3].
- GRPO control on same environments: entropy 0.30 → 0.002, transfers 0–1/50 on non-saturated tasks against base 8%/68%/4%, retains only the saturated task [§4.3].
- Selection-rule ablation on
liftacross three trainer seeds (same journal, same recipe): LCB (3 rows) 11/50, 5/50, 13/50, mean 9.7; sign-only (7 rows) 5/50, 4/50, 4/50, mean 4.3; unfiltered (25 rows) 6/50, 2/50, 3/50, mean 3.7; outcome-based teacher-program selection (27 rows) 5/50, 9/50, 4/50, mean 6.0 [§4.4, Table 2]. - Objective-composition quartet on
restack(separate 50-seed cohort): stripping the student prefix (patch-only) or the retention term (weighted) collapses the gain the full objective and uniform credit largely retain — the full exact-mixture projection and uniform-on-the-verified-corpus SFT fall within trainer-seed variance of each other, isolating verified-admission (the corpus) as load-bearing and weighting as secondary [§4.4]. - Transfer: cross-task eval is selective rather than universal (
restacktraining improvesnut,spill’s wiping dynamics do not carry); pooled multi-task training shows substantial interference [§4.5, Appendix F]. - Zero-shot real-robot deployment on dual-arm AgileX PiPER (SAM3 open-vocabulary perception, no hardware-specific edits, no teacher calls): 13/20
restack, 12/20nut, 20/20spill, 20/20cubestack, 2/20lift[§4.5, Fig. 4].
Why it’s interesting
Section titled “Why it’s interesting”RE-0 is the sharpest formal statement to date of the “verify teacher corrections per-event before letting them in” position that the embodied-coding-agent cluster has been circling. Two framings make it a natural reference point.
First, it is a structural counter-recipe to the two dominant post-training threads on robot-code policies. Rethinking On-Policy Distillation of Large Language Models: Phenomenology, Mechanism, and Recipe identifies two necessary conditions for on-policy distillation to help a text LLM (thinking-pattern compatibility + genuinely new teacher knowledge) and shows OPD breaks silently when they fail. RE-0 extends that failure-mode taxonomy into embodied, history-dependent, long-horizon execution where a single harmful code segment alters the environment state, the program namespace, and the subsequent observable history — and gives the first principled answer: don’t check teacher strength at the global level, check per-event local counterfactual advantage on student-induced histories, and absorb only what passes a paired same-state LCB gate. The empirical sharpening that the LCB admission gate carries the gain while advantage weighting is replaceable by uniform weights (within trainer-seed variance) is a direct contribution the OPD literature has not had: it says the load-bearing variable is corpus composition under verified counterfactual admission, not reward shape.
Second, it stakes out an orchestration-cell in the recipe-lever board tracked under VLA Models that none of the existing frozen-base-plus-companion recipes occupy — distinct from FailSafe: Reasoning and Recovery from Failures in Vision-Language-Action Models FailSafe (10-step polling companion VLM emitting runtime deltas), Harness VLA: Steering Frozen VLAs into Reliable Manipulation Primitives via Memory-Guided Agents Harness VLA (LLM planner invoking narrow retryable primitives at subtask boundaries), and the Enact launch — post-training infrastructure that generates targeted recovery data for robotics VLAs Enact / MicroFactory — 99.9% reliability via $5 human-in-the-loop DAgger retraining on Jetson (Ilir Aliu × Igor Kulakov podcast) MicroFactory on-robot DAgger lineage. RE-0’s load-bearing move is measurement discipline on the correction signal before training: the environment-grounded LCB on paired same-state rollouts is a decision procedure for whether a specific teacher intervention produced a positive causal contribution, and only verified events — a tiny verified corpus (3–67 rows across six tasks) — survive into SFT. The reported real-robot zero-shot transfer at verified-event counts matching single-digit sim journal entries is the sharpest filed datapoint on the “verify then compress” axis in this cluster, and the GRPO control (0–1/50 under sparse terminal reward on the same tasks) is a crisp quantitative statement of why outcome-RL cannot localize credit inside a long code trajectory.
The guardrail finding is independently useful: the outer acceptance criterion catches a 76% → 58% regression on lift and halts the recursion, with the regression reproducing at a second trainer seed. This is the first filed empirical demonstration in the embodied-agent cluster that per-round guarantees + stage-entry measurement are individually necessary and jointly sufficient to make self-improvement safe — a template Reasoning RL‘s on-policy distillation lineage (On-Policy Distillation, Nemotron-Cascade 2: Post-Training LLMs with Cascade RL and Multi-Domain On-Policy Distillation, MOPD: Multi-Teacher On-Policy Distillation for Capability Integration in LLM Post-Training) could plausibly import.
See also
Section titled “See also”- VLA Models — RE-0 occupies a distinct “verify before distillation” cell on the orchestration-over-frozen-base recipe-lever board tracked here
- Reasoning RL — extends the OPD lineage with per-event verifier-mediated local credit on robot-code trajectories
- RL Environment Platforms — robosuite as substrate, with the per-event LCB admission gate functioning as both a verifier and a measurement instrument
- Rethinking On-Policy Distillation of Large Language Models: Phenomenology, Mechanism, and Recipe — OPD failure-mode taxonomy that RE-0 extends from text to embodied code-as-policy
- On-Policy Distillation — Thinking Machines’ OPD framing that RE-0 sharpens with a verifier gate
- FailSafe: Reasoning and Recovery from Failures in Vision-Language-Action Models — FailSafe runtime companion VLM, closest sibling on the “intervene on failures” axis but at deployment time rather than during data collection
- Harness VLA: Steering Frozen VLAs into Reliable Manipulation Primitives via Memory-Guided Agents — Harness VLA frozen-primitive orchestration pattern that RE-0 is upstream of (data-collection vs runtime invocation)
- MOPD: Multi-Teacher On-Policy Distillation for Capability Integration in LLM Post-Training — MOPD multi-teacher recipe RE-0 provides an admission-side counterpart to