How a chatbot picks its next word

How Large Language Models Work. From tokens and embeddings, through attention and training, to RLHF — no machine learning background needed.

17 lessons · 56 min of video · 21 quiz questions

Large Language Models explained briefly, by 3Blue1Brown

Try a question from this course

Which step in a transformer block lets words exchange information with each other?

What you'll be able to do

  • Explain in plain words how a chatbot produces a reply one token at a time
  • Distinguish tokens from embeddings and say why context matters
  • Describe what attention does and why long contexts are costly
  • Choose sensible temperature settings and explain hallucinations
  • Walk through pre-training, fine-tuning, RLHF and Constitutional AI

What's in it

  1. The big picture

    What a large language model is, and the journey a piece of text takes through one.

    1. A machine that predicts the next word
    2. Recap
  2. Tokens and embeddings

    How text becomes numbers a model can work with, and how those numbers come to carry meaning.

    1. Step one: chopping text into tokens
    2. Step two: embeddings give numbers meaning
    3. Where embeddings came from: fixed to contextual
    4. Recap
  3. Attention and the transformer

    How words exchange information so each vector reflects its context, and how blocks stack into a deep network.

    1. Why we need attention
    2. How attention works: queries, keys and values
    3. Many heads, many layers: the transformer block
    4. Recap
  4. Producing a reply

    From the final vector to a chosen word: probabilities, sampling settings, and why models make things up.

    1. From probabilities to a word
    2. Hallucinations and context limits
    3. Recap
  5. Training and RLHF

    How a raw text-completer becomes a helpful assistant: pre-training, fine-tuning, human feedback, and a newer variant using AI feedback.

    1. Pre-training: learning from text
    2. From completer to assistant: fine-tuning and RLHF
    3. Replacing human feedback with AI feedback
    4. Recap

Made from these videos

More courses