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 11 · From Scratch · Raft · about 11 min to read

Play it as a journeyTutor comes with a plan

Build a GPT: the series, indexed

From Transformer to LLM
From Transformer to LLM · Open board

The From Transformer to LLM board draws the machine that fills in the next blank. This lesson is the timetable for building that machine and then serving it: which station comes first, what each one adds, and the order to run the files. It follows the capstone of the Raft series, Raft Capstone: Everything.

Before you start. Raft Capstone: Everything showed what a build series looks like when it is finished: small stages, each with its own test, then one lesson that runs them all together. The AI track has the same shape in two series, one that builds a small GPT and one that builds the engine that serves it. How It Learns (loss, gradient descent, backprop) gave you the loop every stage here depends on: measure how wrong the model is, find each dial’s slope, step every dial a little downhill, repeat. A GPT is a model that writes text one piece at a time, each time guessing what comes next. Nothing else is assumed.

Lesson 83 of 117 in From Scratch

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

  • January 2023: a video that said “from scratch” and meant it
  • The first half of the route: a model that learns, then writes
  • The second half of the route: from a trained model to a served one
  • Why the order is not a choice
  • Where the files live
  • The run order
  • What the toy shows and what it hides
  • Which stage to blame

Terms it explains: [[0408-autograd-by-hand]], [[0409-the-bigram-model]], [[0410-the-mlp-language-model]], [[0411-attention-by-hand]], [[0412-the-gpt-block]], [[0413-sampling-and-what-scale-buys]], inference engine, forward pass, [[0730-serve-from-scratch]], [[0731-serve-the-kv-cache]], [[0732-serve-continuous-batching]], [[0733-serve-paged-kv]], [[0734-serve-prefix-cache]], [[0735-serve-speculative-decoding]], [[0736-serve-everything]], alignment, autoregressive, base model, Chinchilla, decoder-only, distribution, emergent ability, in-context learning, logits, next-token prediction, parameters / data / compute, pretraining, scaling laws, self-supervised.

Related papers

Review From Scratch