Resumable Weighted Batch Data Loader

Asked at Microsoft · Coding Questions · Difficulty: Medium · Last asked Mar 18, 2026

Build a data loader that mixes several datasets into one stream of fixed-size training batches. Each dataset (a "source") has an integer weight, and over time the share of items taken from each source must match its weight. Every source is read in its own order, and the loader can save its progress and later resume exactly where it stopped, so a restarted training job sees the same batches.

Loading the problem…