Reasoning Models: Thinking Mechanisms and Turn-Level Control in Practice
This article explains how to control "thinking" in reasoning large language models. It covers three mechanisms that answer three questions: interleaved thinking, which decides when to think; preserved thinking, which decides whether to carry reasoning forward across turns; and turn-level thinking, which decides how deeply to think. Each mechanism is explained alongside its trade-offs in cost and latency. The article also includes conceptual configuration and code examples, plus practical tips for tuning reasoning effort per turn, managing context in long agent flows, and tracking quality and cost in production.
1. Why Reasoning Models Need a “Thinking” Mechanism
What sets reasoning-focused large language models apart from ordinary chat models is that they run an internal reasoning process, often called “thinking” or a “chain of thought”, before producing the final answer. This explicit step-by-step reasoning substantially improves performance on complex tasks such as mathematics, logic, and coding.
Still, more thinking is not always better:
- Excessively long reasoning adds noticeable latency and hurts the interactive experience.
- Unnecessary reasoning wastes compute and tokens.
- In multi-turn conversations and tool-calling scenarios, unmanaged thinking can pile up redundant context and even break the chain of reasoning across turns.
This raises three core questions for engineering reasoning models: whether to think, how deeply to think, and when to stop. Interleaved thinking, preserved thinking, and turn-level thinking are three mechanisms designed to address these three dimensions respectively.
2. Interleaved Thinking
2.1 Definition and How It Works
Interleaved thinking means that, within a single task, the model alternates between reasoning and producing responses or tool calls. Before every response to the user, and before every tool call, the model runs a round of reasoning.
Its main benefits are:
- Tool-call decisions rest on the latest reasoning rather than a one-time plan that is then executed blindly.
- In multi-step agent workflows, the strategy at each step can adapt to the outcome of the previous step.
- It substantially improves robustness on complex tasks, especially automation scenarios that need to “think while doing”.
2.2 How It Differs from One-Shot Reasoning
In the conventional model, the model runs a long round of reasoning at the start of a task and then emits several actions in a row. Interleaved thinking slices the reasoning across the individual action points, forming a “think → act → observe → think again” loop. This mirrors the classic agent paradigm (the ReAct loop) and is closer to how people actually solve problems.
2.3 Typical Flow
User request└─ Thinking (1)├─ Response / tool call (1)│ └─ Tool returns result├─ Thinking (2) ← re-reasoning based on the tool result│ ├─ Response / tool call (2)│ └─ ...└─ Thinking (n) → Final answer
3. Preserved Thinking
3.1 The Problem
In long-running scenarios such as coding agents, a single session can involve dozens of turns and many tool calls. Re-deriving the reasoning from scratch in every turn is expensive. It also loses the conclusions and constraints already established in earlier reasoning, which makes the agent’s behavior inconsistent across turns.
3.2 How It Works
Preserved thinking automatically carries earlier thinking blocks over to later steps in scenarios such as coding agents. Later reasoning can then build on that prior context instead of re-deriving everything. This:
- Keeps reasoning continuous and consistent, so key constraints hold throughout the session.
- Reduces wasted tokens from repeated reasoning and lowers the cost of long-running workflows.
- Turns interim conclusions from complex engineering tasks into reusable reasoning assets.
3.3 Caveats
Preserved thinking needs to work together with a context management strategy. When sessions grow long, only the key thinking blocks should be retained, so that the context does not expand indefinitely. In practice, teams usually manage this with techniques such as summary compression and consolidating key conclusions. The aim is to balance continuity against cost.
4. Turn-Level Thinking Control
4.1 Core Idea
Turn-level thinking lets you control the reasoning for each turn within the same session independently. For example, simple turns can think less or not at all, while complex turns can think more. It turns “thinking depth” from a fixed global value into a variable that can be adjusted per turn, which makes it a key lever for fine-grained cost control.
4.2 Example of a Tiered Strategy (Conceptual)
Generic concepts such as “reasoning mode” and “reasoning effort” illustrate the idea. The following configuration is illustrative; refer to the official documentation of the platform you use for the actual parameter names:
{"reasoning": {"mode": "on","effort": "low"}}
Different turns can pass different configurations:
- Simple Q&A turns:
mode=offoreffort=lowfor fast responses and a clear cost reduction. - Moderately complex turns:
effort=mediumto balance quality against latency. - Complex reasoning or code generation turns:
effort=highto trade more reasoning for higher accuracy.
5. Implementation and Code Example
The following is a conceptual call example. All parameters are illustrative and need to be adjusted to the actual platform interface:
def chat_turn(messages, reasoning_mode="on", reasoning_effort="medium",interleaved=True, preserve_thinking=True):payload = {"messages": messages,# Turn-level thinking control"reasoning": {"mode": reasoning_mode, "effort": reasoning_effort},# Interleaved thinking: reason before each response / tool call"interleaved_thinking": interleaved,# Preserved thinking: carry thinking blocks over automatically in agent scenarios"preserve_thinking": preserve_thinking,}return call_model_api(payload)
In real systems, the following are usually needed as well:
- Tool-call loop: Parse the
tool_callsreturned by the model, execute the tools, append the results back tomessages, and start the next round of interleaved thinking. - Thinking block handling: Separate visible answers from internal thinking, and decide whether to return the thinking to the frontend.
- Budget management: Based on latency and cost targets, dynamically adjust
effortand whether preserved thinking is enabled.
6. Best Practices
- Design the thinking policy in tiers. Break sessions into different types of turns and give each type a preset thinking effort. This avoids a one-size-fits-all approach.
- Enable interleaved thinking wherever tool calls are involved. This keeps every tool call grounded in the latest reasoning and cuts down on blind actions and rework.
- Use preserved thinking in long-running workflows, with limits. Combine it with context summarization and consolidation of key conclusions to keep cost and latency under control.
- Make observability a priority. Log per-turn thinking tokens, tool-call counts, and end-to-end latency. Use monitoring and alerting to catch anomalies early.
- Make use of general-purpose cloud services. You can deploy reasoning services on a container platform, use message queues to orchestrate asynchronous tasks, and store session artifacts in object storage. Logging and monitoring services can help track both quality and cost. When evaluating platforms such as Baidu AI Cloud, focus on how well their general-purpose container, messaging, storage, logging, and monitoring products work together.
7. Summary
Interleaved thinking, preserved thinking, and turn-level thinking address three dimensions: when to think, whether to carry reasoning forward, and how deeply to think. Together, they form a complete reasoning control system. For developers, understanding how these mechanisms differ and how they work together is key to balancing quality on complex tasks, response latency, and compute cost. In practice, start with turn-level control, then gradually add interleaved thinking and preserved thinking. Back them up with solid context management and observability, and keep tuning the cost-performance ratio and stability of your reasoning system over time.
