The problem
The OLMo 3 report gives enough numbers to check each other: if they are consistent, you understand how a training run is planned. For the pre-training of the 32B model:
- 5.5T tokens, in batches of 8,388,608 tokens (1,024 sequences of 8,192);
- a measured throughput of 1,960 tokens per second per GPU (graphics processing unit), on up to 1,024 H100 GPUs;
- 32,233,522,176 parameters;
- a real duration of about 9.5 days on 512 GPUs followed by 35 days on 1,024 GPUs, restarts included;
- about 56 days on 1,024 GPUs from the start of training to the evaluated 32B Think model, priced at $2 per H100-hour.
You will write the five small functions of the arithmetic.
The five calculations
- Steps. The number of optimizer steps is the tokens divided by the tokens per batch, rounded up (a partial last batch is still a step).
- Compute. The training FLOPs (floating-point operations) are (section 8).
- Ideal days. If the cluster ran at the measured throughput the whole time: seconds, divided by 86,400.
- GPU days. A run can change size: a list of
(days, n_gpus)segments adds up to GPU days. - Cost. GPU days times 24 hours times the price of one GPU hour.
Example. With the numbers above:
- , so steps.
- FLOPs.
- tokens per second for the cluster, so seconds: days. The real run took days: the difference is crashes, restarts and the first 9.5 days on half the GPUs.
[(9.5, 512), (35, 1024)]is GPU days.56 * 1024GPU days at $2 per hour: 57,344 times 24 times 2 is $2,752,512, the $2.75M of the report.
What to implement
n_steps(tokens, batch_tokens): optimizer steps, rounded up, anint.train_flops(n_params, tokens): .ideal_days(tokens, tokens_per_sec_per_gpu, n_gpus): days at the measured throughput.gpu_days(segments): total GPU days of a list of(days, n_gpus).cost_usd(gpu_days, price_per_gpu_hour): dollars.
Requirements
- Return Python numbers (
intforn_steps). - Use
math.ceilfor the steps.