Docs/Guarantees and recipes
Reproducibility Recipe
A concrete checklist for "make my numerical pipeline bit-reproducible from a fresh checkout, on any compatible machine, today and three years from now."
- Pin the toolchain. Add
rust-toolchain.tomlwith a specific nightly. We usenightly-2026-08-31. - Pin every dependency. Use exact
=x.y.zconstraints inCargo.toml, not caret/tilde. CommitCargo.lock. - Use an explicit RNG seed for reproducibility.
Generator::from_pcg64_dxsm(seed)for new code;SeedMaterial::Noneintentionally sources OS entropy like NumPy. - Spawn child streams for parallelism, not OS entropy.
let mut parent = SeedSequence::new(&[seed])?; let children = parent.spawn(n_workers)?;gives each worker a child stream. The full lineage is captured in the spawn counter, so child indices reproduce. - Capture the full generator state. Before any non-deterministic side-effect, call
generator.to_pickle_payload()to obtain a typed snapshot struct;from_pickle_payloadreconstructs the exact state in-process. For cross-process persistence you currently need to layer your own transport over the payload's public fields. - Use
errstaterather than globalseterrfor short-lived overrides. Globalseterris process-wide;errstateis RAII-scoped and restores prior state on drop. - Round-trip via
save/loadfor canonical output. The NPY format is byte-stable across runs; pickle and JSON formats are not. - Hash your inputs and outputs. SHA-256 every fixture and every artifact. The
fnp-conformanceartifact-durability stack does this for you, but the pattern is portable. - Record the environment fingerprint (Rust toolchain, NumPy version if relevant, CPU model). Two reproducibility runs are only comparable when their fingerprints match.
Following all nine steps gives you a pipeline whose output is bit-identical between any two runs on compatible hardware, including across the project's 0.x → 1.0 evolution: the RNG, dtype, and shape contracts are stable even when the API surface moves.