skip to content

How do you keep chain-of-thought reasoning out of the user-facing answer?

level: juniorimportance: should knowfreq 58%

answer

  1. reasoning still runs, just not shown
  2. two sections, one delimiter each
  3. order: reasoning first, answer last
  4. strip at render, log for QA
  5. fail closed when the delimiter is missing

basics

~20 s

Ask for reasoning inside one delimiter and the final answer inside another, then strip the reasoning before display. It is still generated and can be logged for review — hiding it is a rendering step, not a prompt shortcut.

solid answer

~50 s

Structure the output as a two-part contract in a single response: a delimited reasoning section first, then a delimited answer section. Order matters — the answer must come **after** the reasoning, otherwise the model commits to a result before any reasoning tokens exist and the reasoning becomes a post-hoc rationalisation. Downstream code extracts only the answer block, and should fail closed if that block is missing rather than shipping the raw text, which would leak the reasoning verbatim. The hidden section is still generated, so it is billed and it adds latency; budget for it and cap it with a length instruction. Keeping it is often useful — a QA sample of hidden reasoning is the cheapest way to see *why* the system got something wrong — but it restates user input, so it inherits the same retention, access and redaction rules as the reply itself.

code

markdown · 10 lines
markdown
Classify the message below as ALLOW or BLOCK.

First reason inside <scratch> tags: list the policy clauses that could apply,
then judge each one. Keep it under 80 words.
Then output the verdict inside <verdict> tags, with no other text inside them.

<scratch>your reasoning</scratch>
<verdict>ALLOW or BLOCK</verdict>

Message: {{message}}

go deeper

for a junior

Be ready to sketch a prompt with a reasoning section and an answer section and say plainly that your code renders only the second. Do not propose dropping the reasoning to make the reply shorter.

for a middle

Explain why the answer must come after the reasoning, how you delimit and extract it, and exactly what your parser does when the answer block is missing.

for a senior

Show the operational side: hidden tokens are billed and add latency, the reasoning is sampled for QA, and it inherits the same retention and privacy rules as the reply.

for a principal

Own the contract across the system — one output shape regardless of model or branch, a stated retention policy for hidden reasoning, and a deliberate decision about whether any user or auditor ever sees a rendered rationale.

## What the question is really about Chain-of-thought only helps because the model generates intermediate text before committing to an answer; those tokens condition what comes next. That creates a product problem: the thing that makes the answer better is exactly the thing you usually do not want a customer to read. A moderation verdict, a pricing decision or a support reply should arrive as a clean result, not as a paragraph of the model second-guessing itself. So the requirement is *generate but do not display*, and the mistake to avoid is *do not generate*. ## The two-section contract The standard shape is one response containing two clearly delimited sections. A delimiter is any unambiguous marker the model can reproduce and your code can search for — an XML-style tag pair, a fenced block, a rare sentinel line. Reasoning goes first, the answer goes last, and the instruction says explicitly that nothing but the answer may appear inside the answer delimiter. Why that order is non-negotiable: an autoregressive model produces tokens left to right. If the verdict is emitted first, the deliberation that follows cannot influence it; the model then writes a defence of a choice it has already made. That reads convincingly and is empirically no better than answering with no reasoning at all — sometimes worse, because a wrong answer arrives wrapped in a plausible justification that makes review harder. ## Parsing it reliably Extraction should be exact and fail closed: - Search for the answer delimiter specifically. Do not fall back to "take the last line" or "take everything after the last blank line" — on a malformed response those fall back to the reasoning text and leak it to the user. - Constrain the answer's *shape* as well as its position when you can (a label from a fixed set, a number, a short JSON object). That turns a parse failure into an obvious validation failure instead of a silently wrong value. - On a miss, retry once with the format restated, then fall back to a safe default or route to a human. Never render unparsed output. - Track the miss rate as a metric. A rising rate is usually the first visible sign that the prompt drifted, the input got longer, or the model version changed. Some providers return deliberation on a separate channel from the visible answer, which removes the parsing problem entirely for that provider — but the design decision is the same, and a prompt-level contract is what keeps the behaviour portable when it is not available. ## The costs people forget Hidden reasoning is not free on any axis: - **Tokens.** Generated output is billed whether or not it is shown. A reasoning block that triples output length triples the output cost of every request that uses it. - **Latency.** The user waits for the reasoning to finish before the answer exists. If the interface streams, the visible part cannot begin until the reasoning section closes, so time-to-first-useful-token gets worse even though total wall time only grew moderately. - **Length control.** Without an explicit cap ("under 80 words", "at most five bullets") reasoning sections grow over time as prompts get edited, and cost grows with them silently. A practical mitigation is to ask for *brief* reasoning. On classification-shaped work, a short structured deliberation — name the applicable rules, judge each — often captures most of the accuracy benefit at a fraction of the tokens of an open-ended narration. ## Retention and privacy Teams routinely log the hidden section for quality sampling, and that is a genuinely good practice: it is the only artefact that explains a bad output. But it is user data. It quotes the input, often verbatim, and it can contain speculation about the person that you would never render — inferred intent, guessed circumstances, tentative accusations. Treat it with the same retention window, access controls, redaction and deletion behaviour as the conversation itself, and do not pipe it into a support tool with weaker access rules than the message store. ## What good looks like A reviewer wants to hear: reasoning first inside a delimiter, answer last inside its own delimiter, strict extraction that fails closed, a length cap on the reasoning, and an explicit decision about whether the hidden text is logged and under what policy. If the interviewer pushes on cost, the honest answer is that hiding changes nothing about billing or latency — it changes only what the user sees.

  • What goes wrong if you ask for the answer first and the explanation afterwards?
    The answer is produced before any reasoning tokens exist, so the explanation cannot influence it — it is a post-hoc rationalisation. Accuracy is about the same as answering directly, and a wrong answer now arrives wrapped in a convincing defence, which makes review harder rather than easier. If reasoning is meant to change the result, it has to be generated first.
  • You keep the hidden reasoning for QA sampling — what does that oblige you to do?
    Treat it as user data. It restates the input, often verbatim, and can contain speculation about the person that you would never show them. It inherits the same retention window, access control, redaction and deletion rules as the reply, and it must not land in a tool whose access rules are weaker than the conversation store's.
  • How should the parser behave when the answer delimiter is missing?
    Fail closed. Never fall back to shipping the raw text, because that leaks the reasoning verbatim. Retry once with the format restated; if it fails again, return a safe default or route to a human. Track the miss rate — a rise usually means the prompt, the input length or the model changed.

It is scratch paper: the working happens on the sheet, only the boxed final line is handed in — and the sheet is kept in the folder, not thrown away.

saying these in an interview costs you the question

  • Telling the model to skip the reasoning to keep the reply short
  • Putting the final answer before the reasoning in the output
  • Assuming hidden reasoning is free because nobody sees it
  • Falling back to raw output when the delimiter is missing
  • Treating logged reasoning as exempt from retention and privacy rules

context