In-context learning
In-context learning is a model’s adaptation of its behavior to examples, instructions, or other information in its input context without updating its parameters.
LLM Customization and Fine-Tuning
A technique in which a model uses examples and instructions in its prompt to perform a task without updating its weights.
- How it is used
- Provides a low-overhead baseline for adapting model behavior before committing to training.
- How deep it goes
- Explains prompt design, held-out evaluation, cost tradeoffs, and escalation criteria, with a worked ticket-classification workflow.
- Examples
- Uses eight labeled examples and 100 held-out tickets to evaluate a twelve-category help-desk classifier.
- What you can do after
- Build a few-shot classifier and evaluate whether its accuracy and operating cost justify deployment or further adaptation.
Read how LLM Customization and Fine-Tuning explains in-context learning →
Retrieval Augmented Generation, The Foundational Ideas
In-context learning is a model adaptation method in which a model learns from information provided in its prompt without modifying its internal weights.
- How it is used
- Uses prompt-provided information to connect a general generator with changing or specialized knowledge.
- How deep it goes
- Defines prompt-based adaptation and demonstrates concatenation, while stopping short of changing model weights or detailing training internals.
- Examples
- Uses a BART generator that concatenates a retrieved passage with a question before generation.
- What you can do after
- Apply it via retrieval-augmented generation by updating retrieved corpus content without retraining the generator.
Read how Retrieval Augmented Generation, The Foundational Ideas explains in-context learning →
Deep Learning with R, Third Edition
In-context learning is the adaptation of a model's output behavior from examples or instructions supplied within the current input context without parameter updates.
- How it is used
- Frames prompt-based behavior as apparent adaptation and tests whether it reflects memorization or genuine generalization.
- How deep it goes
- Contrasts memorized vector-function retrieval with new-skill acquisition and stops short of explaining model internals.
- Examples
- Uses leopard-print sofas, novel puzzles, prompt rewording, and large-integer addition to expose familiarity-dependent behavior.
- What you can do after
- Evaluate/understand whether prompt-based success reflects memorization, interpolation, or adaptation to genuinely novel tasks.
Read how Deep Learning with R, Third Edition explains in-context learning →
Also covered in
- Prompt Engineering in Practice
- Machines that ThinkIn early access (MEAP)
- The Art of AI Product Development
- Timeless Algorithms, The Foundational IdeasIn early access (MEAP)
What to know first
- language modelA language model is a computational model that represents patterns in linguistic sequences to assign probabilities, predict, generate, or evaluate language.
- promptA prompt is text or other input supplied to an AI model to provide instructions, context, or other information that guides its response or generated output.
- accuracyAccuracy is the degree to which a result agrees with a specified truth, reference, or criterion, commonly measured as the proportion of evaluated predictions that are correct.
- context windowA context window is a bounded span of sequence elements or contextual information that a model or processing operation can consider together.
Related concepts
- few-shot learningincludes · Few-shot learning is an approach in which a model is guided to perform or adapt to a task from only a small number of examples.
- retrieval-augmented generationincludes · Retrieval-augmented generation is a technique that retrieves relevant information from external sources and supplies it as context to a generative model when producing an output.
- self-distillation fine-tuningused by · A fine-tuning method in which a model conditioned on an expert demonstration trains the same model conditioned on the prompt alone.
- fine-tuningcontrasts with · Fine-tuning is the continued training of a pretrained model on targeted data or objectives to adapt its parameters or behavior to a task, domain, or use.
- promptuses · A prompt is text or other input supplied to an AI model to provide instructions, context, or other information that guides its response or generated output.
- demonstrationused by · A demonstration is an example, often pairing an input with an output, that illustrates a task or desired behavior for training or guiding a model.
Questions about in-context learning
What is in-context learning?
In-context learning is a model’s adaptation of its behavior to examples, instructions, or other information in its input context without updating its parameters.
Which Manning books explain in-context learning?
LLM Customization and Fine-Tuning, Retrieval Augmented Generation, The Foundational Ideas and Deep Learning with R, Third Edition.
What should I know before learning in-context learning?
Manning books that teach in-context learning usually introduce language model, prompt, accuracy and context window first.
What is the difference between in-context learning and fine-tuning?
In-context learning is a model’s adaptation of its behavior to examples, instructions, or other information in its input context without updating its parameters. Fine-tuning is the continued training of a pretrained model on targeted data or objectives to adapt its parameters or behavior to a task, domain, or use.
What kinds of in-context learning are there?
Kinds of in-context learning include few-shot learning and retrieval-augmented generation.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.


