Learning Paradigms

Few-shot Prompting

In shortShowing a language model a handful of worked examples inside the prompt so it copies the pattern, format or labels you want, without retraining.

Updated 24 Oct 2026· 2 min read

Few-shot prompting means including a small number of examples of the task, each with its input and the correct output, in your prompt to a large language model. The model infers the pattern from those examples and applies it to new input. With no examples it is called zero-shot; with one, one-shot.

How it works

The 2020 GPT-3 paper, “Language Models are Few-Shot Learners”, showed that large models can pick up a task from a few demonstrations in the prompt, with no change to their weights. This is sometimes called in-context learning. The examples teach format, label set, tone and edge cases far more precisely than a description alone. Good examples are varied, cover the tricky cases, and are clearly separated from the instructions, for instance with tags or headings.

Few-shot prompting sits between zero-shot approaches and fine-tuning, which changes the model itself using many labelled examples.

How it’s used in SEO and marketing

  • Classifying keywords by intent or category: show five labelled keywords, then ask for labels on the rest.
  • Extracting entities or attributes in a fixed JSON format.
  • Writing titles or meta descriptions in a house style, using strong existing examples.
  • Sentiment or topic labelling of reviews, where examples clarify what “mixed” or “neutral” means for your brand.
  • Understanding AI search: a Google patent describes using few-shot prompting to generate synthetic query-document pairs for training retrieval models.

Example

MLforSEO’s Semantic ML-enabled Keyword Research course covers patent WO2024064249A1, Systems and Methods for Prompt-Based Query Generation. It describes giving an LLM a few example query-document pairs and asking it to generate diverse queries for new documents. Those synthetic queries then train a retrieval model, one reason your pages may be matched to queries no user has typed yet.

Limitations and things to watch

  • Models can over-copy examples, repeating their wording or favouring the label that appears most. Balance and vary your examples.
  • Examples use up tokens, adding cost on every call.
  • MLforSEO’s comparison of NLP APIs found that zero-, one- or few-shot prompting improves generative AI on sentiment, but results stayed questionable compared with a purpose-built API.
  • Test on a labelled sample before running at scale; few-shot is not a substitute for evaluation.

Learn it on MLforSEO

Where Few-shot Prompting shows up on MLforSEO

Sources and further reading

Other terms from Learning Paradigms