Skip to content
Physical AI
All experiments

Running mean / std observation normalization

How a running mean and variance turn observations with very different scales (a joint velocity of several rad/s, a gravity component near −0.98) into comparable, roughly zero-mean unit-variance inputs, and what happens if the data shift after the statistics are frozen.

Loading simulation…

What it demonstrates

How a running mean and variance turn observations with very different scales (a joint velocity of several rad/s, a gravity component near −0.98) into comparable, roughly zero-mean unit-variance inputs, and what happens if the data shift after the statistics are frozen.

How it works

Two synthetic channels are streamed at 50 Hz. Each new sample is merged into the running statistics with the parallel mean/variance update, then normalized as (x − mean)/√(var + ε) and clipped. Freezing the statistics mimics deployment, where the normalizer saved with the policy is applied unchanged.

Adjustable parameters

  • Raw offset (−8 to 8 rad/s)
  • Raw spread (0.2–10 rad/s)
  • Clip (±1 to ±10)
  • Freeze statistics
  • Reset statistics

Known limitations

  • Menlo documents that observation normalization is enabled; the exact implementation, clip value and whether statistics are frozen at deployment are not stated.
  • The input signals are synthetic.

Equations

δ=xˉB−μ,μ←μ+δ nBn+nB\delta = \bar x_B - \mu,\quad \mu \leftarrow \mu + \delta\,\frac{n_B}{n+n_B}
σ2←nσ2+nBσB2+δ2n nBn+nBn+nB\sigma^2 \leftarrow \frac{n\sigma^2 + n_B\sigma_B^2 + \delta^2\frac{n\,n_B}{n+n_B}}{n+n_B}
x~=clip⁡ ⁣(x−μσ2+ε, −c, c)\tilde x = \operatorname{clip}\!\left(\frac{x-\mu}{\sqrt{\sigma^2+\varepsilon}},\,-c,\,c\right)

Core update rule

updateRunningStats(stats, [raw]);          // skipped when frozen
const z = normalize(stats, raw, clip);     // (x - mean) / sqrt(var + 1e-8), clipped

Explained in Chapter 8: Locomotion Policy