How does few-shot learning work?
The idea came to prominence with the 2020 paper that introduced GPT-3, "Language Models are Few-Shot Learners". In this setting the model receives a few demonstrations of the task at inference time and no weight updates are made [1]. The authors typically used between 10 and 100 examples, capped by how many fit into the model's 2048-token context window [1].
The paper's headline finding was that larger models did markedly better with these demonstrations, in some tasks approaching fine-tuned systems [1].
A concrete case: you want customer reviews tagged "positive" or "negative". The prompt opens with three labelled reviews, then adds a new unlabelled one. The model follows the pattern in the examples and labels the new review.
How many examples should you include?
With today's chat models the number is much smaller. Anthropic's prompting guide says a few well-crafted examples, which it calls few-shot or multishot prompting, improve accuracy and consistency, and it recommends 3 to 5 for best results [2]. The guide asks for examples that mirror the real use case, vary enough to cover edge cases, and sit inside tags so the model can tell them apart from the instructions [2].
What is it often confused with?
Few-shot learning is often confused with fine-tuning. Fine-tuning retrains the model on extra data and changes its weights. In few-shot learning the examples live only in that one request and the model itself is unchanged [1]. Leave the examples out of the next request and the model has no memory of them.