Season 1 · The Foundations · Episode 2

How LLMs Work

A machine that does one thing, billions of times: guess the next word

What this lesson is about

A large language model works by predicting the next word in a sequence, over and over again. During training it does this billions of times, and along the way it builds a vast internal map of language where words, meanings, and contexts are stored as numbers. In this lesson you will open up that process and follow it from raw training data, through tokenisation and embeddings, to the moment the model picks its next word. The goal is for the inner workings of an LLM to stop feeling like magic and start feeling like something you can explain.

What you'll be able to do

A little background

When you type a prompt, the model navigates its internal word map using an architecture called a transformer, paying attention to the parts of your input that matter most. It then uses probability to choose the most likely next token, one piece at a time. The key terms to get comfortable with are training data, tokens, embeddings, the transformer, and self-attention, and you will build your own definition of each.

Readings

Open the bot →