AI 101 · 5 chapters · 23 puffs
How a chatbot works, from zero
Start with a machine fitting a line through some dots. Finish knowing how a chatbot reads, thinks, answers and makes things up. Each puff takes about five minutes: guess, play, see how it works, check. Open “Go deeper” on any puff for the real math.
-
Chapter 1How machines learn
- 1 What does it mean for a machine to learn?A model is a guess with knobs. Learning is turning the knobs until the guess is less wrong.
- 2 How wrong is it?Before a machine can improve, it needs one number that says how bad its guess is.
- 3 Rolling downhillGradient descent: feel which way is down, take a step, repeat.
- 4 Big steps vs. small stepsThe learning rate decides whether training crawls, lands or flies off the hill.
- 5 Memorising vs. understandingA curve through every dot can be the worst curve of all.
-
Chapter 2Neural networks
- 6 One neuronMultiply, add, squash. The whole building block of a neural network.
- 7 Why layers can bend the lineStack simple neurons and straight lines turn into any shape you like.
- 8 Passing the blame backwardsBackpropagation works out how much each weight is to blame for a mistake.
- 9 Watch a small network learnA real neural network training in your browser, one step at a time.
-
Chapter 3Words as numbers
- 10 Chopping text into tokensModels don’t read letters or words. They read tokens, and here is how text gets chopped.
- 11 Words as places on a mapGive every word a position, and similar words end up as neighbours.
- 12 The one job: predict the next wordEverything a chatbot says comes from guessing the next word, over and over.
- 13 Why it answers differently each timeTemperature turns a list of likely words into a dice roll you can tune.
-
Chapter 4The transformer
- 14 Attention: which words matterEach word looks back at the others and decides which ones to listen to.
- 15 Questions, labels and answersQueries, keys and values: the three lists that make attention work.
- 16 Many heads looking at onceSeveral attention heads, each one watching for a different kind of link.
- 17 How it knows word order“Dog bites man” and “man bites dog” use the same words. Position tells them apart.
- 18 Stacking it all upAttention, a small network and a few shortcuts make one block. Stack dozens.
-
Chapter 5From model to chatbot
- 19 Reading the internetPretraining: predict the next word across trillions of words, and knowledge falls out.
- 20 Learning to be helpfulFine-tuning and human feedback turn a text predictor into an assistant.
- 21 How much it can rememberThe context window is everything the model can see at once. The rest is gone.
- 22 Why it makes things upA model predicts likely words, not true ones. Usually those match. Sometimes they don’t.
- 23 Using tools and acting on its ownGive a model a calculator, a search box and a loop, and it starts to act.