In-Context Learning
12 frameworks — Few-shot, zero-shot, and example-selection methods that teach AI by demonstration.
Overview
In-context learning methods teach AI by demonstration — using zero, one, or multiple examples within the prompt itself. These foundational techniques leverage the model’s ability to recognize patterns from examples and generalize to new inputs.
Use in-context learning when you need the AI to match a specific format, style, or reasoning pattern. From zero-shot instructions to sophisticated example selection algorithms, these techniques give you fine-grained control over AI behavior without any model training.
In-Context Learning 12
Few-Shot Learning
2020Provide examples to guide AI output format and reasoning patterns.
Still active techniqueZero-Shot
2021Direct task instruction without examples, relying on model knowledge.
Still active techniqueOne-Shot
2020Single example to establish output pattern and expectations.
Still active techniqueExample Selection
2022Choose the most informative demonstrations for the task at hand.
Still active techniqueKNN Prompting
2022Select examples nearest to the query in embedding space.
Still active techniqueVote-k
2022Iteratively select unlabeled examples via model confidence voting.
Still active techniqueDemo Ensembling
2023Combine results from multiple demonstration sets for robustness.
Still active techniquePrompt Mining
2022Discover optimal prompt templates through systematic search.
Still active techniqueMany-Shot
2024Provide hundreds to thousands of demonstrations using extended context windows.
Still active techniqueExample Ordering
2022Optimize the sequence of few-shot examples to maximize performance.
Still active techniqueSelf-Generated ICL
2022Have the model generate its own demonstrations before tackling the task.
Still active techniqueActive Example Selection
2023Dynamically choose demonstrations based on model uncertainty per query.
Still active techniqueTechnique Comparison
Side-by-side comparison of all 12 frameworks in this category.
| Technique | Year | Best For | Key Strength | Complexity |
|---|---|---|---|---|
| Few-Shot Learning | 2020 | Pattern matching | Example-driven | Low |
| Zero-Shot | 2021 | Direct tasks | No examples needed | Very Low |
| One-Shot | 2020 | Quick patterns | Single example | Very Low |
| Shot Prompting | 2020 | Example strategy | Selection & ordering | Low |
| Example Selection | 2022 | Optimal demos | Informative examples | Medium |
| KNN Prompting | 2022 | Similar examples | Embedding proximity | High |
| Vote-k | 2022 | Annotation | Confidence voting | High |
| Demo Ensembling | 2023 | Robust results | Multiple demo sets | Medium |
| Prompt Mining | 2022 | Template discovery | Systematic search | High |
| Many-Shot | 2024 | Complex patterns | Volume of examples | Low |
| Example Ordering | 2022 | Consistency | Sequence optimization | Medium |
| Self-Generated ICL | 2022 | Cold start tasks | No labeled data needed | Low |
| Active Example Selection | 2023 | Diverse queries | Query-aware selection | High |
Related Categories
Explore other framework categories that complement In-Context Learning.
Start with Few-Shot Learning
Few-Shot Learning is the most widely used in-context learning technique — provide a few examples, and the AI matches your format and reasoning pattern. It is the foundation for all example-based prompting.