LLenny's Podcast
← All frameworks
ProductivitySander Schulhoff (Learn Prompting, HackAPrompt)

Few-Shot Prompting

Show the model examples of what good looks like instead of describing it

Difficulty
Easy
Time to result
~days to results
Steps
3
Confidence
95%

Rather than describing what you want an LLM to produce, paste in a few concrete examples of the desired output (or input/output pairs). Schulhoff, lead author of The Prompt Report, calls this the single highest-leverage technique for most people. Examples encode format, tone, and edge cases that are hard to express in instructions, and the model generalizes from them to unseen inputs.

Origin

Drawn from Sander Schulhoff's work on The Prompt Report, a 76-page study co-authored with OpenAI, Microsoft, Google, Princeton and Stanford that analyzed 1500+ papers and 200 prompting techniques. Few-shot/zero-shot terminology originates in classical NLP/ML research.

Core principles

  • 01Examples beat descriptions when the target is hard to articulate (e.g. your writing style)
  • 02Zero-shot = no examples, one-shot = one example, few-shot = multiple examples
  • 03Use a format the model saw often in training (Q:/A:, XML) because common-in-training formats empirically perform best
  • 04You don't always need input/output pairs — a list of good outputs alone can work

How to run it

  1. 1

    Collect real examples of the output you want

    Gather a handful of concrete artifacts that represent success — past emails in your voice, high-performing titles, correctly labeled data points.

    Pro tip For a subjective task like matching your writing style, a few of your own past emails outperforms any description you could write.

  2. 2

    Structure them in a common format

    Wrap examples in a format the LLM is familiar with — XML tags, or a Q:/A: (question/answer) layout with the input after Q: and the desired output after A:. Q&A works even when there is no literal question, because models are heavily trained on that shape.

    Pro tip Formats that appear most commonly in training data are empirically the best formats to prompt with — don't invent a bespoke structure.

  3. 3

    Append the new, unseen input

    After several example pairs, add a final line with just the new input (e.g. a trailing 'Q:') and let the model produce the answer it has never seen.

    Watch out Small, seemingly-irrelevant changes to your examples can have large unpredictable effects — test before trusting.

In the wild

Medical coding accuracy jump

On a medical-coding startup project, GPT-4 initially gave little to no accuracy and poorly formatted codes. Schulhoff took a set of documents he had coded himself, attached the reasoning for each code, and dropped all of it into the prompt as examples before giving the model a brand-new transcript.

Accuracy on the task rose by roughly 70%.

Podcast title generation

Lenny generates episode title suggestions by giving the model ~10 bullet-pointed examples of past titles that performed well — outputs only, no inputs.

Usable title suggestions with a very simple example-only prompt.

Common mistakes

Describing instead of showing

Trying to explain a subjective style in words when a few examples would convey it instantly and more accurately.

Inventing an exotic prompt format

Using an uncommon structure the model rarely saw in training instead of XML or Q&A, which reduces performance.

Is it for you?

Best for

Anyone building a product prompt or doing a repeatable conversational task where output format, tone, or classification labels matter

Not ideal for

Trivial one-off asks where copy-pasting examples is more effort than the improvement is worth

From the transcript

it is fshot prompting which is just giving the AI examples of what you want it to do

12:30

zero (13:30) shot is no examples, one shot is one examples and few shot is multiple

formats of questions that show up most commonly in the training data are the best formats of questions to actually use when you're prompting it

15:00

that boosted the accuracy on that task up by I think like 70%

08:30

From the episode

AI prompt engineering in 2025: What works and what doesn’t

Sander Schulhoff (Learn Prompting, HackAPrompt)