CoursesAIMathCodePhysicsAbout and FAQ

TwiddleLab / Artificial Intelligence / How Language Models Work

From Autocomplete to Assistant

Lesson 10 of 12 · 7 min · Free, no account needed

What you will learn

  • A base model only continues documents. Asked a quiz question, it may write more quiz questions.
  • Fine-tuning on example dialogs teaches it to answer. Human feedback (votes on better answers) makes it more helpful.
  • A system prompt is a hidden instruction the app adds to every chat. The model reads it like any other text.

Start the lesson

How the lesson goes

  1. A raw model reads "What is the capital of France?" What comes next?

    Drag the line you think a raw language model writes next.

  2. Let the raw model write.

    Press Write.

  3. You are the rater. Pick the better answer, four times.

    Watch the model's bars for the France question after each vote.

  4. How a raw model becomes an assistant.

    Tap to reveal.

    The model after pretraining is a base model: it continues documents.

    Fine-tuning trains it more on example dialogs, so it learns to answer. Human feedback, votes on better answers, makes it more helpful and polite.

    On top, the app adds a system prompt: a hidden instruction at the start of every chat.

  5. Put the path in order: raw model to assistant.

    Drag the three stages onto the belt, then Check.

  6. This bot said "Ahoy!" Nobody asked for a pirate. Why?

    Tap words in the bot's reply to see where they look.

  7. Write the hidden instruction.

    Build an instruction from tiles so the bot meets all three goals. Test as often as you like, fewer tries is better.

  8. Your bot against another bot on the same model.

    Ask both bots the same questions. Ask at least two.

  9. Which stage gave the assistant each behaviour?

    Drag each behaviour onto a stage, then Check.

  10. A mystery: what happens when you hit Send?

    Press Send and watch.

Previous lesson: Why It Makes Things Up · Next lesson: What Happens When You Hit Send · Part of the course: How Language Models Work

Lessons are interactive and need JavaScript. Turn it on to play them.

Loading TwiddleLab