Plan (goal: make evaluation statistically correct, reproducible, and robust to dataset skew)1) Clarify requirements & metrics- Define exact eval metric(s) and acceptable CI width / significance level (e.g., 95% CI ±1%).2) Deterministic sharding & sampling- Implement deterministic sharding by hashing stable sample ID (not file order) mod world_size, so each process gets consistent partitions across runs.- Use epoch-aware shuffling with a fixed global seed: shuffle_index = RNG(seed + epoch) so shuffles are repeatable.Example (PyTorch-style):python
# per-worker deterministic shard and seed
global_seed = 12345
rank, world_size = get_dist_info()
ids = all_ids[hash_fn(all_ids) % world_size == rank] # deterministic shard by id hash
rng = np.random.RandomState(global_seed + epoch)
rng.shuffle(ids)
3) Seed management- Centralize seed handling: set seeds for Python, NumPy, random, and framework RNGs on all workers.- Make sure any non-deterministic ops (cuDNN, async data loaders) are controlled or logged.- Persist seed and metadata with each run.4) Stratified sampling for skew- If labels or strata are imbalanced, perform stratified sharding so each worker's shard preserves population proportions (or use oversampling/cost-sensitive losses for training).- For time/temporal skew, shard by contiguous time windows but rotate evaluation windows across runs.5) Warm-up epochs & burn-in- Use warm-up epochs to let distributed sampling buffers and batchnorm statistics stabilize. Exclude first N epochs from final evaluation aggregation.- For BN in distributed env, use synchronized BN or accumulate running stats before eval.6) Statistical validation- Compute per-run metric and its standard error. For binary/continuous metrics: - SE = sqrt(p(1-p)/n) for proportions; use delta method for derived metrics (AUC).- Use bootstrap or repeated subsampling (B=1000) to get empirical 95% CI and variance estimate.- When comparing runs, run paired tests (e.g., paired bootstrap) to assess significance.7) Monitoring & checks- Log per-shard counts, class distributions, seeds, shard hashes, and RNG state.- Run deterministic reproducibility checks: rerun with same seed should match exactly.- Run sensitivity experiments varying seed and report metric variance; if too large, increase eval sample size or use stratification.8) Operationalize- Automate the pipeline to record metadata, CI, and variance in experiment reports.- Require minimum effective sample size for evaluation; if below threshold, aggregate more data.Why this works:- Deterministic sharding + centralized seed makes runs reproducible.- Stratification reduces variance from skew.- Warm-up stabilizes model state across distributed workers.- Bootstrap/CIs provide formal uncertainty quantification so differences are interpretable.