Chain of Thought
Razonar antes de responder · Scratchpad
Escrito por Darjus Kazakevic · revisado el
Room to think, in a block you throw away.
A model writes its reply one token (a word piece) at a time. Without help, it picks the first token of the answer before any working exists. Chain of thought gives it room. Ask for the steps before the verdict, and multi-step tasks such as arithmetic, rule checks and multi-hop lookups often improve a lot.
Three limits apply. The written reasoning is not a reliable explanation of why the model answered. On one-step tasks it only adds latency and tokens. And reasoning models (models trained to think internally before they reply) already do this, so asking again mostly adds cost. For them, state the goal and the constraints instead.
En esencia — Reasoning before the answer helps when the task has real steps. Elsewhere it adds latency, tokens and a convincing story.
Cuándo recurrir a él
Recurre a él cuando
- Multi-step work: arithmetic, rule checks, multi-hop lookups
- Classification where a rule must be applied, not just recognized
- Debugging a wrong answer: the working shows where it went wrong
Reconsidéralo cuando
- One-step tasks such as extraction, formatting or translation
- Reasoning models that already think internally: you pay twice
- When users need a trustworthy explanation: this is not one
The parts
- The scratchpad
- A delimited block for the reasoning, such as <thinking>, with the answer outside it. The split keeps the answer easy to parse and lets your code drop the working before display.
- The request
- How you ask for reasoning: one instruction to work it through first (zero-shot), or examples that contain worked steps (few-shot). Examples are stronger and also set the style of the reasoning.
- The order
- Where the working sits. Tokens written after the verdict cannot change it, so the working comes first. In a JSON reply, the reasoning field goes before the verdict field.
Reglas de diseño
- Reason first, answer last
- The order is the mechanism. Reasoning written after the verdict cannot have shaped it. All you get is a more convincing wrong answer.
- Check for built-in reasoning first
- Reasoning models think before they reply, and providers often hide or summarize that thinking. Asking them for step-by-step text adds cost. Give them the goal and the constraints instead.
- Name the steps when you know them
- "List the rules, check each one, then decide" beats "think step by step" on any task with a known method. Use generic wording only when you do not know the method.
- Delimit it and drop it
- Keep the working in its own block so the answer stays parseable. Remove it before display and keep it in logs, where it helps you debug. Never present it to users as an explanation.
Errores habituales
- Showing the scratchpad to users as the reason for a decision
- Turning it on everywhere and paying for it on trivial tasks
- Scripting step-by-step text for a model that already reasons internally