跳转至

推理模式对比 — CoT / ReAct / Interleave / ToT / Self-Consistency

更新日期:2026-04-26

LLM 推理模式从 2022 的 CoT 到 2025 的 interleaved thinking,已经分化成多种行为模式。本文把它们摆在一张图上对比。

主要参考:


一、模式分类

flowchart LR
    base["Base LM<br/>direct answer"]
    cot["CoT<br/>think then answer"]
    sc["Self-Consistency<br/>N CoT votes"]
    react["ReAct<br/>think + act + observe"]
    inter["Interleaved<br/>think ↔ tool ↔ think"]
    tot["ToT<br/>tree search<br/>over thoughts"]
    got["GoT<br/>graph search"]

    base --> cot
    cot --> sc
    cot --> react
    react --> inter
    cot --> tot
    tot --> got

    classDef stage fill:#fff,stroke:#cc785c,color:#1a1a1a;
    class base,cot,sc,react,inter,tot,got stage

每一步都是上一个的扩展,但 trade-off 不同。


二、Chain-of-Thought(CoT)— 基础线

2.1 形态

[User] 计算 23 × 47
[Model] Let me think step by step:
        23 × 47 = 23 × (50 - 3) = 23×50 - 23×3
        = 1150 - 69 = 1081
        Answer: 1081

模型生成 reasoning chain → 最终答案。

2.2 实现层

  • Prompting CoT (Wei 2022):在 prompt 加 "Let's think step by step" 或 few-shot example
  • Trained CoT:训练数据本身就是 (prompt, reasoning, answer) 三元组
  • Reasoning model:CoT 内化进模型本能(o1 / R1 路线)

2.3 优劣

简单实现,prompt 即可 一次性,错了无法回头
数学 / 逻辑题准确率显著提升 reasoning chain 长 → token 多
可解释(chain 可读) 中间步骤错会 propagate

2.4 何时用

  • 必用:数学、推理、多步逻辑题
  • 可选:长文本 QA、代码生成
  • 没意义:闲聊、单事实问答("巴黎是哪国首都")

三、Self-Consistency — 多数投票版 CoT

3.1 形态

[同一 prompt 采样 N 次]
- CoT path 1: ... → Answer: 1081
- CoT path 2: ... → Answer: 1081
- CoT path 3: ... → Answer: 1080  (错)
- CoT path 4: ... → Answer: 1081
- CoT path 5: ... → Answer: 1081

[Final] Answer = majority(1081) = 1081

3.2 实现

def self_consistency(model, prompt, n=5, temperature=0.7):
    answers = []
    for _ in range(n):
        out = model.generate(prompt, temperature=temperature)
        ans = extract_answer(out)
        answers.append(ans)
    return Counter(answers).most_common(1)[0][0]

3.3 优劣

答案准确率显著提升(~5-15% on MATH) N 次推理 → token cost N×
不需要训练,纯 inference 技巧 投票只用 final answer,浪费 reasoning 信息
易并行化 对开放生成(如代码)不适用

3.4 跟 reasoning model 关系

Self-Consistency 是外部控制(采 N 次取多数)。Reasoning model(o1 / R1)把这个内化 —— 模型内部自己 explore + verify + revise,不需要外部投票。

但两者可以叠加:reasoning model + self-consistency = 更高准确率(成本更高)。


四、Tree of Thoughts(ToT)— 显式树搜索

4.1 形态

                    [root prompt]
                         |
                  [thought_1, thought_2, thought_3]
                  /        |         \
            [t1.1, t1.2]  [t2.1]    [t3.1, t3.2]
             /     \        |         /     \
           ...                                 ...

模型在每一步生成多个候选 thought,用 evaluator 给每个 thought 打分,按 BFS / DFS / beam 搜索 chain。

4.2 实现伪代码

def tot(model, prompt, max_depth=5, beam_width=3):
    """
    搜索 thought tree,找最优 reasoning path
    """
    frontier = [(prompt, "")]  # (state, partial_chain)

    for depth in range(max_depth):
        candidates = []
        for state, chain in frontier:
            # 生成下一步候选 thoughts
            next_thoughts = model.sample_thoughts(state, n=beam_width * 2)
            # 用 evaluator (LLM 或 verifier) 给每个 thought 打分
            scored = [(t, model.evaluate(state, chain + t)) for t in next_thoughts]
            candidates.extend([(state + t, chain + t, score) for t, score in scored])

        # 取 top beam_width 进入下一层
        frontier = sorted(candidates, key=lambda x: -x[2])[:beam_width]
        frontier = [(s, c) for s, c, _ in frontier]

    # 取分最高的 path 提取 answer
    best_chain = max(frontier, key=lambda x: model.final_score(x))
    return extract_answer(best_chain)

4.3 ToT 的 evaluator

evaluator 决定 ToT 质量,三种实现:

  1. Self-evaluation:让 model 自己给 thought 打分("How likely is this thought correct? 1-10")
  2. Verifier model:训练专门的 PRM(Process Reward Model)打分
  3. Rule-based:可执行验证(数学题:跑 sympy;代码题:跑 unit test)

4.4 优劣

复杂推理任务上显著优于 CoT 计算开销 N×(取决于树宽度)
能从错误 thought 回退 evaluator 是 bottleneck
适合需要 backtrack 的题(24 点、棋类) 实现复杂,调参多

4.5 ToT vs Reasoning model

Reasoning model 内化了 ToT 的部分能力 —— o1 / R1 在 thinking chain 中会自然出现 backtrack("Wait, this is wrong, let me try...")。但 reasoning model 还是线性搜索(一条 chain),不是显式树。

ToT 是外部控制,reasoning model 是内部隐式。两者可叠加(每步 thinking 时跑 ToT),但工程复杂。


五、ReAct — 推理 + 工具调用

5.1 形态

[User] 巴黎现在天气怎么样?

[Model] Thought: I need current weather, which I don't know offline. Let me check.
        Action: search_weather("Paris")
        Observation: 18°C, partly cloudy

        Thought: Got the data. Let me format the response.
        Action: finish("巴黎现在 18°C,多云。")

ReAct = Reason + Act。模型在 thinking 时输出工具调用,外部执行后把 observation 接回 context,继续 reasoning。

5.2 跟 CoT 的关键区别

维度 CoT ReAct
推理 闭环(只用 LM 内部知识) 开环(可调外部工具)
实时信息
错误恢复 工具反馈可纠正
Token cost 高(observation 占 token)
实现 单次 generate 多轮 generate + tool 执行

5.3 ReAct loop 实现

def react_loop(model, tools, prompt, max_steps=10):
    """
    tools: dict of name → callable
    """
    history = [{"role": "user", "content": prompt}]
    for step in range(max_steps):
        # 模型生成下一步:thought + action 或 final answer
        response = model.generate(history)
        thought, action = parse_response(response)
        history.append({"role": "assistant", "content": response})

        if action.name == "finish":
            return action.args.get("answer")

        # 执行工具
        observation = tools[action.name](**action.args)
        history.append({"role": "tool", "name": action.name, "content": str(observation)})

    return "I couldn't finish in time."

5.4 历史与现状

ReAct 是 2022 提出(Yao et al.),早于 reasoning model。当前的 agent(Cursor、Claude Code、Cline)都是 ReAct 范式 —— 工具是 file_read / file_write / shell 等。

最大的工程挑战:

  • Token 爆炸:tool observation 累积,long context 下 model 失忆
  • Action grounding:模型决定调用哪个 tool 时容易选错
  • Recovery:工具失败后的 retry / fallback 逻辑

六、Interleaved Thinking — Reasoning 和 Tool 交错

6.1 形态

ReAct 的 thinking 是 short bursts(几行一动手)。Interleaved Thinking 把 reasoning model 的长 thinking 和 tool calling 交错:

[User] 帮我查 2026.04 美联储利率决定,并分析对市场的影响。

[Model] <think>
Step 1: I need the current Fed rate. Let me search.
</think>
Action: web_search("Fed rate decision 2026 April")
Observation: Fed kept rate at 4.25-4.5%, signaled possible cut.

<think>
Now I have the data. Let me reason about market implications.
The Fed maintaining rate suggests... [long reasoning chain]
</think>
Action: web_search("US 10Y treasury yield 2026.04")
Observation: 10Y at 4.1%, down 5bps post-decision.

<think>
With rate hold but dovish signaling, treasuries rallied as expected.
Now let me think about equity impact... [more reasoning]
</think>

[Final answer] 美联储 2026.04 维持利率不变...

6.2 为什么 interleave > 严格分阶段

朴素 ReAct:thought → action → observation → thought → action → ...,每个 thought 短

Interleaved:每个 thought 是 reasoning model 级的长 chain(含 self-doubt、verification、planning)。

好处:

  • 复杂任务的 reasoning depth 不被 tool calling 打断
  • Tool 之间的 reasoning 可以是高质量的(不是简单 transition)
  • 更接近人类专家:先深度思考再决定下一步行动

6.3 实现需要的改动

ReAct 的 prompt template:

Thought: ...
Action: ...
Observation: ...

Interleaved 的 prompt template:

<think>
[长 reasoning chain,可能 10k token]
[在 chain 内部决定 "我现在需要调用 tool X"]
</think>
<tool_call>tool_X(...)</tool_call>
<tool_result>...</tool_result>
<think>
[继续长 reasoning,分析 tool result]
</think>
<tool_call>...</tool_call>
...
<answer>...</answer>

关键工程点:

  • Tokenizer 需要识别 <think><tool_call><tool_result> 等结构 token
  • Sampling 在 thinking 段和 tool_call 段不同(高 temperature vs 低)
  • KV cache 处理:thinking 段可能很长,需要决定是否在 tool_result 后压缩 / 丢弃

6.4 谁在做

  • Anthropic Claude 3.7+ Extended Thinking with Tool Use(2025):thinking 阶段允许 tool call
  • OpenAI o1/o3 with tool use(2025-2026):reasoning 中调用 web / code interpreter
  • DeepSeek-R1 + Computer Use(推测路线)

实现层面:tool call 出现在 thinking 段是 system prompt + tokenizer 设计 + 训练数据三方配合。

6.5 数据怎么造

def build_interleaved_data(complex_prompts, reasoning_model, tools):
    """
    收集 (prompt, thinking-with-tools, answer) 数据
    """
    dataset = []
    for prompt in complex_prompts:
        # 让 reasoning model 在带 tools 的环境下解决
        trajectory = reasoning_model.solve_interactive(
            prompt, tools=tools, allow_tool_in_thinking=True
        )
        # 验证最终答案对
        if verify(trajectory.answer, ground_truth(prompt)):
            dataset.append({
                "prompt": prompt,
                "trajectory": trajectory,  # 含 thinking + tool calls + observations
                "answer": trajectory.answer,
            })
    return dataset

数据来源(推测):

  • 公开 agent benchmark(HumanEval / SWE-Bench / WebArena)的 ground truth trajectory
  • 强模型自动 rollout + 验证器筛
  • 人工标注的高质量交互式任务

七、Graph of Thoughts (GoT)

7.1 形态

ToT 是树 → GoT 是图(有合并、分叉、循环):

[node A: idea 1]
[node B: idea 2 from A]    [node C: idea 3 from A]
       ↓                          ↓
       └──────  [node D: merge B and C] ─────┘
                  [node E: refined]

GoT 适合需要合并多个推理 path 的任务(如多视角分析、综合多 evidence)。

7.2 跟 ToT 的差异

维度 ToT GoT
拓扑 树(无合并) 图(有合并 / 循环)
适合 搜索单一最优 path 多视角综合
实现 beam search graph algorithm(更复杂)
工程成熟度 低(学术阶段)

GoT 在生产里很少见。是 ToT 的研究分支,未来可能在多模态 / 综合分析 task 上有价值。


八、横向对比

模式 实现层 Token cost 准确率提升 适合任务
Direct 模型 forward baseline 简单 QA、闲聊
CoT (prompted) prompt 2-5× +10-30% (math) 多步推理
CoT (trained) 模型本能 2-5× 同上 同上
Self-Consistency 推理 wrapper N×(采样数) +5-15% on top of CoT 数学、闭式答案
ReAct agent loop varies(含 tool 时间) 适合需 tool 的任务 实时数据、动作执行
Interleaved Thinking 模型 + tokenizer + agent 复杂 agent 任务 Coding agent、深度研究
ToT search wrapper N×(树宽度) +5-20% on hard reasoning 24 点、棋类、复杂 puzzle
GoT graph search 待证实 多视角分析(少见)
Reasoning model 训练(RL) 5-20× 显著(30%+ on AIME) 全场景

九、模式之间的关系图

flowchart LR
    direct["Direct"]
    cot["CoT<br/>2022"]
    sc["Self-<br/>Consist"]
    tot["ToT"]
    react["ReAct"]
    rm["Reasoning<br/>Model"]
    inter["Interleaved<br/>Thinking"]

    direct --> cot
    cot --> sc
    cot --> tot
    cot --> react
    cot --> rm
    react --> inter
    rm --> inter

    classDef stage fill:#fff,stroke:#cc785c,color:#1a1a1a;
    class direct,cot,sc,tot,react,rm,inter stage

演进逻辑

  • 2022:CoT 作为 prompting trick
  • 2023:Self-Consistency / ToT 作为外部包装
  • 2023-2024:ReAct + agent 框架(LangChain、AutoGPT 时代)
  • 2024-2025:Reasoning model 内化 CoT + tree-like exploration(o1/R1)
  • 2025-2026:Interleaved Thinking = reasoning model + tools 综合

每一代都把上一代"外部"的能力内化到模型本能。


十、还有哪些类似模式(不太常用但值得知道)

10.1 Plan-and-Execute (Sun et al. 2023)

先生成 high-level plan,再 execute:

Plan:
1. Find current Fed rate
2. Compare to historical
3. Analyze market reaction

Execute step 1: <action>
Execute step 2: <action>
...

跟 ReAct 区别:plan 一开始就定,不动态调整。简单但缺灵活性。

10.2 Reflexion (Shinn et al. 2023)

每个 trajectory 失败后,让模型 reflect "我哪里错了" → 下次尝试时把 reflection 加进 context。

Attempt 1: failed
Reflection: I should have checked the units first.
Attempt 2: [with reflection in prompt] succeeds

适合需要从失败学习的 task(agent benchmark)。

10.3 Debate (Du et al. 2023)

两个模型 instance 互相 debate 答案,第三个 judge 决定。

  • Pro:模型 diversity 提升 robustness
  • Con:N× cost,judge 可能 bias

实际生产很少用。Anthropic / OpenAI 内部研究多。

10.4 Multi-Agent Discussion / MAD (Liang et al. 2023)

类似 Debate,但 N>2 个 agent。每个 agent 有不同 persona / role,互相讨论后投票或综合。

效果:在某些 reasoning task 上 +5-10%,但成本高。没有明显优于 Self-ConsistencyH3.3 章节深入讨论)。

10.5 Iterative Refinement (Madaan et al. 2023)

让模型自己审稿自己的输出:

Draft: [first answer]
Critique: [model self-critiques the draft]
Refined: [model rewrites based on critique]

适合写作、代码 review。Constitutional AI 的 SL-CAI 就是这个 pattern 的特例。


总结

  1. Reasoning model 是当前主流 —— 内化 CoT + 隐式 ToT-like exploration,比外部包装高效
  2. Interleaved Thinking 是下一代 frontier —— reasoning model + tool use 综合,Anthropic / OpenAI 都在做
  3. Self-Consistency 仍是免费午餐 —— 任何 base model 加上都能涨准确率,cost 是 N×
  4. ToT 实际生产不常见 —— 工程复杂、调参多;reasoning model 内化了大部分价值
  5. ReAct 是 agent 范式的基石 —— Coding agent / Computer Use 都是 ReAct 变体
  6. Plan-and-Execute / Reflexion / Debate 在特定场景有用,但不是主流

实操路径:

  • 想做 agent → ReAct + tools,加 reasoning model 当 backbone
  • 想做数学 / 推理 → Reasoning model + Self-Consistency
  • 想做研究助手 → Interleaved Thinking
  • 想做代码 → Coding agent (ReAct + 长 context)

参考文献

  1. Wei et al. Chain-of-Thought Prompting. 2022. arXiv:2201.11903
  2. Wang et al. Self-Consistency Improves Chain of Thought. 2022. arXiv:2203.11171
  3. Yao et al. ReAct: Synergizing Reasoning and Acting. 2022. arXiv:2210.03629
  4. Yao et al. Tree of Thoughts. 2023. arXiv:2305.10601
  5. Besta et al. Graph of Thoughts. 2023. arXiv:2308.09687
  6. Sun et al. Plan-and-Execute Agents. 2023.
  7. Shinn et al. Reflexion: Language Agents with Verbal Reinforcement Learning. 2023. arXiv:2303.11366
  8. Du et al. Improving Factuality and Reasoning via Multiagent Debate. 2023. arXiv:2305.14325
  9. Liang et al. MAD: Multi-Agent Debate. 2023. arXiv:2305.19118
  10. Madaan et al. Self-Refine. 2023. arXiv:2303.17651
  11. Anthropic. Extended Thinking with Tool Use. 2025. docs.anthropic.com/en/docs/build-with-claude/extended-thinking(待核实)

上级 · J. 推理行为与失败模式