Before you start: words you need#
| Word | Plain meaning |
|---|---|
| Binding resource | The one resource that runs out first and so sets the speed: FLOPs, memory bandwidth, memory capacity, network, storage or power. |
| Pretraining | Training a model from scratch on trillions of tokens of text (and images, audio, video) to predict the next token. |
| Post-training | Everything after pretraining that turns a raw model into a useful one: supervised fine-tuning, preference tuning and reinforcement learning. |
| RL rollout | In reinforcement learning, the model generates an answer so a reward can score it. Generating is inference. |
| Fine-tuning | Adapting an existing model to one task or domain with a much smaller dataset. |
| LoRA / QLoRA | Fine-tuning that trains small extra matrices instead of all the weights (LoRA); QLoRA also stores the frozen base model in 4 bits (18.g). |
| MFU | Model FLOPs utilisation: the fraction of a chip’s peak FLOPs a job actually achieves. |
| Prefill / decode | The two halves of serving: reading the whole prompt at once (compute-heavy) and then producing one token at a time (memory-heavy) (12.c). |
1. What is it?#
“AI hardware” is not one market. A model passes through seven stages, and each stage runs out of a different resource first:
| Stage | What runs out first |
|---|---|
| 1. Data | storage throughput and CPU cores, not GPUs |
| 2. Pretraining | tensor FLOPs, the network between thousands of chips, and uptime |
| 3. Post-training | a mix: reinforcement learning spends much of its time generating, which is inference |
| 4. Fine-tuning | memory capacity, because optimizer state is several times the model |
| 5. Evaluation | batch throughput |
| 6. Serving | compute for prefill; memory bandwidth and capacity for decode |
| 7. Edge | power and memory capacity |
Knowing which resource a stage exhausts tells you which hardware lever is worth paying for. This lesson walks the stages; the rest of Module 8 sizes them (8.b), places their data (8.c, 8.d) and turns them into a buying decision (8.e).
Facts checked on 12 November 2026.
2. Why does it matter?#
Because the same money buys very different results depending on the stage:
- Buying the fastest GPUs for a data pipeline wastes them: the job waits on object storage and CPU parsing.
- Buying many small GPUs for pretraining fails: the job needs a fast network and a large scale-up domain more than it needs more chips.
- Buying for training and then serving on the same hardware is often fine, but tuning it the same way is not. Serving is two workloads with opposite needs.
- Planning RL post-training like ordinary training under-sizes the part that dominates: the generation pool.
Inference engineers care about all of it, because serving, evaluation, RL rollouts and synthetic data generation are all inference.
3. Simple analogy#
A model’s life is like a restaurant chain’s.
- Data: buying and sorting ingredients. You need warehouses and staff, not ovens.
- Pretraining: building the central kitchen. Enormous, one-off, and everything must work together or the project stalls.
- Post-training: test-cooking dishes and tasting them. Half the time is spent cooking to get something to taste.
- Fine-tuning: adapting a recipe for one branch. The bottleneck is counter space.
- Serving: running every branch, every day, forever. This is where most of the money goes.
- Edge: a food truck. Small, power-limited, and it has to carry everything with it.
4. Tiny example#
One 70B model, three stages, three different answers to “what limits it?”:
Pretraining on 15T tokens: 6 × 70e9 × 15e12 = 6.3e24 FLOPs
→ bound by FLOPs; needs thousands of GPUs for months
Full fine-tune with Adam: ~16 bytes/parameter × 70e9 = 1.1 TB of state
→ bound by capacity; needs a sharded node (8.c)
Serving one user at FP8: 70 GB read per token; on an 8 TB/s GPU ≤ 114 tok/s
→ bound by memory bandwidth (4.e)Same model. One stage wants FLOPs, one wants memory, one wants bandwidth.
5. Technical explanation#
Stage by stage#
1. Data. Crawling, deduplication, filtering, tokenisation and mixing run on CPU clusters (Spark, Ray, Dask) over object storage, at petabyte scale. GPUs appear only for quality classifiers, embeddings and synthetic-data generation, which is itself inference. The bottleneck is storage throughput and CPU cores.
2. Pretraining. Next-token prediction over tens of trillions of tokens. The cost is
≈ 6 × parameters × tokens FLOPs (10.j), so the levers are:
- tensor FLOPs at a usable precision: BF16, now FP8, with FP4 training demonstrated in research;
- the scale-out network that synchronises gradients (9.d);
- reliability: with 100,000 chips, something fails every few minutes, so checkpoint speed and fast restart matter as much as peak speed (8.c).
Mixture-of-experts (MoE) models add heavy all-to-all traffic, which is why they want the largest scale-up domains: NVL72 racks (7.d), TPU pods (7.i), Trainium UltraServers (7.j). Scale: tens of thousands of chips, tens to hundreds of megawatts.
3. Post-training. Supervised fine-tuning is ordinary training at smaller scale. Preference tuning and reinforcement learning are different:
- The policy model generates answers (rollouts).
- A reward model or a checker (unit tests, a maths verifier) scores them.
- The trainer updates the weights.
- The new weights are copied back to the generators.
Generation is decode, which is memory-bandwidth-bound (12.c), and for reasoning models with long chains of thought it is often most of the GPU time. So post-training clusters are split into a trainer pool and a rollout pool running an inference engine (vLLM, SGLang), and weight synchronisation between them is a new bottleneck: hundreds of gigabytes after every step, ideally over NVLink or RDMA (9.c).
4. Fine-tuning. Adapting an open model to a task. Full fine-tuning with Adam needs roughly 16 bytes per parameter before activations (8.c), so capacity binds first. LoRA trains small adapter matrices; QLoRA also keeps the base model in 4 bits. Together they bring a 70B fine-tune down to one or two large GPUs and an 8B fine-tune onto a gaming card.
5. Evaluation. Benchmark suites, LLM judges and red-team prompts: large batches of inference with no latency target. The ideal use for spare, older or spot capacity.
6. Serving. Two workloads in one request (12.c):
- Prefill processes the whole prompt in parallel. Compute-bound, like training.
- Decode produces one token at a time per user. Each step reads all the weights and that user’s KV cache (12.e), so it is bound by memory bandwidth; the KV cache for many users and long contexts binds capacity.
This split is why serving systems now run prefill and decode on separate pools (14.j), and why decode-specific hardware exists: SRAM machines such as Groq 3 LPX and Cerebras (7.k), and Google’s TPU 8i (7.i). For a successful model, serving is most of its lifetime compute.
7. Edge. Phones, PCs, cars and robots run models on NPUs or small GPUs within about 5–130 W (7.f). Memory capacity limits model size; bandwidth limits speed; battery and heat limit everything. INT4, INT8 and FP4 quantisation are the norm (13.b).
Training is paid once, inference forever#
Pretraining is one large bill. Serving is a bill per token for as long as the model is used. For a model that people actually use, inference compute overtakes training within months. Because decode runs far below peak efficiency, it overtakes training sooner in GPU-hours than in FLOPs.
6. Under the hood#
The program compares the two bills for a dense 70B model on H100-class GPUs (989 TFLOP/s dense BF16, 7.b).
// lifecycle.go — training is one bill; inference is a bill per token, forever.
package main
import "fmt"
func main() {
const (
params = 70e9 // dense model
trainToks = 15e12 // pretraining tokens
peakFLOPs = 989e12
trainMFU = 0.40 // fraction of peak achieved in pretraining
serveMFU = 0.08 // decode-heavy serving achieves far less
)
trainFLOP := 6 * params * trainToks
trainGPUh := trainFLOP / (peakFLOPs * trainMFU) / 3600
fmt.Printf("pretraining: %.2e FLOP = %.1f M H100-hours\n\n", trainFLOP, trainGPUh/1e6)
fmt.Println("tokens served/day serving GPU-hours/day days until serving > training")
for _, perDay := range []float64{1e9, 10e9, 100e9, 1e12} {
flop := 2 * params * perDay // forward pass only: ~2 FLOPs per parameter per token
gpuh := flop / (peakFLOPs * serveMFU) / 3600
fmt.Printf("%17.0e %21.0f %29.0f\n", perDay, gpuh, trainGPUh/gpuh)
}
}Output:
pretraining: 6.30e+24 FLOP = 4.4 M H100-hours
tokens served/day serving GPU-hours/day days until serving > training
1e+09 492 9000
1e+10 4915 900
1e+11 49152 90
1e+12 491518 9How to read it:
- At a billion tokens a day, serving takes about 25 years to match the training bill. At 100 billion a day, which a popular model reaches, about three months. At a trillion, nine days.
serveMFUcarries the result. Batching (12.j) and speculative decoding (12.n) raise it; long contexts and small batches lower it.- The training side ignores failed runs, ablations and post-training, which in practice multiply the bill. The serving side ignores idle capacity kept for peaks, which multiplies that bill too.
7. Performance implications#
- Each stage has one lever. Faster HBM does nothing for a storage-bound data pipeline; more FLOPs do nothing for small-batch decode.
- RL is two workloads. Trainer throughput and rollout throughput must be balanced, or one pool waits for the other. Long reasoning rollouts make the rollout pool the larger one.
- Serving efficiency compounds. A 2x gain in serving MFU halves the largest bill in the lifecycle; the same gain in pretraining saves a one-off cost.
- Evaluation and synthetic data can absorb idle serving capacity at night, raising utilisation without new hardware.
8. Production implications#
- Plan capacity per stage, not per company. A team that only fine-tunes and serves does not need a pretraining fabric.
- Share hardware where the regimes match. Evaluation, synthetic data and RL rollouts can run on serving hardware; pretraining needs its own tightly coupled pool.
- Treat weight sync as a network workload. In RL, moving new weights to hundreds of generators after every step is a large, bursty transfer; put it on the fastest fabric you have.
- Budget serving first. For any model that succeeds, the serving fleet becomes the main cost (23.c).
9. Common mistakes#
- Treating “AI hardware” as one thing. Each stage needs a different resource.
- Sizing RL like training. Most of the time is generation; size the rollout pool like a serving fleet.
- Ignoring the data stage. GPUs that wait for data are expensive idle machines.
- Thinking training is the big bill. For a used model, inference overtakes it within months.
- Using one serving configuration for prefill and decode. They have opposite needs (12.c).
10. Hands-on exercise#
- Run
lifecycle.go. RaiseserveMFUto 0.2 (aggressive batching). How do the break-even days change? - Replace the dense 70B with a MoE of 671B total and 37B active parameters (DeepSeek-V3-class). Which parameter count goes into the training formula and which into the serving formula? Run it.
- Pick one row of the bottleneck matrix you disagree with and argue for a different score.
- For a reasoning-model RL job where each rollout is 8,000 tokens and each training step processes the same tokens once, estimate the ratio of rollout GPU-hours to trainer GPU-hours. (Hint: decode MFU is far below training MFU.)
11. Interview questions#
- Which stage is bound by storage and CPU rather than by accelerators?
- Why does RL post-training need an inference engine, and what new bottleneck does it create?
- What makes prefill and decode want different hardware?
- Why does inference overtake training sooner in GPU-hours than in FLOPs?
- Why do MoE models want large scale-up domains for pretraining?
12. Further reading#
Checked on 12 November 2026.
- Scaling laws and the 6ND approximation (Kaplan et al., 2020)
- The Llama 3 herd of models (Meta, 2024): training scale, failures and checkpointing in practice
- DeepSeek-R1 (2025): RL with verifiable rewards
- Pretraining large language models with NVFP4 (NVIDIA, 2025)
- DistServe: disaggregating prefill and decoding (Zhong et al., 2024)
- QLoRA (Dettmers et al., 2023)