How LLMs work
A 23-lesson animated video course on how large language models work, from the first artificial neurons to building your own model. Hosts Anna and Max explain each idea, and Akami the octopus builds his own chatbot, AkamiGPT, one piece per lesson. Every lesson has a transcript, and several come with hands-on exercises in Google Colab, Ollama, PyTorch and Claude Code. Coming in November.
Create a free account to start this course.
Sign up free to unlock every lesson in How LLMs work — no card required.
Create Free AccountCurriculum
- 1 Start here: the course in two minutes Create a free account What How LLMs work covers, who it is for, your hosts Anna and Max, and Akami's project: building his own chatbot, AkamiGPT, one piece in every lesson.
-
2 From the perceptron to reasoning models Coming soon From 1843 to 2026: Lovelace, Markov and Shannon, the first artificial neurons, backpropagation, the transformer, ChatGPT, reasoning models and agents, and the limit each idea removed.
-
3 GPUs, servers and data centers Coming soon The hardware behind LLMs, from one chip to a whole data center: CPU versus GPU, memory on the card, the 8-GPU server, the liquid-cooled rack, the cluster and its network, power and cost, and how training and answering use it all.
-
4 A prompt's journey: from ChatGPT to the GPU and back Coming soon Follow one message from the ChatGPT app over the internet, through the provider's front door, onto a GPU for prefill and decode, and back to your screen token by token, with real timings.
-
5 The context window Coming soon A mystery: why did AkamiGPT forget Akami's name after fifty messages? Following the clues: what the context window is (the model's desk, counted in tokens) and whether a chat still fits, how a token on it gets its meaning (embeddings on a map of meaning, then context from the words before it), what happens when the desk fills up, why the middle gets lost, how the weights, the desk and an app's saved memory differ, and why a new topic deserves a new chat. The name never left the model's memory; it fell off the desk.
-
6 Good prompts Coming soon Turn a bad prompt into a good one with five golden rules (clear and specific, context and goal, format, role, iterate), choose zero-, one- or few-shot examples (and still check the answers), and decide when step-by-step thinking is worth its tokens and when a reasoning model does it on its own.
-
7 RAG: give AI your documents Coming soon Why a model doesn't know your documents, and how retrieval-augmented generation fixes it: chunks and embeddings for search by meaning, cosine similarity, chunk size, why vector databases exist (approximate nearest neighbours with HNSW and IVF) and which to pick, the whole pipeline from handbook to an answer with its source, the toolbox (an embedding model, a vector database like Chroma, frameworks like LangChain and LlamaIndex), a small search built in Google Colab with code an AI wrote, and how RAG goes wrong.
-
8 Prompt security: injection, leaking and jailbreaks Coming soon Why text can trick an AI (the model reads instructions and data as one stream), direct and indirect prompt injection, why agents with tools raise the stakes (the lethal trifecta), prompt leaking and why secrets never go in a prompt, the main families of jailbreaks, how to defend an app in layers, so a fooled model can't do much harm, and how to attack your own bot first with promptfoo's red teaming and read its report.
-
9 Evaluating LLMs Coming soon Why grading an LLM is like grading essays, not a multiple-choice test; the many sides of a good answer; four ways to measure (exact match, shared words, people, an AI judge); the benchmarks in every model announcement (MMLU, HELM, BIG-Bench Hard, GPQA, SWE-bench, Humanity's Last Exam, ARC-AGI) and their limits; how to build a small test set of your own, and the tools that run it: promptfoo's test grid before you ship, Langfuse's traces after, and others like Ragas, DeepEval and LangSmith.
-
10 Smaller models: quantization Coming soon How a big model gets small enough for one GPU, a laptop or a phone: weights rounded to fewer bits (16, 8, 4), the memory math, how groups with their own scale and quantization-aware training keep the loss tiny, the files and apps people use (GGUF, Ollama, Gemma 4), and TurboQuant, Google's trick for shrinking the KV cache to about three bits.
-
11 Local models: AI on your laptop and phone Coming soon Why people run models on their own machines (privacy, offline, no bill per token, control) and the limits; the tools (Ollama, LM Studio, llama.cpp and GGUF files, MLX on Apple silicon, LiteRT and Google AI Edge Gallery on phones); the memory rule (about 0.6 GB per billion weights at 4 bits, plus the KV cache, plus your system); why speed is memory bandwidth (system memory, a gaming card's VRAM, a Mac's unified memory); what NPUs and 'AI ready' stickers do and don't mean; which machine for which model size; and running a model offline with Ollama and on a phone.
-
12 The math of neural networks Coming soon AkamiGPT gives wrong answers and has a billion knobs. Tensors, dot products and matrix multiplication; layers as a factory line and activation functions (step, sigmoid, ReLU); gradients and gradient descent; the loss as a scorecard with cross-entropy; backpropagation; and overfitting versus underfitting, with dropout, regularization and more data; then the classic toolbox (scikit-learn: fit, score, predict on the iris flowers in Google Colab, with code an AI wrote) and the deep learning toolkits PyTorch and TensorFlow with Keras.
-
13 Attention: how each word looks back at earlier words Coming soon How models read before attention (fixed embeddings, CNN windows, RNN memory that fades, LSTM gates that still wait word by word), self-attention as a networking event, the prepared input (embedding, position, layer norm), queries, keys and values as a video search on "the cat sat on the mat because it was tired", the causal mask that stops peeking, and multi-head attention with MQA and GQA to keep the KV cache small.
-
14 The transformer, block by block Coming soon What's inside the box: a transformer as a building. The ground floor (a brick and a seat number for every word), floors with a meeting room (attention) and desks (feed-forward), leftover lines (residual connections) and volume knobs (layer norm), dozens of floors, and the roof that scores every token. Then mixture of experts, the three families (encoder-only like BERT, decoder-only like GPT, encoder–decoder like the 2017 original and T5) and which jobs each suits, and the toolkits people build with: PyTorch, TensorFlow and Keras, JAX.
-
15 Pretraining and scaling laws Coming soon Where a model learns everything from: the next-word guessing game on huge amounts of text (self-supervised, loss going down, batches and epochs), the scaling laws and Chinchilla's twenty tokens per parameter, the full recipe to train a model from scratch (data from Common Crawl, books and code; cleaning; the tokenizer; the blueprint; GPU hours and cost; mixed precision and checkpoints), how one model is split over thousands of GPUs (data, tensor and pipeline parallel), a real PyTorch training loop and a nanoGPT Shakespeare run checked by its loss, and the build-or-buy choice: a ready model with prompts and RAG, fine-tuning, or pretraining.
-
16 Fine-tuning and LoRA Coming soon AkamiGPT wants to talk like a pirate octopus. Why a base model only continues text, and how supervised fine-tuning on example pairs (a job description made of examples) turns it into an assistant (InstructGPT's step one: about 13,000 prompts with written answers); the chat template the model really reads; why the model copies everything in your examples (quality beats quantity, LIMA); where examples come from (30 by hand, a big model drafts more, you check: synthetic data) and distillation (a big teacher, small students: DeepSeek-R1) with its risks (the teacher's terms, copied mistakes, model collapse); full fine-tuning (every knob moves, about 16 bytes per knob with Adam, a full copy per job) vs LoRA (sticky notes on a frozen book) and QLoRA; what goes wrong (memorizing and catastrophic forgetting); a real LoRA script asked from an AI, run in Google Colab and checked; and when to use a prompt, RAG or fine-tuning.
-
17 RLHF and reasoning Coming soon Why a fine-tuned model still isn't helpful or safe enough, reinforcement learning as learning by trying, RLHF (people compare answers, a reward model learns their taste, the model is nudged toward higher scores; InstructGPT), reward hacking, DPO as a shortcut straight from pairs, reasoning models trained with RL on problems with an answer key (GRPO, DeepSeek-R1), test-time compute (o1) and what thinking tokens cost, and why models make things up (the guessing game, rare facts, tests that reward guessing) and what helps (RAG, honest grading and calibration, checking).
-
18 Pictures, voices, music and video: how AI makes them Coming soon One prompt, four machines: text one token at a time, pictures by diffusion (static cleaned step by step, steered by your words, on a small sketch), voices and music from audio tokens and pictures of sound, and video as diffusion over many frames at once. Plus text made by diffusion: DiffusionGemma.
-
19 Beyond LLMs: what comes next Coming soon Fast and slow thinking (Kahneman's System 1 and System 2) and where LLMs and reasoning models fit, Yann LeCun's world models and JEPA (predict the meaning, not every pixel), V-JEPA 2 and Genie 3, fast decision models like Jev, tiny on-device models like Needle 3, chips with one model built in, how an agent uses tools (a tool call, and MCP, the open standard plug, with every server a new door), and why the future looks like a team of brains.
-
20 Design patterns for AI agents Coming soon The parts of an agent, built with LangChain (the model, the system prompt, tools, the loop seen as a trace, short-term and long-term memory, middleware), then do and verify (check every step outside the model, with a retry budget), the five workflow patterns from Anthropic's Building effective agents (chains with gates, routing, parallel work, orchestrator and workers, evaluator and optimizer), ReAct versus plan and execute, human approval and the lethal trifecta, and a first agent in Claude Code, with Akami's party agent as the running example.
-
21 Scaling: thousands of chips as one Coming soon How the giants train and answer on thousands of chips, from Google DeepMind's free book How to Scale Your Model: the three limits every job hits (math speed, the memory door, the network), why a tray of about 300 tokens keeps an H100 busy and one person alone uses under 1%, GPUs (132 small kitchens) versus TPUs (giant grids of calculators, wired as a donut), the speed ladder from memory to NVLink to InfiniBand, passing plates around a ring (all-gather, all-reduce), the training bill (6 × knobs × words, MFU), training memory and scratch notes, copies with FSDP, slices, floors and experts with their limits (Llama 3 and DeepSeek V3), and answering at scale: prefill versus decode, notebooks that outgrow the model, and the speed-or-cost dial.
-
22 Running AI for real: MLOps with NVIDIA NIM and Brev Coming soon How a model goes from a laptop to real users: what MLOps is (the restaurant: the recipe is the model, the kitchen is serving, the inspector is monitoring), the loop every model lives in (data, train, evaluate, package, deploy, monitor, improve), versions, tests before every release, canary releases and rollbacks, NVIDIA NIM (a model and its engine in one container with an OpenAI-style API, run on any NVIDIA GPU and scaled with Kubernetes), renting a GPU by the hour with NVIDIA Brev, calling the model with curl and Python, the free developer access versus a production licence, and watching speed, cost, errors, quality and drift.
-
23 Akami builds his own LLM Coming soon The finale: the whole build as one road with ten stations, each a lesson of the course (data, tokenizer, blueprint, training, checking, fine-tuning, aligning, shrinking, serving, using it well), the hardware ladder from a laptop to a cluster with rough prices, the free software for each job, and the realistic path as a runnable kit (one Google Colab notebook, eight boxes): 30 examples by hand and checked drafts, LoRA on Qwen2.5 (a free try run with 0.5 B, the 7 B AkamiGPT on a rented GPU), merge, GGUF at 4 bits, an Ollama Modelfile with the chat template, RAG with a guard, and a 10-question test before and after. AkamiGPT runs.