In-Context Learning

12 frameworks, Few-shot, zero-shot, and example-selection methods that teach AI by demonstration.

*These are learning tools, not prompts. They teach you to write your own, think of them as training wheels that guide you while you learn, then fall away once you can ride on your own.

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.

Technique 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