Overview
Direct Answer
In-context learning is the ability of large language models to adapt behaviour and perform new tasks by conditioning on examples or instructions embedded directly in the input prompt, without modifying the model's underlying parameters. This represents a fundamental departure from traditional machine learning approaches that require retraining or fine-tuning.
How It Works
When relevant examples, instructions, or few-shot demonstrations are provided at the beginning of a prompt, transformer-based models leverage their attention mechanisms to recognise patterns and apply implicit learning directly during inference. The model's internal representations shift to accommodate the new task context, with later token predictions influenced by earlier contextual information through learned attention weights.
Why It Matters
This capability dramatically reduces deployment friction and cost by eliminating the need for task-specific fine-tuning cycles, which require labelled data, computational resources, and model versioning overhead. Organisations can iterate rapidly on use cases, adapt to domain shifts, and deploy generalised models across diverse applications without retraining.
Common Applications
Practical applications include zero-shot and few-shot classification in customer support (routing queries by providing category examples), legal document analysis where domain-specific terminology is demonstrated in-prompt, and cross-lingual translation tasks where bilingual examples guide behaviour. Content moderation systems and domain-specific question-answering similarly rely on contextual demonstration.
Key Considerations
Performance remains sensitive to example selection, ordering, and prompt formulation; there is no guarantee of task mastery regardless of in-prompt guidance. Context window length constraints and potential brittleness with complex reasoning tasks necessitate careful validation before production deployment.
Referenced By2 terms mention In-Context Learning
Other entries in the wiki whose definition references In-Context Learning — useful for understanding how this concept connects across Artificial Intelligence and adjacent domains.
More in Artificial Intelligence
Sparse Attention
Models & ArchitectureAn attention mechanism that selectively computes relationships between a subset of input tokens rather than all pairs, reducing quadratic complexity in transformer models.
Model Distillation
Models & ArchitectureA technique where a smaller, simpler model is trained to replicate the behaviour of a larger, more complex model.
Confusion Matrix
Evaluation & MetricsA table used to evaluate classification model performance by comparing predicted classifications against actual classifications.
Model Merging
Training & InferenceTechniques for combining the weights and capabilities of multiple fine-tuned models into a single model without additional training, creating versatile multi-capability systems.
AI Red Teaming
Safety & GovernanceThe systematic adversarial testing of AI systems to identify vulnerabilities, failure modes, harmful outputs, and safety risks before deployment.
AI Tokenomics
Infrastructure & OperationsThe economic model governing the pricing and allocation of computational resources for AI inference, including per-token billing, rate limiting, and credit systems.
AI Training
Training & InferenceThe process of teaching an AI model to recognise patterns by exposing it to large datasets and adjusting its parameters.
Edge AI
Foundations & TheoryArtificial intelligence algorithms processed locally on edge devices rather than in centralised cloud data centres.