Build an LLM from scratch
Train a small language model on your own device, watch it learn to write short stories, then post-train it to follow a request.
See what a language model does
Start Lab 01See what a language model doesNot started
A language model only ever guesses the next piece of text, and seeing it do that makes the rest easier to follow.
Open Lab 01Follow the maths insideNot started
A language model guesses the next word with plain arithmetic on lists of numbers, and you can follow each calculation by hand.
Open Lab 03Explore the design of a transformerNot started
A transformer is the kind of model inside most of today’s chatbots. Its design decides what the model can notice, so you will see which parts matter and why.
Open Lab 02Pre-train your modelNot started
Pre-training is the first and biggest stage of training: the model reads thousands of short stories and learns language by guessing the next piece of text, many thousands of times. You load the stories, cut them into tokens (small numbered pieces of text), train, and then let your model write a story. The loss is a number for how wrong its guesses are: lower is better. To post-train it in the next two labs, train the small size.
Open Lab 04Post-training 1: teach it a formatNot started
Post-training starts from the pre-trained model and keeps training it on chosen text. Mid-training mixes in a new kind of text, here simple sums, so you see what the model gains and what it forgets.
Uses what you learned in Lab 04
Open Lab 11Post-training 2: fine-tune on labelled examplesNot started
Supervised fine-tuning (SFT) trains on labelled data: requests, each paired with a good answer written for it. The model learns to follow a request instead of just continuing the text.
Uses what you learned in Lab 11
Open Lab 12