Log inStart free
LESSON 29.C6 · 6 STAGES · 2 CONTROLS · 3 CHECKSPRO · PREVIEW

An LLM request's lifecycle, end to end

Follow one chat request from its text to its last streamed token.


Pro lesson. Stage 1 is free to watch. Pro opens all 6 stages, 2 controls and 3 checks, in this lesson and every other.

Go Pro · $8.25/mo
EXPLAINER · 29.C6 · SERVING BAY512 PROMPT TOKENS · 7 FROM THE QUESTION
01
Stage 1 of 6 · Tokenize
A tokenizer splits the question into 7 BPE tokens. With the system prompt, the prompt holds 512 tokens.
Explain it simply

The question has 30 bytes, one per character. The tokenizer joins them with 52 merge rules learned from a short training text. So each word here becomes one token with its own ID. The system prompt, fixed instructions at the start, adds 505 more tokens. The model only ever sees these 512 IDs.

The question's 30 bytes join into 7 tokens. Token IDs: What 276, is 257, the 277, capital 265, of 267, France 297, ? 63. A system prompt block adds 505 tokens, 512 in all.

prompt tokens, KV cachewaiting, dropped tokens (dashed)output tokenspolicy pick, cut, now
one H100 over time · 2 batch slots · FCFS020406080100120140160180mssummarybatchcodebatchchatinteractiveshort questioninteractivethe chat request, before it is queuedBPE · 8.0252 merge rules, learned from 8 training linessystem prompt505 tokensnot split herethe question: 30 bytesWhat␣is␣the␣capital␣of␣France?What276␣is257␣the277␣capital265␣of267␣France297?63505 system + 7 question = 512 prompt tokensone H100 over time · 2 batch slots · FCFS020406080100120140160180mssummarybatchcodebatchchatinteractiveshort questioninteractivethe chat request, before it is queuedBPE · 8.0252 merge rules, learned from 8 training linessystem prompt505 tokensnot split herethe question: 30 bytesWhat␣is␣the␣capital␣of␣France?What276␣is257␣the277␣capital265␣of267␣France297?63505 system + 7 question = 512 prompt tokens
Toy: 4 requests, an 8B model on one H100; hand-set logits
STAGE 1 / 6
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
nprompt=nsys+nq\sy{np}{data}{n_{\text{prompt}}} = \sy{ns}{data}{n_{\text{sys}}} + \sy{nq}{data}{n_{\text{q}}}
512=505+7512 = 505 + 7

The prompt is the system tokens plus the question tokens.

Common mix-ups

MYTHTime to first token is the prefill time.

The fix, and 1 more mix-up with the diagram to show them, come with Pro.

Predict, then reveal
3 CHECKS · PRO
Q01With 2 slots, does priority give the chat its first token sooner? Who pays?

Make your guess, then test it in the diagram. All 3 checks come with Pro.

PRO LESSON · YOU WATCHED STAGE 1 OF 6
Unlock the full explainer
  • 5 more stages and 2 live controls
  • 2 mix-up cards and 3 predict-then-reveal checks
  • Watch it as a narrated video, in three voices
  • Every Pro lesson and capstone · 656 in total

$99 a year, or $15 a month. Cancel any time.