Artificial Intelligence (AI) · Intermediate level

Intermediate level · Module 3: Prompt Engineering · Lesson 2 of 3

Examples and Step-by-Step Guidance

Improve outputs with worked examples and by asking the model to follow explicit steps.

In this lesson you will

  • Use few-shot examples effectively
  • Guide the model through steps and self-checks

Key concepts

few-shot examplesstep-by-step instructionsself-checkingexample selection

The lesson

Few-shot prompting includes a few examples of inputs and ideal outputs. Examples show the style, length and format you want more clearly than descriptions.

Choose varied, correct examples, including one where the right answer is 'I don't know'. Biased examples produce biased outputs.

For complex tasks, give explicit steps — find the relevant passage, check it answers the question, then answer with a citation — and ask the model to check its answer against the rules.

Step by step

  1. Add three examples to the prompt.
  2. Include a 'don't know' example.
  3. Add explicit answering steps.
  4. Compare results with version 1.

Practice activity

Write version 2 of the prompt with examples and steps, and compare it with version 1.

Expected result: A measured comparison on the same questions.

Check your understanding

  1. What is few-shot prompting?

    Show answer

    Including a few examples of inputs and ideal outputs in the prompt.

  2. Why include an example where the answer is 'I don't know'?

    Show answer

    To show the model it is acceptable and expected to decline.

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.