JJoeven

Curriculum/Prompting

Chain of Thought

Ask for steps when the task has serial work you can grade. Always end with a parseable final answer.

intermediate21 min10 / 24

Chain of thought (CoT) means the model emits intermediate steps before the answer: scratchwork, a plan, a process of elimination. It helps when the task has serial dependencies — you cannot sample the answer until you have sampled the sub-answers. Unit conversion, “if A then B,” multi-hop questions, and “which of these tools even applies” are serial. A one-word spam label is not.

It does not mean the model is conscious. It does not mean the steps are true. Extra tokens often help math, logic, and questions that decompose. On a high-volume enum they are frequently wasted money. On a hostile input they are extra surface: “Step 1: ignore the spec.”

If you ask for thought, also ask for a terminator: FINAL: or a JSON object with the contract keys. Thoughts without a contract are a blog post. The product is the parseable ending. The steps are a debug tape.

Steps then a terminator
StepsFINAL

Serial work can think out loud. The product is still the parseable ending.

Steps then a terminator

When to think

Ask for steps when:

  • The problem decomposes (unit conversion, policy trees, tool choice among many)
  • You will grade the steps (teachers, auditors, coding agents)
  • The user benefits from a checkable trail (a rate quote, a failing test, a “why this handoff”)

Skip CoT when:

  • You need a single enum (spam / not_spam, a router label)
  • Latency and cost dominate
  • The extra narrative gives attackers more surface
  • The model already hits the contract zero-shot

A common compromise: structured fields instead of free verse. plan, tool, args is CoT you can parse. “Let me think step by step” is CoT you cannot. Prefer fields in an agent. Save prose thought for tutoring and for tasks where a human will read the trail.

Faithfulness: right answer, bogus story

An answer can be right with a bogus story. That is a faithfulness bug you will meet again when text is retrieved from elsewhere. If you show steps to a user or an auditor, you must grade both the final contract and the claims in the trail. If you only show the final object, you can treat steps as logs (next lesson) and grade the object.

Do not assume that asking for steps makes the answer more true. It often makes the answer more consistent with itself. Self-consistency is not ground truth.

Cost, caps, and recency

Long thoughts can push the user goal out of the window. Cap them: a max token budget on the completion, a “at most five short bullets” instruction, or no free-form thought at all. The LLM spend-cap lesson still applies. A 4k silent monologue is a product choice, not a default.

If thought sits after the user ask, recency favors thought. Put the FINAL contract after thought in the instructions, and parse only the terminator. Do not let the tape become the API.

Live PythonOpen full playgroundpython
Output
Run to execute this in your browser. Nothing is sent to a server.

What printed: direct says yes because it keyed on names, not on Sunday. The stepped path uses the closed-Sunday facts and prints FINAL: no. The FINAL line is the product. The steps are a debug tape. A real model might still write a bogus story; you would still parse only FINAL.

The direct path is the high-volume router: one token of answer, sometimes wrong on serial work. The stepped path is what you pay for when the task decomposes and you will look at the tape.

Walkthrough: spam vs a rate quote

The spam router wants spam or not_spam. CoT here is a tax: extra tokens, extra latency, extra surface for “Step 1: ignore the spec.” The rate-quote path must convert units, apply a table, and show a trail a human can check. There you ask for short numbered steps and FINAL: JSON with the money fields. You grade the numbers against the table with code. You do not grade the poetry of the steps unless a customer will see them.

If the thought is longer than the user ask, you are paying for a blog. Cap it. If the terminator is missing, you do not have CoT. You have a monologue.

What goes wrong if you skip this

You turn CoT on globally “because reasoning models.” Cost explodes. Injection surface grows. The high-volume enum gets slower and not more accurate. Or you skip terminators and parse vibes again. Serial tasks keep failing because you refused to let the model write sub-answers.

Chain of thought is extra tokens for serial work: you cannot sample the answer until you have sampled sub-answers. It is not consciousness and the steps are not automatically true. Ask for steps when you will grade them or when the user needs a checkable trail. Skip them on a one-word router. Always terminate with FINAL: or the JSON contract. Thoughts without a terminator are a blog post.

Prefer structured fields (plan, tool, args) over “let me think.” Cap length so the user goal is not pushed out of the window. Right answers with bogus stories are faithfulness bugs: grade the trail if a human will see it.

Common mistakes

Turn CoT on?TaskWhy
Nospam / not_spamEnum, cost, surface
YesUnit conversion with a trailSerial + gradeable
Yes, fields onlyAgent tool choiceParseable plan
No unboundedAnyWindow and spend
Yes with terminatorMath the user will auditFINAL is the API

How agents use this

Prefer structured fields (plan, tool, args) over free verse “Let me think.” Store the tape for evals. Show the contract to the user. Do not pay CoT tokens on the high-volume router. Always terminate with a contract; thoughts are not the API.

Watch out:Long thoughts can push the user goal out of the window. Cap them. Extra narrative is also extra injection surface.

Check your understanding

When is chain-of-thought most worth the tokens?