ML Systems: From Weights to Work. Lesson 4. Budget training, not peak floating-point operations.

This educational session uses fictional healthcare operations examples. This session uses AI narration.

Start with an explicitly simplified model

A useful first estimate for dense Transformer pretraining is approximately six times the number of parameters times the number of training tokens, measured in floating-point operations. The factor summarizes forward and backward work under simplifying assumptions. It is not an exact formula for every architecture, sequence length or implementation. Attention work, embedding details, sparsity, recomputation and communication can make the approximation less representative.

Use decimal billions for parameters and tokens, and keep units visible. A seven-billion-parameter model trained on two hundred billion tokens gives roughly 8.4 times ten to the twenty-first operations. Eight accelerators sustaining one hundred and fifty trillion operations per second each provide 1.2 times ten to the fifteenth operations per second in aggregate. Dividing gives about seven million seconds, or eighty-one days. Those are synthetic assumptions, not a claim about a particular accelerator or a recommended training run.

Peak hardware capability is not sustained useful work

A vendor's peak throughput depends on precision and operation type. A real training job loses time to communication, input pipelines, uneven work, checkpoints, failed runs and evaluation. Model floating-point operations utilization is one way to relate useful model computation to peak capability, but definitions and measurement methods matter. If you enter sustained throughput directly, do not multiply by utilization again; this lab instead asks for peak throughput and a separate utilization assumption.

More devices help only if the workload can use them. Data parallelism replicates a model and combines gradients across data shards. Tensor parallelism partitions operations within layers. Pipeline parallelism partitions layers and introduces scheduling considerations. Optimizer-state sharding distributes state that would otherwise be replicated. These strategies trade memory, communication, batch constraints and implementation complexity; their effects are not captured by multiplying a device count alone.

Training memory has several owners

The weights are only one memory consumer. Trainable parameters need gradients, and optimizers can keep multiple state tensors. An illustrative mixed-precision budget for the Adam optimizer is sixteen bytes per trainable parameter: low-precision weights and gradients, a higher-precision master copy and two higher-precision moment estimates. Implementations differ, and this estimate is not a universal requirement. Activations, temporary buffers, communication workspaces and fragmentation come on top.

At seven billion parameters, sixteen bytes per parameter is about 104.3 binary gigabytes before activations. Sharding changes per-device residency rather than erasing the underlying state. Gradient checkpointing reduces saved activations by recomputing some forward work during backward propagation. Gradient accumulation can reduce the microbatch footprint while increasing the number of passes before an optimizer step. Neither technique makes a compute budget disappear.

Allocate the budget to a decision

Scaling studies ask how to distribute a fixed compute budget across model size and training data under their assumptions. A larger model with too little training can lose to a smaller, better-trained one. Data quality, repetition, task coverage and contamination also matter. Counting tokens without inspecting their provenance and information content can produce an expensive but weak training plan.

Before proposing pretraining for a healthcare application, compare it with adapting an existing model, improving retrieval, using a smaller specialized predictor or changing a workflow rule. A new base model needs a reason that survives those alternatives. Record the expected capability gain, data rights, evaluation set, compute estimate, memory plan, failure allowance and operating cost after training. The training job ends once; serving and maintaining its result may continue for years.

Your decision exercise. A synthetic plan uses 7 billion dense parameters, 200 billion tokens, 8 GPUs, 500 trillion peak floating-point operations per second per GPU and 30% sustained model utilization. An estimate promises completion in 24 days using only peak throughput. It budgets 14 GB for weights and treats that as the total training memory. Which revision is closest to the stated assumptions?

Option 1. About 24 days remains reasonable; optimizer state matters only during inference.

Option 2. About 81 days before additional overhead, and approximately 104 binary gigabytes of unsharded 16-byte parameter state before activations.

Option 3. About 810 days, because the 30% utilization must be applied once to each GPU and once to the cluster.

Pause here and commit to a choice. Name the decisive evidence and one limitation before continuing.

Reference analysis. Six times seven billion times two hundred billion gives eight point four times ten to the power of twenty-one floating-point operations. Effective throughput is eight times five hundred trillion times 0.30, or one point two times ten to the power of fifteen floating-point operations per second. The quotient is about 81 days. Fourteen decimal gigabytes describes only a two-byte raw weight payload; the illustrative sixteen-byte training state is about 104 binary gigabytes before activations and buffers. Do not apply utilization twice. This estimate still cannot establish wall-clock completion because checkpointing, data stalls, failures and the accuracy of the dense approximation need measurement.

Now change one fact. Double the number of GPUs but assume utilization falls from 30% to 20% because communication dominates. Calculate the speedup. Then explain why halving the microbatch may help memory while making the training run slower.

Write a training-budget review in four sentences. State the formula and units, the sustained-throughput assumption, the memory categories omitted from the first estimate, and the experiment that would replace the largest uncertainty. Your final sentence should say which cheaper intervention you would test before approving pretraining and why it could answer the same business question.
