Back to Blog
ReasoningPromptingLLMs

What is Chain‑of‑Thought (CoT)

A practical, opinionated guide to chain‑of‑thought prompting: what it is, how self‑consistency decoding works, when long reasoning helps, and when you should keep models terse and tool‑driven.

Paweł Brzuszkiewicz

Paweł Brzuszkiewicz

PractiqAI Team

PractiqAI spark icon

If a prompt is your specification to an AI model, then chain‑of‑thought (CoT) is you saying:

“Don’t just give me the conclusion - show me how you got there.”

In the “What Is a Prompt?” article we treated prompts as structured instructions: task, constraints, context, examples, output spec. CoT is one more dimension on top of that: do you want the model to reason out loud, or silently and just hand you the answer?

Modern models are strongly biased toward “thinking in text”. Research starting with Chain‑of‑Thought Prompting Elicits Reasoning in Large Language Models showed that asking for intermediate reasoning steps can drastically improve performance on math, logic, and multi‑step problems - especially at large scale. (arXiv) But like any powerful technique, it comes with trade‑offs: latency, cost, verbosity, and sometimes safety issues.

This guide is here to make CoT practical:

  • What CoT actually is (in plain language),
  • Why self‑consistency decoding works,
  • Where CoT shines and where it quietly sets things on fire,
  • How to evaluate CoT vs. no‑CoT on your task,
  • Implementation patterns and a “do this, not that” cheatsheet.

And because this is PractiqAI, we’ll also connect CoT to real tasks with judges and certificates, not just toy examples.


CoT in plain language

Think of CoT as “show your work” for language models.

  • No CoT: “What is 27 × 14?” → “378.”

  • With CoT: “What is 27 × 14? Think step by step.”“First compute 27 × 10 = 270. Then 27 × 4 = 108. Add them to get 270 + 108 = 378. So the answer is 378.”

The model was always generating some internal representation; CoT just asks it to externalize a human‑legible reasoning trace.

A typical CoT‑style prompt looks like this:

prompt
You are good at step-by-step reasoning.
 
Question: A box contains 5 red balls and 7 blue balls.
If you randomly pick 2 balls without replacement,
what is the probability they are both red?
 
Think through the solution step by step in natural language.
Then give the final answer as a simplified fraction
on the last line, prefixed with "Answer:".

Two important ideas:

  1. CoT ≠ magic phrase. Early results used “Let’s think step by step” as a magic incantation, but the real win is:
  • You demand intermediate steps,
  • You shape how they are written and how the final answer appears.
  1. CoT is about structure, not length. A paragraph of coherent steps can beat a page of rambling. You care that the reasoning mirrors the structure of the problem (subproblems → intermediate results → conclusion).

In practice, you’ll meet three flavors:

  • Implicit CoT – model reasons internally, you see only the final answer (common in production APIs).
  • Explicit CoT – you ask for reasoning and show it to the user (“Explain your answer”).
  • Hidden CoT – you let the model reason in one call, then summarize or strip the rationale before showing anything user‑facing.

This article focuses on explicit and hidden CoT, because that’s where your prompting choices matter most.


Self‑Consistency decoding (why it helps)

Once you start using CoT, you notice something interesting:

  • Sometimes the model produces a beautiful chain of reasoning… and the final answer is still wrong.
  • Other times it takes a different path and gets the right answer.

The paper Self‑Consistency Improves Chain of Thought Reasoning in Language Models attacks this problem with a clever decoding trick. (arXiv)

The core idea

Instead of:

  1. Generate one CoT sample with greedy or low‑temperature decoding.
  2. Take its final answer.

You do:

  1. Generate many CoT samples with higher temperature (e.g. 5–20 reasoning traces).
  2. Extract the final answers from each trace.
  3. Pick the answer that appears most often (majority vote, or a small re‑scoring model).

Why this works:

  • Many problems admit multiple correct reasoning paths but a single correct final answer.
  • Wrong answers often require specific mistakes; those mistakes are relatively rare in the model’s distribution.
  • By sampling diversely and voting, you average out idiosyncratic errors in any one reasoning chain.

The authors show large gains on math and reasoning benchmarks: on GSM8K, self‑consistency improves CoT accuracy by double‑digit percentages compared to greedy CoT. (arXiv)

Intuition with a toy example

Imagine you ask 10 equally smart people to solve a puzzle independently:

  • 7 say “42”, each with slightly different reasoning.
  • 3 say other numbers.

You’d feel comfortable betting on 42, even if you didn’t inspect every explanation.

Self‑consistency turns the model into this little panel of alternate selves, each thinking slightly differently because of temperature sampling. The majority answer becomes a good heuristic for truth.

Rough pseudo‑implementation

Here’s what self‑consistency looks like in a pipeline:

pseudo
for i in 1..N:
  response_i = call_model(prompt_with_CoT, temperature=0.7)
  reason_i, answer_i = split_reasoning_and_final(response_i)
answers = [answer_1, ..., answer_N]
majority_answer = most_frequent(answers)
 
# Optional: ask the model to pick the "best" reasoning among those
# that lead to majority_answer
best_reason = select_best_reasoning(responses, majority_answer)
 
return format_output(best_reason, majority_answer)

You pay N times the cost and latency, but often get a big jump in correctness - especially for mathy, puzzle‑like tasks.


Risks: verbosity, leakage, latency

If CoT was free, you’d just enable it everywhere. It isn’t.

Three big failure modes show up quickly in real systems.

1. Verbosity and token blow‑ups

Every extra reasoning token is:

  • Money (you’re billed by tokens),
  • Latency (responses stream slower),
  • Context budget (less room for your documents, examples, and user history).

On a small problem:

  • No‑CoT answer: ~10 tokens.
  • CoT answer: 200 tokens of explanation + 10 tokens of final result.

On a big pipeline with thousands of daily calls, that 20× factor matters. If you stack self‑consistency on top (say, 10 samples × 200 tokens each), you get a 200× jump in infer‑time tokens for essentially the same UI‑visible answer.

This is why many production teams treat CoT as a debugging or “power mode” feature rather than the default.

2. Information leakage

CoT invites the model to spell out intermediate reasoning. That’s great for transparency… but:

  • On moderation/safety tasks, CoT might repeat harmful content in the explanation (“Step 1: restate the user’s bomb recipe…”).
  • On private/regulated data, CoT might regurgitate names, IDs, or internal policies as part of its reasoning.
  • In evaluation setups, CoT can unintentionally leak the label or ground‑truth signal if you later reuse the traces for supervised tuning.

If those traces are logged, stored, or later used for training, your reasoning text becomes a data governance problem.

Hidden cost of great explanations

The more detailed and specific the reasoning, the more likely it contains sensitive or policy‑relevant content. Treat CoT logs as high‑sensitivity data.

3. Latency and UX

Even if you don’t care about money, your users care about waiting.

CoT usually implies:

  • Longer generations,
  • Fewer tokens per second (models sometimes slow down on long, structured outputs),
  • And with self‑consistency, multiple sequential calls.

On a chat‑like interface, the difference between:

  • “Answer in 0.7 seconds” and
  • “Answer in 4.2 seconds”

is the difference between “this feels snappy” and “this feels sluggish”.

That trade‑off is sometimes worth it. But you should make it intentionally, not because you copy‑pasted “Let’s think step by step” from Twitter.


Alternatives: concise rationales, tool‑use

Good news: CoT is not all‑or‑nothing. You have knobs.

Concise rationales

You can ask for just enough reasoning to:

  • Debug when things go wrong,
  • Provide a short user explanation,
  • Feed a judge model.

Patterns:

prompt
Solve the problem and give a SHORT explanation (1–2 sentences)
before the final answer.
 
Format:
Explanation: <one or two sentences>
Answer: <final answer only>

or, even stricter:

prompt
Think about the problem internally.
Then respond with:
 
Reason: <max 30 words>
Answer: <final answer>

The goal is to bound the token cost while still getting interpretability and an anchor for automated evaluation.

Tool‑use instead of more words

The ReAct and Tree‑of‑Thoughts (ToT) families generalize CoT by interleaving reasoning with actions - like calling a calculator, searching the web, or writing code. (arXiv)

  • ReAct: the model alternates “Thought:” and “Action:” steps, using tools and then updating its plan.
  • ToT: you explore a tree of partial thoughts, branching on promising directions and backtracking when something looks bad.

In both cases, the model still “thinks in text”, but:

  • It doesn’t rely only on its parametric memory,
  • It uses tools to offload exact computation and retrieval,
  • You can aggressively truncate or hide the reasoning in the final user‑facing output.

For many real‑world tasks, “short rationale + tool calls” beats “long freeform CoT” on both correctness and safety.


When CoT shines (math, logic, multi‑step tasks)

So when should you lean into rich CoT and maybe even self‑consistency?

1. Multi‑step math and symbolic reasoning

This is the canonical CoT use case. The Wei et al. paper shows big gains on benchmarks like GSM8K (grade‑school math word problems), SVAMP, and other arithmetic datasets, especially for large models. (arXiv)

Why it works:

  • Problems naturally decompose into steps.
  • Each step depends on the previous ones.
  • The model benefits from spelling out these intermediate states.

Any time you see: “First compute… then plug that into… then compare…”, CoT is your friend.

2. Logic puzzles and brainteasers

Tasks like:

  • Truth‑telling/lying puzzles,
  • Temporal ordering (“who arrived first?”),
  • Graph or set reasoning (“who is connected to whom?”),

often require the model to juggle constraints. CoT lets it:

  • State assumptions,
  • Derive implications,
  • Eliminate inconsistent options.

It’s very similar to how a human would scribble notes in the margins of a puzzle book.

3. Multi‑hop question answering

For questions like:

“Which author wrote more books: the person who wrote X or the person who wrote Y?”

a good CoT trace might:

  1. Identify who wrote X and Y,
  2. Look up their bibliographies (with tools),
  3. Count or approximate counts,
  4. Compare and decide.

Here, CoT often works best combined with retrieval (RAG) or web tools. If your system already pulls in relevant documents, CoT helps the model stitch them together.

4. Teaching and tutoring modes

If your product is meant to teach, CoT is a feature: users want to see the steps.

In a PractiqAI‑style task, you might:

  • Ask the model to solve a math or coding problem with CoT,
  • Then ask another prompt to rewrite that reasoning as a compact “teacher explanation”,
  • Use a judge model to check correctness of both solution and explanation.

In other words, rich CoT is ideal whenever:

  • Intermediate states matter, and
  • You or the user benefit from seeing those states.

When to keep it minimal (policy, safety, classification)

There are whole classes of tasks where explicit CoT is either unnecessary or actively risky.

1. Safety and moderation

For content classification like:

  • “Does this violate policy X?”
  • “Does this contain hate speech?”
  • “Is this prompt asking for a bomb recipe?”

you usually want yes/no/label + maybe a short justification, not a detailed re‑enactment.

If you enable full CoT, the model might:

  • Reproduce slurs and violent details in the reasoning,
  • Elaborate on policy‑breaking content while analyzing it,
  • Create logs full of things you didn’t want any human to read.

Instead, aim for:

prompt
Classify the user message according to the policy below.
 
1) Think through the decision internally.
2) Respond with:
- verdict: one of ["allow","block","escalate"]
- reason_short: max 25 words, referencing policy section IDs only
 
Do NOT quote or restate offensive or harmful text in your explanation.

You’re telling the model: “Yes, reason carefully - but don’t show that reasoning in full, and don’t amplify the harm.”

2. Compliance, HR, high‑stakes decisions

In areas like:

  • Hiring,
  • Credit / insurance screening,
  • Legal/compliance triage,

huge CoT dumps can backfire:

  • They may contain hallucinated justifications that lawyers or regulators later treat as real.
  • They expand the surface area for bias (“the model rambled into something discriminatory in paragraph 7…”).
  • They’re harder to audit and explain.

A better pattern is:

  • Keep model output tight and structured (labels + short references to guidelines),
  • Maintain separate documentation of your decision policy,
  • Use hidden CoT internally if needed - but don’t let the model freestyle long legal rationales.

3. Simple classification and extraction

If your task is:

  • Extracting fields from a form,
  • Classifying sentiment,
  • Detecting language,

you almost never need verbose reasoning. It just burns tokens.

For these, think in terms of:

  • “Answer only in JSON,”
  • “No explanation unless I explicitly request debug mode,”
  • “Short rationale behind a feature flag.”

Sampling strategies & costs

CoT interacts strongly with your decoding settings. A few practical heuristics:

Temperature and diversity

  • Deterministic CoT (temperature ≈ 0):

  • Pros: stable, reproducible traces, good for logs and debugging.

  • Cons: if the model falls into a bad reasoning pattern, it will repeat it.

  • Moderate temperature (0.5–0.8) for self‑consistency:

  • Pros: more diverse reasoning paths, crucial for majority voting.

  • Cons: each individual trace might look a bit more “creative” or messy.

A common pattern:

  • Dev mode / offline eval: temperature ~0.7, sample N traces → self‑consistency.
  • Production high‑volume: temperature ~0, 1 trace, CoT off or minimal.

Max tokens and budget

For CoT, max_tokens is not just a safety cap; it shapes reasoning style:

  • Too low → model truncates mid‑reasoning or mid‑sentence.
  • Too high → model may ramble.

If you know a task should fit into ~10 steps, you can:

prompt
Solve the problem in at most 8 numbered steps.
Each step must be a single short sentence.
Then output "Answer: <...>" on the last line.

This gives you a crude but effective bound on generation length.

Cost arithmetic (back‑of‑the‑envelope)

You don’t need exact pricing to see the shape:

  • Let C = cost per 1M tokens.
  • No‑CoT: ~50 tokens per query → cost ≈ 50 * C / 1,000,000.
  • CoT: ~400 tokens per query → 8×.
  • Self‑consistency with 10 samples: 4,000 tokens → 80×.

The actual C depends on the model and provider and changes over time, but the multiplier is the key. Self‑consistency is not free accuracy; it’s paid for in tokens.


Eval CoT vs. no‑CoT on your task

CoT is not universally better. You should treat it as a hypothesis to test, not a religion.

Here’s a simple evaluation workflow you can mirror in PractiqAI‑style tasks or your own pipelines.

Step 1: Define what “better” means

Pick metrics that matter:

  • Accuracy (or F1, BLEU, etc.) on labeled data,
  • Latency (p95 response time),
  • Token cost per request,
  • Optional: user satisfaction or expert ratings.

For some tasks, “slightly lower accuracy but 10× cheaper” might be a win.

Step 2: Create prompt variants

At minimum:

  1. Baseline – no explicit reasoning:
prompt
Answer the following question.
Return only the final answer, nothing else.
  1. Explicit CoT – visible reasoning:
prompt
Solve the problem step by step.
Show your reasoning.
Then give the final answer on the last line, prefixed with "Answer:".
  1. Minimal rationale – short explanation:
prompt
Solve the problem.
Output:
Explanation: <max 20 words>
Answer: <final answer>
  1. Optionally, CoT + self‑consistency for hard tasks.

Step 3: Run a small offline experiment

Use a few dozen to a few hundred examples:

  • Run all examples through each prompt variant.

  • Collect outputs, timing, and token counts.

  • Score accuracy with:

  • Exact match for simple tasks,

  • Heuristics or a judge model for more complex tasks. (This matches the PractiqAI pattern where a separate model verifies correctness.)

Step 4: Compare and choose

Look for:

  • Does CoT deliver meaningful accuracy gains?
  • Are those gains worth the extra cost and latency?
  • Can you get most of the gain with minimal rationales instead of full essays?

You might end up with a hybrid policy:

  • CoT off for easy / high‑volume traffic.
  • CoT on for hard / ambiguous cases, or when a judge model signals low confidence.
  • Self‑consistency only on a small percentage of most important or hardest tasks.

Implementation patterns

Let’s make this concrete with some patterns you can adapt.

1) CoT for debugging and prompt design

During development, turn CoT on to see how the model thinks.

prompt
You are a careful problem solver.
 
For each question:
1) Restate the question in your own words.
2) List the key facts and numbers.
3) Solve step by step.
4) Give the final answer on the last line, prefixed with "Answer:".
 
Question: <insert here>

Use this to:

  • Spot where the model gets confused,
  • Adjust your problem statements or context,
  • Decide which steps could be replaced by tools (e.g. “this part should be a calculator”).

Once you’re happy, you can move to hidden CoT or no‑CoT in production.

2) Hidden CoT + answer summarization

Pattern:

  1. Call the model with a CoT‑heavy system/user prompt.

  2. Get a long reasoning trace.

  3. Call the model again with:

prompt
You will receive a reasoning trace and a final answer.
Do NOT change the answer.
Summarize the reasoning in at most 2 short sentences,
suitable for a non-technical user.
 
Reasoning:
<paste chain of thought here>
  1. Show only the summary + final answer to the user.

  2. Keep the full CoT in logs only if you’re comfortable with its privacy/safety implications.

This gives you the performance benefits of CoT while controlling what users see.

3) ReAct / ToT style reasoning with tools

For complex problems needing search or calculation, adopt a ReAct‑like format:

prompt
You can use tools by writing lines that start with "Action: <tool>(<arguments>)".
After each action, I will reply with "Observation: <result>".
 
Solve the user's question by alternating between:
Thought: <what you are thinking>
Action: <tool call or "finish">
 
Be concise in your thoughts. When you are done, output:
Final Answer: <your answer here>

Tools might include:

  • search(query),
  • calculator(expression),
  • code_run(snippet).

This merges CoT with explicit actions, and is closer to what Tree‑of‑Thoughts does with structured exploration. (arXiv)

4) CoT‑guided judges

For evaluation tasks (like in PractiqAI courses), a judge model can itself use CoT:

prompt
You are evaluating whether the assistant's answer solves the user's task.
 
1) Read the task.
2) Read the assistant's answer.
3) Think step by step through whether all requirements are met.
4) Then output ONLY this JSON:
 
{
  "score": <0 to 1 in steps of 0.1>,
  "verdict": "<pass|fail>",
  "feedback": "<max 50 words of constructive advice>"
}

The judge’s internal reasoning helps it catch edge cases; the JSON keeps things automatable.


“Do this, not that” cheatsheet

You don’t need to memorize all of this. Here’s a quick mental model:

  • DO use rich CoT:

  • For math, puzzles, symbolic logic, multi‑hop QA.

  • When you’re debugging prompts or building new workflows.

  • For teaching/tutoring experiences where steps matter.

  • DON’T default to CoT:

  • For simple classification, extraction, and transformation.

  • In high‑volume, latency‑sensitive endpoints.

  • Where long reasoning adds cost but not clarity.

  • DO restrict or hide CoT:

  • For safety, moderation, and harmful‑content tasks.

  • In compliance / HR / regulated flows.

  • When logs contain sensitive user data.

  • DON’T forget the cost multipliers:

  • Self‑consistency ≈ CoT × N in tokens.

  • CoT itself can be 5–20× more tokens than a bare answer.

  • DO evaluate CoT vs. no‑CoT on your own data:

  • A/B prompts, measure accuracy + latency + cost.

  • Use judge models and concise rationales.

  • Keep what works; discard the rest.

  • DON’T treat “Let’s think step by step” as a magic spell:

  • CoT is about structured intermediate steps,

  • Shaped by your prompt, context, tools, and decoding strategy.


Where to go next

If you want to go deeper into the theory and experiments behind CoT, self‑consistency, and structured reasoning, start with:

  • Chain‑of‑Thought Prompting Elicits Reasoning in Large Language Models (Wei et al.) – the foundational CoT paper with math and logic benchmarks. (arXiv)
  • Self‑Consistency Improves Chain of Thought Reasoning in Language Models (Wang et al.) – the decoding strategy that ensembles multiple reasoning traces. (arXiv)
  • ReAct: Synergizing Reasoning and Acting in Language Models (Yao et al.) – CoT plus tool‑use in an interleaved trajectory. (arXiv)
  • Tree of Thoughts: Deliberate Problem Solving with Large Language Models (Yao et al.) – generalizes CoT to tree search over “thoughts”. (arXiv)

Then, turn theory into skill:

  • Take a PractiqAI course where you have to design prompts that elicit the right kind of reasoning for specific job‑like tasks, and a judge model checks your work.
  • Compare full CoT, minimal rationales, and tool‑augmented reasoning on the same tasks.
  • Build your own little “CoT policy”: when to use it, how much, and with which sampling setup.

CoT is not about making models sound “smart” - it’s about making their reasoning process work for you, not against you. Use it deliberately, measure its impact, and let the numbers (and your logs) tell you when to stop explaining and just answer.

Paweł Brzuszkiewicz

Paweł Brzuszkiewicz

PractiqAI Team

PractiqAI designs guided drills and feedback loops that make learning with AI feel like muscle memory training. Follow along for product notes and workflow ideas from the team.

Ready to make AI practice part of your routine?

Explore interactive drills, daily streaks, and certification paths built by the PractiqAI team.

Explore courses

Article snapshot

Why read: What is Chain‑of‑Thought (CoT)

A practical, opinionated guide to chain‑of‑thought prompting: what it is, how self‑consistency decoding works, when long reasoning helps, and when you should keep models terse and tool‑driven.

What is Chain‑of‑Thought (CoT)ReasoningPromptingLLMsPractiqAI blog article

Reading time

19 min read

Published

2025-12-08

Practical takeaways

Built for operators who want actionable next steps—not just theory—so you can test ideas immediately.

What it covers

Reasoning, Prompting, LLMs

Structured navigation

Use the table of contents to jump between key sections and return to examples faster.

Apply with PractiqAI

Pick a course or task after reading to reinforce the ideas with real prompts and AI feedback.

Keep learning

Apply this article inside a course

Choose a path that reinforces the tactics you just read about.

Quick drills

Practice what you just learned

These tasks are perfect for pressure-testing the frameworks from this post.

Explore more

Where to go after this story

Stay close to product updates and pricing so you never miss a launch.