In this article
A JAX random call does not advance its key; independent stochastic operations need deliberately derived keys.
Identify the random input of an operation
A GPU simulation creates perturbations for multiple model candidates but accidentally gives every candidate the same noise. In JAX random functions, a key is an explicit input, and using it does not mutate hidden generator state. Repeating an equivalent sampling call with the same key reproduces the result. That behavior is useful for controlled comparisons, but it is different from repeatedly drawing from a stateful generator.
Give stochastic roles distinct keys
Decide which operations should share randomness and which should receive independent random inputs. Parameter initialization, augmentation and dropout usually represent different roles. The split API derives a batch of keys from a parent. Associate derived keys with the intended roles before passing them into transformed functions. A variable named next_key has no special semantics; the program must actually derive and route a different key.
Keep the implementation inside the type contract
The typed-key design explains why keys carry a dedicated element type rather than presenting ordinary integer buffers. Raw arithmetic on old key buffers can create unsupported derivations. When interfacing with a serialization system, preserve the PRNG implementation as well as the necessary key data. Typed keys remove several accidental integer-array operations, but they do not by themselves design a correct allocation of randomness across your experiment.
Test intended sharing and intended independence
A useful pilot contains repeated sampling that should match and separate roles that should not unintentionally reuse a key. Compare results across the actual transformation and batching choices used by the application. Do not use a visual inspection of noisy output as proof of independence. Trace key provenance through the relevant function arguments, especially when a helper receives both a model state and a key hidden inside a nested container.
Record derivation alongside experiment state
Keep enough information to reconstruct how keys were associated with samples, steps and model roles. A seed alone cannot explain an undocumented reshaping of that allocation. The guides on data random-state replay and activation recomputation provide related context. Their connection is practical: reproducing model arithmetic also requires reproducing the stochastic inputs used by the intended operations.
Earn rental income from GPUs
Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.