Decode is a bandwidth problem wearing a compute costume
Generating one token requires one matrix-vector product per weight matrix, and a matrix-vector product touches every weight exactly once while doing only two floating-point operations per weight. At BF16 that is two bytes read for two operations: an arithmetic intensity of one FLOP per byte. A GPU's ridge point, where compute and bandwidth balance, sits around twenty to thirty FLOPs per byte for BF16 tensor cores. Token generation is therefore an order of magnitude below the ridge and fully bandwidth-bound. Peak FLOPS numbers are almost irrelevant to it.
Prefill is the opposite. Processing a prompt is a matrix-matrix product over many tokens, so each weight read is reused across the whole batch. Arithmetic intensity rises with prompt length, the GPU's tensor cores become the limit, and the gap between a CPU and a GPU widens. This is why time to first token and tokens per second are separate measurements with separate bottlenecks, and why a machine can feel fast on short prompts and slow on long ones.
The only table you need
Memory bandwidth is the number to look up before anything else. Dual-channel DDR5-5600 in a desktop delivers 89.6 GB/s theoretical and typically 55 to 70 GB/s in a streaming benchmark. LPDDR5X-8533 on a 128-bit bus, as in a Snapdragon X Elite laptop, delivers 136 GB/s. Apple silicon ranges from about 120 GB/s on the base M4 to 273 GB/s on the M4 Pro, 546 GB/s on the M4 Max and 800 GB/s on the M2 Ultra. A discrete GPU is in another class: 272 GB/s on an RTX 4060, 504 GB/s on an RTX 4070, 1008 GB/s on an RTX 4090, 1792 GB/s on an RTX 5090, 2039 GB/s on an A100 80GB and 3350 GB/s on an H100 SXM.
Server CPUs close part of the gap through channel count rather than clock speed. A single EPYC Genoa with twelve DDR5-4800 channels reaches 460 GB/s theoretical, and Turin with twelve DDR5-6000 channels reaches 576 GB/s. That is enough to make a 70B model at four bits usable on a CPU-only server, which is a genuinely different proposition from a desktop. The catch is that achieving even 70 percent of theoretical bandwidth requires enough outstanding memory requests, and a CPU core supports far fewer than a GPU does.
Estimating tokens per second before you buy
The estimate is achieved bandwidth divided by bytes read per token, and bytes read per token is approximately the size of the weights. A 7B model at Q4_K_M is 4.4 GB. On an RTX 4090, at a realistic 700 to 850 GB/s of achieved bandwidth, the ceiling is 160 to 190 tokens per second; real single-stream numbers land lower because of kernel launch overhead, sampling and cache reads. On dual-channel DDR5 at 60 GB/s the ceiling is about 13.6 tokens per second, and real numbers are typically 6 to 10. On an M4 Max at perhaps 450 GB/s achieved, the ceiling is around 100 tokens per second.
These are ceilings, not benchmarks, and the gap between ceiling and reality is informative. A machine that hits 80 percent of its bandwidth ceiling is well tuned. A machine at 30 percent has a problem: too few threads, a quantisation type with expensive dequantisation, no Flash Attention, or a model split across PCIe. Compute the ceiling first, then measure, then investigate the ratio.
Where the CPU actually wins
A CPU is not a slower GPU; it is a different point in the design space. It wins on memory capacity per rupee, because 128 GB of DDR5 costs less than 48 GB of GDDR6X and holds a 70B model at four bits that no consumer graphics card can. It wins on idle power, which matters for an always-on assistant or a box in a cupboard. It wins on availability and cost at the low end, where a used office machine with 32 GB of RAM can run a 3B or 7B model for extraction and classification tasks at a few tokens per second. And it wins on deployment simplicity: no driver version matrix, no CUDA compatibility, no VRAM fragmentation.
The workloads that fit are the ones where latency is not the product: overnight batch summarisation, document classification, embedding generation on a few thousand files, a local router that decides which requests need a bigger model, or a private assistant that answers in ten seconds rather than one. The workloads that do not fit are interactive chat with long contexts, code completion, and anything with concurrent users.
Capacity and bandwidth pull in opposite directions
Unified-memory machines make the trade explicit. A Mac Studio with 512 GB can hold a 405B model at four bits, but at 546 GB/s it will generate a few tokens per second, and the model will be reading 230 GB per token. A Strix Halo mini-PC with a 256-bit LPDDR5X-8000 bus has 256 GB/s and up to 128 GB of unified memory: enough capacity for a 70B at four bits, at a decode rate around four to six tokens per second. Neither is a substitute for an H100, and both are vastly cheaper per gigabyte of model.
The practical rule is that capacity decides whether a model runs and bandwidth decides whether it is usable. Write both numbers down before choosing a machine, and remember that the second one is usually the binding constraint for anything interactive.
Batching changes the regime on a GPU and barely helps a CPU
At batch size one the GPU reads the weights once per token. At batch size thirty-two it reads them once and reuses them across thirty-two tokens, so aggregate throughput rises several-fold while per-token latency stays roughly flat until compute becomes the limit. This is the entire economic argument for serving many users on one GPU, and it is why vLLM's continuous batching matters more than any kernel optimisation.
A CPU cannot exploit the same trick, because it is already bandwidth-starved and adding sequences adds cache pressure without adding bandwidth. Its aggregate throughput improves modestly and then saturates, while latency degrades. That is why CPU inference is best understood as a single-stream technology, and why a CPU box serving ten concurrent users behaves far worse than the arithmetic suggests.
The context window is a second bandwidth bill
Weights are not the only thing read per token. Attention reads the key and value cache for every token in context, at every layer, and that read grows linearly with context length. For Llama 3.1 8B the cache costs 128 KiB per token, so at 32K context the model reads 4 GiB of cache per generated token on top of 4.4 GB of weights. Effective bytes per token nearly doubles, and decode speed nearly halves. At 128K the cache read is 16 GiB per token and the model is barely usable on a single GPU without paging or eviction.
Flash Attention reduces intermediate memory traffic and makes long contexts feasible, but it does not remove the need to read the cache once per token. KV cache quantisation to 8 bits halves that bill and is usually close to lossless; 4-bit cache is a larger quality risk. This is also why models with grouped-query attention are so much better at long context: fewer KV heads means proportionally fewer bytes per token.
Quantisation interacts with the bottleneck in a non-obvious way
Because decode is bandwidth-bound, halving the bits per weight roughly doubles the tokens per second, until the dequantisation work becomes the limit. On a GPU with fused kernels, going from BF16 to four bits is close to a 3x improvement in decode throughput. On a CPU without vectorised dot-product instructions, a four-bit format can be slower than Q8_0 because unpacking nibbles and applying scales costs more cycles than the bytes saved.
Instruction set support decides this. AVX2 gives 256-bit vector integer operations; AVX-512 VNNI adds fused 8-bit dot products; ARM NEON with dotprod and i8mm does the equivalent on modern phones and servers. A Q4_K_M build on a recent x86 chip with AVX-512 is fast; the same file on an older Atom-class chip is not. It is worth checking that the runtime was compiled with the right flags for the target CPU, because a generic binary leaves a large factor on the table.
The parts of the pipeline that are not the model
Tokenisation is negligible for short prompts and measurable for long ones: a 20,000-token prompt can take tens of milliseconds in a Python tokenizer. Sampling over a 128K vocabulary costs a fraction of a millisecond per token, which is nothing against a 100 ms decode step but is not nothing at 5 ms per token on a small model. Detokenisation and JSON serialisation in a streaming server add overhead per chunk. Python's GIL and HTTP framework can cap throughput well below what the GPU can do if the server is written naively.
Measure at the boundary the user sees: time to first token, inter-token latency at p50 and p95, and tokens per second over the whole request. Averages hide the stalls that make an interface feel broken, and the p95 is usually set by a long prompt or a cache eviction rather than by the model.
Hybrid offload and the PCIe tax
When the model does not fit in VRAM, llama.cpp can keep some layers on the GPU and the rest on the CPU. Each token then crosses PCIe at every boundary, and PCIe 4.0 x16 moves about 25 to 30 GB/s in practice against 1000 GB/s of VRAM bandwidth. Offloading even a few layers can halve throughput, but partial offload that runs at eight tokens per second beats an out-of-memory error. The right split puts as many layers on the GPU as fit with the KV cache and compute buffer, not as many as fit by weight size alone.
On a laptop with a small discrete GPU, the integrated GPU often drives the display and the discrete card is free. Forcing the compositor onto the iGPU can recover a gigabyte of VRAM, which is worth more than any flag. The same logic applies to other processes: a browser with hardware acceleration can hold a gigabyte on the card you are trying to fill with weights.
What to measure, and with what
- Weight size in bytes at the chosen quantisation, from the file itself rather than the model card.
- Achieved memory bandwidth: nvidia-smi dmon for utilisation, or a streaming benchmark on CPU.
- Tokens per second and time to first token separately, at the context length you will actually use.
- Sustained throughput over five minutes, not a twenty-second burst, especially on laptops.
- p50 and p95 inter-token latency under the concurrency you expect.
- GPU offload ratio and whether any layer is spilling to CPU.
- KV cache size at the configured context, computed from the config file's layer and head counts.
- Power draw and clock throttling during the run, because a 45 W part and a 250 W part tell different stories.
Speculative decoding moves the bottleneck instead of removing it
Speculative decoding uses a small draft model to propose several tokens and the large model to verify them all in a single forward pass. Verification is a batched prefill, which is compute-bound, so the trick converts spare compute into fewer bandwidth-bound decode steps. When the draft model predicts well the throughput gain is substantial; when it predicts badly the large model rejects the proposals and you have paid for the draft model's memory and time for nothing. Code and formulaic text accept well; open-ended prose accepts poorly.
The draft model must share the target's tokenizer, which rules out mixing families casually, and it consumes VRAM that an 8 GB card does not have to spare. On a CPU the same trick helps much less, because prefill is already compute-starved and there is little idle compute to spend. It is a GPU optimisation for a bandwidth-bound decode, not a general-purpose speedup.
The short version
- Decode is memory-bandwidth-bound: tokens per second ≈ achieved bandwidth ÷ bytes of weights read per token.
- Prefill is compute-bound and favours GPUs far more than decode does.
- A GPU's advantage is bandwidth first, compute second, and batching third.
- A CPU's advantage is capacity, cost, idle power and deployment simplicity, not latency.
- Long contexts add a KV cache read per token that can rival the weight read.
- Four-bit quantisation helps decode almost linearly until dequantisation becomes the bottleneck.
- Partial GPU offload is a fallback, and PCIe makes it expensive.
- Measure time to first token and inter-token latency separately; they have different causes.