PrepCity

LLM inference: prefill, decode and the KV cache

Open the lab

By the last page, this is the design you will have built.

Lesson · 9 pages · about 6 min

LLM inference: prefill, decode and the KV cache

A language model answers one token at a time. See why the first token is slow and the rest are quick, why GPU memory runs out before the arithmetic does, and how paged memory lets one GPU serve far more people.

Words you’ll learn

  • Request
  • Inference
  • Gateway
  • Rate limit
  • Server
  • Language model
  • GPU
  • Stream
  • Prefill
  • Time to first token

Page by page