In-Context Learning (ICL)
YouTube ... Quora ...Google search ...Google News ...Bing News
- Perspective ... Context ... In-Context Learning (ICL) ... Transfer Learning ... Out-of-Distribution (OOD) Generalization
- Graph ... Spreadsheets ... Documents ... Slides ... Database; Vector & Relational ... Wiki
- Causation vs. Correlation ... Autocorrelation ...Convolution vs. Cross-Correlation (Autocorrelation) ... Signal Processing
- Artificial General Intelligence (AGI) to Singularity ... Curiosity ... Emergence ... Moonshots ... Explainable AI ... Automated Learning
- Artificial Intelligence (AI) ... Generative AI ... Machine Learning (ML) ... Deep Learning ... Neural Network ... Reinforcement ... AI Algorithms & Learning Methods Navigator
- Conversational AI ... ChatGPT | OpenAI ... Gemini | Google ... Claude | Anthropic ... Bing | Microsoft ... Siri | Apple ... Meta AI/Muse | Meta ... Perplexity ... Grok | SpaceXSI ... Manus ... Ernie | Baidu ... DeepSeek ... Qwen | Alibaba ... Mistral
- Large Language Model (LLM) ... Multimodal ... Native Multimodal Architectures ... Foundation Models (FM) ... Tabular Foundation Models (TabPFN) ... Time-Series Foundation Models (Chronos, TimesFM) ... Generative Pre-trained ... Transformer ... Attention ... GAN ... BERT ... Tokens
- Mixture-of-Experts (MoE) ... Reasoning Models & Test-Time Compute ... Chain of Thought (CoT) ... Tree of Thoughts (ToT) ... Theory of Mind (ToM)
- AI Algorithms & Learning Methods Navigator
- Few Shot Learning
- A Survey on In-context Learning | Q. Dong, L. Li, D. Dai, C. Zheng, Z. Wu, B. Chang, X. Sun, J. Xu, L. Li, Z. Sui - arXiv Cornell University
- Context-based learning | Wikipedia
- How does GPT do in-context learning? | Kushal Shah - Medium
- In Context | Daniel Bashir - The Gradient
- Think Like this and Answer Me: This AI Approach Uses Active Prompting to Guide Large Language Models | Ekrem Çetinkaya - MarketTechPost
- In-Context Learning Approaches in Large Language Models | Javaid Nabi - Towards Data Science - Medium ... Simple and powerful techniques to make LLMs learn new tasks at inference time
In-context learning (ICL) is a model's ability to adapt its behavior using examples or other task information supplied in its current context, without updating its learned weights during that inference. Show a Large Language Model (LLM) several support messages paired with the correct department, then give it a new message: it can infer the desired mapping and output format. This adaptation depends on the information actually available to the model. Saving a conversation or example library doesn't mean every future request automatically includes it.
ICL now extends beyond a handful of text examples. Long-context models can use hundreds of demonstrations; retrieval systems can select examples for each request; prompt optimizers can search for useful combinations of instructions and examples. Tabular foundation models also use labeled rows as context for predictions. These developments can reduce the effort needed to prototype a classifier, apply a house style, translate specialized material, or adapt an evaluator to human judgments. They don't remove the need to check accuracy, privacy, inference cost, and performance on unfamiliar cases.
The practical question is what the examples teach and whether that lesson transfers to new inputs. A model might follow a formatting pattern without learning the intended rule, copy a flawed label, or miss an exception. More context isn't automatically better. Start with a clear task, representative demonstrations, and a separate test set; compare the results with simpler prompting and other approaches before adding complexity. Stanford's framework for understanding ICL Many-Shot In-Context Learning, NeurIPS 2024
Reviewed 23 November 2026. Research results describe their tested models and tasks; product capabilities, limits, and licensing can change.
ICL in Practice
A shot is a demonstration, usually an input paired with its desired output. Zero-shot prompting gives the task without demonstrations; one-shot provides one; few-shot provides several; many-shot supplies a larger collection. These terms don't define universal numerical thresholds. In broader research, ICL can also refer to adaptation from task histories or unlabeled context.
“Password reset fails” → Access
“I need some help” → Review
The demonstrations specify a local convention. They don't grant access to a billing system or authorize the model to change an account. For a new request, an application must supply the relevant examples again or otherwise make them available in context. A persistent example store, retrieval mechanism, and the model's use of retrieved examples are different parts of the system.
A simpler sky example illustrates the same idea: “bird → true; plane → true; car → false; truck → false; train → ?” under a stated sky-related rule. Its expected answer is false, but the categories depend on the chosen convention. Toy examples show the mechanism; they don't establish robust real-world understanding.
Recent Advances
From Few-Shot to Many-Shot Learning
The 2024 Google DeepMind study examined hundreds or thousands of demonstrations across tasks including mathematics, question answering, translation, and classification. It reported gains over few-shot prompting and explored model-generated rationales and unlabeled domain inputs. The implication is that a prompt can carry a substantial task-specific dataset. It isn't evidence that a full context window always helps, or that ICL replaces fine-tuning for every workload. Many-Shot In-Context Learning
2026: Selection and Ordering Depend on the Task
An IJCNLP-AACL 2026 study examined English translation into ten low-resource languages. In its experiments, 50 examples selected with BM25 retrieval roughly matched 250 many-shot examples, and 250 retrieved examples approached 1,000. Ordering had little effect in that setting. This suggests a way to lower context cost: retrieve informative translation pairs rather than append a much larger undifferentiated collection. These ratios are study results, not universal settings. Lu and colleagues, many-shot translation study
By contrast, an ICML 2026 study of many-shot reasoning demonstrations found value in arranging understandable examples into a conceptual progression. Its Curvilinear Demonstration Selection method improved one math task by up to 5.42 percentage points with 64 demonstrations. Taken together, the studies support testing selection and order for the actual task rather than applying one ordering rule everywhere. Reasoning demonstrations can be worked solutions written for teaching; they needn't be a model's private internal reasoning. Chung and colleagues, Many-Shot CoT-ICL
2026: Generating Demonstrations and Optimizing Prompts
A Findings of ACL 2026 paper studies a semi-supervised pipeline that generates annotations, selects demonstrations, and performs in-context inference. Its IterPSD method uses iterative refinement and curriculum pseudo-labeling, with improvements on the paper's classification tasks. This could reduce manual annotation work, but generated labels can reproduce model errors. For an application, review a sample of labels and evaluate on independent human-checked cases before treating a larger generated library as an improvement. Gu and colleagues, self-generated demonstrations
Prompt optimization makes this selection process operational. DSPy's MIPROv2 searches combinations of instructions and few-shot demonstrations against an evaluation metric. It optimizes the program's prompts rather than fine-tuning model weights. The work still consumes model calls and depends on the quality of the metric and development examples. Keep final test cases outside that search. DSPy MIPROv2 documentation
Current Tools and Applications
These are different kinds of tools: a model interface, a prompt optimizer, an evaluation platform, and a specialized prediction model. Some are established tools with current capabilities; the 2026 research and TabPFN releases add newer methods and application scope.
| Tool or application | How it uses examples | Practical impact and limits |
|---|---|---|
| Gemini and Google AI Studio | Supply input-output demonstrations to establish labels, style, or formatting; experiment with prompts through AI Studio. | Useful for prototypes such as message routing and structured extraction. Consistent formatting helps, but examples aren't a schema validator. Use supported structured-output controls for complex JSON requirements and validate meaning separately. |
| DSPy MIPROv2 | Proposes instructions and bootstraps candidate demonstrations, then searches combinations using an evaluation metric. | Useful when a repeatable task has development data and a measurable goal. Optimization costs and a weak metric can erase the benefit; use an untouched test set. |
| LangSmith few-shot evaluators | Inserts examples of human-corrected scores and explanations into an LLM evaluator's prompt. | Helps align automated scoring with reviewer judgments. This is prompt-based calibration, not proof that the judge is correct. Current documentation limits the feature to compatible mustache prompts and run-level evaluators; it excludes thread-level and decision-model evaluators. |
| Prior Labs TabPFN-3.5 family | Uses a pretrained tabular foundation model to make classification or regression predictions from labeled example rows. It's a specialized model rather than a chat prompt template. | Useful for evaluating predictions on structured business or scientific data with less task-specific training work. Compare against strong tabular baselines and use time- or group-aware test splits where appropriate. The September 2026 release includes an alpha Fast variant; check the particular checkpoint's limits. |
New Tabular Applications Beyond Chat
Prior Labs' 4 November 2026 update makes TabPFN-3.5-Thinking available through its API with support for one million fitting rows, and describes image-plus-table and zero-inflated-target extensions. These are provider-reported capabilities. They broaden the kinds of prediction workflows that can use the ecosystem, such as demand estimates with many zero-sales observations or records accompanied by product images. They don't mean every variant has the same capacity or that a model result is ready for an operational decision. Prior Labs November update
TabPFN's software and weights have separate licenses. The current repository identifies non-commercial licenses for 3.5 and several other recent weight releases, with commercial production arrangements offered separately. Choose the deployment and license before building a production dependency. TabPFN repository and licensing
Where ICL Changes Everyday Work
The following are application designs, not claims that a particular product has passed an independent benchmark.
| Application | Demonstrations to provide | Benefit to test |
|---|---|---|
| Customer support routing | Reviewed messages paired with destination labels, plus ambiguity examples. | Faster introduction of a new local taxonomy; measure routing accuracy and inappropriate escalation. |
| Document and spreadsheet extraction | Representative source fragments paired with approved fields and missing-value conventions. | Less manual formatting work; measure field accuracy, invented values, and schema compliance separately. |
| Editorial or game-rule house style | Approved before-and-after passages that preserve meaning while changing wording. | More consistent drafts; check that examples don't introduce rules or facts absent from the new input. |
| Specialized translation | Approved source-target pairs retrieved for the current domain. | Better terminology consistency; use qualified review for important material and check out-of-domain text. |
| AI quality review | Outputs paired with human scores and explanations of the rubric. | More consistent automated triage; audit disagreements and keep human review for consequential judgments. |
Design and Evaluation
Begin with a zero-shot baseline so you can tell whether demonstrations help. Write the labels, output format, and handling of insufficient information explicitly. Select accurate examples that cover real variation and difficult boundaries, not just easy cases. Keep input and output delimiters consistent. With an API service, you don't need a powerful local computer to try ICL; local inference hardware needs depend on the chosen model and context size.
| Check | What to measure or inspect |
|---|---|
| Correctness and coverage | Accuracy or task-specific quality, including rare labels and cases that require abstaining or review. |
| Sensitivity | Change example order, remove an example, and vary input wording. Look for brittle decisions and unintended copying. |
| Leakage | Separate source documents, people, groups, or time periods where shared information would make the test unrealistically easy. |
| Total cost | Input and output tokens, latency, retrieval work, repeated optimization calls, and human maintenance effort. |
| Evidence and freshness | Track example provenance, approval status, and version. Remove or supersede outdated examples deliberately. |
| Trust boundary | Treat retrieved documents and quoted messages as data. They mustn't silently acquire authority to change instructions or authorize tool actions. |
Long Context, Caching, and Persistence
Context engineering chooses which instructions, tool outputs, documents, and history reach the model. ICL describes how the model adapts from that supplied material. A larger advertised window doesn't guarantee equal use of every example: irrelevant or conflicting context can hurt reliability. Anthropic's September 2025 engineering guidance emphasizes selective, maintained context for agents. Effective context engineering for AI agents
Caching can reduce the cost of processing reused prompt content. Gemini's current API documentation describes automatic savings when requests hit an implicit cache; support and controls depend on the model and API. A cache hit doesn't train the model, guarantee better answers, or turn a prompt into durable semantic memory. Measure actual cache usage and costs rather than assuming every repeated request receives the same saving. Gemini context caching
Repeated demonstrations can also steer behavior in unwanted directions. Anthropic's 2024 many-shot jailbreaking research showed that long collections of malicious demonstrations could undermine safeguards in the models tested. That historical result isn't a current attack-success rate for every model. It is a reason to review the source and authority of examples, test contaminated retrieval, and enforce tool permissions outside the prompt. Many-shot jailbreaking research
Why is ICL exciting?
- How In-Context Learning Emerges | Jacky Liang - Last Week in AI ... LLMs have been able to do something more powerful: learn new tasks and skills simply from new examples in the input, without any gradient updates or changes to the pretrained model.
ICL lets users demonstrate a local convention without running a separate weight-training job. That can shorten prototyping and make task changes easier to inspect: change the example library, rerun the evaluation, and compare versions. The benefits depend on representative demonstrations and reliable evaluation. Repeated long prompts can still be expensive, and performance may drop when the task distribution changes.
Mystery: Why does ICL work so well?
There isn't one universally accepted explanation for every form of ICL. Stanford's 2022 account interprets it as implicit Bayesian inference: examples help a model infer which latent task or concept is intended. Inputs, labels, formatting, and their relationships can all contribute. This helps explain why apparent success doesn't always mean the model learned a new input-output rule. Xie and Min, understanding ICL
Other research studies learning-algorithm-like behavior in transformers. Calling a computation “implicit fine-tuning” is an analogy or theoretical interpretation, not evidence that ordinary ICL changes stored model weights. What a model infers depends on its pretraining, architecture, task, and supplied context. The 2026 reasoning and translation findings above illustrate why the explanation and practical recipe need to be tested for the setting.
The animation and videos below provide background on the earlier research. Read model-specific comparisons as historical material rather than current product rankings.
Larger Language Models do In-Context Learning Differently - Overview
Overview of research showing larger language models do in-context learning differently.
In-context Learning - A New Paradigm in NLP?
Asks whether in-context learning is a new paradigm in NLP.
Stanford CS25: V1 I Transformer Circuits, Induction Heads, In-Context Learning
Stanford CS25 lecture on transformer circuits, induction heads and in-context learning.
Fine-tune ChatGPT w/ in-context learning ICL - Chain of Thought, AMA, reasoning & acting: ReAct
Discover AI on improving ChatGPT with in-context learning techniques like chain of thought and ReAct.
A Walkthrough of In-Context Learning and Induction Heads Part 1 of 2 (w/ Charles Frye)
Neel Nanda and Charles Frye walk through in-context learning and induction heads, part 1.
PR-418: What learning algorithm is in-context learning? Investigations with linear models
Paper review asking what learning algorithm in-context learning implements, using linear models.
Pretraining vs Fine-tuning vs In-context Learning (ICL) of LLM
YouTube ... Quora ...Google search ...Google News ...Bing News
| Method | Description |
|---|---|
| Pretraining | ... training a model on a large dataset to learn general language patterns. This is usually done using an unsupervised or self-supervised objective such as predicting the next word in a sequence. |
| Fine-tuning | ... taking a pretrained model and further training it on a smaller dataset specific to a particular task. This allows the model to adapt to the specific task while still leveraging the general language patterns learned during pretraining. |
| In-context learning (ICL) | ... uses a pretrained model to predict from supplied examples or task histories without inference-time updates to its weights. Demonstrations may be few-shot or many-shot, and adaptation depends on what remains available in context. |
Pretraining vs Fine-tuning vs In-context Learning of LLM (GPT-x) EXPLAINED | Ultimate Guide ($)
Discover AI explains pretraining versus fine-tuning versus in-context learning.
In-context Reinforcement Learning
YouTube ... Quora ...Google search ...Google News ...Bing News
- Artificial Intelligence (AI) ... Generative AI ... Machine Learning (ML) ... Deep Learning ... Neural Network ... Reinforcement ... AI Algorithms & Learning Methods Navigator
- Agents/Assistants ... Personal Companions ... Team AI ... Customer-Facing AI ... Negotiation ... Productivity ... Email ... Web Automation ... Computer Use ... Model Context Protocol (MCP) ... Robotic Process Automation (RPA) ... LangChain
- In-context Reinforcement Learning with Algorithm Distillation | M. Laskin, L. Wang, J. Oh, E. Parisotto, S. Spencer, R. Steigerwald, DJ Strouse, S. Hansen, A. Filos, E. Brooks, M. Gazeau, H. Sahni, S. Singh, V. Mnih - arXiv - Cornell University
Algorithm Distillation is a research example of in-context reinforcement learning. A causal transformer is trained on learning histories generated by a source reinforcement-learning algorithm. At inference, it conditions actions on preceding history and can improve its policy across episodes without updating network parameters. Training the transformer is still a separate weight-learning stage. This isn't a claim that any general chatbot automatically learns an effective RL policy merely by reading a reward log. Laskin and colleagues, Algorithm Distillation, 2022
For agent applications, the relevant design question is whether feedback histories actually improve later actions on held-out tasks. Storing a successful run, replaying a recipe, and adapting a policy from rewards are different capabilities. Validate the claimed learning behavior before granting more autonomous actions.
Misha Laskin, In-context Reinforcement Learning, 22.February.2023
Misha Laskin on in-context reinforcement learning.
Amy Zhang - Exploring Context for Better Generalization in Reinforcement Learning @ UCL DARK
Amy Zhang on using context for better generalization in reinforcement learning.