Lesson 1 of 14
The roofline
An H100 can do almost a quadrillion operations a second, yet it writes only a few hundred tokens a second for one user. Watch a clerk and a conveyor belt to see why, and what fixes it.
A fast clerk, a slow belt
The 3D view could not load. The three stages are described below.
01 · Why it is slow
The clerk waits for the belt
A GPU is the chip that runs the model. Picture a clerk at a small desk: the desk is the chip’s own fast memory, and it is tiny. The model’s weights, the billions of numbers it multiplies by, are her rulebook. They live in a basement archive, the GPU’s main memory, and ride up to her on a conveyor belt: the memory bandwidth.
To write one token (a piece of a word, about three-quarters of one on average), she needs every page: 15.0 GB for Parrot’s Llama 3.1 8B. An H100’s belt moves 3.35 TB a second, so the ceiling is 223 tokens a second, however fast she works. Real software lands a little under it.
Your dashboard is right: the arithmetic units are busy only 0.3% of each step. The GPU is not broken and it is not the wrong one. It is waiting, and the belt sets its speed, not the arithmetic rating.
Three GPUs, one chat each
0 ms of real time, slowed down
A100
0 tokens (136 a second)
H100
0 tokens (223 a second)
H200
0 tokens (320 a second)
- Arithmetic rating (the clerk)
- Memory bandwidth (the belt)
- One token written
02 · The fix
More chats per trip
The pages are not used up. Once a page is on the desk, the clerk can apply it to every chat waiting there. Each trip now writes one word for each chat, and since she was idle anyway, the step hardly grows. Serving many chats in one step is called batching.
A six-page rulebook, more chats per trip
- A page of the rulebook
- One chat; each line is a word written
- Belt carrying a page
- Clerk working (arithmetic)
- Waiting
Keep adding chats and the clerk becomes the slow one: pages wait on her desk and the belt stands still. Where both take equally long is the balance point: 8 chats in the toy, about 296 on an H100.
03 · The roof
Which wall are you hitting?
Divide the arithmetic a step does by the bytes it reads and you get its arithmetic intensity, in FLOPs per byte (a FLOP is one multiply or add). One chat does about one. An H100 does 295 FLOPs in the time its belt brings one byte. Below that, the belt sets the pace; above it, the clerk does. Drawn as a chart, the two limits make a roof.
The roof: what a step can reach
- Chats
- Tokens/s, all chats
- Tokens/s, each chat
- Clerk busy
Reading your question is already past the bend: all its tokens are on the desk at once, so each page serves them all. Below the bend only a faster belt or fewer bytes per weight helps; above it, only faster arithmetic.
04 · Playground
Size a step yourself
Add chats until the amber bar outgrows the teal one. Then try 8 bits per weight, and the H200, which has the H100’s clerk and a faster belt.
One decode step, your settings
Llama 3.1 8B, short chats
- One step
- Tokens/s, all chats
- Tokens/s, each chat
- Balance point
05 · Glossary
The vocabulary, in one place
- GPU
- The chip that runs the model: arithmetic units plus memory of its own. Here an NVIDIA H100.
- Token
- The unit a model reads and writes: a piece of a word, about three-quarters of one on average.
- Weights
- The numbers a model multiplies by: the clerk's rulebook. Llama 3.1 8B reads 15.0 GB of them for every token, at 16 bits each.
- Arithmetic units
- The parts of the chip that multiply and add: the clerk. An H100 is rated at 989 trillion FLOPs a second (TFLOP/s) at 16 bits.
- FLOP
- One multiply or one add, the unit arithmetic is counted in.
- On-chip memory
- The desk: a small, fast memory inside the chip, where the clerk works on what the belt has brought.
- GPU memory
- The archive: the chip's large main memory (80.0 GB on an H100, also called HBM), where the weights live.
- Memory bandwidth
- The belt: how many bytes a second GPU memory can deliver to the chip. 3.35 TB/s on an H100.
- Batching
- Serving many chats in the same step, so every page the belt brings up is used for all of them.
- Arithmetic intensity
- The FLOPs a piece of work does for each byte it reads. One chat at a time does about one.
- Balance point
- The intensity at which reading and arithmetic take equally long: 295 FLOPs per byte on an H100, reached at about 296 chats. Also called the ridge point.
- Memory-bound, compute-bound
- Limited by the belt (the bytes), or by the clerk (the arithmetic). Each needs a different fix.
You can now
- Compute the ceiling on single-user decode speed by dividing a GPU's memory bandwidth by the bytes of weights read per token.
- Explain why a GPU rated near a quadrillion operations a second sits mostly idle while writing text for one user, and why serving many chats at once fixes it almost for free.
- Decide whether a piece of work is memory-bound or compute-bound by comparing its arithmetic intensity with the chip's balance point, and so which fix helps: fewer bytes per weight, a bigger batch, or faster maths.
Try it in the Serving Lab: Find the batch size where decode stops waiting on memory.
Open the workbook: the formulas, the exact numbers, graded exercises and the sources behind this page.