What is few-shot prompting? Demonstrating a task without training the model
Understand few-shot prompting through message classification, including differences from fine-tuning, example coverage, consistent labels, and evaluation separation.
Understand the concept
Few-shot prompting supplies a small number of demonstrations in the current input before a new task instance, usually as input-answer pairs. It does not inherently update model parameters and differs from training on a small dataset. Examples can clarify formats but can also mislead; evaluate unseen inputs.
Demonstrate the decision rule, not just label names
For inquiry versus complaint classification, show messages and labels before a new message. If inquiries are always short and complaints long, the model may use length as a shortcut. Demonstrations should distinguish content without identical surface patterns.
Cover ambiguous messages, such as delivery inquiries expressing frustration. Define primary intent or an uncertain label to avoid contradictory examples. These illustrate design without real annotation or claimed accuracy.
Context examples differ from supervised fine-tuning
Few-shot demonstrations occupy request context; fine-tuning updates parameters and may remove the need to resend examples. Their cost paths differ. Using question-answer pairs does not make them the same training process.
The GPT-3 paper studies few-shot behavior without parameter updates, and Google provides example-design guidance. Findings depend on model and task, not a guarantee from three examples. Check format comprehension and context limits for the chosen model.
Hold out examples to distinguish learning from imitation
Evaluation instances should not already appear as demonstrations in that request. Include different phrasing and missing information, checking labels and explanations. Record revisions to avoid overfitting examples to a fixed evaluation set.
Zero-shot prompting can be simpler when demonstrations are unnecessary; persistent complex behavior may call for other adaptation. Choose from actual errors and runtime conditions. More examples consume capacity and should not be added without evidence of benefit.
Checked sources
These sources support the concepts and methods described here. Examples and test scope are labeled separately; check the version of the tools you use.