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 08 · AI · Serve the GPT you built · with code: Python · about 15 min to read

Play it as a journeyTutor comes with a plan

The Engine, Whole

Inference Engineering
Inference Engineering · Open board

The Inference Engineering board follows one message through a serving system, from the front door to the card and back. This lesson puts the front door on the engine you built and measures the trip. Closes the serving series that began at Build Your Own Inference Engine.

Before you start. Five stages built the kitchen. Serve 01: The KV Cache saved each character’s keys and values, Batching: A Slot That Frees Early handed a seat on to the next reply the moment one freed, Paged Attention: The Cache in Blocks cut the memory into blocks, The Prefix Cache: Computed Once computed a shared opening once, and Speculative Decoding: The Bigram Drafts, the GPT Checks let a cheap guesser draft ahead. Later in this track, The Two Clocks (TTFT, TPOT, and why goodput is the number) names the two waits a user feels. This lesson measures both on your own machine.

Lesson 76 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

  • 20 June 2023: the same model, half the cards
  • Streaming: the reply arrives one chunk at a time
  • TTFT and TPOT: the two clocks on a stopwatch
  • The sweep: 1, 4, 16 and 64 clients
  • Goodput: the number that caught the lie
  • One process, one lock: why the numbers are a shape
  • What vLLM has that this engine does not
  • What does the customer’s stopwatch read?
  • Why does the last customer wait about 1.5 seconds?
  • What does each column of the log say?
  • All of it in code

Terms it explains: streaming, chunk, engine, handler, TTFT, TPOT, percentile, Goodput, engine thread, handler thread.

Review AI