Skip to content

Fix additive noise bias accumulating across resets - #8634

Merged
hujc7 merged 3 commits into
isaac-sim:mainfrom
Patrick-SCH03:fix/noise-bias-reset
Oct 30, 2026
Merged

hujc7 merged 3 commits into
isaac-sim:mainfrom
Patrick-SCH03:fix/noise-bias-reset

Conversation

@Patrick-SCH03

@Patrick-SCH03 Patrick-SCH03 commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Description

NoiseModelWithAdditiveBiasCfg.bias_noise_cfg is documented as "sampled at every reset of the noise model", and the direct-env how-to says the bias is "resampled at the next reset". NoiseModelWithAdditiveBias.reset instead applies the bias noise to the previous bias:

self._bias[env_ids] = self._bias_noise_cfg.func(self._bias[env_ids], self._bias_noise_cfg)

With the default operation="add", every reset adds a new sample to the old bias, so the bias random-walks across episodes. With 4096 envs, sample_bias_per_component=False, GaussianNoiseCfg(std=0.1) as the bias noise and torch.manual_seed(0), after N calls to reset():

resets bias std ("add", develop) bias std ("abs")
1 0.099 0.099
10 0.317 0.101
100 0.988 0.101

A UniformNoiseCfg(n_min=-0.1, n_max=0.1) bias spans about -1.3 to 1.5 after 50 resets. ObservationManager.reset and the direct envs call this reset on every episode reset, so the observation bias of long training runs keeps growing. "abs" happens to work because it ignores the input.

This samples the bias from zeros instead of from the previous bias. "add" now gives a fresh sample on each reset, the same as "abs". The noise functions draw the same random numbers either way, so "abs" (used by all in-repo configs) and "scale" give bit-identical results to develop. The changelog fragment notes the behavior change for configs that use "add", and the bias_noise_cfg docstring now says how each operation applies to the bias ("scale" already yielded no bias on develop, since the initial bias is zero).

All in-repo configs have used "abs" since the bias model was added, and I did not add an option to keep the accumulating behavior; happy to add one if you prefer.

#8218 (draft) also edits this reset to add an env_mask path, but both of its branches still pass the previous bias, so the two changes would need a small merge there.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks with uv run isaaclab --format
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have validated the changed behavior with focused coverage and applied the test-audit criteria to any test changes
  • I have added a changelog fragment under source/<pkg>/changelog.d/ for every touched package (do not edit CHANGELOG.rst or bump package versions — CI handles that)
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

Testing

  • Added test_additive_bias_is_resampled_on_reset to test/utils/test_noise.py: with a constant "add" bias of 0.5, the output must stay 0.5 after repeated full resets, and after changing the bias to 0.25 a partial reset of env 1 must resample only that env. On develop it fails at the first check with 1.0 (the explicit reset and the lazy per-component reset on the first call each add 0.5); it passes with the fix.
  • Compared the fixed reset with the develop one under a fixed seed for Gaussian, uniform and constant bias noise, each operation, and both sample_bias_per_component settings, over 50 full and partial resets: "abs" and "scale" outputs are identical, and "add" now stays at the configured spread.
  • test_noise.py and test_observation_manager.py pass locally on CPU (the cuda:0 rows of the existing noise tests were run with the device swapped to CPU, since my machine has no CUDA). I could not run the direct-env unit tests in my environment.
  • Ruff v0.14.10 (the pre-commit pin) check and format and codespell are clean on the changed files. I ran them directly because the full uv run isaaclab --format environment isn't available on my Windows machine.

Release backport

  • Backport this pull request to the active release branch after it merges into develop

NoiseModelWithAdditiveBias.reset applied the bias noise to the previous
bias. With the default "add" operation every reset added a new sample to
the old one, so the bias random-walked across episodes instead of being
resampled as documented. Sample the bias from zeros instead, which
leaves "abs" and "scale" results unchanged.

Signed-off-by: Patrick-SCH03 <[email protected]>
@Patrick-SCH03
Patrick-SCH03 requested a review from a team October 16, 2026 02:22
@github-actions github-actions Bot added bug Something isn't working isaac-lab Related to Isaac Lab team labels Oct 16, 2026
@greptile-apps

greptile-apps Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] This PR appears safe to merge.

Summary

Fixes NoiseModelWithAdditiveBias.reset so each reset samples from zeros instead of adding noise to the previous bias.

  • Additive bias resets now draw a fresh sample each time.

Reviews (1) · Last reviewed commit: "Fix additive noise bias accumulating acr..." · Reviewed by Greptile

@isaaclab-review-bot isaaclab-review-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isaac Lab Review Bot

All reviewed code categories look good.

  • PR description: The title and body match the four-file diff and report focused validation; mark the documentation checkbox complete and trim the repeated bug-versus-feature rationale.
  • Design and architecture: Architecture looks good.
  • Scope and over-engineering: No over-engineering issues.
  • API: API changes look good.
  • Compatibility and deprecation: No breaking changes identified.
  • Implementation: Implementation looks good.
  • Style consistency: Style consistency looks good.
  • Test quality: Test quality looks good.

No blocking issues. No inline findings.

Automated review; human maintainers own approval decisions.

@AntoineRichard AntoineRichard left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @Patrick-SCH03! I have one comment, could you take a look? Thanks again!

# reset the bias term
self._bias[env_ids] = self._bias_noise_cfg.func(self._bias[env_ids], self._bias_noise_cfg)
# sample a fresh bias; applying the noise to the previous bias would accumulate it for the "add" operation
self._bias[env_ids] = self._bias_noise_cfg.func(torch.zeros_like(self._bias[env_ids]), self._bias_noise_cfg)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we avoid the memory allocation here? Maybe pre-allocate a array full of 0 on the init?

@Patrick-SCH03

Copy link
Copy Markdown
Contributor Author

Thanks for the review! Done in bccbe89: the model now keeps a zero tensor _zero_bias from __init__ (re-created once when the bias is expanded per component) and reset() passes self._zero_bias[env_ids] to the bias noise function, so it no longer allocates zeros on every reset. The noise functions are out of place, so the buffer stays zero; I checked this over repeated full and partial resets, including the UniformNoiseCfg(0, 0) path that returns its input.

One note: for a full reset the slice is a view, but with a list or tensor of env_ids the indexing still gathers a small copy, and the noise function allocates its output in either case.

@Patrick-SCH03

Copy link
Copy Markdown
Contributor Author

@AntoineRichard friendly ping: the zero buffer is now preallocated in __init__ (bccbe89), as suggested. Could you take another look when you have a moment? Thanks!

@AntoineRichard AntoineRichard left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes @Patrick-SCH03. Looks good now!

@AntoineRichard

Copy link
Copy Markdown
Collaborator

run-ci

@isaaclab-bot isaaclab-bot Bot added ci:run-docker Trigger the on-demand Docker and GPU CI workflow and removed ci:run-docker Trigger the on-demand Docker and GPU CI workflow labels Oct 27, 2026
@AntoineRichard

Copy link
Copy Markdown
Collaborator

run-ci

@isaaclab-bot isaaclab-bot Bot added ci:run-docker Trigger the on-demand Docker and GPU CI workflow and removed ci:run-docker Trigger the on-demand Docker and GPU CI workflow labels Oct 30, 2026
@hujc7
hujc7 merged commit 82a5df1 into isaac-sim:main Oct 30, 2026
59 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants