liveBook · Manning

Few-shot chain of thought

As explained in Prompt Engineering in Practice

A prompting technique that provides worked examples demonstrating intermediate reasoning steps.

Few-shot chain of thought (CoT) is a prompt pattern that supplies a worked example of intermediate reasoning before presenting a new input. Use it when a task needs not just a decision, but a repeatable way to reach and explain that decision. A direct prompt requests an answer; zero-shot CoT asks for visible steps; few-shot CoT also demonstrates which steps matter. section 9.1.1 section 9.0

For a canary-rollout assessment, structure the prompt around four parts:

  • Assign a release-engineer role and request a GO or NO-GO recommendation. section 9.1.1
  • Provide a reference case with deployment signals, thresholds, and a worked assessment of each signal. section 9.1.1
  • In that assessment, check thresholds and duration, separate noncritical paths from deciding signals, and explicitly name the deciding signal. section 9.1.1
  • Present the target signals separately and require the same step-by-step reasoning pattern. section 9.1.1

Reference reasoning for a rollout

A reference case gives an API error rate of 1.8% against a rollback threshold above 3% for at least five minutes, memory utilization of 91% against a 90% alert threshold, and elevated cache misses on a noncritical path. Its worked response says the error rate is not decisive, memory is a sustained deciding signal after 12 minutes, and cache misses do not block rollout. It concludes NO-GO and names memory utilization as the reason to pause. section 9.1.1

Keep the worked example's decision procedure distinct from its particular numbers: apply the thresholds and path criticality supplied for the target rollout. Compared with zero-shot CoT, the added reference example specifies the team's reasoning pattern rather than merely requesting visible steps. Compare the two on the same input to see whether the deciding signal and secondary concerns are treated as intended. section 9.1.1 section 9.0

How Prompt Engineering in Practice covers it

How deep it goes
Works through a structured prompt and reference assessment, then compares direct, zero-shot, and few-shot prompting rather than model internals.
Examples
Uses a canary-rollout reference with API errors, memory utilization, cache misses, and a NO-GO recommendation.
What it assumes
Builds on few-shot reference examples and structured prompts; uses deployment signals and thresholds as the task context.
What you can do after
Build it from scratch as a structured prompt that demonstrates threshold checks, path weighting, and an explicitly justified GO or NO-GO decision.
How it connects
Connects few-shot examples and chain-of-thought prompting to canary rollouts, rollback thresholds, and noncritical service paths.

Also explained in

Compare how 2 books explain few-shot chain of thought →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Prompt Engineering in Practice. The section links point to the parts of the book it draws on.