4.4.7 · D3Alignment, Prompting & RAG

Worked examples — Chain-of-thought prompting

3,007 words14 min readBack to topic

Before we compute anything, three small pieces of notation appear repeatedly, so we earn them up front.


The scenario matrix

Think of a "scenario" as a cell in a grid. The two axes that matter most for CoT are (a) what kind of reasoning the question needs and (b) what edge condition makes it tricky. Below, every row is a case class we will fully solve.

# Case class The trap / edge condition Example
C1 Sequential arithmetic order of operations matters Ex 1
C2 Rate / normalisation "scale the count" illusion Ex 2
C3 Multi-hop logic chaining facts, no numbers Ex 3
C4 Degenerate input zero / empty / "nothing happens" Ex 4
C5 Limiting / extreme value very large or "0 machines" boundary Ex 5
C6 Self-consistency clear majority outliers are lone errors Ex 6
C7 Self-consistency tie two answers get equal votes Ex 7
C8 Faithfulness failure chain looks right, answer wrong Ex 8
C9 Real-world word problem units, money, must sanity-check Ex 9
C10 Exam-style twist scale / small-model gotcha Ex 10

Every cell above is covered by exactly one worked example below. If you want the tools these examples lean on, see Self-Consistency Decoding, Temperature and Sampling, and Emergent Abilities of LLMs.

The figure below draws this same matrix as ten coloured tiles — the top row is "ordinary" reasoning (C1–C3), the middle two rows are exactly the tricky edge cases (the degenerate, limiting, tie, faithfulness and scale cells). Notice how the teal arrow points into the interior of the grid: those inner tiles are where naive prompting quietly breaks, and they are the whole reason this page exists. Glance at the colour of each tile now — every worked example below is labelled with its cell ID so you can locate it back on this map.

Figure — Chain-of-thought prompting
Recall What to take from the figure

Where do the "dangerous" cases sit on the grid? ::: In the interior rows (C4 Zero, C5 Limit, C7 Tie, C8 Faith) — the edge conditions the teal arrow points at, not the clean top row.


The examples


Recall Quick self-test across the matrix

Which example handled a division-by-zero boundary? ::: Example 5 (C5), 0 painters → infinite/undefined time. In a self-consistency tie, what do you do? ::: Draw more chains (increase ) or fall back to the top-probability chain — don't silently pick one (Ex 7, C7). Why can a fluent chain still be wrong? ::: Faithfulness problem — the prose may hide a bad step; re-check the maths (Ex 8, C8). On which model does CoT reliably help? ::: The large one; gains are emergent with scale (Ex 10, C10).