शब्दकोश · AI और डेटा

Few-Shot Prompting

Few-shot prompting puts a handful of worked input and output examples in the prompt so a language model can infer the task and format without retraining.

अपडेट: अक्टूबर 6, 2026

Few-shot prompting is a technique where you include a small number of example input and output pairs in the prompt, then add the real input. The model infers the pattern from the examples and applies it, with no change to its weights.

Why it matters

Examples communicate format, tone and edge-case handling more reliably than a long description. Few-shot prompts often improve consistency on classification, extraction and style-matching tasks, and they are far cheaper than fine-tuning. The cost is tokens: every example is sent on every request and occupies part of the context window.

Example

Classify the sentiment as positive, negative or neutral.

Text: "Setup took five minutes." -> positive
Text: "The dashboard keeps timing out." -> negative
Text: "The report is attached." -> neutral

Text: "Alerts arrived late again." ->

The model should answer "negative", copying the label style it saw.

Common mistakes

  • Using examples that are all one class, which biases the model toward that label.
  • Including inconsistent or mislabelled examples. The model copies mistakes faithfully.
  • Adding many examples when two or three diverse ones would do, wasting context and money.

Get notified when this term updates

Plus occasional practical tips on uptime and monitoring, nothing else. Unsubscribe anytime.

यह पेज सामान्य जानकारी है, जिसे हमारी संपादकीय टीम ने लिखा है और दस्तावेज़ीकरण बदलने पर अपडेट किया जाता है। सर्वर और प्रदाता अलग-अलग होते हैं, इसलिए बदलाव पहले सुरक्षित तरीके से जाँचें। देखें: संपादकीय नीति और अस्वीकरण.