Index

Free, with Google

Keep going, free.

A free account opens lessons 2 and 3 of every track, 33 more lessons, and keeps your progress and review cards on every device.

Start free with Google

A chalk plan

Open everything on chalk.

Every lesson, board, video, lab and paper, and the full review decks. Yearly is $39/year.

See plansStart free instead

Module 09 · AI · Serving LLMs · about 24 min to read

Play it as a journeyTutor comes with a plan

Prefill / Decode Split (two pools, one KV in flight)

Prefill Decode Split
Prefill Decode Split · Open board

Serving LLMs. Chunked Prefill (one long prompt must not freeze the room) ended in a truce: one shared card, the long prompt sliced so it rides along with everyone else’s reply, everyone paying a little all the time. This board breaks the truce instead of managing it, reading and writing on two separate machines, and then prices the one bill that truce never had to pay: a gigabyte of notes crossing a wire between them.

Before you start. Chunked Prefill (one long prompt must not freeze the room) left you in a room where 32 people share one card. The card is a GPU: the chip built for doing the same arithmetic on millions of numbers at once. The whole model lives on it, and thirty-two people share one because a single pass through the model answers all thirty-two of them. The rest of this lesson just says card, and the diagrams say GPU. They are the same chip. A token: a word, or a piece of one, arrives for each of those people every 39 milliseconds. The card makes that token by pushing it through the model’s weights, the 7 billion numbers it learned during training. Reading a prompt for the first time, before any reply starts, is prefill. Writing the reply afterward, one token at a time, is decode. Every token a conversation has already produced leaves behind notes about itself, its KV cache, that decode has to keep re-reading for every later token. K and V are for key and value: the two numbers the model keeps per token so it never has to read that token again. Moving that cache is exactly the new problem this lesson has.

Lesson 80 of 83 in AI

The rest of this lesson is part of a plan.

A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year.

See plansAlready a member? Sign in

Or start free: a free account opens lessons 2 and 3 of every track.

In this lesson

  • November 2023: a team stops trying to share
  • January 2024: the arithmetic that says how many of each
  • The one new bill: a gigabyte that has to travel
  • Mid-2024: when the pools fill up anyway
  • Why one card cannot do both jobs
  • How many readers for each writer
  • A gigabyte on a wire
  • When not to split
  • All of it in code

Terms it explains: GPU, token, weights, prefill, decode, KV cache, pool, disaggregation, goodput, backpressure, batch, compute-bound, memory-bound, MFU, layers, NVLink, RDMA, layer-wise pipelining.

Review AI