System Design
19. AI System Design and LLM InfrastructureAnimated
LLM Inference Architecture
How an LLM serves requests.
The idea
A gateway, scheduler, GPU workers with KV cache, and streaming responses.
Watch it work
Press play, pause, or step through. Some animations have settings you can change.
Prefill reads the whole prompt at once. It is compute-bound, and sets time-to-first-token.
- generated:
- 0
1/7
Prefill and decode have different bottlenecks, which is why serving systems treat them differently.
Step by step
- 1Request enters the gateway
- 2Scheduler batches it
- 3Prefill processes the prompt
- 4Decode streams tokens
Where it is used
Chatbots and APIs.
Watch out for
Time-to-first-token and tokens-per-second pull in different directions.