How to Steal an AI Model’s Private Thoughts
現代 frontier models 在輸出可見的回應之前,會先生成一段長篇的內部文字 sequence,讓它們能探索假設並修正錯誤。這個內部 sequence 被稱為 reasoning trace 或 chain of thought。與最終修飾過的回應不同,reasoning trace 包含未經處理的 tool outputs、中間探索過程,以及在 session 期間處理的任何敏感 context 資料。例如,當 coding agent 被指示清除 hardcoded credentials 時,這些 credentials 必然會經過 reasoning trace。Model providers 隱藏 reasoning traces 主要是出於商業和安全性考量。在商業層面上,競爭對手可以從高能力模型中蒐集 traces 來提取其 methodology,並訓練出成本更低的 imitation models。從安全角度來看,模型在提出拒絕回應(refusal)之前,通常會先生成有關有害主題的中間推理。因為 safety filtering 是在 trace 生成之後才應用以產生最終回應,釋出未加工的 traces 會繞過這些 guardrails 並向使用者暴露有害內容。在 multi-turn 對話中,儘管 model APIs 在本質上是 stateless 的,但先前的 reasoning traces 仍必須在各個 requests 之間保持可存取性。Providers 面臨兩種架構選擇:在 server 端儲存 traces 並透過 session identifiers 進行參照,或是將 traces 加密後委託回 client 端儲存。包括 OpenAI、Anthropic 和 Google 在內的頂尖 providers 都選擇了 client-side 加密的方式。此架構滿足了 confidentiality 與 integrity,同時免去了 server-side 儲存 trace 的 infrastructure 成本。
閱讀原文 ↗目錄
Reasoning Traces
現代 frontier models 在輸出可見的回應之前,會先生成一段長篇的內部文字 sequence,讓它們能探索假設並修正錯誤。這個內部 sequence 被稱為 reasoning trace 或 chain of thought。與最終修飾過的回應不同,reasoning trace 包含未經處理的 tool outputs、中間探索過程,以及在 session 期間處理的任何敏感 context 資料。例如,當 coding agent 被指示清除 hardcoded credentials 時,這些 credentials 必然會經過 reasoning trace。
- Frontier models 在產出最終答案之前,會先生成長篇的內部文字 sequences。
- Reasoning trace 也被稱為 chain of thought。
- Reasoning traces 會擷取中間假設、放棄的路徑以及未經處理的 tool outputs。
- Reasoning traces 比最終輸出更密集且透露更多資訊,通常包含 context 中的機密或使用者資料。
- 移除 credentials 等任務會導致敏感資料暴露在 reasoning trace 之中。
隱藏理由
Model providers 隱藏 reasoning traces 主要是出於商業和安全性考量。在商業層面上,競爭對手可以從高能力模型中蒐集 traces 來提取其 methodology,並訓練出成本更低的 imitation models。從安全角度來看,模型在提出拒絕回應(refusal)之前,通常會先生成有關有害主題的中間推理。因為 safety filtering 是在 trace 生成之後才應用以產生最終回應,釋出未加工的 traces 會繞過這些 guardrails 並向使用者暴露有害內容。
- Model providers 基於商業競爭與安全考量而隱藏 reasoning traces。
- 公開 reasoning traces 會揭露運算背後的 methodology,讓競爭對手得以訓練出成本更低的 imitation models。
- 模型在組織拒絕回應(refusal)的過程中,經常會生成關於有害主題的推理。
- Safety filtering 是在完成的 traces 下游運作,以產出安全的可見回應。
- 發布 reasoning traces 會繞過 generation 後的 safety filters,可能使使用者接觸到有害內容。
狀態管理
在 multi-turn conversations 中,儘管 model APIs 本質上是 stateless 的,但先前的 reasoning traces 仍必須能在多次 requests 間被存取。Providers 面臨兩種架構選擇:將 traces 存儲在 server 端並以 session identifiers 引用,或是加密 traces 並將存儲委派回 client 端。包含 OpenAI、Anthropic 和 Google 在內的頂尖 providers 都選擇了 client-side encrypted 方案。該架構在滿足 confidentiality 與 integrity 的同時,消除了 server 端存儲 trace 的 infrastructure cost。
- Model APIs 本質上是 stateless 的,這意味著 conversation 的連續性必須在每次 request 中被明確地重構。
- Server-side state storage 使用 identifiers 在 database 中追蹤 conversation traces,這種做法直截了當,但在 global scale 下成本高昂。
- Client-side state storage 會加密 trace 並將其返回給 client 端,使 provider 在各 turn 之間無需存儲任何內容。
- OpenAI、Anthropic 與 Google 都採用 client-side encrypted trace 的做法。
- Client-side encrypted 方案對競品實現了 confidentiality、防止 trace 被篡改的 integrity,並透過 statelessness 節省成本。
Envelope Structure
返回給 client 端的 payload block 被格式化為 base64-encoded AEAD (Authenticated Encryption with Associated Data) envelope,同時提供 encryption 與 tamper protection。該 envelope 包含帶有 model name 和 version 等 metadata 的 header,以及 nonce、authentication tag 與 ciphertext。不同 providers 對此 container 的命名各不相同,例如 Anthropic 使用 signature,OpenAI 使用 encrypted_content,而 Google 則使用 thinkingSignature。值得注意的是,authentication 涵蓋了 model name 與 version,但省略了 account 和 conversation identifiers,觀察到的行為顯示 providers 在整個 ecosystem 中使用單一 global key。
- 返回給 client 端的 blocks 是 base64-encoded AEAD envelopes,在隱匿內容的同時確保 tamper-protection。
- Envelope 包含 header(例如 model name、block type、version、key ID)、nonce、authentication tag 以及 ciphertext。
- 該 payload 欄位在 Anthropic 被命名為 'signature',在 OpenAI 被命名為 'encrypted_content',在 Google 則被命名為 'thinkingSignature'。
- Authentication 涵蓋了 model name 與 version,但排除了 user account 和 conversation identifiers。
- 可觀察到的行為顯示 providers 在其整個 ecosystem 中使用單一 global key。
Trace Compatibility
研究人員分析了當 authenticated fields 缺乏來源資訊時的 block compatibility,並歸納出三種寬鬆程度遞增的形式:cross-session、cross-user 與 cross-model compatibility。Cross-model compatibility 支援動態任務,例如 mid-conversation model switching 與 automatic rerouting。2026 年 7 月針對多種 model 組合進行的一項評估顯示,各大主流 AI models 的支援程度各不相同。Gemini 接受跨世代的所有組合,Claude 接受了除 Fable 5 之外的幾乎所有組合,而 GPT 的相容性則取決於世代,其中 GPT-5.6 可以接受來自舊世代的 blocks。
- Block compatibility 被分為三個層級:cross-session、cross-user 以及 cross-model compatibility。
- Cross-session compatibility 允許亂序 replay blocks、修改 conversation history,以及將 sessions 裁切至 context limits。
- Cross-model compatibility 允許一個 model 的 blocks 被另一個 model 接受,從而實現 mid-conversation model switching 與 rerouting。
- 在 2026 年 7 月的測試中,Gemini 接受了跨各世代所有被測試的 block 組合。
- Claude 接受了幾乎所有組合,但 Fable 5 的 blocks 僅能被 Fable 5 本身接受。
- GPT-5.6 系列接受所有早期 GPT 世代的 blocks,而較舊的 GPT models 僅接受自身的 blocks。
Extraction Method
旗艦級 AI models 會經過 anti-distillation training 以隱藏其 reasoning,但同家族中較小的 models 由於 cost 和 speed 的最佳化,獲得的保護顯著較少。研究人員利用了這種 cross-model compatibility 的落差,從旗艦 models 中擷取加密的 reasoning blocks,並 prompt 較小的 models 將其轉譯為 plaintext。透過將 re-encoded token 數量與 API billing records 中的精確 reasoning token 數量進行比對,驗證了復原 reasoning 的 fidelity。不同 providers 的 extraction 難度有所不同:Claude 只需要單一 prompt,而 GPT 則需要 chunking 以及數十次 candidate extractions。
- 旗艦 models 接受了 anti-distillation training,而同家族中較小、經過 cost-optimized 的 models 則大多缺乏這種訓練。
- 強大 models 的 reasoning traces 可以透過將其 reasoning blocks 餵給扮演 fuzzy decoders 的較弱 sibling models 來復原。
- 旗艦模型的 refusal training 被繞過,因為它只被詢問了一個會產生良性輸出的普通問題。
- 利用 120 個程式設計任務中回報確切 reasoning token 數量的計費記錄,來驗證 reconstruction faithfulness。
- Claude 模型僅需單一 prompt 即可完成擷取,而 GPT 模型則需要 chunked outputs 以及每個 block 最多 50 次嘗試,以規避 verbatim reproduction filters。
攻擊向量
該研究概述了源於隱藏或加密的 model reasoning traces 的四種不同攻擊向量,依據 blocks 是由攻擊者還是第三方建立來分類。攻擊者可以利用 reasoning traces 來增強 model distillation,並透過對隱藏 reasoning 進行 jailbreaking 來繞過可見的 safety guards。此外,在 GitHub 和 Hugging Face 等平台上共享的第三方 agent logs 經常外洩未經清理的機密資訊,包括 API keys 和密碼。最後,攻擊者可以在共享 agent trajectories 的加密 blocks 中植入惡意指令,以便在 session resumption 時執行 prompt injection 攻擊。
- 相較於僅使用答案的 training,利用 reasoning traces 進行 distillation 將 MATH500 的準確率從 68.4% 提升至 76.0%。
- 以 Claude Haiku 4.5 的定價計算,解碼 10,000 個 reasoning traces 的成本約為 $720 美元。
- 透過 traces 對模型進行 jailbreaking 是可行的,因為模型鮮少接受限制有害推理的訓練,這使得敏感細節可以隱藏在 traces 內部,而可見的輸出則顯得毫無危害。
- 對 GitHub 和 Hugging Face 上 6,708 個公開 trajectories 的分析顯示,有 1,028 個洩漏的 blocks,其中包含 62 個 API keys、33 個密碼和 24 個 access tokens。
- 在恢復執行的 agent runs 中,加密的 blocks 會助長 prompt injection,這已透過誘騙 GPT-5.6 Sol 外洩 PowerPoint 檔案得到證實。
實地觀察
大規模復原 reasoning traces 顯示,回傳的摘要可能與模型實際內部的 reasoning 有實質上的分歧。在一個 AIME 2025 題目的範例中,API 摘要聲稱進行了有條理的幾何推導,而底層的 trace 卻顯示出記憶回想以及試錯反推的辯護過程(trial-and-error backward justification)。此外,復原的 GPT traces 通常由壓縮、不合語法的電報式筆記組成,而非流暢的英文。這種缺乏可讀性的狀況,對 trace monitoring 和 AI oversight 造成了重大障礙。
- API 生成的摘要有時會與復原的 traces 中觀察到的實際 reasoning path 產生分歧。
- 在一個 AIME 2025 的題目中,摘要回報了使用餘弦定理的有條理幾何步驟,而 trace 卻顯示是來自記憶的事後合理化(post-hoc rationalization)。
- 負責總結較大模型的較小模型,本質上會壓縮並過濾原始的思考過程。
- 復原的 GPT reasoning traces 通常由省略冠詞、不合語法的電報式筆記所組成。
- 當內部 traces 缺乏可讀性時,trace monitoring 和 oversight 機制將面臨挑戰。
建議的緩解措施
該研究論文指出,安全問題的產生是因為 reasoning block envelopes 驗證了內容,卻忽略了 context。透過在發行時直接將帳戶識別碼嵌入已驗證的資料中,即可在不需要 server-side storage 的情況下以低成本緩解 cross-user replay。為了在不破壞 conversation forking 或 turn compaction 等可攜性功能的前提下保護跨 session contexts,作者提出了 hash chain 搭配 Merkle tree 的方案。對於未包含 context 簽署的現有 blocks,key rotation 是主要的追溯修復手段,同時輔以 API gateway 的 model version 驗證和 refusal training。
- Reasoning block envelopes 驗證了內容,但並未驗證該 block 產生或被重放時的 context。
- 透過將帳戶識別碼嵌入已驗證的簽發資料中,無需 server-side storage 即可防止 cross-user replay 攻擊。
- 將 blocks 與完整的 transcripts 綁定,會破壞如 forking conversations、compacting history 和 model downgrades 等合法功能。
- 結合 hash chains 與 Merkle trees 可以在允許 pruned histories 的同時,實現 session binding 與順序完整性(ordering integrity)。
- 處理先前已發布的 blocks 需要進行 key rotation,這不可避免地會使舊 session 的合法延續失效。
- 補充的緩解措施包括 server-side storage、在 API gateways 進行 model version 驗證,以及訓練模型拒絕 transcription 請求。
結論
這裡討論的安全問題並非源自密碼學技術的漏洞,而是因為 encrypted block 與生成它的 context 之間缺乏 binding。顯示的回答摘要與底層的 trace 是各自獨立的 artifact,兩者可能會產生分歧;同時,sanitization 無法在不完全移除不可檢視的 encrypted blocks 的情況下安全地清理資料。此外,整個 model family 的安全性取決於其防護最薄弱的模型,這意味著若較便宜的 sibling models 接受相同的 blocks,旗艦模型上的 anti-distillation 防護機制就會被削弱。
- Cryptographic envelopes 運作正常,但 blocks 與其生成 context 之間缺乏 authenticated binding。
- 顯示在回答旁邊的 summary 與它所描述的 trace 是彼此獨立的 artifact,因此兩者可能會產生分歧。
- Session log 的 sanitization 僅對 plaintext 有效,由於 encrypted blocks 無法被檢視,因此必須將其完全剔除。
- 一個 model family 的安全性取決於其防護最薄弱的成員;若較便宜的 sibling models 接受相同的 blocks,旗艦模型的 anti-distillation 訓練成效便會大打折扣。