Friday, August 21, 2026

    Apply few-shot prompting to improve output consistency and quality

    Domain 4 — Prompt Engineering & Structured Output · 20% of the exam

    Task statement 4.2

    Apply few-shot prompting to improve output consistency and quality

    What you should be able to do
    • Reach for few-shot when detailed instructions still produce inconsistent output.
    • Use examples to show how ambiguous cases are decided, including the reasoning for the choice.
    • Demonstrate the exact output shape you want rather than describing it.
    • Cover varied source structures so extraction generalises instead of matching one layout.
    Exam traps (5)

    Add more instructions when the format keeps varying.

    Format is easier to show than to describe, and each additional clause is another thing to interpret and trade off against the others.

    Demonstrate the output. Two to four examples settle shape faster than paragraphs.

    Give one example per case you expect to see.

    The model matches the enumerated cases and has nothing to generalise from, so the first novel pattern falls through.

    Show the reasoning for why one action was chosen over a plausible alternative; that is what transfers.

    Use clean, canonical examples so the pattern is unmistakable.

    Real sources are messy — informal measurements, inline citations, missing sections — and clean examples say nothing about any of it.

    Draw examples from the awkward cases, because those are the ones in dispute.

    Add many examples so coverage is thorough.

    They crowd the context and the later ones dilute the earlier, while the marginal example teaches almost nothing.

    A few well-chosen ambiguous cases outperform a long catalogue of easy ones.

    Treat empty required fields as a schema problem.

    The schema is satisfied — the extraction genuinely failed to find the value in a layout it did not recognise.

    Show correct extraction from the varied formats that produced the blanks.

    Primary sources
    Know cold
    • Few-shot prompting
    • Hallucination
    • Grounding
    • Structured output

    5 practice questions in the bank are tagged to this task statement.

    Practise this task in context: open it inside the interactive study guide, which carries the concept cards, the mock quiz and the practice simulation.

    Blueprint-aligned independent practice. Koko's scenarios and company facts are fictional and synthetic. This aid does not reproduce official exam questions or Anthropic's undisclosed scoring model, and is not affiliated with or endorsed by Anthropic.