屋檐

Under the Eaves

How fast a model can serve inference has an upper bound that can be worked out on paper first. Here I work it out, then measure one model at a time, to see how far the measurement falls short of the eaves and where the gap comes from.

Crayon drawing: a piglet stands on a stool and lifts a flower over his head; the tip of her leaf touches a wooden beam that climbs and then runs level.
The roofline, sketched The horizontal axis is arithmetic intensity, the vertical axis attainable compute. The roofline starts as a slope whose gradient is the memory bandwidth; past the ridge point it is a level line at the height of peak compute. Three points sit under the roof: decode at batch 1 below the slope, decode at a big batch near the ridge point, and prefill below the level part. The stretch between a point and the roof is what there is to tune. slope = memory bandwidth ridge point peak compute decode, batch 1 decode, big batch prefill this gap iswhat gets tuned attainable compute (FLOP/s) arithmetic intensity (FLOP/byte) The roofline, sketched The horizontal axis is arithmetic intensity, the vertical axis attainable compute. The roofline starts as a slope whose gradient is the memory bandwidth; past the ridge point it is a level line at the height of peak compute. Three points sit under the roof: decode at batch 1 below the slope, decode at a big batch near the ridge point, and prefill below the level part. The stretch between a point and the roof is what there is to tune. slope = memory bandwidth ridge point peak compute decode, batch 1 decode, big batch prefill this gap iswhat gets tuned attainable compute (FLOP/s) arithmetic intensity (FLOP/byte)
A sketch, not a measurement.

What sets the eaves

Model
architecture
Workload
input and output shapes
SLO
TTFT, TPOT
Card
GPU compute, memory capacity, memory bandwidth
Interconnect
speed inside the machine (NVLink, for example) and between machines

Where it starts

    Only then come the models, starting with the one whose accounts are cleanest: a single card, dense, fp16. Each model after that adds just one term to the bound: quantization, long context, MoE, several cards.

    The ledger

    Model · card · precision Bound on paper Measured Reached
    The first one is still being measured.

    Every issue runs in the same order: write down the prediction, measure, then say where the gap is, what was tuned, and how much is left.