Generative AI · Beginner level

Beginner level · Module 4: Prompt Engineering Fundamentals · Lesson 2 of 3

Roles, Zero-Shot and Few-Shot Prompting

Learners use role instructions and examples to control tone and style, comparing zero-shot (no examples) with few-shot (a few examples) prompts.

In this lesson you will

  • Use role prompts appropriately
  • Use few-shot examples to control style

Key concepts

role promptzero-shotfew-shotstyle examplesconsistency

The lesson

A role prompt ('You are an experienced copywriter for small shops in Juba') sets tone and expertise. It does not give the model real knowledge, so facts must still be provided.

Zero-shot prompting gives only instructions. Few-shot prompting adds two or three examples of the desired output, which is very effective for consistent style, such as a set of SMS promotions in the same format.

Choose examples carefully: the model copies their length, tone and even their mistakes.

Step by step

  1. Write a zero-shot prompt for SMS promotions.
  2. Add two good examples to make it few-shot.
  3. Compare the outputs.
  4. Add a role and compare again.

Practice activity

Produce a consistent set of five SMS promotions using few-shot prompting.

Expected result: Five promotions in a consistent style and length, with correct facts.

Check your understanding

  1. What is few-shot prompting?

    Show answer

    Including a few examples of the desired output in the prompt.

  2. Does a role prompt give the model real expertise?

    Show answer

    No. It sets tone; facts must still be provided and checked.

Further learning

Taught live by an instructor — online or in person. Free course lessons are for self-study and do not lead to a certificate — see registration options.