Introduction
A humanoid trained in simulation can be shown things it will never sense on deployment: its true base velocity, the external forces acting on it, its friction and mass, its foot contacts. The deployed policy sees only a short history of proprioception. This task fixes the robot, the environment, the reward, the domain randomisation and the training budget of Humanoid-Gym [1], and asks only how the learner should use the privileged state during training so that the proprioceptive policy it deploys transfers to a simulator it was never trained in.
The field offers three broad answers. The privileged state can go to the critic alone, as in the asymmetric actor-critic [2] that Humanoid-Gym uses by default. It can be compressed by a teacher into a latent that a student learns to infer from history, as in rapid motor adaptation [3]. Or it can supervise an estimator or a representation inside the actor: implicit terrain imagination [4], a hybrid internal model [5], contrastive alignment of proprioceptive and privileged representations [6, 7], or a denoising world model [8]. All of these treat transfer as a perception problem: give the actor a better picture of the hidden state and it will act well in the new simulator.
Our development measurements pointed elsewhere. An actor that additionally saw the privileged state learned no faster and tracked no better over the first 400 iterations, so the actor here is not short of information. What failed in the unseen simulator was feedback: the default policy's forward tracking gain there, the ratio of realised to commanded forward speed, fell from 0.82 at iteration 200 to 0.47 at the end of training in our run, while it kept tracking well in the training simulator. PPO in one simulator produces a gait that realises the command largely feed-forward; when the plant gain changes, the realised velocity changes with it, although the policy's own inputs reveal the error. That is a control problem, and we treat it as one.
Method
We call the method IVL (integral velocity loop). The deployed controller is a learned inner policy inside an explicit outer velocity loop, and the privileged state enters the deployed controller in exactly one place: it supervises the loop's velocity measurement. Everything else the privileged state does happens in training only.
The deployed controller
Let be the actor's observation history and the command in its newest frame. An estimator reads the history with every command channel masked out by , so that it is driven by measurement and never sees the command it is used to track, and returns the base velocity in the command's units. The loop low-pass filters the estimate and integrates the tracking error:
and the inner policy is run on the history with every frame's command channels replaced by
Here is the running range of commands seen in training, the loop's authority is with per axis, the slew limit is of the authority per second, the filter constant is s, the leak constant s, s, and the integral gain is per axis. The command reaching the inner policy therefore never leaves . The carry is six numbers, reset with every episode.
The reason for integral action is the internal-model principle: an integrator on the measured error makes "realised equals commanded" a steady-state constraint that holds for any plant gain, which a memoryless policy cannot guarantee. The loop is deliberately slow against the gait; the inner policy handles transients and the loop only trims. The lateral axis gets the full command span as authority because, under this reward, the inner policy realises only a fraction of a lateral command, so the loop has to ask for several times the commanded value to obtain it. The forward gain is half the lateral one because, as the code records, a faster forward loop fed a period-two limp in the backward-sideways gait.
def loop(self, observations, carry):
"""One step of the outer loop: (command clamped to the trained range, correction, new carry)."""
v_f = self.alpha * carry[:, 0:3] + (1.0 - self.alpha) * self.estimate(observations).detach()
cmd = observations[:, -SINGLE_OBS_DIM + 2:-SINGLE_OBS_DIM + 5]
d_max = self.auth * (self.cmd_hi - self.cmd_lo)
rate = self.slew_dt * d_max
step = torch.maximum(torch.minimum(self.ki_dt * (cmd - v_f), rate), -rate)
integ = torch.maximum(torch.minimum(self.keep * carry[:, 3:6] + step, d_max), -d_max)
cmd = torch.maximum(torch.minimum(cmd, self.cmd_hi), self.cmd_lo)
return cmd, integ, torch.cat((v_f, integ), dim=-1)
def policy(self, observations, command):
"""Inner policy on the history whose command channels are all set to `command`."""
frames = observations.reshape(-1, FRAME_STACK, SINGLE_OBS_DIM)
frames = torch.cat((frames[:, :, :2], command.unsqueeze(1).expand(-1, FRAME_STACK, -1), frames[:, :, 5:]), dim=2)
return self.pol(frames.reshape(-1, FRAME_STACK * SINGLE_OBS_DIM))
def step(self, observations: torch.Tensor, carry: List[torch.Tensor]) -> Tuple[torch.Tensor, List[torch.Tensor]]:
cmd, corr, new_carry = self.loop(observations, carry[0])
return self.policy(observations, cmd + corr), [new_carry]The velocity estimator
The estimator is supervised by the privileged base velocity, from the newest privileged frame, with its own Adam optimiser (learning rate ) and no RL gradient. Two choices in its fit matter. First, it is fitted on the noise-free observation history and applied to the noisy one. Fitted on noisy regressors, a regression is attenuated, the errors-in-variables effect, and then under-reads on any sensor cleaner than the training noise. The noise-free history is rebuilt inside the algorithm from the simulator's noise-free actor frame, frame by frame, and cleared at every reset as the environment clears its own. Second, its loss is a Huber loss whose threshold is three median absolute errors, computed per output over the minibatch:
A robot that is falling has a velocity error far larger than the typical one; under a squared loss a burst of falls takes the regression over, and the loop needs the estimate of a walking robot.
# Velocity estimator: privileged base velocity regressed on the noise-free history, own optimiser.
# Robust (Huber) loss with the threshold at EST_ROBUST median absolute errors: a robot that is falling
# has a velocity error hundreds of times the typical one, and under a squared loss a burst of falls
# takes the regressor over (and the inflated second moments of Adam then keep it wrong for hundreds
# of iterations). The loop needs the estimate of a walking robot.
est_err = ac.estimate(aux_batch[:, 7:]) - aux_batch[:, 0:3]
est_abs = est_err.abs()
est_delta = self.EST_ROBUST * est_abs.detach().median(dim=0).values.clamp(min=1.0e-6)
est_loss = torch.where(est_abs <= est_delta, 0.5 * est_err.pow(2), est_delta * (est_abs - 0.5 * est_delta)).mean()
self.est_optimizer.zero_grad()
est_loss.backward()
nn.utils.clip_grad_norm_(ac.est_parameters(), 10.0)
self.est_optimizer.step()Training the inner policy without letting it cancel the loop
Each training episode is rolled out with the loop closed with probability 0.25, otherwise open, so that the inner policy sees the true command (clamped to the trained range). The PPO surrogate, and the advantage normalisation that feeds it, use open-loop episodes only; closed-loop episodes train the value function, and the estimator is fitted on every episode. Optimising the reward through the loop would let the learner neutralise it: wherever the reward prefers posture over tracking, a lazier response pays for as long as the integrator takes to compensate, so the integrator ratchets to its limit and the policy learns to decode the saturated command. The loop is first closed after 10% of training and its authority ramps to the deployed value over the next 10%.
Randomising the actuator through the action
The training simulator has one actuator law: fixed PD gains on every joint. Our development probes located the transfer gap in the joint-level response of the light ankle joints, which neither the environment's randomisation nor anything else in training varies. The algorithm controls only the action, so it varies the actuator through it. Per episode and per joint it draws an action gain and a relative damping change , both opened gradually over the first 15% of training, and executes
where is the noise-free joint velocity and is the action-equivalent of the damping torque per unit joint velocity. We do not assume ; we identify it online from the privileged joint torques. For each joint we fit the actuator law
by two accumulated normal equations: ordinary least squares, and instrumental variables with the joint velocity of one control step earlier as the instrument. Torques at or beyond 0.9 of the limit are left out, the accumulators forget by a factor 0.98 per iteration, and the returned ratio is the instrumental-variable estimate kept between the least-squares estimate and five times it. The reason for the instrument is that the simulator computes the torque from a state one physics sub-step older than the one it reports, which on light links attenuates the least-squares slope towards zero; least squares is still the stable fallback when the instrument is weak. The value function is told both perturbations, together with the loop's correction and whether the loop is closed: 28 extra inputs to the privileged critic.
def _solve_actuators(self):
"""Damping ratio per joint: the instrumental-variable estimate, kept between the least-squares estimate (biased
towards zero, never away from it) and ID_MAX_ATTENUATION times it. The accumulators forget with ID_FORGET per
iteration, so the fit follows the motion of the current policy."""
if self.id_zx is None:
return
eye = 1.0e-9 * torch.eye(4, dtype=torch.double, device=self.id_zx.device)
try:
ls = torch.linalg.solve(self.id_xx + eye, self.id_xy.unsqueeze(-1)).squeeze(-1)
iv = torch.linalg.solve(self.id_zx + eye, self.id_zy.unsqueeze(-1)).squeeze(-1)
except RuntimeError:
return
finally:
for acc in (self.id_zx, self.id_zy, self.id_xx, self.id_xy):
acc.mul_(self.ID_FORGET)
r_ls = -ls[:, 2] / ls[:, 0].clamp(min=1.0e-6)
r_iv = -iv[:, 2] / iv[:, 0].clamp(min=1.0e-6)
ok_ls = torch.isfinite(r_ls) & (ls[:, 0] > 1.0e-6) & (r_ls > 0)
r_ls = torch.where(ok_ls, r_ls, torch.zeros_like(r_ls))
r_iv = torch.where(torch.isfinite(r_iv) & (iv[:, 0] > 1.0e-6), r_iv, r_ls)
ratio = torch.minimum(torch.maximum(r_iv, r_ls), self.ID_MAX_ATTENUATION * r_ls)
self.damp_ratio = torch.nan_to_num(ratio, nan=0.0, posinf=0.0, neginf=0.0).float() cmd, corr, self.loop_state = ac.actor.loop(obs, self.loop_state)
corr = corr * self.loop_closed
command = cmd + corr
critic_in = self._critic_input(critic_obs, corr)
self.transition.actions = ac.act(obs, command=command).detach()
self.transition.values = ac.evaluate(critic_in).detach()
self.transition.actions_log_prob = ac.get_actions_log_prob(self.transition.actions).detach()
self.transition.action_mean = ac.action_mean.detach()
self.transition.action_sigma = ac.action_std.detach()
# need to record obs and critic_obs before env.step()
self.transition.observations = obs
self.transition.critic_observations = critic_in
self.transition.aux = torch.cat((self._true_velocity(critic_obs), command, self.loop_closed, clean), dim=-1)
# the simulator executes the policy's action through this episode's action gains and damping change
executed = self.transition.actions * self.gains
if full_state is not None and self.damp_ratio is not None:
executed = executed - self.damps * self.damp_ratio * full_state[:, self.FS_DQ]
return executedTwo phases: stop learning the policy at convergence
The last percent of training return is bought with behaviour specific to the training simulator, and robustness elsewhere erodes while the return still creeps up. We therefore track an exponential moving average (weight 0.02) of the mean per-step reward of open-loop episodes and freeze the inner policy and critic once that average has improved by less than 1% of its magnitude over a window of 10% of training, checked only after the loop has reached full authority and a further window has passed, and in any case after 67% of training. From then on the rollouts continue through the same, now stationary, controller and only the estimator is fitted, with its learning rate decaying linearly to 5% of its initial value by the end, so that the loop's measurement is matched to the policy that is deployed instead of chasing a moving one.
def _policy_converged(self):
"""Convergence monitor: smoothed mean reward of the open-loop episodes; True once it has stopped improving."""
ret = self.rew_sum / max(self.rew_cnt, 1.0)
self.rew_sum, self.rew_cnt = 0.0, 0.0
self.ret_ema = ret if self.ret_ema is None else (1.0 - self.FREEZE_EMA) * self.ret_ema + self.FREEZE_EMA * ret
self.ret_hist.append(self.ret_ema)
total = float(self.num_learning_iterations or 3001)
window = max(1, int(round(self.FREEZE_WINDOW * total)))
if self._progress() < self.LOOP_START + self.LOOP_RAMP + self.FREEZE_WINDOW or len(self.ret_hist) <= window:
return False
if self._progress() >= self.FREEZE_LATEST: # the estimator needs the rest of training on a stationary policy
return True
return self.ret_ema - self.ret_hist[-1 - window] < self.FREEZE_EPS * abs(self.ret_ema)We also corrected one detail of the stock update: the environment refreshes its time-out flag only on steps in which some robot resets, so the flag is stale on other steps. We bootstrap on a time-out only where an episode really ended.
Results
| Method | ① | ② | ③ | |||
|---|---|---|---|---|---|---|
| Fall rate ↓ | Success rate ↑ | Fall rate ↓ | Success rate ↑ | Fall rate ↓ | Success rate ↑ | |
| Claude Fable 5.2 | 0.847 | 0.713 | 0.197 | |||
| Asymmetric actor-critic | 0.954 | 0.004 | 0.536 | 0.429 | 0.932 | 0.022 |
| Symmetric critic | 0.598 | 0.004 | 0.779 | 0.095 | 0.752 | 0.001 |
| RMA | 0.862 | 0.018 | 0.574 | 0.245 | 0.646 | 0.126 |
| DreamWaQ | 0.775 | 0.037 | 0.499 | 0.491 | 0.830 | 0.095 |
| Hybrid Internal Model | 0.766 | 0.023 | 0.576 | 0.392 | 0.756 | 0.136 |
| TAR | 0.780 | 0.014 | 0.344 | 0.645 | 0.526 | 0.170 |
| PvP | 0.960 | 0.003 | 0.730 | 0.262 | 0.994 | 0 |
| TAR, LSTM encoder | 0.947 | 0.002 | 0.543 | 0.412 | 0.888 | 0.025 |
| RMA, 50-step history | 0.950 | 0.010 | 0.440 | 0.435 | 0.394 | 0.233 |
| DWL | 0.986 | 0.002 | 0.615 | 0.369 | 0.602 | 0.066 |
- ① MuJoCo · mixed commands + unseen pushes
- ② MuJoCo · forward gait + payload range up to 1.25x body weight
- ③ MuJoCo · high-speed forward commands
The run's means report the fall rate on Push-recov and the success rate on Payload and High-speed, so these are the comparisons we can make.
On Payload IVL has the highest success rate of every method in the table: 0.713 against 0.645 for the strongest published baseline, TAR [6], and 0.429 for the asymmetric actor-critic it modifies.
On High-speed IVL reaches a success rate of 0.197, second to RMA, 50-step history [3] at 0.233 and ahead of every other baseline, the next being TAR at 0.170; the default reaches 0.022.
On Push-recov the picture is different. IVL's fall rate of 0.847 is lower than the default's 0.954 and lower than those of six of the ten baselines, but higher than those of four: the symmetric-critic ablation (0.598), the HIM-style estimator (0.766), the DreamWaQ-style estimator (0.775) and TAR (0.780). The loop corrects slow drift in the realised velocity; it was not designed to stop a fall, and this result says it does not.
How we got here
IVL was not our starting point. We began by reproducing the reference methods in our own transfer tests, and the estimator and latent methods we ran first (HIM-style and PvP) trailed the default there at 600 iterations. The diagnostic that redirected the work was the one above: the actor was not short of information, and the default's forward tracking in the unseen simulator decayed steadily with training. As a diagnostic only, we wrapped a velocity loop around policies trained without it; it raised the default's success in our tests a great deal, which told us the estimator transferred and the missing ingredient was feedback.
Building the loop into training took most of the session, and most attempts failed.
- An always-closed loop was degenerate. With the learner co-adapting from the first iteration, the integrator's operating point was unidentifiable and it sat near its clamp on every axis.
- Co-training with the loop closed in half the episodes collapsed later. The policy drifted along the direction the loop could compensate, acquiring a forward bias that held the integrator near its limit at zero command, and transfer collapsed around iteration 1000 in our run. Our earlier analysis of co-adaptation, that the reward pays a lazier response for as long as the integrator takes to compensate, had already led to the split design, which won clearly at iteration 600 in our comparison.
- Other cures for co-adaptation did not hold up. A fall-probability advantage on closed-loop episodes tracked worse than the split design at the same iteration and left the lateral integrator more saturated; we dropped it. Relabelling closed-loop rewards with a learned privileged reward model collapsed. We also tried feedback-error learning and disturbance training, and kept neither.
- The estimator's bias in the unseen simulator was attenuation. On one seed the in-loop estimator, fitted on noisy inputs, under-read by a factor of about 0.66 on the cleaner inputs of the unseen simulator, so the loop drove the robot to 1.5 times the command. Fitting it on the noise-free history removed that.
- Estimator spikes came from the squared loss. Bursts of large errors during falls coincided with spikes in the estimator's error that persisted for hundreds of iterations; the median-scaled Huber loss was the fix.
- Late training eroded transfer. Without a freeze, one seed's falls in our transfer tests rose from 0.05 at iterations 600 to 800 to 0.55 at iteration 1600, and the policy fell even with the loop open. That is the origin of the two-phase schedule. The actuator-damping randomisation came later, from open-loop response curves that located the gap in the ankle's actuator response; with it, continued training no longer hurt transfer, and we moved the freeze later.
- The action-gain randomisation earns its place. Removing the action-gain randomisation on one seed dropped success in our tests from 0.992 to 0.925.
- The loop and the training changes both contribute. With the integral gain set to zero in the final models, success in our tests was 0.71 to 0.93, against 1.000 with the loop and 0.525 for the default, so the training changes alone already improve on the default and the loop supplies the rest.
The last change was made minutes before the end: we returned the lateral authority from 1.25 times the command span to 1.0. On one seed's final model, 1.25 gave four falls in a stress test of backward-sideways commands where 1.0 gave none; we judged a fall to cost more than the few strict tracking misses that 1.25 was buying. The installed combination of that authority with the per-axis integral gains was not itself trained end to end before the session ended.
All figures in this section are our own development measurements, recorded in the run's trace. Our literature survey also pointed to work finding that the base linear velocity is the single most useful quantity to estimate explicitly for blind humanoid locomotion, which is consistent with spending the privileged state on that estimate.
Limitations
- Falls are not what the loop addresses. On Push-recov, IVL's fall rate is behind four published baselines. The loop is a slow trim with bounded authority and deliberately leaves transients to the inner policy; nothing in IVL is aimed specifically at staying upright.
- The constants were tuned by hand on our own tests. The per-axis gains and authorities, the slew and leak constants, the loop probability and the freeze thresholds come from development runs on a handful of seeds, and the final lateral authority was chosen against one seed's stress test without a full training run of the exact configuration.
- A residual corner remains. In development, backward-sideways commands occasionally produced a fall on some seeds, and no loop setting we tried removed it systematically.
- The loop leans on the estimator. If the estimator is biased in a new plant, the integrator tracks the bias; the noise-free fit and the robust loss reduce this risk but do not remove it, and the bounded authority is the only guard against an estimate that is badly wrong.
- Lateral tracking stays reward-limited. The inner policy realises only a fraction of a lateral command, and the loop compensates by asking for more; the lateral integrator is the one that reaches its limit most often in our tests.
- Freezing ends learning early. Once the inner policy is frozen, the remaining budget trains only the estimator. That traded training return for transfer in our tests, but it is a fixed rule, not a measured trade-off on each run.
References
- Xinyang Gu, Yen-Jen Wang, Jianyu Chen (2024). Humanoid-Gym: Reinforcement Learning for Humanoid Robot with Zero-Shot Sim2Real Transfer. ICRA.
- Lerrel Pinto, Marcin Andrychowicz, Peter Welinder et al. (2018). Asymmetric Actor Critic for Image-Based Robot Learning. RSS.
- Ashish Kumar, Zipeng Fu, Deepak Pathak et al. (2021). RMA: Rapid Motor Adaptation for Legged Robots. RSS.
- I Made Aswin Nahrendra, Byeongho Yu, Hyun Myung (2023). DreamWaQ: Learning Robust Quadrupedal Locomotion With Implicit Terrain Imagination via Deep Reinforcement Learning. ICRA.
- Junfeng Long, Zirui Wang, Quanyi Li et al. (2024). Hybrid Internal Model: Learning Agile Legged Locomotion with Simulated Robot Response. ICLR.
- Amr Mousa, Neil Karavis, Michele Caprio et al. (2025). TAR: Teacher-Aligned Representations via Contrastive Learning for Quadrupedal Locomotion. IROS.
- Mingqi Yuan, Tao Yu, Haolin Song et al. (2026). PvP: Data-Efficient Humanoid Robot Learning with Proprioceptive-Privileged Contrastive Representations. CVPR.
- Xinyang Gu, Yen-Jen Wang, Xiang Zhu et al. (2024). Advancing Humanoid Locomotion: Mastering Challenging Terrains with Denoising World Model Learning. RSS.