"매 same input + same code = same output, every run, every machine". 매 1936 Turing 의 deterministic state machine 부터 매 2026 ML training 의 bit-exact reproducibility, 매 distributed consensus (Raft), 매 blockchain virtual machines 까지 — 매 trust 와 debugging 의 foundation.
매 핵심
매 등급
Bit-exact: 매 byte-level identical output. 매 cryptographic hash 동일.
Numerically reproducible: 매 within ε tolerance — 매 floating-point order 차이.
Statistically reproducible: 매 same distribution, different sample (RNG seed only).
Behaviorally reproducible: 매 high-level outcome 동일 (test passes/fails 동일).
매 nondeterminism 원인
FP non-associativity: 매 (a+b)+c ≠ a+(b+c) — 매 reduction order matter.
GPU atomic ops: 매 CUDA atomicAdd 의 ordering 비결정적.
Thread scheduling: 매 OS scheduler 의 race condition.
Hash randomization: 매 Python PYTHONHASHSEED, Go map iteration.
Wall-clock dependency: 매 timestamps, time.time(), random().
Hardware: 매 cosmic ray bit flips, TLB/cache state.
매 응용
ML training reproduction: 매 paper benchmark 의 reproducibility crisis.
Blockchain consensus: 매 nodes must reach identical state.
Distributed log replay: 매 event sourcing 의 deterministic projection.
Game engine replays: 매 lockstep multiplayer (RTS, fighting games).
💻 패턴
PyTorch Bit-Exact Setup
importtorch,random,numpyasnp,osdefset_full_determinism(seed=42):os.environ['PYTHONHASHSEED']=str(seed)os.environ['CUBLAS_WORKSPACE_CONFIG']=':4096:8'# CUDA 10.2+random.seed(seed);np.random.seed(seed)torch.manual_seed(seed);torch.cuda.manual_seed_all(seed)torch.backends.cudnn.deterministic=Truetorch.backends.cudnn.benchmark=Falsetorch.use_deterministic_algorithms(True,warn_only=False)set_full_determinism()
// All clients run identical sim → only inputs synchronized.
constFIXED_DT: Fixed<i64,16>=Fixed::from_num(1.0/60.0);fntick(state: &mutGameState,inputs: &[Input]){forinputininputs.iter().sorted_by_key(|i|i.player_id){state.apply(input,FIXED_DT);// fixed-point, no f32!
}state.tick+=1;}
언제: 매 evaluation harness, 매 regression test 의 ground truth, 매 paper code release.
언제 X: 매 LLM sampling 자체 (temperature > 0) — 매 inherently nondeterministic; 매 fixed seed + temperature=0 만 reproducible.
❌ 안티패턴
Forgetting CUBLAS_WORKSPACE_CONFIG: 매 CUDA matmul 비결정적, training 결과 매 run 다름.
Using set() in pipeline: 매 Python <3.7 dict order 비결정적.
Wall-clock as seed: 매 reproducibility 불가, debugging 불가.
Mixing CPU/GPU reductions: 매 sum order 차이로 ε divergence 누적.
Ignoring hardware drift: 매 different GPU arch (A100 vs H100) → different results 가능.