Reusing Wasted Rollouts: Surrogate-Corrected Gradients for Physics-Based Demonstration Synthesis

A recent recipe for training robot manipulation policies starts from a couple dozen human demonstrations, maps them onto a robot, and then repairs and multiplies them inside a physics simulator. The repair step is a search over the robot's motion that restores physical plausibility, such as closing the gaps where fingers hover or pass through the object. The multiplication step reruns that search under many randomized masses, frictions, and object sizes. The search is usually the Cross-Entropy Method (CEM), a derivative-free optimizer that repeatedly samples many candidate trajectories, keeps the best ones, and refits a sampling distribution. Each repaired trajectory therefore costs thousands of full simulator rollouts. Almost all of them are thrown away once the search ends, even though the thousands of search problems are nearly identical to one another.

We propose to keep those rollouts. A single neural model of the simulator, trained online on every rollout produced across all randomized problems, would serve as a control variate: a cheap approximation whose known errors are subtracted out of a noisy gradient estimate. The simulator itself is never differentiated or rewritten. We estimate gradients of a noise-smoothed version of the trajectory cost with a small number of black-box rollouts, and we cancel most of their variance with the surrogate. Because of how the correction is built, the estimate stays unbiased however wrong the surrogate is. The claim is that the cost of synthesizing a feasible, contact-rich demonstration dataset can be cut several-fold relative to the strongest derivative-free refiner, with no loss in the downstream policy's success rate. The saving should grow as more of the dataset has been generated.

Core Claim and What Is New

The pipeline we target is Physics-Driven Data Generation for Contact-Rich Manipulation via Trajectory Optimization. It turns 24 VR demonstrations into 3,000 feasible trajectories per embodiment using a CEM refiner inside a rigid-body simulator. It trains a Diffusion Policy that reaches 81% success on Allegro hand manipulation (versus 21% from the raw demonstrations) and 92% on bimanual iiwa (versus 56%). That paper motivates this work: it shows the refiner is what makes the data useful, and it treats the refiner's cost as fixed.

Two lines of work supply our method, and neither was built for this setting. The first is Accelerating Legacy Numerical Solvers by Non-intrusive Gradient-based Meta-solving. It wraps black-box PETSc and FEniCS solvers with directional finite differences plus an online neural control variate, and it restores convergence up to 128 dimensions. Its tests are smooth partial differential equation problems, and each problem is solved in isolation. The second is A Multi-Fidelity Control Variate Approach for Policy Gradient Estimation, which uses cheap low-fidelity simulators to reduce the variance of REINFORCE gradients. It requires a hand-built low-fidelity twin and targets online reinforcement learning, not dataset synthesis.

What is new here has three parts. We apply surrogate control variates to discontinuous contact dynamics rather than smooth equations. We share one surrogate across a whole family of randomized trajectory problems, so its training data comes free from earlier searches. We measure success by the simulator cost per feasible trajectory and by the quality of the student policy, not by optimizer iterations.

Contact discontinuities are exactly where plain gradients fail. PlasticineLab and DiffGen both report vanishing or exploding gradients as contact is made and broken. DiffGen also needs a natively differentiable engine (NimblePhysics) and manual segmentation of long tasks. We sidestep both problems by never differentiating the true simulator. Instead we optimize the Gaussian-smoothed cost, which CEM already implicitly optimizes.

Write $J(u)$ for the scalar cost of a flattened control sequence $u \in \mathbb{R}^d$ under the black-box simulator. The cost combines penetration, contact force, and tracking of the retargeted demonstration. Write $\hat J_\phi$ for the same cost computed through a learned differentiable surrogate with weights $\phi$, and $\sigma$ for the smoothing scale. Our estimate of the gradient of the smoothed cost $\mathbb{E}_\epsilon[J(u+\sigma\epsilon)]$ is

$$ g(u) = \frac{1}{K\sigma}\sum_{k=1}^{K}\Big[\big(J(u+\sigma\epsilon_k)-J(u)\big)-\big(\hat J_\phi(u+\sigma\epsilon_k)-\hat J_\phi(u)\big)\Big]\epsilon_k \;+\; \nabla_u\, \mathbb{E}_{\epsilon}\big[\hat J_\phi(u+\sigma\epsilon)\big], $$

where $\epsilon_k$ are standard Gaussian directions and $K$ is the number of true-simulator rollouts per step. The last term is computed by backpropagating through the surrogate over many cheap samples.

The first term is unbiased for the smoothed gradient of the residual $J-\hat J_\phi$. The second term adds back exactly what was subtracted, so $g$ is unbiased for any $\phi$. The variance scales with the size of the residual rather than of $J$, following standard zeroth-order estimator analysis. This property addresses surrogate distribution shift, the known way neural surrogates produce misleading gradients when an optimizer drifts outside their training data. When the surrogate is wrong, it costs variance rather than correctness.

Research Program

We will build the estimator above into a trajectory refiner with three pieces. The first is a shared surrogate: a recurrent next-state predictor conditioned on the randomized physical parameters, in the spirit of the articulated neural simulator in Learned Neural Physics Simulation for Articulated 3D Human Pose Reconstruction. It is retrained periodically on all rollouts collected so far. The second is an ordering over randomized instances so that each new problem is warm-started from the solved trajectory of its nearest neighbor in parameter space. The third is a rollout budget that shrinks as the residual variance, measured online, falls.

The analysis tracks three quantities as generation proceeds. We record the residual variance, the gradient cosine to a high-sample reference estimate, and the number of true-simulator steps per trajectory that passes the feasibility filter. The hypothesis is that the per-trajectory cost falls over the course of dataset generation, because each solved instance improves the surrogate for the next one. A derivative-free refiner has no such mechanism. If that decline does not appear, the central claim is wrong.

We will also study where the idea breaks. As the smoothing scale shrinks, contact events become sharper and the residual $J-\hat J_\phi$ concentrates on them. We will report the range of $\sigma$ over which contact feasibility is still recovered.

Baselines

The naive reference point is the 24 retargeted demonstrations used without any refinement, together with rejection sampling: randomized replays of those demonstrations kept only if they pass the feasibility filter. This bounds what repair buys at all and fixes the yield denominator. The source paper reports 21% Allegro success from the 24 raw demonstrations.

The strongest existing method is CEM refinement as in Physics-Driven Data Generation for Contact-Rich Manipulation via Trajectory Optimization. We will upgrade it to iCEM from Sample-efficient Cross-Entropy Method for Real-time Planning. iCEM adds colored noise and a memory of the best samples, and it reports 2.7 to 21.9 times fewer samples than standard CEM to reach 90% of the best baseline, plus 90% success on Relocate with 13.7 times fewer samples. We also give it the same nearest-neighbor warm start our method uses. A reviewer would rightly insist on that combination, so it is the bar to clear. The source paper's downstream figures (81% Allegro, 92% bimanual) are the policy-quality targets. For simulator calls per refined trajectory, there is no reported result found on Lacuna for the CEM refiner, so we will measure it ourselves.

All methods receive the same seed demonstrations, randomization ranges, feasibility filter, and wall-clock budget on identical hardware. Each gets an equal hyperparameter search budget: the colored-noise exponent and population size for iCEM, and the smoothing scale and step size for ours. Surrogate training compute is charged to our method.

Beating the strongest baseline means one of two things. Either our method reaches the same feasible-trajectory yield and downstream Diffusion Policy success (within confidence intervals over seeds) using at least three times fewer true-simulator steps in total. Or, at equal steps, it produces a larger feasible dataset that yields higher student success.

Three ablations isolate what matters. The first is a surrogate-only variant that uses just $\nabla\hat J_\phi$. This is the biased, model-based option, and it isolates the value of the unbiasing correction. The second drops the surrogate term entirely, leaving plain smoothed forward differences, which isolates the control variate. The third trains a fresh surrogate per instance instead of sharing one, which isolates the amortization across the randomized family.

Why not just…?

Why not just use iCEM with warm starts from neighboring solved instances? This is the real threat, since nearby randomized problems may be solved in a few CEM iterations from a good initialization. The iCEM evidence shows large sample savings but still hundreds of rollouts per step. Warm starting helps our method equally, because we use it too. The warm-started iCEM baseline and our shared-surrogate ablation will settle this directly. If the gap is under about two times, the surrogate is not worth its complexity, and we will say so.

Why not just make the gradients cheaper with finite differences? Coordinate-wise differencing costs $d$ rollouts per gradient, and trajectory problems have hundreds of control dimensions. The non-intrusive meta-solving work reports that plain forward-gradient estimates fail to converge by 128 dimensions without the surrogate correction, and End-to-End Differentiable Physics for Learning and Control describes the instability of differencing over long horizons. The no-surrogate ablation reproduces this comparison on contact tasks.

Why not just learn a generator of refined trajectories, as DiffuSolve does? DiffuSolve warm-starts solvers 2 to 11 times faster and reaches 100% feasibility on 10-dimensional quadrotor navigation. However, it needed 114k to 179k solver-computed trajectories, produced over thousands of hours, before it helped, and it assumes smooth dynamics. That is the bootstrapping cost we are trying to avoid. Our method starts paying off from the first instance, and a generator could later be trained on our output.

Why not just use model-free reinforcement learning or a natively differentiable engine? Reported gaps make model-free reinforcement learning uncompetitive. DiffGen's PPO needed 5 to 10 million steps, against 20,000 for the gradient-based pipeline. PlasticineLab's reinforcement learning agents stayed near 0.80 IoU after 10,000 episodes, against 0.93 for gradient descent. Native engines remove the black-box constraint, but they inherit contact-gradient pathologies and require rewrites that are infeasible for most production simulators.

Proposed Experiments

The primary testbed reimplements the box-flipping and sliding tasks from the source paper in MuJoCo, which is non-differentiable, for the Allegro hand and the bimanual iiwa. We will also check against the RRLS parameter-variation suite (SuReLI/RRLS) and the iMuJoCo variants (mpatacchiola/imujoco) for randomized-dynamics families.

A diagnostic study uses PlasticineLab, whose engine is differentiable. We run it as a black box, which lets us compare our gradient estimates to true smoothed gradients and to the reported 0.93 RollingPin IoU obtained with exact gradients.

The metrics are true-simulator steps per feasible trajectory, feasibility yield, gradient cosine to reference, and Diffusion Policy success on held-out randomizations.

Two results would be decisive. The first is the per-trajectory cost curve over the course of generation, which must decline for our method and stay flat for warm-started iCEM. The second is matched-budget downstream success, which must meet or exceed the CEM-refined datasets' 81% and 92% at a fraction of the simulation cost.