AI & integration

Chain of thought prompting: definition, examples and templates

Ask a language model a hard question and it will usually hand you an answer with total confidence and no working. Sometimes it is right. Sometimes it is quietly, expensively wrong, and you have no way to tell which. Chain of thought prompting closes that gap by asking the model to think out loud, one step at a time, before it commits to a conclusion.

The idea is simple enough to explain to anyone. Instead of demanding the answer, you ask the model to show its reasoning first, the way a maths teacher wants to see the working and not just the number at the bottom of the page. Break a hard problem into ordered steps, solve each one, then arrive at the result. On tasks that need real reasoning, calculation, or multi-step logic, that small change in how you ask makes a large difference in what you get back.

We build AI features into products at Shipshape Data, and this is one of the first techniques we reach for when a model keeps getting something almost right. It is cheap to try, it needs no fine-tuning, and it often turns a flaky output into one you can actually trust. This guide covers what chain of thought prompting is, why it works, the main variants, and a set of templates you can adapt to your own domain today.

Why chain of thought prompting matters

Standard prompting falls over on hard problems. You ask a question, the model leaps to an answer, and there is nothing in between for you to check. When it gets a straightforward calculation wrong or drops a step in a chain of logic, you cannot see where it went off, so you cannot fix it and you certainly cannot trust the next answer either. That black box is fine for casual use. It is a real problem the moment money, compliance, or a customer decision depends on the output.

Chain of thought prompting turns the box transparent. By making the model lay out its steps, you can read the reasoning, spot the exact point where it went wrong, and know whether to believe the conclusion. When the reasoning is visible, a bad answer becomes a bug you can find rather than a mystery you have to live with.

Accuracy on tasks that need reasoning

The performance jump is the headline. In the original research from Google, prompting models to reason step by step produced large gains on tasks that need more than pattern matching. On the GSM8K set of grade-school maths word problems, a well-known benchmark, chain of thought roughly tripled the accuracy of a large model compared with answering directly. Symbolic and commonsense reasoning tasks showed similar movement. The model still holds all the same knowledge either way. Giving it room to work through the problem is what lets that knowledge actually surface.

One important caveat: the gains cluster in bigger models. The step-by-step effect really shows up in models around 100 billion parameters and above, where enough reasoning patterns exist in the training data to build on. Push the same prompt through a small model and the reasoning chains can wander, sometimes landing on a worse answer than a plain prompt would have. Model size is part of the recipe, not an afterthought.

Transparency and debugging

Accuracy gets the attention, but the visibility is the part we value most in production work. When every step is on the page, you can point at the one that failed. Maybe the model misread a figure in step two. Maybe it picked the wrong formula in step four. Either way you now have something specific to fix, which is the difference between improving a prompt and guessing at it.

That visibility matters far beyond the engineering team. When you build production-ready AI features, someone eventually has to explain to a stakeholder, an auditor, or a regulator how the system reached a decision. A visible reasoning chain is an answer to that question. It also gives you a handle on wrong or invented answers, because a claim that appears from nowhere, with no supporting step, is much easier to catch when the surrounding steps are all laid out around it.

Visible reasoning turns a wrong answer from a mystery you have to live with into a bug you can actually find.

How chain of thought prompting works

At its core, the technique is one instruction: get the model to break its reasoning into ordered steps before it gives a final answer. You do that in one of two ways. Either you show it worked examples of the reasoning you want (few-shot), or you simply tell it to think through the problem methodically (zero-shot). Both nudge the model away from a fast pattern-matched guess and toward a slower, more deliberate walk through the intermediate steps.

The basic instruction

The simplest version costs you a single line. Add something like "Let's think step by step" or "show your reasoning before answering" to the end of your prompt, and you trigger the model's reasoning behaviour without writing a single example. This zero-shot approach works surprisingly well on problems where the logical steps are fairly clear.

Say you ask: "Calculate the total cost if I buy 3 items at 15 pounds each and 2 items at 8 pounds each. Let's think step by step." Rather than firing back a number, the model works each part in turn (three at fifteen is forty-five, two at eight is sixteen, forty-five plus sixteen is sixty-one) and only then gives the total. If any one calculation is wrong, you can see it, which you never could with a bare figure. The mechanics of that step-by-step generation are worth understanding if you want to reason about how the model produces each token.

Reasoning cues and formatting

How you format the prompt shapes how usable the output is. You get cleaner results when you separate the reasoning from the answer with clear signposts. Labels like "Reasoning:", "Step 1:", "Step 2:" and "Final answer:" push the model into distinct sections rather than one run-on paragraph. That structure is not just tidy. If you are feeding the output into an automated system, predictable delimiters are what let you pull out the final answer, or validate a specific step, without brittle string parsing.

Structuring the whole prompt

The order of the pieces matters as much as the reasoning instruction. The most consistent results come from a prompt that states the problem clearly, gives the relevant context, shows the reasoning pattern through an example or two, and ends with the explicit instruction to work step by step. Put your examples before the real question, so the model has the demonstrated pattern fresh in mind when it reaches your actual problem.

The quality of those example reasonings drives the quality of the output directly. Pick examples that match the complexity and the domain of your real task. If you need the model to reason about financial data, show it financial reasoning, not general arithmetic. Your examples are teaching it two things at once: which kinds of steps matter in your world, and how much detail you expect at each one.

Types of chain of thought prompts

Chain of thought is a family, not a single trick. The variants differ by how many examples you supply, whether the model builds its own examples, and whether it reasons over more than text. Which one fits depends on your problem domain, the examples you have to hand, the model you are using, and whether images or diagrams are in the mix. Knowing the options keeps you from defaulting to one method for every situation.

Zero-shot chain of thought

Zero-shot needs no examples at all. You bolt an instruction like "Let's think step by step" onto the query and the model generates a reasoning path from its training alone. This is the fastest thing to try, and it earns its keep when you have no good examples to hand or when your inputs are too varied to write examples for every case. The weakness is consistency: results swing with model size, and smaller models can produce reasoning chains that ramble and, occasionally, land somewhere worse than a plain prompt would have.

Few-shot chain of thought

Few-shot gives the model two to five worked examples that show the exact reasoning pattern you want copied. Each example carries the problem, the intermediate steps, and the final answer in the shape you expect back. The model reads the pattern and applies the same structure to new problems. On genuinely complex tasks this usually beats zero-shot, because you are teaching the reasoning style outright rather than hoping the model guesses it. The cost is your time upfront writing good examples, and you get more consistent, more accurate output in return.

Automatic chain of thought

Automatic chain of thought builds its own examples instead of asking you to handcraft them. A typical system clusters similar questions, picks a representative problem from each cluster, and uses zero-shot prompting to generate a reasoning chain for each one. That makes the approach far easier to scale, since you are not writing examples by hand for every domain or task. The research on this is encouraging: a diverse set of automatically generated examples can match or beat a carefully curated manual set, while cutting the preparation work sharply.

Multimodal chain of thought

Multimodal chain of thought stretches the technique past text to bring in images, diagrams, or other data types alongside the words. The model reasons over the visual and the textual context together, producing steps that reference both. This is the version you want when the problem genuinely involves more than one kind of information, like reading a chart, interpreting a diagram, or weighing visual evidence against a written description. The constraint is that you need a model trained to handle multimodal inputs, which narrows your options compared with text-only prompting.

Templates and worked examples

Definitions only get you so far. What you actually need are templates you can drop into your own prompts and adapt. The three below cover the cases we see most often in client work: numerical problems, decisions with competing factors, and data interpretation. Each one gives you a reasoning skeleton and a worked example so you can see the pattern in action. Treat the step names and counts as starting points, not gospel, and reshape them to match how experts in your field actually think.

Mathematical problem solving

Maths is the obvious home for chain of thought, because calculations are step-based by nature and the technique catches errors that would otherwise pass unseen. A workable template asks the model to lay out what it knows, state what it needs to find, then show each calculation in order before giving the final answer with units. The structure looks like this:

  • State the problem clearly as the question.
  • Identify what you already know from the problem.
  • State what you need to find.
  • Show each calculation on its own line, in order.
  • Give the final answer, with units where they apply.

Put a warehouse question through it and the value is obvious. Suppose a warehouse starts with 450 units, takes in a delivery of 180 and ships out 275 on Monday, then ships another 120 on Tuesday. The model works it in the open: 450 plus 180 is 630, minus 275 is 355, minus 120 leaves 235 units remaining. Every arithmetic step is visible, so a slip at any point is caught in the reasoning rather than buried in a wrong total.

Logical reasoning and decisions

Problems that turn on weighing several factors need chain of thought to make sure the model actually considers all of them. Business decisions usually involve trade-offs, conditions, and rules where dropping one factor changes the answer. The template pulls each decision point into the open:

  • Describe the situation to analyse.
  • List the factors that genuinely matter.
  • Work through each factor and what it implies.
  • Name the trade-offs where factors conflict.
  • State the decision rule that settles the choice.
  • Give the conclusion, with its justification.

Take a real-feeling call: migrate a database this quarter (four weeks of downtime, 50k cost, quicker performance gains) or next quarter (two weeks of downtime, 65k cost, delayed benefits but better team availability). Reasoned in the open, the model can note that this quarter's longer downtime risks perhaps 30k of lost revenue in peak season, that next quarter's shorter off-peak downtime avoids most of that, set the decision rule as minimising total cost including business impact, and conclude: migrate next quarter, because the extra 15k of project cost is more than offset by the 30k of revenue you protect. You may disagree with the rule. You can see exactly where it entered, which is the point.

Data analysis and interpretation

When you want a model to read patterns in data rather than jump to a tidy conclusion, chain of thought keeps the analysis honest by walking it through the same steps a careful analyst would. A dependable structure moves from observation to context to pattern to cause to implication:

  • Present the dataset or a summary of it.
  • Observe what stands out first.
  • Add the context: benchmarks, history, anything relevant.
  • Identify the trends or anomalies in the numbers.
  • Suggest what might be causing them.
  • Spell out what it means for the decision at hand.

The discipline here is forcing the model to earn its conclusion. Without the steps, a model will happily assert that revenue is down because of a pricing change. With them, it has to observe the drop, check it against last year, name the actual pattern, and only then propose a cause, which makes the leap to "it was pricing" something you can inspect and challenge. Adapt the number of steps and the language to your field, and the same shape holds.

Applying chain of thought in your organisation

Getting value from this across a business means treating it as a capability to build, not a clever prompt someone shares in a chat channel. The teams that get the most from it pick the right use cases, grow real internal skill, and fold the technique into the tools people already use. The ones that get the least scatter random experiments across departments and wonder why nothing sticks.

Start with the high-value cases

Aim your first efforts where wrong reasoning is expensive. Look for the places your people already spend time double-checking AI outputs, chasing down errors, or explaining decisions to someone who needs convincing. Customer service teams untangling complex queries, analysts weighing investment scenarios, compliance officers reading regulatory requirements, all of them feel the benefit of visible reasoning quickly. Adoption comes easier when the value is plain to the people doing the work.

Give priority to cases owned by subject-matter experts who can judge whether the reasoning holds up. A legal team can tell you whether a step-by-step contract analysis follows sound principles. Your analysts can check whether the statistical reasoning actually progresses. That expert eye is how you refine prompts and build confidence before you push the technique into less supervised corners of the business.

Build internal skill

Teaching people to write good chain of thought prompts takes hands-on practice with real problems, not another slide deck. What works is a workshop where teams write prompts for their own use cases, test them on real data, and iterate on what comes back. Teach people to recognise when the technique earns its place and when it does not, because not every task needs elaborate reasoning. Plenty of straightforward queries run perfectly well on a plain prompt, and time spent over-engineering those is time wasted.

Fit it into existing workflows

Your prompts have to live inside the tools people already open, not in a separate app nobody remembers to use. Embed the reasoning into the CRM, the analysis platform, the internal knowledge base, wherever the decisions actually get made. The technical wiring matters less than making sure the reasoning shows up in the right place, in a format that matches how your people work.

Governance becomes real once you scale. You want standards for prompt versioning, a way to validate reasoning, and clear ownership of who maintains which prompts. Skip that and you drift into prompt sprawl, where a dozen near-identical versions float around different teams with no shared record of what actually works best. It is the same lesson we see everywhere in data work: the technique is only as reliable as the foundation you run it on.

Where to start

Chain of thought prompting is one of the highest-return changes you can make to how you work with language models, and one of the cheapest to try. It lifts accuracy on hard tasks, and just as usefully it makes the reasoning something you can read, check, and defend. Pick a variant that fits your problem, format the output so you can actually use it, and start with a use case where getting the reasoning wrong genuinely costs something.

Where implementations stall, the cause is usually underneath the prompt rather than in it: shaky data foundations, fuzzy use cases, no agreement on what the AI is actually for. That is the work we do. If you want to move past experimental pilots into AI features that hold up in production, talk to us and we will give you a straight read on what your foundation needs first.

Start at your core.

Tell us where your data is today and what you want AI to do. We will come back with a straight answer on what your foundation needs and where the quickest real win is.

Talk to us