L

Learn AI

Track progress · learn offline

Open

Lesson 7 of 7

Learning on the fly

8 min read

The model you've been taking apart is, at heart, a next-word predictor with fixed, frozen parameters. Training is over; nothing inside it changes when you use it. And yet you can teach it a brand-new task in a single message — with no retraining at all. How?

Just show it a few examples

The trick is almost too simple: put a couple of worked examples of the task right in your prompt. The model reads them, spots the pattern, and simply continues it for your new case — because continuing a pattern is exactly what a next-word predictor does. In the scene below the model faces a made-up task it's never seen. With no examples it can only shrug; feed it a couple and watch it get the rule.

Give the model the pattern and it finishes it — no training, no changed parameters, just a couple of examples added to what it's reading.

This is in-context learning

This is called in-context learning, or few-shot prompting — "few-shot" meaning you gave it a few examples (shots) to go on. Ask with no examples and that's zero-shot; add a handful and it's few-shot. It's the reason a prompt that shows what you want so often beats one that only describes it.

The examples don't retrain the model — they steer the one frozen model toward the pattern you want, and only for this message. Start a new chat and you'd show them again.

Why a mere predictor can do this

It can feel like magic that a "just predict the next word" machine learns tasks on the spot. But think back to lesson one: to predict text well across a huge slice of the internet, the model had to absorb an enormous library of patterns and mini-skills. Your examples don't teach it a skill from nothing — they point at one it already picked up in training and say "this one, please."

In-context learning isn't new knowledge appearing out of thin air — it's the model recognising which of its many trained-in patterns you're after, from the examples you show it.

Under the hood, those examples sit in the context window — the model's short-term working memory for the conversation. That's why the "lesson" is temporary: it lasts only as long as the examples stay in the window, and a fresh chat starts blank.

Where it shines — and where it stops

Because the whole "lesson" lives in the prompt, in-context learning has clear edges. It's brilliant for teaching a format or a style — a way to lay out an answer, a tone, an unusual pattern — from just two or three examples. But it can't pour in knowledge the model never learned: showing it examples won't teach it a fact it doesn't know, only how you'd like the answer shaped. And the effect is temporary — it lasts only while the examples stay in view. Start a fresh chat and the model is blank again, waiting to be shown.

In-context learning steers, it doesn't teach. A few examples are unbeatable for fixing the shape of an answer, but they can't add missing knowledge — and the moment the examples leave the prompt, the effect is gone.

Recap

You need an AI to format dates in a specific, unusual style, and you can't retrain it. What's the most reliable way to get it right?

Continue in the app

Take the whole How AI Really Works course — tracked

Get your personalized path, progress and streaks in the app — this lesson and every next one, in order.