brax icon indicating copy to clipboard operation
brax copied to clipboard

init_noise_std silently ignored when distribution_type='tanh_normal' (default)

Open AIRJASON50 opened this issue 9 months ago • 1 comments

Summary

When using make_ppo_networks() with the default distribution_type='tanh_normal', the init_noise_std parameter is accepted without any warning but has no effect.

Root Cause

In make_policy_network() (networks.py:393-399), the tanh_normal branch creates a plain MLP:

if distribution_type == 'tanh_normal':
    policy_module = MLP(
        layer_sizes=list(hidden_layer_sizes) + [param_size],
        activation=activation,
        kernel_init=kernel_init,
        layer_norm=layer_norm,
    )

init_noise_std, noise_std_type, and state_dependent_std are all accepted by the function signature but never passed to this branch. The std is entirely determined by the network's output (second half of 2*action_size, passed through softplus in NormalTanhDistribution.create_dist()), with the initial value depending on random weight initialization.

Only the normal branch creates PolicyModuleWithStd, where init_noise_std actually initializes the learnable LogParam/Param.

Impact

  • Users who set init_noise_std while using the default tanh_normal get zero feedback that the parameter is being ignored
  • Any hyperparameter sweep over init_noise_std under tanh_normal produces identical results — wasted compute
  • learner.py default flags combine tanh_normal with init_noise_std=1.0 (dead code)
  • train_test.py tests tanh_normal + init_noise_std=0.8 without verifying it has any effect

We discovered this while training dexterous manipulation policies with MJX. We had been tuning init_noise_std under the default tanh_normal for some time before realizing it had zero effect.

Suggested Fix (any of)

  1. Raise a warning when init_noise_std is explicitly set with tanh_normal
  2. Document that init_noise_std only applies to distribution_type='normal'
  3. Consider changing the PPO default to distribution_type='normal' — most PPO implementations in the community (IsaacLab, rl_games, rsl_rl, CleanRL, Stable-Baselines3) use state-independent std without tanh squashing, consistent with Schulman's original PPO

AIRJASON50 avatar Feb 28 '26 08:02 AIRJASON50

I'd like to send a PR for this. Before writing it, a quick question on which option you'd prefer.

The least disruptive fix I can see is to raise a clear error when init_noise_std (or noise_std_type / state_dependent_std) is set together with distribution_type='tanh_normal', and to document that these options only apply to 'normal'. Default behavior and existing checkpoints stay exactly the same.

The alternative is to make tanh_normal honor init_noise_std by initializing the bias of the std output, but that changes the starting std for everyone using the default. I'd only do that if you want it.

I'm planning the first option unless you'd rather go another way.

mert-ogul avatar Oct 12 '26 12:10 mert-ogul