Seeds and Reproducibility

RL is unusually sensitive to randomness. Initialization, exploration, environment stochasticity, replay-buffer ordering, data-loader behavior, action sampling, distributed actor timing, and GPU nondeterminism can all change the trajectory of learning. Two runs can use the same code, hyperparameters, environment, and reward function, yet different random seeds can lead to very different final policies: one policy may solve the task reliably, while another may fail or learn unsafe behavior.

That is why deployment teams should care about the full training process. If retraining the same system next week could produce a much worse policy, that instability is itself a product risk.

⚠

Common Reproducibility Challenges

  • Stochastic transitions and randomized resets.
  • Exploration randomness from action sampling or noise processes.
  • Random-number streams inside environment physics.
  • GPU nondeterminism and floating point differences across hardware.
  • Replay-buffer ordering differences, especially with parallel actors.
  • Long-horizon compounding effects where a tiny early difference changes the future state distribution.

Different seeds can lead to different learned policies, even when the training script "converges":

π^1≠π^2andJ(π^1)−J(π^2) can be large\hat{\pi}_1\neq\hat{\pi}_2\quad\text{and}\quad J(\hat{\pi}_1)-J(\hat{\pi}_2)\text{ can be large}

So the reproducibility question has two parts: "can I rerun this seed?" and "does this method produce acceptable policies across seeds?"

Reproducibility has two layers:

  • Exact replay: can this run be reproduced closely enough to debug it?
  • Statistical reliability: does the method work across seeds?

Exact replay is hard in physics simulators because multithreading, floating point differences, variable timesteps, and contact-resolution order can cause trajectories to diverge. The practical target is often "deterministic enough" for unit tests and auditable enough to explain divergence.

Seed variance

Put the policy on trial

Deployment asks whether the training process reliably produces a good policy across repeated runs.

Seed 1

88

Return88%
Violations15%

Seed 2

84

Return84%
Violations20%

Seed 3

81

Return81%
Violations25%

Seed 4

22

Return22%
Violations90%

Seed 5

90

Return90%
Violations20%

Seed 6

19

Return19%
Violations100%

Seed 7

86

Return86%
Violations15%

Seed 8

24

Return24%
Violations85%

mean return

61.8

low-tail return

22.0

avg violations

9.3

gate

block

Investigate

Strong seeds exist alongside bad seeds, exposing an instability that can reappear after retraining.

Report distributions across seeds. The lower tail often matters more than the best run.

When reporting an RL result, summarize the distribution across seeds. A basic report should include mean return, variance or confidence intervals, lower-tail performance, failure rate, and constraint violations.

For deployment, the lower tail matters. A warehouse robot policy with seven reliable seeds and one seed that collides repeatedly reveals that the training recipe can produce an unacceptable policy unless selection, evaluation, and safety gates catch it.

Many simulators add another wrinkle: even with fixed seeds, stepping can be nondeterministic. Causes include multithread scheduling, non-fixed integration timesteps, floating point differences across hardware, GPU physics, and nondeterministic collision resolution order. If multiple contacts are resolved in a different order, the resulting forces and positions can differ, and that difference can compound over a long rollout.

Simulator-dependent knobs that can make a run more deterministic include single-threaded simulation, fixed timesteps, deterministic solvers or contact ordering when supported, and disabling GPU physics. Physics-heavy RL often cannot reach full determinism. The practical goal is to be deterministic enough for regression tests and to measure replay divergence: how quickly two supposedly identical trajectories drift apart.

⚠

Best-Seed Selection Is Leakage

If you train many seeds and report only the best one, you have used evaluation as a selection mechanism and hidden the selection process. In real deployments, the key question is whether your recipe reliably produces a safe policy across repeated training runs.

ℹ

Real Deployment Decision

Before retraining or refreshing a deployed RL policy, decide the seed policy: how many seeds will be trained, what statistic selects the candidate, what lower-tail threshold blocks release, and whether a human review must inspect rollout traces from every seed.

Checkpoint

Why is selecting the best seed after training misleading?