-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
DOC: better document the spawn interface, compare and contrast it to Jax's "split" #15656
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
We already have such an interface, see Parallel Random Number Generation. If you couldn't find it that means we need to somehow make it more discoverable, so I am pivoting this to a documentation issue. |
@mattip Please don't be so fast to blame your documentation. I didn't look hard enough. I'm goign to read it now. |
Looks like an excellent design. I guess you could use the word "splittable" and "fork" somewhere on the page so that Google finds it. This is the terminology used by Jax. |
Maybe we should have keyword lists in the documentation. |
Good idea. Anyway, feel free to close this. I've tried to convince the Jax people to use your interface: jax-ml/jax#2294 If they agree, the ambiguity will disappear. |
While the current API forces you to work with Just to provide some mathematical background, Jax's PRNG is in the same weak-crypto family as our
|
@rkern I wish there was a fascinating reaction, because that is fascinating. I'll point them to your comment. |
Note that Philox Also, splittable PRNGs are far from being an "innovation" of JAX (see also the JAX PRNG design notes); they have existed, for example, in Haskell and Java for years. Some of the known constructions for splittable PRNGs are surveyed in "Evaluation of Splittable Pseudo-Random Generators" by H. G. Schaathun, 2015. Some of them are general enough to be used by any PRNG (including Mersenne Twister and PCG), but do not necessarily lead to high-quality splittable PRNGs. Another example of a splittable PRNG is found in JuliaLang/julia#34852. See also idontgetoutmuch/random#7. |
Just for the record, note that SFC64 is not actually counter-based. It incorporates a counter into its state, but the counter isn't the only part of the state that evolves a la ThreeFry and Philox. The counter in SFC64 is there to ensure a minimum size of the cycles, which are of variable size. |
Jax, a new deep learning machine learning library has copied numpy's excellent interface. They added one innovation to random number generation: splitting.
This is useful when parallel processes that should not be serialized need access to random numbers from a reproducible stream.
I suggest adding a method to BitGenerator:
and a similar method on Generator that splits the underlying bit-generator and returns
The text was updated successfully, but these errors were encountered: