Skip to content

New PRNG in 0.5.0 has degraded pseudorandom capability #26019

Closed
@patrick-kidger

Description

@patrick-kidger

Description

Something we just spotted in patrick-kidger/diffrax#569 is that several of Diffrax's tests are now failing as of the 0.5.0 release. We run Kolmogorov-Smirnov tests to check the randomness of our Brownian motion samples, and these are now dramatically exceeding thresholds: with p = 0.01 the null hypothesis (that our random samples are correctly normally distributed) is rejected, in favour of the alternate hypothesis (that our samples are from non-normal distributions).

Setting JAX_THREEFRY_PARTITIONABLE=False as per #18480 fixes the issue (p=0.61).

As you might imagine a MWE is somewhat tricky to isolate, but I wanted to bring this up now to limit the blast radius of this fairly severe, fairly subtle, problem.

In the mean time this issue can be reproduced by running the following test (we have several tests failing, here is just one) from Diffrax (check out the source from here):

pytest test/test_brownian.py::test_statistics[True-SpaceTimeLevyArea-VirtualBrownianTree]

using versions:

beartype==0.19.0
diffrax==0.6.2
equinox==0.11.11
iniconfig==2.0.0
jax==0.5.0
jaxlib==0.5.0
jaxtyping==0.2.36
lineax==0.0.7
ml_dtypes==0.5.1
numpy==2.2.2
opt_einsum==3.4.0
optimistix==0.0.10
packaging==24.2
pluggy==1.5.0
pytest==8.3.4
scipy==1.15.1
setuptools==75.1.0
typeguard==2.13.3
typing_extensions==4.12.2
wheel==0.44.0

System info (python version, jaxlib version, accelerator, etc.)

jax:    0.5.0
jaxlib: 0.5.0
numpy:  2.2.2
python: 3.12.8 | packaged by Anaconda, Inc. | (main, Dec 11 2024, 10:37:40) [Clang 14.0.6 ]
device info: cpu-1, 1 local devices"
process_count: 1
platform: uname_result(system='Darwin', node='Air.local', release='24.2.0', version='Darwin Kernel Version 24.2.0: Fri Dec  6 18:51:28 PST 2024; root:xnu-11215.61.5~2/RELEASE_ARM64_T8112', machine='arm64')

(Tagging @lockwo @andyElking as folks who are likely to need to know about this from the Diffrax side.)

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions