AI Model Wiki

    Skip to main content
    Back to Glossary

    Few Shot Prompting

    Few-shot prompting is an in-context learning technique in which a small number of worked examples — typically two to ten input-output pairs — are embedded directly in the prompt before the actual query. The model reads these demonstrations and infers the task format, tone, and output structure from them, then applies that pattern to the final question without any weight updates. The examples act as a transient specification of the task, not a training signal in the gradient sense.

    Think of it like briefing a new contractor by showing them three completed work orders before handing them a blank one. You are not formally training them; you are just making the expected format obvious enough that they can match it immediately.

    A concrete example for named-entity extraction: the prompt provides two labelled sentences and then asks about a third. The model sees the pattern of the bracketed labels and reproduces it for the unseen sentence. This is far faster than fine-tuning and requires no labelled dataset beyond the handful of examples in the prompt.

    Few-shot prompting sits within the broader field of Prompt Engineering and is closely related to Zero-Shot prompting (no examples given) and Chain of Thought prompting (examples that walk through intermediate reasoning steps). The technique exploits the pattern-matching capability developed during Pretraining rather than any task-specific Fine-tuning.

    You will encounter few-shot prompting any time you need to control output format precisely — structured JSON extraction, consistent classification labels, stylistic tone matching — without the cost and latency of a full fine-tuning run. It is a standard first tool when adapting a general LLM to a business-specific task during prototyping.

    AI Terminology
    Glossary