电竞比分网-中国电竞赛事及体育赛事平台

分享

CoD: 拋棄CoT?大模型推理提速80%!Chain of Draft(草稿鏈)技術(shù)揭秘

 小張學(xué)AI 2025-04-22 發(fā)布于山東
  • · 大家好,我是 同學(xué)小張,日常分享AI知識(shí)和實(shí)戰(zhàn)案例

  • · 歡迎 點(diǎn)贊 + 關(guān)注 ??,持續(xù)學(xué)習(xí),持續(xù)干貨輸出。

  • · +v: jasper_8017 一起交流??,一起進(jìn)步??,更有專業(yè)資料領(lǐng)?。?/span>


在大模型(LLM)席卷全球的浪潮中,推理效率低下始終是工業(yè)落地的最大瓶頸。傳統(tǒng)Chain-of-Thought(CoT)方法通過“思維鏈”提升準(zhǔn)確率,但也付出了高延遲、高成本的代價(jià):一次多步推理動(dòng)輒消耗數(shù)百Token,答案生成需等待數(shù)秒。

Zoom團(tuán)隊(duì)最新提出的Chain of Draft(CoD)技術(shù),通過“極簡草稿推理”首次實(shí)現(xiàn)了效率與性能的平衡:在主流任務(wù)中,它用7.6%的Token量達(dá)到了與原版CoT相近的準(zhǔn)確率,推理延遲直降76%!

一起來學(xué)習(xí)一下這項(xiàng)技術(shù) - CoD。

在這里插入圖片描述

1. 為什么需要拋棄冗長的“思維鏈”?

(1)成本黑洞

以GPT-4 Turbo為例,生成200個(gè)Token的CoT推理需要約0.02美元。假設(shè)某客服系統(tǒng)日均處理10萬次查詢,僅Token開銷就高達(dá)2000美元/天。

(2)延遲困局

在多輪對(duì)話場景中,用戶等待時(shí)間超過1.5秒會(huì)導(dǎo)致體驗(yàn)顯著下降。然而,傳統(tǒng)CoT在復(fù)雜數(shù)學(xué)題中平均耗時(shí)達(dá)4秒以上。

(3)人類智慧的啟示

人類在解決數(shù)學(xué)題時(shí),往往用符號(hào)速記代替完整句子(如“20=12-8”)。若將這一行為映射到LLM,可能開啟效率革命。

2. CoD如何實(shí)現(xiàn)“少即是多”?

(1)極簡核心法則

  • · 每步最多5詞:強(qiáng)制模型提取關(guān)鍵信息,如數(shù)學(xué)推導(dǎo)僅保留公式。
  • · 少樣本“模板教學(xué)”:通過3-5個(gè)手動(dòng)示例,教會(huì)模型模仿速記風(fēng)格。

示例:

  • · Q: 倉庫現(xiàn)有貨物150箱,運(yùn)出后剩80箱,運(yùn)出多少?
  • · A: 150??=80 → ?=70 ####70

(2)系統(tǒng)級(jí)優(yōu)化設(shè)計(jì)

  • · 動(dòng)態(tài)松弛約束:允許少量超長步驟(如6-7詞),避免語法斷裂。
  • · 分層解碼策略:對(duì)草稿和答案分段生成,優(yōu)先輸出關(guān)鍵數(shù)據(jù)。

(3)開箱即用

接入僅需添加一行提示詞:

system_prompt = """生成極簡推理草稿(每步≤5詞),答案以####結(jié)尾。"""
在這里插入圖片描述

3. CoD與CoT區(qū)別

我們都知道,CoT的實(shí)現(xiàn)其實(shí)更多的是在提示詞中加入一句:Think Step By Step. 例如下面這個(gè)Prompt:

Think step by step to answer the following question.
Return the answer at the end of the response after a
separator ####.

CoD其實(shí)也類似,只需要在提示詞中加幾句話:

Think step by step, but only keep a minimum draft for
each thinking step, with 5 words at most. Return the
answer at the end of the response after a separator
####.

輸出區(qū)別示例:對(duì)于同一個(gè)提問,

Q: Jason had 20 lollipops. He gave Denny some lollipops. Now Jason has 12 lollipops. How many lollipops did Jason give to Denny?

CoT回復(fù):

Q: Jason had 20 lollipops. He gave Denny some
lollipops. Now Jason has 12 lollipops. How many
lollipops did Jason give to Denny?
A: Let’s think through this step by step:
1. Initially, Jason had 20 lollipops.
2. After giving some to Denny, Jason now has 12
lollipops.
3. To find out how many lollipops Jason gave to
Denny, we need to calculate the difference between
the initial number of lollipops and the remaining
number.
4. We can set up a simple subtraction problem:
Initial number of lollipops - Remaining number of
lollipops = Lollipops given to Denny
5. Putting in the numbers: 20 - 12 = Lollipops given
to Denny
6. Solving the subtraction: 20 - 12 = 8
Therefore, Jason gave 8 lollipops to Denny.
####8 lollipops

CoD回復(fù):

Q: Jason had 20 lollipops. He gave Denny some
lollipops. Now Jason has 12 lollipops. How many
lollipops did Jason give to Denny?
A: 20 - x = 12; x = 20 - 12 = 8. #### 8

3. 效果驗(yàn)證

(1)基準(zhǔn)測試數(shù)據(jù)

任務(wù)類型
模型
CoT準(zhǔn)確率
CoD準(zhǔn)確率
Token節(jié)省率
數(shù)學(xué)推理(GSM8K)
Claude 3.5
95.8%
91.4%
79%
體育常識(shí)推理
GPT-4o
95.9%
98.3%
92.4%
代碼調(diào)試
DeepSeek-R1
87%
85%
83%

注:Code任務(wù)需放寬至每步10詞,但仍顯著優(yōu)于CoT

(2)延遲對(duì)比實(shí)驗(yàn)

在AWS g5.12xlarge實(shí)例上,處理1000次并發(fā)請(qǐng)求:

  • · CoT(200 Tokens):平均響應(yīng)4.2秒,費(fèi)用$0.15/千次
  • · CoD(40 Tokens):平均響應(yīng)1.0秒,費(fèi)用$0.03/千次

4. 總結(jié)

Chain of Draft并非簡單的“壓縮”,而是對(duì)LLM推理本質(zhì)的重新思考。它證明:高質(zhì)量的思維輸出無需冗長,關(guān)鍵信息的提取與傳遞才是核心

對(duì)于企業(yè)而言,這項(xiàng)技術(shù)可立竿見影地降低80%以上的推理成本;對(duì)于開發(fā)者,它提供了平衡性能與資源的全新范式。

參考:

  • · 論文地址:https:///abs/2502.18600
  • · GitHub代碼庫:https://github.com/sileix/chain-of-draft

如果覺得本文對(duì)你有幫助,麻煩點(diǎn)個(gè)贊和關(guān)注唄 ~~~


    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類似文章 更多