Prompting

Few-Shot and Chain of Thought

Two techniques do most of the heavy lifting in prompting: show worked examples, and ask the model to reason before it answers. Here is how to use both.

Setuproll Team8 min read2026-06-20

If you only learn two prompting techniques, learn these. Few-shot prompting shows the model examples of the task so it copies the pattern. Chain of thought asks the model to reason step by step before answering so it gets harder problems right. They are independent, and they combine well.

Few-shot: show, then ask

Zero-shot is just asking. Few-shot is asking after you have shown a handful of solved examples. Those examples pin down the format, the level of detail and the edge-case handling far better than a written spec. Two to five examples is usually enough.

few-shot.txt
Extract the action item from each message.

Message: "can you send the deck by friday?"
Action: send the deck by Friday

Message: "we should probably loop in legal at some point"
Action: loop in legal

Message: "the staging build is broken again"
Action:
Pick examples that cover the edges
Your examples are training data for this one request. Include a tricky case, not just easy ones, so the model learns how to handle the messages that would otherwise trip it up.

Chain of thought: reason before answering

Adding a phrase like "think step by step" tells the model to lay out its reasoning before committing to an answer. For math, logic and multi-step problems this meaningfully improves accuracy, because the model works through intermediate steps instead of jumping to a guess.

Chain of thought
You
A shirt costs $40 after a 20% discount. What was the original price? Think step by step.
Agent
$40 is 80% of the original. Original = 40 / 0.8 = $50. The original price was $50.
Reasoning out loud catches the error a direct answer would make.
When you only want the answer
Reasoning out loud is great for accuracy but noisy for production. Have the model reason internally and then output only the final result, or capture the reasoning in a separate block you can discard.

Combine them for hard tasks

The two techniques stack. Show a couple of examples where the worked-out reasoning is part of the example, and the model learns both the format and the habit of reasoning. This is especially effective for classification or extraction where the right answer depends on a judgment call.

combined.txt
Decide if the review is a complaint or a question.

Review: "does this come in blue?"
Reasoning: the user is asking about availability, not unhappy.
Label: question

Review: "i waited a week and it never arrived"
Reasoning: the user reports a failed delivery, that is a grievance.
Label: complaint

Review: "how do i return this if it does not fit?"
Reasoning:

When to reach for each

SituationTechnique
Output format keeps driftingFew-shot with 2 to 3 examples
Model gets multi-step logic wrongChain of thought
A judgment call with a fixed formatBoth, with reasoning inside each example
Simple lookup or rewriteNeither, just ask clearly
Do not over-apply
Few-shot examples cost tokens and chain of thought adds latency. For an easy task, a clear zero-shot prompt is faster and just as good. Reach for these when a plain prompt is actually failing.

Putting it together

  1. Try a clear zero-shot prompt first.
  2. If the format wanders, add a few examples.
  3. If the logic breaks, ask for step-by-step reasoning.
  4. For hard judgment calls, do both and bake the reasoning into the examples.
  5. In production, keep the reasoning out of the final output.

Examples teach the model what good looks like. Reasoning teaches it how to get there. Most prompting wins come from one of the two.

0 Comments

Sign in to post

Loading discussion...