GeminiPromptingbeginner

Gemini: include a few varied examples in your prompt

Google recommends always including few-shot examples. Clear examples can even replace instructions for format and tone.

Google’s Gemini API docs go further than most: they recommend always including few-shot examples, because prompts without them are likely to be less effective.

How to do it well

  • Show 2-5 input → output pairs that demonstrate exactly the format you want.
  • Make them specific and varied, so the model learns the pattern, not one example’s quirks.
  • Keep formatting identical across examples (same labels, same order).
  • If the examples are clear enough, you can delete some of the instructions.

Watch out: too many near-identical examples can make outputs overfit to them.

Sources

Related tips