AI Compass
Compass

Why GPUs

Why AI runs on graphics cards and not processors: the difference between a few fast and many slow arithmetic units, with numbers.

·2 min read·By Fachredaktion Technik
DETAIL
3 sections

The idea

A processor has perhaps 16 cores, each very fast and very flexible. A graphics card has several thousand arithmetic units, each simpler and slower, but all performing the same calculation on different numbers at the same time.

When a task consists of a million independent, identical multiplications, the second design wins by two orders of magnitude. A matrix multiplication is exactly such a task, and that is what a neural network consists of.

The comparison in numbers

Processor (server CPU)Graphics card (data centre)
Cores32 to 128several thousand
float16 compute2 to 5 TFLOP/s300 to 2,000 TFLOP/s
Memory bandwidth200 to 500 GB/s2,000 to 8,000 GB/s
Memory128 GB to 2 TB24 to 192 GB
StrengthBranching, sequenceSame operation on many data

The calculation that determines your needs

For a language model, to a good approximation every weight is read from memory once per generated token. That makes bandwidth, not compute, the limit.

Upper bound on tokens per second

tokens/s ≤ B / (N · b)

For a single request you cannot exceed bandwidth divided by model size in tokens per second.

B
memory bandwidth in bytes per second
N
number of parameters
b
bytes per parameter: 2 for float16, 1 for int8

Worked through for a 7-billion-parameter model in float16, that is 14 GB, on a card with 1,000 GB/s: 1,000/14 ≈ 71 tokens per second. In int8 it is 7 GB and therefore around 142. That doubling from quantisation costs no extra compute at all.

Which card for what

PlanMemory neededNote
7-billion model, int4~5 GBRuns on a consumer card
7-billion, float16~15 GB16 GB just about, 24 GB comfortable
70-billion, int4~40 GBOne large card or two smaller
70-billion, float16~145 GBMultiple cards mandatory
LoRA fine-tune, 7 billion~20 GBSee LoRA and PEFT
Full training, 7 billion~120 GBSee optimisation

Why compute is rarely the limit

Arithmetic intensity

I = FLOPs / Bytes memory-bound when I < peak compute / bandwidth

If intensity is below the card's compute-to-bandwidth ratio, memory is the limit rather than the arithmetic units.

I
operations per byte read
FLOPs
number of operations
Bytes
data volume read from memory

A card with 1,000 TFLOP/s and 3,000 GB/s has a ratio of about 333 operations per byte. Generating a single token has an arithmetic intensity near 2, more than two orders of magnitude below that. The arithmetic units sit over 99 percent idle.

The remedy is batching: serve 64 requests together and the weights are read once and used 64 times, raising intensity to around 128. Which is why throughput per card with many concurrent requests is ten to fifty times that of a single one. See Speeding up inference.

Cost, worked through

An example for running a 7-billion-parameter model:

ItemAssumptionResult
Card300 W under load
Utilisation60 % across the day4.3 kWh per day
Electricity0.25 EUR per kWh1.08 EUR per day
Cooling, PUE 1.330 % surcharge1.40 EUR per day
Card depreciation8,000 EUR over 3 years7.30 EUR per day
Totalabout 8.70 EUR per day

At 142 tokens per second and 60 percent utilisation that is roughly 7.4 million tokens per day, so about 1.18 EUR per million tokens. That number is the benchmark against a metered API and answers the in-house question factually rather than ideologically. See What AI costs.

Alternatives to GPUs

DesignStrengthWeakness
GPUUniversal, mature softwarePrice, availability
TPU and similarVery efficient on large matricesTied to one platform
NPU in end devicesVery frugalSmall models, limited memory
CPU with extensionsAlready present, no purchase10 to 50 times slower
FPGAAdaptable, low latencyHigh development effort
Was this page helpful?
Why GPUs