4.2 — Few-Shot Prompting

CCAR-F Domain 4 · Task 4.2

What You Need to Know

Few-shot prompting puts a few worked examples (input + desired output + reasoning) in the prompt. It is the most effective technique for consistent, well-formatted output.

When to Deploy Few-Shot Examples

  1. Detailed instructions alone produce inconsistent formatting
  2. Model makes inconsistent judgement calls on ambiguous cases
  3. Extraction returns empty/null fields for information the document contains

How to Construct Effective Examples

  • Use 2 to 4 targeted examples
  • Each example must show reasoning (why this action over alternatives)
  • Cover the failing cases specifically

Key Concept: Few-shot examples are the most effective technique for consistency. Use 2–4 targeted examples with reasoning when instructions alone give inconsistent results, ambiguous judgements, or empty fields for data that exists.

Matching Technique to Problem

Problem Correct Technique
Inconsistent output formatting Few-shot examples
Malformed JSON tool_use with JSON schemas
Fabricated values for missing fields Optional/nullable schema fields
Wrong tool selection Better tool descriptions first, then few-shot
Extraction sum ≠ total Validation-retry loop

Exam Traps

  • Choosing "add more detailed instructions" when formatting is inconsistent
  • Adding many examples to cover every case
  • Using confidence thresholds to fix inconsistent judgements

Check your understanding

Practice Scenario

🔒 This practice scenario is part of Skillmarked Pro

The lessons stay free. Pro unlocks the other 23 CCAR-F practice scenarios and the 60-question timed mock exam, plus everything for every other exam.

See plans

Cancel anytime. Or €199 a year, which saves 17%.

Not sure yet? Try 10 free mock exam questions.

Already Pro? Log in.

Sources