Skip to content

2.3 Zero-Shot, Few-Shot, and Chain-of-Thought

A prompt engineering technique changes a prompt so that the model does a task better. Zero-shot prompting gives instructions only. Few-shot prompting adds worked examples. Chain-of-thought (CoT) tells the model to reason before it answers. The three techniques cost more in that order. This order of rising cost is the escalation ladder.

This lesson uses one made-up example throughout: a butcher’s shop that uses Claude to convert order emails into order sheets. Four things go wrong:

  • The sheet layout changes from week to week.
  • Claude files marinated chicken thighs as fresh meat one day and as prepared food the next day.
  • The totals for mixed orders are wrong. These orders are priced by weight and have a bulk discount.
  • The replies promise collection times, although the prompt forbids promises of collection times.
  • Zero-shot with clear instructions is the baseline for capable models, and it handles most production tasks. If the instructions define the task, audience, format and constraints, nothing more is needed. The first fix is to improve the quality of the instructions, and this fix costs nothing.
  • Few-shot examples come second. The examples are sent with every request and make the request larger. So they must be worth including.
  • Chain-of-thought comes last among single-call techniques. It adds reasoning tokens and latency, so it is reserved for failures that are genuinely about multi-step reasoning.

Diagnose the failure before you add anything. A system that ignores stated rules needs clearer instructions and structure first (tags, ordering, emphasis). Any technique added to ambiguous instructions keeps the ambiguity. The butcher restates the collection rule plainly, in its own tag.

Anthropic’s guidance calls examples “one of the most reliable ways to steer Claude’s output format, tone, and structure”. The guidance recommends 3 to 5 examples for best results. A set of examples works when it has three properties:

  • Relevant : the examples match the actual use case, not a generic version of it.
  • Diverse : the examples cover edge cases. Five examples that repeat the happy path (the ordinary case, with no edge cases) teach the model an unintended pattern. Near-miss examples (inputs that look like one class but are another) and boundary examples teach the distinctions that prose cannot define.
  • Structured : the examples are wrapped in example tags, so that the model can distinguish them from instructions.

Few-shot is the standard fix for format-compliance failures and for failures at classification boundaries. An exact example fixes a layout that prose does not define. A boundary example shows on which side of a boundary a case belongs. The butcher adds one sheet in the exact layout and one correctly filed thigh order. Examples make every request larger unless they are in the cached static prefix (the unchanging opening part of the prompt) (objective 2.5).

CoT uses step-by-step instructions or a thinking-then-answer format. Tags separate the reasoning from the final output, so parsing in later steps still works. CoT improves accuracy on multi-step reasoning, such as calculations, multi-criteria decisions and contract analysis. CoT adds latency and output tokens, so it is wrong for trivial tasks where latency is critical. Visible reasoning also shows faulty logic, so that the logic can be audited.

The butcher’s totals have several steps: weight times price per kilo across the cuts, then the discount. Examples of finished totals show the results without teaching the steps. When the reasoning is in its own tags, staff can check each sum.

Current Claude models have built-in thinking (checked 14 October 2026). On Claude 4.6-generation and later models, adaptive thinking decides dynamically when and how much to think. Adaptive thinking is always on for Fable 5.1 and Opus 5.5, and on by default for Sonnet 5.5 and Haiku 5.5. The older Haiku 4.5 uses configured extended thinking. Thinking tokens are billed as output and count towards max_tokens and the context window.

Prompted CoT remains the portable, named form of the technique. Prompted CoT stays the right tool where reasoning must be visible and auditable in the response body. It is also the right tool where thinking is unavailable or disabled for cost. Current state (checked 6 October 2026): the prompting docs now say to rely on thinking on Claude Fable 5.1, Fable 5, Opus 5.5, Opus 5 and Sonnet 5.5. On those models, as of that check, the model may decline a prompt that asks for written-out reasoning (for example in <thinking> tags). The architect decides where reasoning happens and whether it must be auditable. CoT and thinking do not exclude each other.

Failure symptom Cheapest effective fix Why not the others
Output format wrong or drifting Few-shot with an exact-format example CoT adds reasoning the task does not need; emphasis alone underdetermines the format
Inconsistent classification at category boundaries Few-shot with boundary examples Prose cannot pin down the distinction; reasoning shows the path but not the boundary
Wrong answers on multi-step reasoning CoT or built-in thinking Examples show outcomes without teaching the path
Stated rules ignored Instruction clarity and structure first Techniques added on top of ambiguity inherit the ambiguity
Any of the above Never a model upgrade first Fixes none of these failures, at maximum recurring cost

If you add examples to fix a reasoning failure, or add reasoning to fix a format failure, you spend tokens on the wrong problem. Every example and reasoning instruction is a recurring cost. It is also one more thing to maintain and to cover in evals (Domain 4). CoT on a high-volume trivial endpoint, such as the butcher’s order-received reply, is over-engineering. It adds reasoning tokens and slower responses for zero gain in quality.

Questions on this objective pair a failure symptom with four plausible fixes. The skill they test is diagnosis. The right answer is the cheapest technique that fixes the observed failure. For the butcher, the fixes are examples for the layout and the thighs, CoT for the totals, and a clearer collection rule. Prompted CoT is still the right answer, even where the docs now recommend thinking.

A support-ticket triage system misroutes tickets that mention two products at once, and its JSON output intermittently gains a prose preamble that breaks the parser. The team proposes upgrading to the largest model, but finance will not fund a more expensive model tier. What is the best fix?

  • A. Add few-shot examples covering multi-product tickets and an exact-format output example
  • B. Upgrade to the largest available model, which separates products better and holds the format
  • C. Add chain-of-thought reasoning to every ticket so the model works out each product before routing
  • D. Rewrite the instructions to demand JSON-only output more forcefully, in capitals at the top
Answer & explanation

Correct: A

  • A — One technique fixes both failures: boundary examples teach the classification distinction prose cannot define, and a format example is the canonical fix for format drift.
  • B — The question excludes this: finance will not fund a more expensive tier. Neither failure is a capability failure, and the same prompt causes both on the new model.
  • C — Adds reasoning tokens and latency to every request. Routing between two products is a boundary problem examples teach better, and CoT does nothing for the format failure.
  • D — Emphasis without an example does not fully define the format and does nothing for the misrouting. It is the cheapest option but fixes at most half of one failure.