Attention-based contact planning for the Unitree G1, trained through one differentiable world model on mjlab. The full three-stage pipeline runs on a single RTX 5090:
- Contact tracker. The robot follows the foot, knee, hand, elbow and pelvis contacts of 296 parkour clips on box terrain.
- Contact planner. A planner predicts the contacts from a height scan, and the tracker learns to follow them.
- Goal reaching. The robot reaches goals across 9 procedural terrain types at 10 levels, using contacts that the planner proposes.
instantACP is built on the ACP implementation of Vu Dinh Quang. He designed the contact planner and tracker, the box-terrain data pipeline, the three stages and the evaluation used here. instantACP changes how the stages are trained, makes Stage 2 and 3 stable on a 32 GB GPU, and fixes a shortcut in goal reaching. Every change is listed in What instantACP changes.
- Results at a glance
- Videos
- Stage 1: contact tracker
- Stage 2: contact planner
- Stage 3: goal reaching
- What instantACP changes
- Setup
- Reproduce
- Evaluation and rendering
- Repository layout
- Known limitations
- Acknowledgements
- License
All runs use one RTX 5090 (32 GB). Clip metrics cover all 296 clips, each played once from its first frame without noise. Normalized return lies in [0, 1], and a clip fails when the robot falls or drifts out of the termination window.
| Stage | Main result | Training time | Seeds |
|---|---|---|---|
| 1. Contact tracker | return 0.874–0.886, 0–1 failed clips (target: > 0.835, ≤ 4) | 3.5 h (original recipe: never reached the target in 4.7–7.5 h) | 3 |
| 2. Contact planner | planner targets: return 0.543, 1 failed clip (upstream: 0.56 / 8) | 0.4 h planner + 9.9 h co-training (upstream: 0.7 h + 14.7 h, on a different GPU) | 1 |
| 3. Goal reaching | goal success 0.992 (held-out terrain: 0.991), climb 1.00; planner-driven clips 0.665 / 0 failed; reference clips 0.856 / 0 failed | 8.0 h | 2 |
The whole pipeline (Stage 1 seed 0, then Stages 2 and 3) takes about 22 h of training on one GPU.
Stage 1 on the same low-climb clip: instantACP after 3.5 h (left) and the original recipe at its best checkpoint (right). The solid robot is the policy and the translucent blue robot is the reference.
Stage 2: the tracker follows the contacts that the planner predicts from the height scan, not the clip's own labels, so it moves differently from the reference.
The full videos below play in the browser when you click them.
| Video | What it shows |
|---|---|
media/stage1_instantacp_seed0.mp4 |
Stage 1, seed 0, final checkpoint, on high and low climbs, high and low steps, and locomotion. The solid robot is the policy, the translucent blue robot is the reference, and the colored spheres are the commanded contacts (feet red / blue, knees orange, hands green, elbows purple, pelvis yellow). |
media/stage1_original_recipe_best.mp4 |
The same clips with the original recipe at its best checkpoint (60k-iteration run, seed 1), for comparison. |
media/stage2_planner_targets.mp4 |
Stage 2, final checkpoint. The tracker follows contacts predicted by the planner instead of the clip's labels. |
media/stage3_goal_reaching.mp4 |
Stage 3, seed 0, goal-reaching highlights: stairs down, platform, climb, gap, balance beam and pallets at the hardest level, then stairs up and down, platform, climb, gap, stepping stones, balance beam and pallets at level 5. Gap, stepping stones, balance beam and pallets stand over 1 m pits. |
media/stage3_core_planner_clips.mp4 |
Stage 3 tracker following planner contacts on the parkour clips. This is the core Stage 3 recipe (--twin_vfs --ref_contact_frac 0.25), before the terrain and style changes. |
Three seeds from scratch with one configuration (scripts/reproduce_stage1.sh):
30,000 iterations on the published clips, then an 8,000-iteration fine-tune on the refined clips.
| Seed | First checkpoint at target | Final checkpoint (3.48 h): return / failed clips | Foot placement error, median (left / right) |
|---|---|---|---|
| 0 | 2.83 h: 0.849 / 0 | 0.886 / 0 | 7.9 / 8.4 cm |
| 1 | 2.83 h: 0.842 / 0 | 0.874 / 1 | 8.5 / 9.1 cm |
| 2 | 2.88 h: 0.836 / 0 | 0.878 / 0 | 8.8 / 9.4 cm |
All 40 low-climb clips succeed at the final checkpoint in every seed.
Compared with the original recipe on the same machine:
| Original recipe, 38k iterations (1 seed) | Original recipe, 60k iterations (2 seeds) | instantACP (3 seeds) | |
|---|---|---|---|
| Iterations per second | 2.22 | 2.21–2.22 | 3.03 |
| Best checkpoint: return / failed clips | 0.737 / 51 (at 4.1 h) | 0.779 / 40, 0.789 / 40 (at 4.2–4.7 h) | 0.875–0.886 / 0 |
| Final checkpoint | 0.632 / 83 (4.7 h) | 0.234 / 246, 0.255 / 237 (7.5 h) | 0.874–0.886 / 0–1 (3.5 h) |
With the original recipe, later checkpoints get worse while the training statistics still improve. Run long enough, it collapses. The original repository reports 0.835 / 4 after 5.4 h on a different GPU. We could not reproduce that figure on our machine, and the original recipe was not retuned for it, so the columns above are our runs, not the published number.
The planner (attention over the height scan) first learns offline from rollouts of the Stage 1 tracker (20,000 steps,
0.4 h). Then planner and tracker are trained together. A schedule (eta) moves the environments from the clip's
contact labels to the planner's targets, both in the observation and in the reward. Training runs for 24,000
iterations, then continues to 40,000 iterations with a ±2 s termination window and eta_rew_max 0.58
(scripts/reproduce_stage2.sh).
| Checkpoint | Planner targets: return / failed clips | Reference targets |
|---|---|---|
| 20k iterations | 0.473 / 62 | 0.826 / 2 |
| 24k iterations (end of phase 1) | 0.545 / 2 | 0.629 / 36 |
| 40k iterations (release) | 0.543 / 1 | 0.546 / 14 |
| 40k, with training noise (action, observation, command) | 0.538 / 0 | |
| upstream (48 GB GPU, 1 seed) | 0.56 / 8 |
Stage 2 moves every environment onto the planner's targets, so following the clip's own labels degrades (0.886 → 0.546).
Stage 3 recovers it with --ref_contact_frac (below).
Half of the environments reach goals on procedural terrain: 9 types × 10 levels, with a curriculum per type. The other
half keep following the parkour clips through the planner. Two critics are trained, one per group. The planner keeps
learning from hindsight contact labels of successful goal episodes
(scripts/reproduce_stage3.sh, 30,000 iterations from the Stage 2 checkpoint).
Release recipe, 2 seeds. Goal reaching is measured with 16 episodes per terrain type and level (1,440 episodes), on the training terrains and on held-out terrain (terrain seed 1).
| Seed 0 | Seed 1 | Mean | |
|---|---|---|---|
| Goal success, training terrain | 0.990 | 0.994 | 0.992 |
| Goal success, held-out terrain | 0.986 | 0.996 | 0.991 |
| Climb (all levels) | 1.00 / 1.00 | 1.00 / 1.00 | 1.00 |
| Positive joint work per metre to the goal | 150.5 J/m | 156.5 J/m | 153.5 J/m |
| Clips, planner targets: return / failed | 0.671 / 0 | 0.658 / 0 | 0.665 / 0 |
| Clips, reference targets: return / failed | 0.855 / 0 | 0.856 / 0 | 0.856 / 0 |
Stairs up and down, walled stairs, platform, climb, gap, balance beam and pallets reach 0.99–1.00 in both seeds.
How the recipe was built. Each row adds to the one above. The numbers are seed 0, except where noted.
| Recipe | Goal success | Clips: planner / reference | What it fixed |
|---|---|---|---|
| upstream Stage 3 flags | collapses in 3 of 6 short runs | 0.659 / 0.584 (a run that survived) | critic and policy diverge right after the goal group enters the actor loss |
+ --twin_vfs |
0.647 / 0.547 (2 seeds) | no collapse in 4 of 4 runs: the minimum of two goal critics bounds the bootstrap | |
+ --ref_contact_frac 0.25 (core recipe, 3 seeds) |
0.991 without pits, 0.725 with pits | 0.697 / 0.870 | reference following back to the Stage 1 level |
+ --pit_depth 1.0 --goal_evict quality |
0.989 | 0.689 / 0.867 | the robot used to step off narrow courses onto the ground and walk around them |
+ --w_style 20 --style_feat fd |
0.988 | 0.672 / 0.859 | motion prior: a more upright, human-like gait, positive joint work 175 → 165 J/m |
+ --w_face 10 |
0.988 / 0.992 | 0.705 / 0.864 | walking sideways up stairs: median heading error 15° → 7° (clips: 7.6°) |
+ --level_mix 0.2 --type_alloc adaptive (release, 2 seeds) |
0.992 / 0.991 | 0.665 / 0.856 | middle climb levels (0.75–0.88 in seed 0, 0.31–0.56 in seed 1) → 1.00 at every level in both seeds |
Per-checkpoint and per-terrain results of the release runs and of the core recipe are in results/.
The task, observations, contact targets, height scans, paper rewards and terminations are those of Vu Dinh Quang's implementation, except where marked behaviour below. Network sizes are unchanged. The training-loop changes (policy EMA, fused optimizer and rotations, Muon, curriculum sampling) come from InstantTrack.
Stage 1
| Change | Kind | Flag |
|---|---|---|
| Policy EMA (0.995). The EMA policy is the one that is evaluated and deployed. | algorithm | --pi_ema 0.995 |
| Fused Adam, elementwise 3×3 rotation products | systems, same arithmetic | --fused_adam --fused_rot |
| 90 % of curriculum resets go to clips in proportion to how far their start phase still is from the first frame | algorithm | --clip_focus 0.9 |
| Curriculum starts are spread over [phase, phase + 5 %] instead of exactly the phase | algorithm | --start_jitter 0.05 |
| Fine-tune only: 25 % of curriculum episodes start at the clip's first frame | algorithm | --first_frame_share 0.25 |
| Each hand collides as one 3 cm sphere instead of the 13 cm rubber-hand mesh | behaviour | always on (g1.py) |
With uniform clip sampling, the low-climb clips stay unsolved: their curriculum phase stalls just before the climb, and
a curriculum step of 5 % of a 16 s clip skips the 0.8 s in which the pelvis rises onto the box. --clip_focus and
--start_jitter address this. In the fine-tune, --first_frame_share keeps whole-clip rollouts in the data. Without
it, one of three seeds failed all low-climb clips after the fine-tune.
Tried and not adopted (one seed each, from the same phase-1 checkpoint):
- Relaxed training terminations (
--train_term_height 0.4 --train_term_tilt 1.2): the robot stayed upright with its hands on the box instead of climbing (0.776 / 40 failed). - The fine-tune flags already in phase 1: failed on seed 2 (0.558 / 156 failed).
Stage 2
| Change | Kind | Flag |
|---|---|---|
| Policy EMA, fused Adam and rotations, as in Stage 1 | algorithm / systems | --pi_ema 0.995 --fused_adam --fused_rot |
| Imagination in the policy update chunked per group, so the update fits in 32 GB | memory | --pi_chunks 4 |
| Resumable full checkpoints, and an exit on non-finite losses or a diverging critic. The scripts resume with a new seed. | robustness | --full_ckpt --abort_nonfinite |
Stage 3
| Change | Kind | Flag |
|---|---|---|
| Two goal critics; the minimum is used for the bootstrap and the GAE targets | algorithm | --twin_vfs |
| 25 % of the reference environments (and imagination samples) keep the clip's own contact targets and reward | behaviour | --ref_contact_frac 0.25 |
| Gap, stepping stones, balance beam and pallets stand over a 1 m pit, and dropping into it ends the episode | behaviour | --pit_depth 1.0 |
| The planner's goal buffer keeps the samples with the lowest positive joint work per metre (the paper's quality-based eviction) | algorithm | --goal_evict quality |
| Motion prior: an LSGAN discriminator scores clip vs goal-environment transitions on finite-difference features. Its differentiable style reward is added to the goal reward. | behaviour | --w_style 20 --style_feat fd |
| Facing reward while away from the goal: the pelvis heading should point toward the goal | behaviour | --w_face 10 |
| 20 % of goal episodes rehearse a uniformly drawn lower level; goal environments drift toward the terrain types that fail more | algorithm | --level_mix 0.2 --type_alloc adaptive |
| Hindsight labelling in chunks (memory only) | memory | --label_chunk 100000 |
Linux x86-64 with an NVIDIA GPU of at least 32 GB (tested on an RTX 5090; CUDA 12.8 wheels) and
uv. The stack is pinned in pyproject.toml: mjlab 1.6.0, Warp 1.16.0, torch 2.9.0.
git clone https://github.com/RoboticsResearchHubVN/instantACP.git
cd instantACP
uv sync
bash tools/download_data.sh # Unitree G1 description + PHP parkour G1 bundles (296 clips) -> data/
bash scripts/prepare_data.sh # contact labels, refined clips, their labelsThe data is downloaded from its sources and checked against their sha256. It is not redistributed here.
bash scripts/reproduce_stage1.sh 0 # ~3.6 h: phase 1, fine-tune, evaluation of every fine-tune checkpoint -> logs/stage1_s0_*
bash scripts/reproduce_stage2.sh # ~11 h: offline planner, co-training, evaluation -> logs/stage2*
bash scripts/reproduce_stage3.sh 0 # ~8.5 h: goal reaching, evaluation -> logs/stage3_s0Each script skips the steps whose outputs already exist, so an interrupted pipeline can be restarted with the same
command. scripts/stage1_protocol.sh <name> <seed> runs the original Stage 1 recipe (no extra flags) for comparison.
MuJoCo Warp is not deterministic, so a rerun gives slightly different numbers from the ones above. Stage 2 can
diverge in some runs (once in two runs of the release configuration); scripts/train_retry.sh resumes such a run
automatically.
# clips: reference contacts, or the planner's targets (Stage 2 / 3)
uv run python -m instantacp.evaluate --ckpt logs/stage3_s0/last.pt --term_window 2
uv run python -m instantacp.evaluate --ckpt logs/stage3_s0/last.pt --planner logs/stage3_s0/last.pt --term_window 2
# goal reaching: success per terrain type and level, falls, joint work per metre
uv run python -m instantacp.evaluate_goal --ckpt logs/stage3_s0/last.pt --episodes 16
# videos: record clip rollouts, then render them with MuJoCo (EGL) and ffmpeg
uv run python -m instantacp.evaluate --ckpt logs/stage1_s0_ft/last.pt --record traj.npz
uv run python -m instantacp.render traj.npz out.mp4 --per_folder 2| Path | Contents |
|---|---|
src/instantacp/ |
environment, task and terrain, world model and policy networks, planner, motion prior, training scripts for the three stages, evaluation and rendering |
scripts/ |
data preparation, reproduce scripts for every stage, Stage 1 checkpoint evaluation |
tools/ |
data download, URDF → MJCF conversion, result collection |
results/ |
arguments, training logs and evaluation results of every run reported above |
media/, figures/ |
videos and plots used in this README |
- The hands collide as 3 cm spheres. This is shorter than the real hand and a sim-to-real risk.
- Stage 2 has one seed. Both Stage 3 seeds start from that one Stage 2 checkpoint.
- The narrowest stepping-stones level is the hardest cell of the goal benchmark (stepping stones overall: 0.93).
- Nothing here has been run on hardware yet.
The method is that of Humanoid Mobility via Attention-based Contacts (He, Wen, Zhang et al.): the contact tracker, the attention-based contact planner, the three training stages and the goal-reaching terrain suite. Thanks to Vu Dinh Quang for his ACP implementation, on which all of this is built, and to InstantTrack, whose fast training loop instantACP brings to contact planning. Thanks also to Chong Zhang for supermimic_vibed, an unofficial reimplementation of SuperMimic. The clips come from PHP parkour.
MIT. Code derived from other projects keeps their MIT notices; see THIRD_PARTY_NOTICES.md.






