Skip to content
all lessons
Operating & Scaling4.13Locked

In-context learning: teaching without training

You need the model to tag reviews as 1–5 stars in your exact format, but you can't retrain it. Are you stuck with its defaults?

The idea inside

Put a few examples or a rule in the prompt and behavior changes.

After this lesson

You can explain in-context learning: examples or instructions in the prompt steer behavior without changing weights, and why that powers RAG, tools, and system prompts.

Where it leads

That's the last operating lever. Now run them all at once: one model, three very different budgets.

Inside this lesson

That's the real lesson stage, paused. Claim your pass to operate it.

See how AI actually works, end to end.

This lesson is one stop on the full arc. Unlock all of it, and keep it for life.

What you get

  • The 34-lesson main path, a finishable route from a word to agents
  • Goal tracks for using AI at work and building AI features
  • Boss labs that make you apply a whole act, not just recognize it
  • Spaced recall that brings each idea back before you forget
  • Course memory: every term defined, with links to where it first appears
  • A shareable capability card when you finish the main path
  • Lifetime access on every device, every future lesson included

Not videos to watch. You predict, operate the machine, then prove it. That is why it stays.

99 interactive lessons and challenges. No videos, no code.

Free launch pass: lifetime access, no card needed

New here? The first lessons are free to try. Start with lesson 0.1

What this lesson shows

Put a few examples or a rule in the prompt and behavior changes.

The question it opens with

You need the model to tag reviews as 1–5 stars in your exact format, but you can't retrain it. Are you stuck with its defaults?

The walkthrough, in the lesson's own words

  • Each example you drag in pulls the output closer to your format.
  • Drag worked examples into the prompt and watch the output snap to your format.
  • With zero examples it can only guess. The examples in the prompt are what fix the shape.
  • Same trick powers system prompts, RAG, and tools.
  • 0 = zero-shot · 1–3 = few-shot. Each example shows the format you want.
  • You can't retrain the model. Your only tool is the text you send it: the prompt.
  • It never saw “your house format”, so with nothing to copy it picks a reasonable shape of its own. To get YOUR shape, you have to show it, in the prompt.
  • Put the persona and rules in context, no retraining.
  • Retrieve the right snippet and drop it in context (5.2).
  • Describe the tools in context so the model can call them.
  • This is in-context learning: the weights never changed, the model just read your examples fresh and pattern-matched the format.
  • Close the chat and it remembers nothing, and everything you teach this way must fit in the context window.
  • Nothing was trained: the weights never changed. The model just read your examples fresh and pattern-matched the format and task from the context, exactly what its instruction-following from 2.6 lets it do.
  • Few-shot is pattern-matching from the prompt, not real learning, close the chat and it remembers nothing. And the prompt has limits: everything you teach this way must fit inside the context window.
  • Your chatbot keeps formatting replies wrong, so you paste two or three correct examples into the prompt and it instantly copies the style, with no retraining. What just happened?
  • That is in-context learning: the model read your examples fresh and pattern-matched the format from the prompt, the weights never changed. So it is free and instant, but it only lasts within that context window and is forgotten when the chat ends.

Key takeaway

A few examples in the prompt taught the model a brand-new task, with zero training.

What you can do after this lesson

You can explain in-context learning: examples or instructions in the prompt steer behavior without changing weights, and why that powers RAG, tools, and system prompts.

Check yourself: You add two examples to your prompt and the model follows the format. Did it learn (change its weights)?
  • No, it only changes behavior for this prompt; the weights never change(correct)
  • Yes, the examples permanently retrained it
  • Only if you add ten or more examples
  • Only the temperature changed

In-context learning is not training. The examples steer the prediction for that one prompt only; nothing about the model is saved. Start a fresh chat and it's forgotten.

Prefer reading first? This lesson has a companion explainer: In-context learning

Where it leads: That's the last operating lever. Now run them all at once: one model, three very different budgets.

This is the written summary. The lesson itself is interactive: you predict, drag and operate the mechanism above, and the reveal answers you.