∇Mimic: training a humanoid tracking policy with exact simulator gradients in 20 minutes on one GPU

A preprint from 30 October 2026 trains one Unitree G1 policy on all 40 LAFAN1 clips by backpropagating through a fast differentiable contact simulator. Median-relative gradient clipping and regression onto bounded action targets tame exploding contact gradients. It reaches the previous best score in 20 minutes instead of 1.2 hours. No hardware tests yet. We explain the method and show the clipping trade-off in numpy.
In short
Most humanoid controllers are trained with reinforcement learning methods such as PPO, which only use reward values and need billions of simulated steps. A preprint posted on 30 October 2026, ∇Mimic by Weyl Lu and Yubei Chen (arXiv:2610.41654), instead trains a whole-body tracking policy for the Unitree G1 with exact gradients through the physics simulator. On the 40 motion clips of the LAFAN1 dataset it reaches a score of 0.82 in 20 minutes on one GPU, a level that the previous best method reports after 1.2 hours. The two ingredients are a fast differentiable GPU simulator (NablaEngine) and two tricks that keep exploding contact gradients under control. Both are open source. There are no hardware results yet.
How it works
Two ways to learn from a simulator.
- Zeroth-order (PPO and similar): try an action, observe the reward, and push the policy toward actions that scored better. The simulator is a black box. This is robust but needs very many samples.
- First-order (differentiable simulation): the simulator also returns how the outcome changes when the action changes a little (the gradient). The policy can follow this direction directly, so far fewer samples are needed in theory.
The problem with contact. When a foot hits the ground, the physics changes abruptly. Gradients through such events are mostly fine, but a few samples produce enormous values. Averaged into a batch, one such sample can dominate the update. Earlier first-order methods such as SHAC stop or diverge for this reason on whole-body tasks.
The ∇Mimic fixes.
- Per-sample clipping relative to the median. At each step of the backward pass, each sample's action gradient g_i is scaled down to at most κ = 3 times the median gradient norm in the batch. The median is used because a few exploding samples do not move it.
- Regression onto bounded targets. The clipped gradients are turned into target actions y_t = a_t + δ · g_t / RMS(g), and the policy is fitted to these targets for several minibatch steps with a separate Adam optimiser. This reuses each expensive simulated window several times, and the size of each target step is bounded no matter how large the raw gradient was (about 0.13 rad per joint at most, according to the paper).
Analogy: a hiker who can feel the slope under her feet (first-order) gets downhill faster than one who only gets told "warmer" or "colder" (zeroth-order), as long as she ignores the occasional rock that feels like a cliff.
Under the hood
Setup. Unitree G1 with 29 actuated joints (mjlab model), control at 50 Hz with 4 physics substeps of 5 ms. One policy tracks all 40 LAFAN1 clips (264,705 frames, about 2.45 hours of motion). The score is a full-clip normalised return; a fall forfeits the rest of the clip. Backpropagation through time over windows of H = 64 control steps, 4,096 parallel simulated worlds. Shorter windows (H = 32) gave lower returns. Residual actions (offsets from the reference pose) learned faster than absolute joint targets.
NablaEngine. A GPU simulator written for the G1 that computes MuJoCo's contact dynamics (502 contact pairs, Newton constraint solver). Each simulated world runs in one GPU warp, and the backward pass (adjoint) of a full control step is fused into one kernel. The adjoint is derived by hand and differentiates the constraint solver through its optimality conditions. Gradients match float64 finite differences with a median relative error of about 10⁻⁵. Near self-contact and nearly parallel capsules, geometric derivatives below 1 mm are frozen during training.
| Measurement (RTX PRO 6000) | NablaEngine | MuJoCo Warp | Ratio |
|---|---|---|---|
| Forward control step | 1.21 ms | 5.84 ms | 4.8× |
| Step with gradient | 1.78 ms | 20.5 ms (adjoint pull request) | 11.5× |
Throughput is about 3.39 million control steps per second.
Results (all from the paper):
| Method | Result |
|---|---|
| ∇Mimic | 0.82 after 20 min, 0.874 after 1.8 h |
| SuperMimic (world-model method, numbers from its paper) | 0.82 after 1.2 h on one H100 |
| PPO with BeyondMimic configuration | about 0.64 after 3 h, 0.70 after 6 h |
| SHAC with its published gradient guard | stops after 0.06 h at about 0.37, 23 clips with falls |
| SHAC with relaxed guards | 0.816 after 3 h |
Caveats. The comparisons are not on identical hardware: SuperMimic's code is not public, so its numbers come from its paper (H100), while ∇Mimic ran on an RTX PRO 6000. Some baselines use a single seed. NablaEngine supports only the G1 on flat ground. The bias that per-sample clipping introduces is not quantified. The authors state that they have not trained on larger motion libraries and have not deployed the policies on a real robot. Sim-to-real transfer is the open question: first-order methods exploit the exact simulator, which can also mean exploiting its errors.
Why it matters. If the result holds up, the cost of training a tracking controller drops from GPU-hours to GPU-minutes, which makes it practical to retrain controllers for each new robot or motion set. It also weakens the common view that PPO is the only reliable option for contact-rich humanoid control.
Try it yourself
1. See heavy-tailed contact gradients and what clipping does (first snippet). A block on a spring is pushed toward a stiff wall; the loss is how far it stays from a goal just before the wall. Exact per-sample gradients are computed through the discrete simulator. Expected output: per-sample gradient magnitudes with median 0.131 but a 99th percentile of 3.51 (heavy tail). The finite-difference slope of the expected loss is −0.047. The raw batch mean is close on average (−0.054) but noisy (standard deviation 0.070), and it has the wrong sign in 13% of batches. The clipped mean is much less noisy (0.010) and always has the right sign, but it is biased (−0.119, about 2.5 times too steep). This is the trade-off the paper leaves unquantified.
2. Why normalised targets bound the update (second snippet). With 8 exploding samples in a batch of 4,096, normalising by RMS(g) without clipping lets one sample move 1.26 rad while the typical sample moves 0.0001 rad. With clipping, the typical sample moves 0.049 rad and the largest 0.148 rad.
3. The real code (needs a large NVIDIA GPU; we have not run it). NablaEngine and ∇Mimic are on GitHub (OamIcs/NablaEngine, OamIcs/NablaMimic, Apache-2.0). According to the README (checked 2 November 2026) you need Linux x86_64, Python 3.12, a CUDA 12 driver and nvcc from CUDA 12.x (12.8 or newer for Blackwell), and about 50 GB of GPU memory for the default configs. Setup and training, as given in the README:
git clone https://github.com/OamIcs/NablaMimic && cd NablaMimic
bash scripts/setup_env.sh # read this script before you run it
source .venv/bin/activate
bash scripts/download_lafan1.sh # LAFAN1 data: CC BY-NC-ND 4.0, non-commercial
export XLA_PYTHON_CLIENT_PREALLOCATE=false
python -m nablamimic.train --config configs/ours.args --out runs/ours_s0
The README reports a normalised return of 0.875 after 3 hours on one RTX PRO 6000 (the paper: 0.874 after 1.8 h). Note the data licence: LAFAN1 is non-commercial; check whether that affects how you may use a policy trained on it.
Python in your browser
Sources
What should happen next with this?
One click per article, no account needed. “Go deeper” feeds the research queue.