Few-shot learning is the art of giving a model a tiny cheat sheet instead of a mountain of labeled data. Supply a few task-specific examples or demonstrations, then ask for a new result in the same pattern. The examples condition the model on the task, format, or style so it can adapt quickly to unseen inputs. section 9.6 section 10.12
In prompt work, those examples can be placed directly before the request. This differs from zero-shot prompting, where instructions alone guide a pretrained model. Few-shot approaches are useful when labels are scarce, expensive, or slow to obtain, but outputs still need verification rather than blind trust. section 6.15 section 6.9
A practical few-shot prompt usually includes:
- A clear task and desired output format. section 9.6
- A small set of representative input-output examples. section 9.6
- A new input that follows the demonstrated pattern. section 6.9
- A check of the result, especially when the task depends on factual accuracy. section 6.15
Teach translation by example
Give the model paired English and French sentences, then present a new English sentence with its French translation left blank. The earlier pairs demonstrate the mapping and expected response format, making the final request a small pattern-completion task rather than a vague “please translate this” gamble. section 6.9
Summarize a new article
Provide several articles alongside their summaries, then add another article and request a summary. The demonstrations show what counts as a summary for the task and help the model adapt without extensive fine-tuning. section 9.6
|
|
English sentence: “I love to travel.” French translation: “J’adore voyager.” English sentence: “The cat is sleeping.” French translation: “Le chat dort.” English sentence: “Where is the nearest train station?” French translation: “Où se trouve la gare la plus proche?” |
Browse the paired translation examples to see how demonstrations establish both the task and the output pattern before a new request. section 6.9

















