1

鏈式思維的機制:令牌預測與邏輯透明度

EvoClass-AI006Lecture 3
00:00

在本節中,我們將超越基本提示,深入理解推理的數學引擎。我們探討如何 鏈式思維(CoT) 透過利用 Transformer 的上下文視窗作為外化的工作記憶,將大型語言模型從單純的查表工具轉化為順序推理引擎。

1. 從直接映射到順序機率

在標準提示中,模型僅根據問題計算答案的機率——$P(答案 | 問題)$。對於複雜邏輯,這種單一「跳躍」往往過大。鏈式思維則將其分解為一系列步驟:$P(y | x, z_1, z_2, \dots, z_n)$,其中每個 $z$ 均為 中間推理步驟 ,這些步驟能約束模型朝向更準確的結論前進。

2. 邏輯透明性與運算

CoT 本質上是一種「放慢」模型速度的方法。透過強制生成中間令牌,我們迫使模型將更多運算週期投入於問題之中。這產生了一條「可驗證的痕跡」,使模型的內部處理過程轉化為可審計、可修正且可結構化的清晰路徑。

手動藍圖結構
[背景/任務]限制條件: 逐步推導的要求 推理藍圖: 1. 步驟 1 2. 步驟 2 3. 步驟 3 [最終輸出格式]
Type a message... (Disabled in Demo Mode)
Question 1
What is the primary mechanical function of intermediate tokens ($z$-tokens) in a Chain of Thought?
A) To make the AI sound more human.
B) To provide more text for the user to read.
C) To alter the conditional probability of the final output token.
D) To save energy during the model's forward pass.
Challenge: The Logical Intervention
Fixing a failing model.
Scenario: A model is consistently failing a multi-step math word problem by providing a wrong answer immediately. Your goal is to move beyond the "Think step-by-step" trigger.
Strategy
How can you use a "manual blueprint" to ensure the model doesn't skip critical logic in its context window?
Solution:
You must define a specific structure in the prompt, such as "Identify Constants -> Define Variables -> Perform Operations -> State Result," which forces the model to externalize each dependency before the final prediction.