#1720·Gymnasium

[Proposal] Document sensitivity of InvertedDoublePendulum to tiny numerical differences in long-horizon trajectory comparisons

Author: HadushHailuCreated Sep 19, 2026Updated Sep 22, 2026
Labelsenhancement

Proposal

Document that InvertedDoublePendulum can amplify extremely small numerical differences over long rollouts, so long-horizon trajectory divergence should not by itself be interpreted as evidence that the simulator dynamics changed.

For regression or cross-version comparisons, first-step or short-horizon comparisons can be more informative because they capture implementation differences before chaotic amplification dominates the trajectory.

Motivation

During a cross-release audit, I ran release pairs from identical initial states with identical action sequences. I observed a difference of at most about 2.2e-16 at the first step, which then grew substantially over the rollout.

In my run, the separation was approximately:

step 0 2.220e-16 step 1 2.220e-16 step 2 4.441e-16 step 5 1.776e-15 step 10 3.553e-15 step 20 3.908e-14 step 50 1.014e-12 step 100 4.836e-09 step 200 1.420e-05 step 400 6.433e-02 step 499 3.648e-02

The separation grows approximately exponentially, which is consistent with chaotic amplification of an initial floating-point difference rather than a change in the underlying simulator dynamics. The practical concern is that long-horizon trajectory comparisons can therefore make equivalent simulator implementations appear substantially different.

Pitch

Document this behavior for InvertedDoublePendulum and note that long-horizon trajectory divergence should not by itself be interpreted as evidence of changed simulator dynamics.

For regression or cross-version comparisons, first-step or short-window comparisons are more appropriate for identifying implementation differences before chaotic amplification dominates the trajectory.

Alternatives

No change to the environment dynamics is proposed.

An alternative is to leave this undocumented and rely on users to recognize chaotic divergence when comparing trajectories, but this can make cross-version validation difficult to interpret.

Additional context

The reproduction code is available at:

https://github.com/TesfayZ/algebraicRLtest

After cloning the repository, run:

./audit/setup_envs.sh ./venv/bin/python audit/run_audit.py ./venv/bin/python audit/amplification.py

The final command reproduces the per-step separation growth for InvertedDoublePendulum-v4 and compares it with Reacher-v4 as a non-chaotic control.

For gymnasium-0.29.1 + mujoco-2.3.7 versus gymnasium-1.0.0 + mujoco-3.1.6, I obtained:

step 0 2.220e-16 step 20 3.908e-14 step 50 1.014e-12 step 100 4.836e-09 step 200 1.420e-05 step 400 6.433e-02

The measured growth was about 32.4 steps per decade, with 14.5 decades climbed from step 0.

For gymnasium-1.2.3 + mujoco-3.2.7 versus gymnasium-1.3.0 + mujoco-3.10.0, the same pattern appears, with about 41.6 steps per decade.

By contrast, Reacher-v4 remains at floating-point precision or is bitwise identical over the same horizon.

The script writes the full results to:

audit/Results/amplification.csv

This analysis is also described in the paper:

Diagnosing Faults in Reinforcement Learning Simulators and World Models with Canonical Polynomial Invariants (https://arxiv.org/abs/2609.13194)

Checklist

  • I have checked that there is no similar issue in the repo

Source: Farama-Foundation/Gymnasium