Skip to content
LearnAI

TABLE OF CONTENTS

The curriculum

10 parts · 67 lessons · about 15 h 36 min of reading and interaction.

Part 0Orientation

39 min

What AI, ML, deep learning and LLMs are, how they relate, and how to use this guide.

  1. 0.1What are AI, ML, deep learning and LLMs?Four buzzwords, one family tree. Learn how the fields nest inside each other and the single idea that separates them, rules written by people versus behavior learned from data.15 min
  2. 0.2A short history: from perceptrons to ChatGPTEighty years of boom, bust and breakthrough, and why the ideas behind today's AI only started working once data, GPUs and a few key algorithms arrived together.14 min
  3. 0.3How to use this site (and a map of everything)A quick tour of how every lesson is built, the tools that help you learn, the learning paths, and a clickable map of all 67 lessons.10 min

Part 1Foundations

1 h 49 min

Functions, vectors, probability, gradient descent, neural networks and backprop — the bedrock.

  1. 1.1Functions & learning from dataA model is just a function with knobs. Learning means turning those knobs until the function fits the examples. Drag data points and watch it happen.13 min
  2. 1.2Vectors & dot productsVectors are lists of numbers that double as arrows. The dot product measures how much two arrows agree, and it is the similarity score behind embeddings, search and attention.13 min
  3. 1.3Matrices as transformationsA matrix is a machine that moves every point in space at once, rotating, stretching, shearing or flattening it. Every neural-network layer is one, plus a shift.12 min
  4. 1.4Probability, softmax & cross-entropyHow a model turns raw scores into probabilities with softmax, how temperature sharpens or flattens them, and how cross-entropy grades a prediction. This is the exact loss every LLM is trained on.13 min
  5. 1.5Loss functions & gradient descentHow a model measures its own mistakes, and the deceptively simple rule — "walk downhill" — that trains every modern neural network.10 min
  6. 1.6Neurons, layers & activation functionsA neuron is a weighted sum plus a squiggle. Stack enough of them and you can bend space into almost any shape you need.17 min
  7. 1.7Backpropagation & the chain ruleHow a network figures out which of its millions of knobs to blame for a mistake, in a single backward sweep that costs about as much as the forward pass.15 min
  8. 1.8Overfitting, regularization & data splitsWhy a model that aces its training data can still fail on new data, and the toolkit (data splits, weight decay, dropout, early stopping) that keeps it honest.16 min

Part 2How Language Models Work

2 h 19 min

Tokens, embeddings, attention and the Transformer, followed one token at a time.

  1. 2.1Tokenization & BPEBefore a language model reads a single word, text is chopped into tokens. Learn how byte-pair encoding builds that vocabulary, and why it explains so many LLM quirks.13 min
  2. 2.2Embeddings & semantic spaceHow a token id becomes a vector, why similar meanings end up close together, and how directions in that space can encode relations like gender, tense and capital-of.13 min
  3. 2.3Next-token prediction: the core ideaEvery LLM is trained on one deceptively simple task, guessing the next token. See it work in a tiny n-gram model, then see why doing it well requires so much more.13 min
  4. 2.4From RNNs to attentionWhy reading text one word at a time through a fixed-size memory hit a wall, and how attention, letting every word look directly at every other word, broke through it.13 min
  5. 2.5Self-attention step by stepThe mechanism at the heart of every Transformer, computed by hand. Queries, keys, values, scaling, masking and softmax, with every number visible.16 min
  6. 2.6Multi-head attentionWhy a Transformer runs a dozen small attention operations side by side instead of one big one, and what the individual heads end up doing.14 min
  7. 2.7Positional encoding: sinusoids to RoPEAttention can't tell "dog bites man" from "man bites dog" on its own. Here is how Transformers learn word order, from sine waves to rotating vectors.16 min
  8. 2.8LayerNorm, RMSNorm & residual connectionsThe unglamorous plumbing that lets Transformers stack dozens of layers without their numbers vanishing or exploding, and the "residual stream" that ties it all together.15 min
  9. 2.9The full Transformer: follow one tokenPut every piece together. Watch "The capital of France is" flow through a GPT-2-sized model, with real tensor shapes and parameter counts, until "Paris" comes out.13 min
  10. 2.10Sampling: temperature, top-k, top-pA language model only outputs probabilities. How you turn them into actual words, greedily, randomly or somewhere in between, changes everything about the text you get.13 min

Part 3Training LLMs

2 h 24 min

Data, scaling laws, optimizers, distributed training and the post-training that turns a text predictor into an assistant.

  1. 3.1Pretraining data: collect, clean, dedup, mixHow a chaotic web crawl becomes 15–36 trillion carefully chosen tokens, and why data quality often matters as much as model size.16 min
  2. 3.2Scaling laws: Kaplan & ChinchillaLoss falls as a smooth power law in model size, data and compute. Here is how to spend a compute budget, and why today's models deliberately "overtrain".13 min
  3. 3.3Optimizers: SGD → Adam/AdamW → MuonWhy plain gradient descent struggles in narrow valleys, how Adam adapts a step size per parameter, and how Muon orthogonalizes whole weight-matrix updates.15 min
  4. 3.4Distributed training: data, tensor, pipeline & expert parallelismA frontier model doesn't fit on one GPU, or even a hundred. Here are the four ways to split the work, and what each costs in memory and communication.15 min
  5. 3.5Mixed precision: FP32, BF16, FP8How a number is stored in 32, 16 or 8 bits, why training moved from FP32 to BF16 to FP8, and the tricks (master weights, loss scaling, block scaling) that keep it stable.14 min
  6. 3.6Post-training I: SFT & instruction tuningHow a raw text predictor becomes an assistant. Chat templates, special tokens, loss masking, and why a small instruction-tuned model can beat a giant base model.13 min
  7. 3.7Post-training II: RLHF & reward modelsTurning "I prefer this answer to that one" into a training signal. Preference data, Bradley–Terry reward models, the KL leash, reward hacking, and AI feedback.13 min
  8. 3.8PPO vs DPO vs GRPOThree ways to push a language model toward better answers. PPO's clipped updates and critic, DPO's closed-form shortcut, and GRPO's group-relative advantages.17 min
  9. 3.9Reasoning models: CoT, RLVR & test-time computeWhy letting a model "think" before answering helps, how reinforcement learning on checkable answers produced o1- and R1-style reasoners, and what more thinking buys you.13 min
  10. 3.10DistillationHow a small student model learns from a big teacher. Soft targets, temperature and "dark knowledge", sequence-level distillation, and how DeepSeek-R1's reasoning was passed down to 1.5B–70B models.15 min

Part 4Efficiency & Inference

1 h 38 min

KV caches, quantization, mixture-of-experts, attention variants and how models are served at scale.

  1. 4.1The KV cacheWhy generating text token by token would be painfully redundant, the cache that fixes it, and the memory bill that cache runs up.14 min
  2. 4.2QuantizationStoring a model's numbers in 8 or 4 bits instead of 16, why that barely hurts quality, and the tricks (groups, outliers, GPTQ, AWQ) that make it work.14 min
  3. 4.3Mixture of ExpertsHow models like Mixtral, DeepSeek-V3 and Qwen3 hold hundreds of billions of parameters but use only a small fraction for each token, and what keeps their routers honest.13 min
  4. 4.4MHA vs MQA vs GQA vs MLAFour ways to organize attention heads, compared by the one number that dominates long-context serving, the KV cache per token, and what each costs in quality.15 min
  5. 4.5Long context & FlashAttentionWhy attention gets expensive as contexts grow, how FlashAttention computes it exactly without ever writing the N×N matrix to memory, and what else makes million-token windows possible.14 min
  6. 4.6Speculative decoding & multi-token predictionLet a cheap model guess several tokens ahead and have the big model check them all in one pass. With the right acceptance rule, the output distribution doesn't change at all.13 min
  7. 4.7Serving: batching & PagedAttentionHow inference servers keep GPUs busy for thousands of users at once with continuous batching, paged KV-cache memory and prefix sharing.15 min

Part 5Open-Weight Model Deep Dives

1 h 24 min

DeepSeek, Kimi, Qwen and friends: what they built, how they differ, and why.

  1. 5.1The open-weight landscapeWhat "open" really means for LLMs, how to decode their licenses, and how three years of releases turned open weights from a leak into a frontier.16 min
  2. 5.2DeepSeek: V3, R1 and beyondHow a Hangzhou lab built frontier models cheaply with MLA, fine-grained MoE and FP8, then taught them to reason with pure reinforcement learning.14 min
  3. 5.3Kimi (Moonshot AI): K2 and beyondA trillion-parameter MoE trained without a single loss spike, a pipeline that manufactures agentic training data, and the road to Kimi K3's 2.8T parameters.13 min
  4. 5.4Qwen (Alibaba): Qwen2.5, Qwen3 and beyondThe family with a model for every size and modality, from 0.6B on a phone to 2.4T in a data center, and how hybrid thinking and hybrid attention came to define it.13 min
  5. 5.5Llama, Mistral, Gemma, GLM, gpt-oss & moreShort, verified profiles of the other open-weight families that matter, what each one is known for, and the idea it contributed.13 min
  6. 5.6Comparing open models: how they differ and whyNearly forty open-weight models side by side, and the convergence story behind them, from MoE everywhere to 4-bit training, plus what the numbers can and can't tell you.15 min

Part 6Using LLMs in Practice

1 h 35 min

Prompting, vector search, RAG, tools, agents, MCP, fine-tuning and evaluation.

  1. 6.1Prompting, system prompts & few-shotA prompt is the only thing a model knows about your task. Learn its anatomy, how in-context learning works, and why small wording changes matter.15 min
  2. 6.2Embeddings & vector searchHow text becomes a point in space, how "similar" is measured, and how indexes like HNSW find the nearest neighbors among millions without checking them all.14 min
  3. 6.3Retrieval-augmented generation (RAG)Give a model an open book. Follow a question through chunking, embedding, retrieval and prompt assembly, and see where RAG systems fail and how to measure them.13 min
  4. 6.4Tool use, function calling & agentsHow a text predictor books meetings and queries databases. Tool schemas, the agent loop, planning, memory, multi-agent setups, and when not to build an agent at all.12 min
  5. 6.5The Model Context Protocol (MCP)One standard plug between AI applications and the tools and data they use. Hosts, clients and servers, the JSON-RPC messages they exchange, and the security questions it raises.14 min
  6. 6.6Fine-tuning: LoRA & QLoRAAdapt a billion-parameter model by training less than one percent of it. When to fine-tune, how low-rank adapters work, and how QLoRA fits it all on one GPU.13 min
  7. 6.7Evaluation, benchmarks & their pitfallsHow LLMs are tested, from MMLU to SWE-bench to chatbot arenas, why headline scores mislead, and how to build an evaluation you can actually trust.14 min

Part 7Multimodal Models

1 h 12 min

Images as tokens, CLIP, vision-language models, audio and any-to-any models.

  1. 7.1Vision Transformers: images as tokensHow a Transformer built for words learned to see, by cutting an image into a grid of patches and reading them like a sentence.14 min
  2. 7.2CLIP & contrastive learningHow 400 million image–caption pairs taught one model to put pictures and words in the same space, and why that unlocked zero-shot vision.13 min
  3. 7.3Vision-language modelsHow a vision encoder, a small projector and an ordinary LLM combine into a model that can read your screenshot, and what every image costs in tokens.14 min
  4. 7.4Audio: speech recognition, TTS & audio tokensFrom pressure waves to spectrograms to discrete audio tokens, and how models like Whisper hear and modern TTS systems speak.17 min
  5. 7.5Native any-to-any (omni) modelsWhy gluing speech recognition, an LLM and text-to-speech together loses tone and time, and how omni models put every modality into one stream of tokens.14 min

Part 8Image & Video Generation

1 h 37 min

VAEs, GANs, diffusion, Stable Diffusion, guidance, flow matching and video.

  1. 8.1Autoencoders, VAEs & latent spaceSqueeze images through a bottleneck and you get a compressed "latent space". Make that space smooth and you can sample new images from it, which is why every Stable Diffusion run starts and ends with a VAE.13 min
  2. 8.2GANs (a brief history)A forger and a detective, trained against each other. GANs produced the first photorealistic generated faces, then lost the crown to diffusion, but their adversarial trick lives on inside today's models.11 min
  3. 8.3Diffusion: noising & denoisingDestroy images with noise on purpose, train a network to undo one small step of the damage, and you get the engine behind modern image generators.17 min
  4. 8.4Stable Diffusion & classifier-free guidanceRun diffusion in a small latent space, steer it with a text encoder through cross-attention, and turn up the guidance knob to make it actually follow your prompt.16 min
  5. 8.5ControlNet, LoRA, img2img & inpaintingText alone is a blunt steering wheel. Start from an existing image, repaint only a masked region, pin down structure with edges or poses, or teach the model a new style with a small adapter.13 min
  6. 8.6Diffusion Transformers & flow matchingSwap the U-Net for a Transformer over latent patches, and swap curved noise-to-data paths for straight ones. Together they power SD3, FLUX and most new image and video models.14 min
  7. 8.7Video generation basicsA video is an image with a time axis. Compress it in space and time, cut it into spacetime patches, and a diffusion transformer can generate it, if you can afford the attention bill.13 min

Part 9Safety, Limits & Understanding

59 min

Hallucination, bias, alignment, jailbreaks and peering inside models.

  1. 9.1Hallucination: why models make things upWhy fluent language models state falsehoods with confidence, how training and grading reward guessing, and what actually reduces it.16 min
  2. 9.2Bias & alignmentWhere models pick up skewed associations, how to measure and reduce them, and how we try to make models helpful, honest and harmless without gaming the target.15 min
  3. 9.3Jailbreaks & prompt injection (conceptual)Why language models can be talked out of their rules or hijacked by text they read, and how to build agents that stay safe even when the model is fooled.13 min
  4. 9.4Interpretability: features, superposition & probingHow researchers look inside neural networks, why single neurons are hard to read, and how features packed into too few dimensions can be pulled apart again.15 min
Type to search across all lessons and glossary terms.