# Chain-of-thought

> Chain-of-thought is a technique in which a language model works through a problem in explicit intermediate steps before giving its final answer, which tends to improve accuracy on tasks that need several stages of reasoning.

Also called: chain of thought, CoT, step-by-step reasoning, think step by step, reasoning traces. Category: Models and training. Source: https://aibuildindex.com/glossary/chain-of-thought

## In the index

- Prompt engineering: median $3,600, middle half $600 to $11,200, 1,367 priced briefs (https://aibuildindex.com/skills/prompt-engineering)
- Large language models: median $4,720, middle half $1,000 to $16,000, 605 priced briefs (https://aibuildindex.com/skills/large-language-models)

People make fewer mistakes on multi-step problems when they write out their working, and language models turn out to behave similarly. Chain-of-thought asks the model to reason step by step before committing to an answer. It began as a prompting technique, sometimes as simple as adding "think step by step" to a question, and the same idea is now built into [reasoning models](https://aibuildindex.com/glossary/reasoning-model). For business builds, it matters wherever a task involves conditions, calculations or comparisons rather than a single lookup.

## How it works

There are several ways to get chain-of-thought behaviour:

- **Instruction.** The prompt asks the model to reason through the problem before answering.
- **Worked examples.** [Few-shot prompting](https://aibuildindex.com/glossary/few-shot-prompting) with examples that show the reasoning, so the model copies the pattern.
- **Structured steps.** The prompt names the steps explicitly, for example: identify the customer's plan, check the eligibility rules, then decide.
- **Built-in reasoning.** Reasoning models generate this working automatically, sometimes hidden from the user.

In production, the reasoning is usually kept separate from the final answer. Software extracts only the conclusion, often as [structured output](https://aibuildindex.com/glossary/structured-output), while the reasoning is logged for review or discarded.

An insurance claims build illustrates the gain. Asked directly whether a claim is covered, a model may give a confident but wrong yes. Asked to list the relevant policy clauses, check each condition against the claim details and then decide, it is more likely to spot the exclusion that applies, and the logged reasoning shows a reviewer why it decided.

## What it means for cost

Chain-of-thought trades running cost and speed for accuracy. The extra reasoning text is generated and billed as output tokens, which are usually the more expensive kind, and it makes responses slower. On simple tasks it adds cost with no benefit.

Used selectively, it can save money elsewhere by catching errors that would otherwise need human review. Ask a builder which steps use step-by-step reasoning, whether the reasoning is logged for auditing, and how they measured its effect on accuracy for your tasks.

## Common questions

### Does chain-of-thought show how the model really reached its answer?

Not reliably. The written reasoning is generated text and may not reflect the model's internal process exactly. It is useful for spotting mistakes but should not be treated as a guaranteed explanation.

### Should customers see the model's reasoning?

Usually not. Raw reasoning can be long, confusing or include discarded ideas. Most builds show a short explanation or citation instead and keep the full reasoning in logs.

### Is chain-of-thought still needed with reasoning models?

Less often as a prompt technique, since reasoning models do it themselves. Explicitly naming the steps a business process requires can still help, because it encodes the company's own rules into the reasoning.

## Related terms

- [Reasoning model](https://aibuildindex.com/glossary/reasoning-model): A reasoning model is a language model trained to work through a problem in intermediate steps before giving its final answer, which improves results on complex tasks such as analysis, maths, planning and coding at the cost of speed and usage.
- [Prompt engineering](https://aibuildindex.com/glossary/prompt-engineering): Prompt engineering is the practice of designing, testing and refining the instructions, context and examples given to an AI model so that it produces accurate, consistent and correctly formatted output for a specific task.
- [Few-shot prompting](https://aibuildindex.com/glossary/few-shot-prompting): Few-shot prompting is a technique in which a prompt includes a small number of worked examples of the task, showing inputs and the desired outputs, so the model can follow the pattern without any retraining.
- [Prompt](https://aibuildindex.com/glossary/prompt): A prompt is the input given to an AI model to tell it what to do, typically instructions, context, examples and the user's request, from which the model generates its response.
- [Hallucination](https://aibuildindex.com/glossary/hallucination): A hallucination is output from an AI model that sounds plausible but is false, unsupported or invented, such as a made-up fact, citation, figure or policy presented with the same confidence as a correct answer.
