Pidoku

The AI Lifecycle on Hardware

Module 8 Lesson 8.a 50 min Difficulty 3/5

Prerequisites 1.b, 6.a


Before you start: words you need#

WordPlain meaning
Binding resourceThe one resource that runs out first and so sets the speed: FLOPs, memory bandwidth, memory capacity, network, storage or power.
PretrainingTraining a model from scratch on trillions of tokens of text (and images, audio, video) to predict the next token.
Post-trainingEverything after pretraining that turns a raw model into a useful one: supervised fine-tuning, preference tuning and reinforcement learning.
RL rolloutIn reinforcement learning, the model generates an answer so a reward can score it. Generating is inference.
Fine-tuningAdapting an existing model to one task or domain with a much smaller dataset.
LoRA / QLoRAFine-tuning that trains small extra matrices instead of all the weights (LoRA); QLoRA also stores the frozen base model in 4 bits (18.g).
MFUModel FLOPs utilisation: the fraction of a chip’s peak FLOPs a job actually achieves.
Prefill / decodeThe 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:

StageWhat runs out first
1. Datastorage throughput and CPU cores, not GPUs
2. Pretrainingtensor FLOPs, the network between thousands of chips, and uptime
3. Post-traininga mix: reinforcement learning spends much of its time generating, which is inference
4. Fine-tuningmemory capacity, because optimizer state is several times the model
5. Evaluationbatch throughput
6. Servingcompute for prefill; memory bandwidth and capacity for decode
7. Edgepower 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.

THE AI LIFECYCLE ON HARDWARE · WHAT EACH STAGE NEEDSfrom raw data to a phone · checked 16 Oct 20261DataWHAT RUNSCrawl, dedupe,filter, tokenize;small models scorequality.BINDING CONSTRAINTstorage + CPUHARDWARECPU clusters (Spark,Ray), object storage;a few GPUs forclassifiers.SCALE1000s of CPU cores,PBsPRECISIONn/aDURATIONcontinuous2PretrainingWHAT RUNSNext-token predictionover tens oftrillions of tokens.BINDING CONSTRAINTFLOPs + networkuptimeHARDWARENVL72 racks, TPUpods, TrainiumUltraServers:10k-100k+ chips.SCALE10-500 MWPRECISIONBF16 → FP8; FP4arrivingDURATIONweeks to months3Post-trainingWHAT RUNSSFT, preferencetuning, RL withverifiable rewards.BINDING CONSTRAINTgeneration + trainingHARDWARESame cluster, splitinto rollout(inference) andtrainer pools.SCALE1k-10k GPUsPRECISIONBF16 train, FP8rolloutsDURATIONdays to weeks4Fine-tuningWHAT RUNSLoRA, QLoRA or fullfine-tune of an openmodel.BINDING CONSTRAINTmemory capacityHARDWARE1-8 GPUs:H100/H200/B200, RTXPRO 6000; DGX Sparkfor small.SCALE1 nodePRECISIONBF16; 4-bit base(QLoRA)DURATIONhours to days5EvaluationWHAT RUNSBenchmarks, LLMjudges, red-teaming,regression suites.BINDING CONSTRAINTbatch throughputHARDWAREInference GPUs, spareor spot capacity.SCALE8-512 GPUsPRECISIONas servedDURATIONhours6InferenceWHAT RUNSPrefill the prompt,then decode token bytoken.BINDING CONSTRAINTprefill: FLOPsdecode: bandwidthHARDWAREH100-B300, NVL72 forbig MoE, MI355X, TPU,Inferentia; LPX forspeed.SCALE1 GPU to a rack perreplicaPRECISIONFP8 / FP4 weights,FP8 KVDURATIONalways on: mostlifetime compute7EdgeWHAT RUNSOn phones, PCs, cars,robots.BINDING CONSTRAINTpower + capacityHARDWARENPUs (Apple,Qualcomm), JetsonThor, DGX Spark,laptop GPUs.SCALE1 chip, 5-130 WPRECISIONINT4 / INT8 / FP4DURATIONalways onRL rollouts are inference: the policy generates, a reward scores, the trainer updates, new weights go back to the generatorsTwo facts that shape every purchase1. Training is bought once per model; inference is paid for every token, forever. Most lifetime compute for a successful model is inference.2. Inference is two workloads: prefill is compute-bound, decode is memory-bandwidth-bound. Different hardware wins each, which is whyprefill and decode are now often run on separate pools (disaggregated serving), and why SRAM-first decode chips exist.
The lifecycle as a pipeline. The dashed loop is the point most people miss: reinforcement learning runs inference inside training.

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#

WHICH RESOURCE EACH AI WORKLOAD EXHAUSTS FIRST0 = barely used · 3 = the bottleneck · author's synthesis · checked 16 Oct 2026TensorFLOPsMemorybandwidthMemorycapacityScale-uplinksScale-outnetworkStorageI/OHostCPUPower andcoolingData preparationData preparation · Tensor FLOPs: 0 of 3·Data preparation · Memory bandwidth: 0 of 3·Data preparation · Memory capacity: 0 of 3·Data preparation · Scale-up links: 0 of 3·Data preparation · Scale-out network: 1 of 3lowData preparation · Storage I/O: 3 of 3HIGHData preparation · Host CPU: 3 of 3HIGHData preparation · Power and cooling: 1 of 3lowPretraining, dense modelPretraining, dense model · Tensor FLOPs: 3 of 3HIGHPretraining, dense model · Memory bandwidth: 1 of 3lowPretraining, dense model · Memory capacity: 2 of 3medPretraining, dense model · Scale-up links: 2 of 3medPretraining, dense model · Scale-out network: 3 of 3HIGHPretraining, dense model · Storage I/O: 2 of 3medPretraining, dense model · Host CPU: 1 of 3lowPretraining, dense model · Power and cooling: 3 of 3HIGHPretraining, MoE modelPretraining, MoE model · Tensor FLOPs: 3 of 3HIGHPretraining, MoE model · Memory bandwidth: 2 of 3medPretraining, MoE model · Memory capacity: 3 of 3HIGHPretraining, MoE model · Scale-up links: 3 of 3HIGHPretraining, MoE model · Scale-out network: 3 of 3HIGHPretraining, MoE model · Storage I/O: 2 of 3medPretraining, MoE model · Host CPU: 1 of 3lowPretraining, MoE model · Power and cooling: 3 of 3HIGHRL post-trainingRL post-training · Tensor FLOPs: 2 of 3medRL post-training · Memory bandwidth: 3 of 3HIGHRL post-training · Memory capacity: 2 of 3medRL post-training · Scale-up links: 2 of 3medRL post-training · Scale-out network: 2 of 3medRL post-training · Storage I/O: 1 of 3lowRL post-training · Host CPU: 2 of 3medRL post-training · Power and cooling: 2 of 3medLoRA fine-tuningLoRA fine-tuning · Tensor FLOPs: 2 of 3medLoRA fine-tuning · Memory bandwidth: 1 of 3lowLoRA fine-tuning · Memory capacity: 3 of 3HIGHLoRA fine-tuning · Scale-up links: 1 of 3lowLoRA fine-tuning · Scale-out network: 0 of 3·LoRA fine-tuning · Storage I/O: 1 of 3lowLoRA fine-tuning · Host CPU: 1 of 3lowLoRA fine-tuning · Power and cooling: 1 of 3lowEvaluation, batch inferenceEvaluation, batch inference · Tensor FLOPs: 2 of 3medEvaluation, batch inference · Memory bandwidth: 2 of 3medEvaluation, batch inference · Memory capacity: 2 of 3medEvaluation, batch inference · Scale-up links: 1 of 3lowEvaluation, batch inference · Scale-out network: 0 of 3·Evaluation, batch inference · Storage I/O: 1 of 3lowEvaluation, batch inference · Host CPU: 1 of 3lowEvaluation, batch inference · Power and cooling: 1 of 3lowServing: prefillServing: prefill · Tensor FLOPs: 3 of 3HIGHServing: prefill · Memory bandwidth: 1 of 3lowServing: prefill · Memory capacity: 1 of 3lowServing: prefill · Scale-up links: 2 of 3medServing: prefill · Scale-out network: 0 of 3·Serving: prefill · Storage I/O: 0 of 3·Serving: prefill · Host CPU: 1 of 3lowServing: prefill · Power and cooling: 2 of 3medServing: decodeServing: decode · Tensor FLOPs: 1 of 3lowServing: decode · Memory bandwidth: 3 of 3HIGHServing: decode · Memory capacity: 3 of 3HIGHServing: decode · Scale-up links: 2 of 3medServing: decode · Scale-out network: 0 of 3·Serving: decode · Storage I/O: 0 of 3·Serving: decode · Host CPU: 1 of 3lowServing: decode · Power and cooling: 2 of 3medServing: long-context decodeServing: long-context decode · Tensor FLOPs: 1 of 3lowServing: long-context decode · Memory bandwidth: 3 of 3HIGHServing: long-context decode · Memory capacity: 3 of 3HIGHServing: long-context decode · Scale-up links: 2 of 3medServing: long-context decode · Scale-out network: 1 of 3lowServing: long-context decode · Storage I/O: 2 of 3medServing: long-context decode · Host CPU: 1 of 3lowServing: long-context decode · Power and cooling: 2 of 3medEdge / on-deviceEdge / on-device · Tensor FLOPs: 1 of 3lowEdge / on-device · Memory bandwidth: 3 of 3HIGHEdge / on-device · Memory capacity: 3 of 3HIGHEdge / on-device · Scale-up links: 0 of 3·Edge / on-device · Scale-out network: 0 of 3·Edge / on-device · Storage I/O: 0 of 3·Edge / on-device · Host CPU: 1 of 3lowEdge / on-device · Power and cooling: 3 of 3HIGH· barely usedlowmed: it mattersHIGH: the bottleneckRead across a row to see what to buy more of; down a column to see who competes for it.
Read across a row to see what a workload needs most; read down a column to see which workloads compete for the same resource.

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:

  1. The policy model generates answers (rollouts).
  2. A reward model or a checker (unit tests, a maths verifier) scores them.
  3. The trainer updates the weights.
  4. 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).

Go
// 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                               9

How 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.
  • serveMFU carries 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#

  1. Treating “AI hardware” as one thing. Each stage needs a different resource.
  2. Sizing RL like training. Most of the time is generation; size the rollout pool like a serving fleet.
  3. Ignoring the data stage. GPUs that wait for data are expensive idle machines.
  4. Thinking training is the big bill. For a used model, inference overtakes it within months.
  5. Using one serving configuration for prefill and decode. They have opposite needs (12.c).

10. Hands-on exercise#

  1. Run lifecycle.go. Raise serveMFU to 0.2 (aggressive batching). How do the break-even days change?
  2. 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.
  3. Pick one row of the bottleneck matrix you disagree with and argue for a different score.
  4. 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#

  1. Which stage is bound by storage and CPU rather than by accelerators?
  2. Why does RL post-training need an inference engine, and what new bottleneck does it create?
  3. What makes prefill and decode want different hardware?
  4. Why does inference overtake training sooner in GPU-hours than in FLOPs?
  5. Why do MoE models want large scale-up domains for pretraining?

12. Further reading#

Checked on 12 November 2026.

↑↓ navigate↵ openesc close

100% drag to pan · scroll or pinch to zoom · double-click to zoom in