Skip to content
AgenticAIWiki
  1. Learn
  2. Part 2
  3. 12. Few-shot examples
  4. 12.4

Lesson 12.4 · 4 of 4 · 4 min read · Reviewed 24 Nov 2026

Few-shot vs step-by-step reasoning

By the end, you can

  • Choose between few-shot examples and step-by-step reasoning.
  • Combine them for hard judgement tasks.

Both techniques improve output, but they fix different problems.

Problem Better tool
Output format, style, tone Few-shot examples
Classifying by pattern Few-shot examples
Multi-step logic or maths Step-by-step reasoning (chapter 13)
Weighing several pieces of evidence Step-by-step reasoning
Hard judgement calls with a set format Both: examples that show brief reasoning

Combining them

Examples can include the reasoning:

<example>
<ticket>I can't log in after resetting my password.</ticket>
<reasoning>Access problem, not billing. The reset worked, so it's likely a session or cache issue.</reasoning>
<label>account-access</label>
</example>

The model learns both the label set and the kind of thinkingExtended thinking: A mode in which the model reasons step by step in thinking blocks before giving its final answer. that leads there.

On models with extended thinking (13.6), you can often let the model reason on its own and keep the examples for the final format.

Key points

  • Few-shot examples are best for format, style and pattern matching.
  • Step-by-step reasoning is best for multi-step logic, maths and weighing evidence.
  • For hard judgement calls, examples that include short reasoning combine both.
Hands-on labOn your own machine

Compare examples and reasoning on a local model

Measure, on a local open-weight model, when few-shot examples help and when step-by-step reasoning helps.

You will have: A results table: accuracy on a format task and on a multi-step rules task, each with examples only, reasoning only, and both.

Steps

  1. Install Ollama from its official site and pull a small instruction-tuned model, for example with ollama pull followed by a model name from the library.
  2. Write 10 test items for a format task (addresses to fixed JSON) and 10 for a rules task (refund eligibility under three rules), each with the right answer.
  3. Write three prompt variants for each task: three examples only, "reason step by step, then answer" only, and examples that include a short reasoning line.
  4. Run every item through every variant with a small script that calls the local server, and score the answers in code.
  5. Fill in the table and write one sentence per task on which variant won and why.

Done when

  • Your table has 6 accuracy figures, one per task and variant.
  • Scoring is done by code, not by reading outputs by eye.
  • Your conclusion matches the lesson's rule of thumb, or explains why your results differ.

Docs: Ollama (GitHub) · Ollama model library

Quick checkA task needs a multi-step eligibility check against a policy. What helps most?
How sure are you?
Pick an answer and how sure you are

Finished the chapter? Take the chapter check.