sileix/chain-of-draft
关于
Code and data for the Chain-of-Draft (CoD) paper
人工智能与机器学习实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 0
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文Chain of Draft: Thinking Faster by Writing Less
Large Language Models (LLMs) have demonstrated remarkable performance in solving complex reasoning tasks through mechanisms like Chain-of-Thought (CoT) prompting, which emphasizes verbose, step-by-step reasoning. However, humans typically employ a more efficient strategy: drafting concise intermediate thoughts that capture only essential information. In this work, we propose Chain of Draft (CoD), a novel paradigm inspired by human cognitive processes, where LLMs generate minimalistic yet informative intermediate reasoning outputs while solving tasks. By reducing verbosity and focusing on critical insights, CoD matches or surpasses CoT in accuracy while using as little as only 7.6% of the tokens, significantly reducing cost and latency across various reasoning tasks.
Usage
To run evaluation:
python evaluate.py \
--task gsm8k \ # Task to evaluate (options: gsm8k, date, sports, coin_flip)
--model gpt-4o \ # Model to be evaluated
--prompt cod \ # Prompting strategy (options: baseline, cod, cot)
--shot 5 \ # [Optional] Number of few-shot examples to include in the prompt (uses all available examples by default if omitted)
--url $BASE_URL \ # [Optional] Base URL for an OpenAI-compatible interface (e.g., locally hosted models)
--api-key $KEY \ # [Optional] API key for model access (automatically loads from environment variables for Claude and OpenAI models if not provided)
Currently, the script supports Claude models, OpenAI models, as well as any model that uses an OpenAI-compatible interface.
The evaluation results will be stored under ./results/.
All prompts and fewshot examples are stored under ./configs/{task}-{prompt}.yaml.
Citation
@article{xu2025cod,
title={Chain of Draft: Thinking Faster by Writing Less},
author={Xu, Silei and Xie, Wenhao and Zhao, Lingxiao and He, Pengcheng},
journal={arXiv preprint arXiv:2502.18600},
year={2025}
}
探索相关项目
加载中…