ToolNavs Find Useful AI Tools
Submit Sign in
Back to AI Encyclopedia
What Is In-Context Learning? Without Changing Parameters, a Model Learns on the Spot from Examples

What Is In-Context Learning? Without Changing Parameters, a Model Learns on the Spot from Examples

AI Encyclopedia • Admin • • 12 views

In-context learning is the ability of a large model to complete a new task from a few examples in the prompt, without updating its parameters. The model is not retrained and does not remember the examples permanently. It treats them as temporary references in the current conversation, infers the format, style, and criteria of the task, and applies them to new input. Clear examples lead to more accurate results; vague examples lead to vague results.

A Concrete Example

Suppose you want a model to sort user messages into inquiries, complaints, and compliments. You do not need to retrain it. Give one or two labelled messages for each category in the prompt, then add an unlabelled message. The model follows the labelling pattern in the examples. Change the examples or the criteria, and the same model may give a very different result, which shows it is following the examples rather than applying a fixed rule.

How It Differs from Fine-Tuning and RAG

Fine-tuning really updates model parameters with training data. The change persists and suits long-term, stable tasks, but it needs data, computing power, and time. RAG first retrieves relevant material from an external knowledge base and then lets the model answer from that material, so the answer mainly rests on the retrieved content. In-context learning neither changes parameters nor searches external sources; its only evidence is the examples in the prompt. It is the lightest and fastest option, and also the easiest to mislead through wording.

Three Common Misconceptions

  • Giving examples is not training. Examples work only in the current conversation. In a new conversation they are gone, and the model does not retain your data long-term.
  • More examples are not always better. Number, order, and wording all matter. Contradictory examples, examples placed last, and vaguely worded examples can all steer the model off course.
  • A longer context does not mean firmer memory. The more content in the prompt, the easier it is for key information to be diluted, and the model may pay more attention to later content. Keep important examples and requirements concise and prominent instead of piling them up.

When It Works Well, and When Not to Rely on It

Tasks with a fixed format and criteria that examples can make clear suit in-context learning well, such as classification, rewriting, and extracting information with a fixed template. Tasks needing precise expertise, long-term memory of preferences, or criteria that examples cannot clarify should not rely on a few examples. Fine-tuning, retrieving external material, or writing the rules explicitly is more suitable then. The test is simple: if changing a few examples changes the result greatly, the task is still at the stage of guessing meaning from examples and needs a more definite basis.

Recommended Tools

More