Randomness enters data shuffling, train/validation splitting, parameter initialization, augmentation, dropout and sometimes low-level hardware kernels.
1. A seed controls a random-number sequence
import random, numpy as np, torch
random.seed(42)
np.random.seed(42)
torch.manual_seed(42)
This makes many sources of pseudo-randomness repeatable. It does not guarantee bit-for-bit reproducibility on every device/library/version.
2. A seed is not a scientific conclusion
If seed 42 produces 92% and seed 17 produces 88%, reporting only seed 42 hides instability. Fixing a seed is useful for debugging; evaluating multiple seeds is useful for evidence.
3. Reproducibility needs context
Record code commit, dataset/version, environment, dependencies, preprocessing, hyperparameters, random seeds and hardware-sensitive settings when relevant.
A metric without provenance is difficult to trust.
4. Determinism can cost performance
Some deterministic kernels may be slower. Decide whether debugging, auditing or exact repeatability justifies the trade-off.
What to Remember
A seed helps replay randomness. Reproducibility means preserving enough of the whole experiment that another run can meaningfully test the same claim.
Next → Why One Training Run Is Not Evidence: what if seed-to-seed variation is larger than the improvement we claim?