Synthesize Where the Agent Fails: Recovery-Targeted Data for Few-Demonstration Imitation

When a robot learns from only one to four expert demonstrations, it rarely fails on the states the expert visited. It fails on the states the expert never visited, the ones its own small mistakes lead it into. A recent line of work tries to fix data scarcity by training a generative model on the few demonstrations and producing many more "pseudo-expert" trajectories. That is expensive, because each trajectory takes many denoising steps. It also looks misplaced: a generator trained on one trajectory mostly reproduces that trajectory, so the extra data lands where the learner already does well. We propose to spend the generation budget where the learner is actually failing. At a small, chosen set of states the agent itself reaches, we generate short corrective action segments. We execute each segment in the simulator and keep it only if it leads back to real expert states. The kept segments then act as extra expert data.

The core idea fits in two sentences. Synthetic demonstrations help imitation only if they cover the states where the policy goes wrong, and only if they are physically real. So you should generate a few short recovery segments starting from the agent's own intermediate-difficulty states, verified by the simulator, rather than many full trajectories copying the expert. The test is whether this beats both full-trajectory synthesis and no synthesis at all when every method gets the same GPU budget and the same number of environment steps.

Core Claim

The closest existing work is SD2AIL. It trains a conditional diffusion model (a generator that learns to turn random noise into samples by repeatedly denoising) on the scarce demonstrations and uses it as a "data factory" for full pseudo-expert trajectories. It keeps a synthetic sample only if its own diffusion discriminator scores the sample as more expert-like than the average real demonstration. With a single demonstration, SD2AIL reports average returns of 3441 on Hopper (expert 3402) and 5885 on HalfCheetah (expert 4663). Our proposal differs from it in three ways.

The first difference is where data is generated. We start from states the agent visits, not from noise shaped like the expert's distribution.

The second difference is which samples are kept. SD2AIL keeps only samples that look more expert-like than average. Two results argue this is the wrong rule. Difficulty Controlled Diffusion finds that synthetic images help most at intermediate difficulty, with scores in the 0.5–0.75 band. Limitations of Synthetic Data Generation in Specialized Data-Scarce Domains finds that generators trained on scarce data produce "canonical" samples that are 11% to 45% easier to recall than real data. Read in the control setting, both results suggest that keeping only the most expert-like samples keeps exactly the redundant ones.

The third difference is how samples are verified. SD2AIL's filter is its own discriminator, so if the discriminator drifts or is gamed, bad samples get in. We check each segment against physics and against the real demonstrations instead. Because every accepted transition was actually executed in the simulator, the states and actions agree by construction. This also sidesteps the separate inverse-dynamics model that KATS needs to infer actions for the states it synthesizes.

Research Program

We build on the reward of Diffusion-Reward Adversarial Imitation Learning (DRAIL). DRAIL trains a diffusion model conditioned on an expert-versus-agent label and computes a smooth reward from the difference in denoising error under the two labels, using a single denoising step. We reuse this reward unchanged, so any improvement can be attributed to the data we add rather than to a new reward.

On top of this we add a periodic synthesis step with three parts.

The first part selects states. Every $N$ policy updates, we score a batch of recently visited agent states by how expert-like the DRAIL reward model judges them. We keep states in an intermediate band. These are states that are not already expert-like, so a segment adds new information, and not hopelessly far off, so a short correction can plausibly succeed. The band is set as a quantile range rather than a fixed value, so it needs no per-environment tuning.

The second part generates a correction. From each selected state, a state-conditioned diffusion model trained on the expert's state and action-chunk pairs samples an $H$-step action segment. It uses a few-step sampler, and $H$ is short, around 10 to 30 steps. This keeps generation cost to a small, controllable number of forward passes.

The third part verifies the segment. We execute it in the simulator from that state, either by resetting the simulator to the state or, in a variant that needs no resets, by branching from the agent's own rollout when it reaches the state. The segment is accepted only if its final state lies within a distance $\epsilon$ of some real expert state. We calibrate $\epsilon$ from the typical step-to-step distance along the expert's own trajectory. Accepted segments consist of real simulator transitions and enter the expert-side buffer the discriminator sees. The discriminator's notion of "expert" therefore widens to include ways back to the expert path.

All costs are counted in the same units for every method: GPU-hours for generation, and environment steps, with verification rollouts charged to the environment-step budget.

The analysis asks three questions. First, does recovery-targeted synthesis reach higher return per GPU-hour and per environment step than full-trajectory synthesis? Second, does the benefit come from where segments start, from the physical verification, or from the generator itself? Third, do our synthetic samples escape the canonical trap? To answer the third question we adapt the recall-gap diagnostic from Limitations of Synthetic Data Generation in Specialized Data-Scarce Domains to control. We compare how easily a held-out discriminator classifies synthetic samples against real held-out expert transitions, separately for SD2AIL's samples and for ours.

Baselines

The naive reference is plain adversarial imitation learning (GAIL, where a discriminator separates expert from agent transitions and supplies the reward) using only the $K$ real demonstrations. This shows how much any synthesis buys.

The first strong competitor is DRAIL on its own, with the same reward and no synthesis. It asks directly whether generating data is worth anything once the reward is smooth. The file reports DRAIL keeping above 95% success on FetchPush under doubled environment noise, against about 79% for Diffusion Policy. The file has no reported DRAIL return on Hopper or HalfCheetah, so we run it ourselves.

The strongest existing synthesis method is SD2AIL. The target numbers are its reported one-demonstration returns of 3441 on Hopper and 5885 on HalfCheetah, with peak Hopper performance at about 210,000 environment steps. We run SD2AIL in two ways. The first uses its published settings. The second gives it exactly our GPU-hour and environment-step budget, including a version with fewer denoising steps. This way, SD2AIL cannot be beaten merely because it is expensive. Beating SD2AIL means matching its final return while using at most half its generation GPU-hours, or exceeding it at equal compute. The comparison is made at $K \in \{1, 4, 16\}$, averaged over at least 10 seeds with confidence intervals.

The strongest method that uses no synthesis at all is Noise-Guided Transport (NGT). NGT frames imitation as minimizing a transport distance between agent and expert data, anchored to a frozen random network, and is reported to master the 376-dimensional Humanoid in about 5 hours on one GPU from 20 to 50 transitions. The file gives no numeric return for NGT, so we run it with its published hyperparameters, plus an equal-budget sweep over its histogram-loss settings.

Four ablations isolate our ingredients. Random-state selection replaces the intermediate-difficulty band and tests whether targeting matters. Discriminator-based acceptance, SD2AIL's rule, replaces simulator verification and tests whether decoupling the filter matters. A retrieval generator, which copies the action chunk of the nearest expert state, replaces the diffusion generator and tests whether a generator is needed at all. A top-confidence band replaces the intermediate band and tests the difficulty-zone hypothesis directly.

Why not just…?

Why not just use DRAIL's smooth reward and skip synthesis entirely? This is the most serious threat. DRAIL's reward already pushes the agent back toward the expert manifold, so recovery segments might duplicate what RL would find on its own. Our answer is not an argument but the direct DRAIL-versus-ours comparison under identical environment-step budgets, where verification steps count against us. If we cannot beat DRAIL at $K=1$ or $K=4$, the honest conclusion is that synthesis overhead is not justified once the reward is smooth, and that is a useful negative result for the field.

Why not just perturb the expert states with noise and reuse the expert's actions? This kind of augmentation costs almost nothing, and in image classification it is hard to beat: AugMix matched or outperformed all the heavy generators in Limitations of Synthetic Data Generation in Specialized Data-Scarce Domains. In control, however, KATS reports that single-step perturbations and mixing produce physically impossible "teleporting" transitions. On antmaze-umaze, its physics-consistent augmentation scores 96.9, against 74.0 for plain behavioral cloning. We include Gaussian state perturbation as a baseline anyway, because a reviewer is right to demand it.

Why not just make SD2AIL cheaper with fewer denoising steps? If a cheaply sampled SD2AIL matches us, then the gain lies in efficient sampling and not in where the data goes. The equal-budget SD2AIL run tests exactly this. Our hypothesis is that the canonical-trap diagnostic will show that cheaper full trajectories remain redundant copies of the expert.

Why not just pre-train a behavior foundation model? Fast Imitation via Behavior Foundation Models derives a policy from one demonstration in about a minute. But it needs a large pre-training phase specific to each environment, and its performance is capped by how much of the state space that pre-training explored. This is a different cost trade-off, and we report it only as context rather than as a matched baseline.

Proposed Experiments

We test on Gymnasium MuJoCo Hopper, HalfCheetah, Walker2d, and Ant at $K \in \{1, 4, 16\}$, matching SD2AIL's protocol, and add Humanoid to cover the high-dimensional regime SD2AIL left untested. The primary metric is return as a function of GPU-hours and of environment steps. Secondary measurements are the fraction of generated segments accepted, the recall-gap diagnostic, and the correlation between the learned reward and the true environment reward, which SD2AIL reports at up to 93%.

The decisive checks are three. First, at equal compute, recovery-targeted synthesis must beat both DRAIL alone and budget-matched SD2AIL at $K=1$. Second, the intermediate band must beat both the random-state and top-confidence ablations. If it does not, the difficulty-zone transfer from images to control fails. Third, if the retrieval generator matches the diffusion generator, we will report that where segments start and how they are verified, not generative modeling, is what helps. That outcome would cut generation overhead to nearly zero.

A final check uses iMuJoCo variants with changed limb mass and friction (resource), where demonstrations and deployment dynamics differ. It asks whether simulator verification keeps synthetic data physically valid in exactly the setting where a generator trained on the original dynamics would drift.