wordfor

few-shot prompt·ing

/ˈfjuː ˌʃɑːt ˈprɑːmp.tɪŋ/ (FYOO shot PROMP-ting) noun

AI & LLMs

  1. Including a handful of worked examples of the desired input and output in a prompt, so the model copies the pattern. Three example commit messages in the prompt did more for consistency than a paragraph describing the format.

Origin

From few-shot learning in machine learning; popularised for prompts by the 2020 GPT-3 paper, 'Language Models are Few-Shot Learners'.

In practice

When a model gets the shape of an answer wrong, an example from your own codebase usually fixes it faster than more description. Vary the examples so it copies the pattern, not the specifics.

Say to your AI

Write the new test in the same style as these two existing tests. Match their naming, setup and assertion style exactly.

In plain words

  • show the AI examples of what I want
  • give it a sample to copy
  • it gets the format right if I paste one
  • teach it by example

See also chain of thought eval

Find similar words