Zero-Shot, Few-Shot or Reasoning: Pick the Cheapest Prompting Technique the Failure Asks For
One refund ticket, three prompts. Zero-shot fails to give a parseable label, few-shot fixes the format at the cost of input, prompted reasoning fixes logic at the cost of output. Climb one step per measured failure.
What you will learn
- Climb a prompting ladder: zero-shot, then few-shot, then prompted reasoning
- Match each technique to the failure it fixes: format drift or multi-step logic slips
- See where each technique pays: few-shot in input, reasoning in output and latency
- Prefer native thinking and effort over hand-written step plans, and avoid the everything-on prompt
Before you start
- One Claude API call with a system prompt
- Basic Python and regular expressions
A refund ticket arrives at a blender shop: Bought the blender 40 days ago. The motor burns out after a minute. I want my money back. The triage bot has to decide what happens next, and there are several ways to prompt it: zero-shot, few-shot, prompted reasoning and native thinking.
An architect doesn't pick the fanciest one. They pick the cheapest one that holds.
Three ways to brief a new hire
Think of a new hire at the refund desk. They can get three kinds of help:
- Just do it. "Handle this refund." No past cases. Fast, when the work is routine. That's zero-shot.
- Here are past cases. Ten days, refund. Fifty days with a fault, escalate. Two years, reject. Now handle this one. That's few-shot.
- Show your working. Forty days, past thirty. The motor dies, so it's a fault. Inside a year, so escalate. Slower, but fewer slips. That's prompted reasoning (chain-of-thought).
Each one buys reliability and charges for it. Zero-shot is the shortest prompt, costs the least and gives the least control. Few-shot sends examples on every call: more input, steadier output. Prompted reasoning writes the reasoning before the answer: more output, more latency. The technique is a way of briefing, not a magic word.
The ladder
- Zero-shot. Start with the shortest prompt that could work.
- Few-shot. Climb when the format or the judgment drifts.
- Prompted reasoning. Climb when multi-step reasoning slips.
Prompt before you fine-tune: every step on this ladder is only a prompt edit. And the trigger is a failure you measured with an eval, not a feeling. Each step adds cost, so each step needs evidence.
The three prompt files
The project runs against a stand-in: the Anthropic SDK on an httpx mock transport with scripted replies, so no API key is needed and the replies show the design, not a real model's quality. The stand-in only checks which technique the prompt holds. The word counts and the parsing are real Python.
zero_shot.txt
You triage refund tickets for a blender shop.
Policy: refund within 30 days of purchase, escalate a fault
under the one-year warranty, reject everything else.
Answer with one label: refund, escalate or reject.
few_shot.txt
You triage refund tickets for a blender shop.
Policy: refund within 30 days of purchase, escalate a fault
under the one-year warranty, reject everything else.
Write one line: label: <refund|escalate|reject> | reason
<examples>
<example>
ticket: Bought it 10 days ago, changed my mind.
answer: label: refund | inside 30 days
</example>
<example>
ticket: Bought it 50 days ago, the lid cracked in use.
answer: label: escalate | a fault inside the warranty
</example>
<example>
ticket: Bought it 2 years ago, it no longer fits my kitchen.
answer: label: reject | outside both windows
</example>
</examples>
- The instructions fix the output format: one line, the label, then the reason.
- The examples sit in their own tags, apart from the instructions.
- The middle one is the ambiguous case, a fault past 30 days, where a rule alone isn't enough.
- The examples are diverse, one per label. The docs ask for relevant, diverse examples; more in few-shot prompting.
reasoning.txt
You triage refund tickets for a blender shop.
Policy: refund within 30 days of purchase, escalate a fault
under the one-year warranty, reject everything else.
Reason it through in <reasoning> tags: the days since purchase,
then whether it is a fault, then which rule applies.
Then give only the final label in <answer> tags.
It asks for the reasoning first, names the steps that matter for this task, and puts the final label in answer tags so code can extract it. This file is the fallback for when native thinking is off.
The script: only the label leaves
From triage.py (the stand-in client setup is left out here): the ladder pairs each failure with the prompt it earns, and the parser keeps the label and drops the reasoning.
TICKET = ("Bought the blender 40 days ago. The motor burns out "
"after a minute. I want my money back.")
EXPECTED = "escalate"
LADDER = [("no failure seen yet", "zero_shot"),
("format or judgment drifts", "few_shot"),
("multi-step reasoning slips", "reasoning")]
ANSWER = r"<answer>(refund|escalate|reject)</answer>"
LABEL = r"^label: (refund|escalate|reject)\b"
def parse(text):
"""Only the label leaves. The reasoning stays here."""
hit = re.search(ANSWER, text)
hit = hit or re.search(LABEL, text)
return hit.group(1) if hit else None
def words(text):
return len(text.split())
for failure, name in LADDER:
path = f"{name}.txt"
system = open(path, encoding="utf-8").read()
msg = client.messages.create(
model="claude-sonnet-5-5", max_tokens=300, system=system,
messages=[{"role": "user", "content": TICKET}])
reply = msg.content[0].text
label = parse(reply)
print(f"{name:10} after: {failure}")
print(f" prompt {words(system):3} words | reply {words(reply):3} words"
f" | label {label} | right {label == EXPECTED}")
zero_shot after: no failure seen yet
prompt 33 words | reply 10 words | label None | right False
few_shot after: format or judgment drifts
prompt 95 words | reply 8 words | label escalate | right True
reasoning after: multi-step reasoning slips
prompt 54 words | reply 27 words | label escalate | right True
Zero-shot got a chatty reply, and the label is None: no parser can read it. Few-shot has the longest prompt and returns escalate. Prompted reasoning has the longest reply, because it carries the reasoning, and also returns escalate. The parser is the architect's gate: nothing but the label reaches the customer.
The bill: where each technique pays
A steady block of examples is a candidate for prompt caching. Reasoning is output you wait for.
Prompted reasoning or native thinking
Reasoning has also moved into the model, as native thinking. With thinking on, the model can think before it answers, and effort sets how much. The docs say a general instruction often beats a hand-written step plan. With thinking off, prompted reasoning is the fallback: ask it to think first, and put the final answer in answer tags you can extract. So set thinking and effort first, and write reasoning steps only as a fallback. The settings are covered in Claude adaptive thinking and effort.
The trap: the everything-on prompt
A routine ticket, one clear label, and a prompt that switches on everything at once:
- Three examples on every call: input, paid every single time.
- A hand-written step plan: more reply words.
- Native thinking switched on as well: now the same reasoning is paid for twice, in output and in waiting time.
Three costs, for a failure nobody measured. Add one technique per measured failure, and stop when the evidence says enough.
A worked judgment
The labels are right, but the reply format changes between calls, and the parser fails on some replies. The tickets are simple. Should you add a step-by-step plan, add three diverse examples, or switch native thinking on?
Add the examples. The failure is format drift, and examples fix format and judgment. A step plan would add reply words, and the labels were never wrong. Native thinking would add output and waiting time, and this isn't a logic slip. Format drift points to examples. Logic slips point to reasoning.
Quick recap
| Technique | Fixes | Pays in | In the run |
|---|---|---|---|
| Zero-shot | Nothing yet: the starting point | Least of both | 33 / 10 words, label None |
| Few-shot | Format and judgment drift | Input, every call | 95 / 8 words, escalate |
| Prompted reasoning | Multi-step logic slips | Output and latency | 54 / 27 words, escalate |
| Native thinking | Multi-step logic, as a setting | Output and latency, set by effort | Not in the run |
The project files for this lesson are in the community, free to join.
Try it yourself
Swap the ticket for Bought it 25 days ago, the jug arrived cracked. Decide the right label from the policy first. Then, against a real model, run the zero-shot prompt with its instruction changed to the one-line label: ... | reason format and see whether that alone fixes the parse, before you pay for examples.
Related course on Udemy
Claude Certified Architect - Professional (CCAR-P) Exam Prep
Architecting with Claude: design, models, context, integration, evals, governance and stakeholders.View on Udemy ↗: Claude Certified Architect - Professional (CCAR-P) Exam Prep (paid course, opens in a new tab)Related posts
The AI Stack in One Picture: Six Layers Every AI Product Is Built From
Every AI product is built from six layers: data, model, retrieval, orchestration, serving and ops, with evals and security across all of them. A restaurant analogy, one request traced through all six, and what an AI engineer actually builds around the model call.
Tokenization: What an LLM Actually Sees When You Type
A language model never sees letters, only token ids. Use tiktoken to watch strawberry become three ids, see a space or a capital change them, fix the letter-counting problem, and compare English, German and Hindi token counts.
LLM Tokens, Context Windows and Cost: What One Question Really Costs
Follow one four-word help desk question that becomes 911 input tokens. Learn what fills the context window, why chat memory grows every turn, how max_tokens cuts a reply, and how to price a call.
What an LLM Can and Cannot Do: One Prediction Loop, Its Strengths and Its Gaps
A large language model predicts the next token, over and over. That one loop makes it strong at drafting, summarising and classifying, and weak at fresh facts, exact maths, memory and guaranteed truth. See why with a three-line tiktoken script, and learn the fix for each gap.
