Summary
A guest lecture on what happens after training: serving models, or turning electricity into tokens. The speaker, who runs a lab at UCSD and works at Together, walks through the lifetime of an inference request — scheduling, KV caching, prefill and decode, parallelism — then presents two research directions that come out of looking at the system closely. The first is megakernels, which fuse an entire model layer into a single GPU kernel to eliminate launch gaps and tail effects during decode. The second is Parcae, a looped or recurrent transformer stabilized using state-space model analysis. The argument tying it together is that deep understanding of inference and GPU kernels enables full-stack innovation in model design.
Key Takeaways
- Prefill and decode are different beasts and are increasingly split across different machines. Prefill resembles training without the backward pass and is compute-bound; decode generates one token at a time, so it does little arithmetic but must reload the whole model, making it memory-bandwidth-bound. This asymmetry is driving hardware specialization, with vendors pairing GPUs for prefill against LPU-style chips such as Groq or Cerebras for decode.
- Production traffic does not look like training data or like a made-up benchmark. A coding agent with a whole repository in context has tens of thousands of input tokens and short output; narrative summarization or casual chat look nothing like it. Session length, turn count, gaps between turns and per-application latency targets all shape what the serving system must optimize.
- The KV cache hierarchy — GPU memory, then CPU DRAM, then SSD — recreates classic operating-system paging, down to LRU eviction being a decent heuristic and prefetching being the ideal if you could predict the next request. This is a concrete reason CPU performance and DRAM/SSD supply now matter to inference providers.
- At trillions of tokens a day, failures that occur 0.001% of the time become routine. Examples given: a subtly wrong kernel producing NaN logits, after which the model repeats one token forever; a regression in tool-call handling that sent completion lengths into tens of thousands of tokens in a doom loop; and an off-by-one that read uninitialized GPU memory, emitting a random Chinese character that made the model switch languages — widely misdiagnosed as a quantization problem.
- Cache-aware prefill-decode disaggregation is a two-line routing change with outsized payoff: send new, cold, low-cache-hit-rate requests to a dedicated set of prefill nodes so a freshly pasted book does not share GPUs with a user midway through a cheap conversation. Reported as up to 40% faster serving.
- Megakernels attack the fact that writing one kernel per operation leaves the GPU idle during launch, teardown and tail effects. Fusing a whole layer into one kernel turns the GPU into a distributed system to be scheduled, allowing the KV cache load to begin before QKV and RoPE finish, or the output-projection weights to load before attention completes. This yields 30-70% speedups on the attention inference kernel and about 72% of achievable memory bandwidth on an H100, implemented via the ThunderKittens library.
- The cost of megakernels is human: a talented kernel engineer spends roughly a year covering one hardware target, two or three models, and batch sizes 1 to 16 — change to batch size 17 and the work restarts. Compilers to automate this are in progress.
- Parcae addresses why looped transformers blow up. Writing the residual as a dynamic system, pushing all the nonlinearity aside, leaves A and B matrices whose closed form is dominated by A raised to the number of loops; when the spectral radius exceeds 1 the activations explode, which explains loss spikes that previous work papered over by fixing the learning rate. Constraining A to a negative diagonal and normalizing B produces stable training at learning rates that broke baselines, plus better perplexity than both a prior recurrent-depth model and a strong transformer baseline.
- Parcae’s scaling laws suggest recurrence is a third axis alongside parameters and data: at fixed parameters and FLOPs, the iso-curves trend down and to the right, implying recurrence should be scaled up as data increases. Since current production models use no recurrence at all, they sit at the far left of that curve. The serving payoff is that fewer parameters mean more room for KV cache and less cross-GPU communication.
Extracted Notes
- None yet.