One Token at a Time: The Anatomy of a Decode Step and Why Inference Is Hard
Photo: N43 and Hermes AIEvery chat answer is built one token at a time, and the physics of that loop — not model size alone — sets the price, the latency, and the shape of the serving business.
Source video: Why Inference is hard.. · Caleb Writes Code · approximately 266K views observed via yt-dlp on November 27, 2026. Independently researched by N43 and Hermes AI.
01 Two Phases: Prefill and Decode
Every answer a large language model produces is assembled in two very different phases. During prefill, the entire prompt — system message, history, documents — is processed in a single parallel sweep: every token passes through every layer at once, and the hardware behaves like the matrix-multiply machine it was designed to be. During decode, the model emits exactly one token per forward pass, repeating that pass until the response is complete.
The distinction is not cosmetic. Prefill is compute-bound: thousands of tokens move through the network together, so arithmetic units stay busy and cost scales with prompt length. Decode is the opposite regime, dominated not by math but by the movement of data. A serving system lives or dies on how well it handles the second phase, because that is where responses spend most of their wall-clock time.
The split also defines the two numbers users actually feel: time to first token, set largely by prefill, and inter-token latency, set by the decode loop. Confusing the two leads to wrong capacity plans and wrong optimization targets — a faster GPU helps prefill immediately, while decode improves only when the memory system or the batching strategy changes.
02 Inside One Decode Step
A single decode step is deceptively simple to describe. The model reads every one of its weights from memory, pushes the current token through each layer, attends over the cached representations of every previous token — the KV cache — and produces a probability distribution over the vocabulary from which the next token is sampled.
Note what dominates. The arithmetic itself is trivial by accelerator standards; the cost is that every weight byte must be fetched from memory for every step, and the attention read grows as the context grows, because the KV cache extends with every token the model emits or receives.
Nothing in this step amortizes for a single stream. Whether the model is producing the first token of an answer or its five-hundredth, the price per step is a full pass over the weights. That invariant — one full model read per token — is the load-bearing fact of inference economics.
03 The Memory-Bandwidth Wall
Engineers describe this regime with arithmetic intensity: operations performed per byte moved from memory. Prefill pushes intensity high enough to saturate the math units. Decode does not: each weight byte yields only a handful of operations, so the floating-point units sit largely idle while the memory bus runs flat out.
A rough illustrative ceiling makes the wall concrete. A 70-billion-parameter model held in fp16 occupies about 140 GB of weights. Streaming those weights once per token over memory rated near 3.3 TB/s bounds a single stream near 24 tokens per second — before accounting for attention, sampling, and scheduler overhead. The number is illustrative, but the shape of the constraint is real: decode speed tracks bandwidth, not FLOPS.
The consequence inverts hardware intuition. Peak teraflops, the headline number in accelerator marketing, barely matters for single-stream decode; memory bandwidth and capacity do. This is why inference-optimized hardware is designed around HBM stacks and memory interconnect rather than raw multiply-accumulate throughput.
04 The Batching Paradox
Serving stacks attack the wall with batching. If forty users are generating at the same moment, the server can read the weights once per step and advance all forty sequences with that single fetch. The bandwidth cost of a weight read is amortized across the batch, so aggregate throughput climbs steeply with batch size.
The paradox is that per-user token speed stays roughly constant. Each user's tokens must still be produced in sequence, one forward pass each, and the per-step weight fetch happens regardless of batch size. Batching transforms the economics of the data center, not the latency any individual user perceives.
The trick has limits. Larger batches demand more memory for KV caches, and schedulers must admit, preempt, and reorder streams continuously — so-called continuous batching — to keep the accelerator fed without letting any one user's stream stall. Batch size becomes a dial traded between throughput and tail latency.
05 Accelerations: Speculation, Paging, Quantization
Speculative decoding attacks the serial structure directly. A small draft model proposes several tokens ahead; the large model then verifies the whole proposal in a single parallel pass, accepting what matches and discarding what does not. Verification is cheaper per token than generation because a batch of candidates rides through the weights together, so accepted runs convert one bandwidth spend into multiple tokens.
Paged KV caches treat attention memory the way an operating system treats RAM: fixed-size pages allocated on demand instead of contiguous reserved blocks. Fragmentation drops, more concurrent streams fit per accelerator, and effective batch density rises.
Quantization shrinks the bytes themselves. Storing weights in 8-bit or 4-bit formats divides the memory traffic per step accordingly, which is why quantized models decode disproportionately faster than their fp16 counterparts. The trade is a small risk to output quality, audited per model and per task.
06 The Price Evidence
The market has priced this engineering progress visibly. Public API list prices for output tokens fell from $60 per million tokens for GPT-4 at launch in March 2023, to $15 for GPT-4o in May 2024, to $0.60 for GPT-4o-mini in July 2024 — a hundredfold decline in roughly sixteen months across comparable hosted access.
Those are list prices, measured from public pricing pages at each launch, and they compress several effects at once: smaller models doing more work, better kernels, denser batching, aggressive quantization, and distillation that moves capability into bandwidth-friendlier models.
The decline is efficiency, not charity. Providers compete on price per useful token, and every serving improvement monetizes as either margin or market share. The floor under all of it remains the decode loop: prices can fall toward the physics of moving weights through memory, but not below it.
07 Limits and What Changes Next
Honest caveats first. The 24-token ceiling is an illustrative single-stream figure; real deployments report different numbers depending on precision, architecture, and scheduler state. The price points are list prices at launch, not negotiated enterprise rates. And speculative decoding changes the effective cost calculus wherever draft models are accepted at high rates.
What changes next is largely co-design. Hardware pushes more bytes per second closer to compute — stacked HBM, larger memory per package, multi-die assemblies. Software pushes fewer bytes per token: quantization, pruning, distillation, and smarter caches. Both lines of attack converge on the same enemy, the per-token weight read.
The decode loop itself survives all of it. As long as autoregressive models produce one token per pass over the weights, inference cost floors at the memory system, and the serving business remains a bandwidth business with a compute veneer. Watch bandwidth-per-dollar and bytes-per-token — the metrics that actually move prices.
References
- Wikipedia: Transformer (deep learning) — architecture the decode loop runs on
- Wikipedia: Speculative decoding — draft-and-verify acceleration
- Source video: Why Inference is hard.. (Caleb Writes Code, ~266K views, observed November 27, 2026)
By N43 and Hermes AI for DutyStation News.





