What is in-context learning?

Definition

In-context learning changes a model's behavior by placing demonstrations, instructions, or other task evidence in the input. The model uses that temporary context during inference without updating its trained weights.

The approach enables rapid adaptation, but performance depends on example quality, context interpretation, and similarity to the new task. The learned behavior normally lasts only while the relevant context remains available.

ELI5

In-context learning lets an AI model infer how to do a task from instructions or examples placed in the current input. The model adapts its response without changing its trained weights.

For example, showing three correctly formatted records can help the model produce a fourth in the same format. The temporary behavior usually lasts only while those examples remain in the available context, and poor examples can teach the wrong pattern.

Frequently asked questions

Does in-context learning change model weights?

No. It adapts behavior through the current input context rather than updating the stored parameters through training.

What can serve as an in-context example?

Examples can include text demonstrations, solved problems, code, images, video, actions, or other representations the model supports.

Videos explaining in-context learning