プロンプトエンジニアリングガイド
😃 基礎編
💼 アプリケーション基礎
🧙‍♂️ 中級
🤖 エージェント
⚖️ 信頼性
🖼️ 画像プロンプティング
🔓 プロンプトハッキング
🔨 ツール
💪 プロンプトチューニング
🎲 その他
📙 Vocabulary Reference
📚 Bibliography
📦 Prompted Products
🛸 Additional Resources
🔥 Hot Topics
✨ Credits

Chain of Thought Prompting

🟢 This article is rated easy
Reading Time: 1 minute

Last updated on August 7, 2024

Chain of Thought (CoT) prompting is a recently developed prompting method, which encourages the LLM to explain its reasoning. The below image shows a few shot standard prompt (left) compared to a chain of thought prompt (right).

Regular Prompting vs CoT (Wei et al.)

The main idea of CoT is that by showing the LLM some few shot exemplars where the reasoning process is explained in the exemplars, the LLM will also show the reasoning process when answering the prompt. This explanation of reasoning often leads to more accurate results.

Example

Here are a few demos. The first shows GPT-3 (davinci-003) failing to solve a simple word problem. The second shows GPT-3 (davinci-003) succesfully solving the same problem, by using CoT prompting.

Incorrect

Correct

Results

CoT has been shown to be effective in improving results on tasks like arithmetic, commonsense, and symbolic reasoning tasks. In particular, prompted PaLM 540B achieves 57% solve rate accuracy on GSM8K (SOTA at the time).

Comparison of models on the GSM8K benchmark (Wei et al.)

Limitations

Importantly, according to Wei et al., "CoT only yields performance gains when used with models of ∼100B parameters". Smaller models wrote illogical chains of thought, which led to worse accuracy than standard prompting. Models usually get performance boosts from CoT prompting in a manner proportional to the size of the model.

Notes

No language models were hurt finetuned in the process of writing this chapter 😊.

Sander Schulhoff

Sander Schulhoff is the Founder of Learn Prompting and an ML Researcher at the University of Maryland. He created the first open-source Prompt Engineering guide, reaching 3M+ people and teaching them to use tools like ChatGPT. Sander also led a team behind Prompt Report, the most comprehensive study of prompting ever done, co-authored with researchers from the University of Maryland, OpenAI, Microsoft, Google, Princeton, Stanford, and other leading institutions. This 76-page survey analyzed 1,500+ academic papers and covered 200+ prompting techniques.

Footnotes

  1. Wei, J., Wang, X., Schuurmans, D., Bosma, M., Ichter, B., Xia, F., Chi, E., Le, Q., & Zhou, D. (2022). Chain of Thought Prompting Elicits Reasoning in Large Language Models. 2 3

  2. Chowdhery, A., Narang, S., Devlin, J., Bosma, M., Mishra, G., Roberts, A., Barham, P., Chung, H. W., Sutton, C., Gehrmann, S., Schuh, P., Shi, K., Tsvyashchenko, S., Maynez, J., Rao, A., Barnes, P., Tay, Y., Shazeer, N., Prabhakaran, V., … Fiedel, N. (2022). PaLM: Scaling Language Modeling with Pathways.

  3. Cobbe, K., Kosaraju, V., Bavarian, M., Chen, M., Jun, H., Kaiser, L., Plappert, M., Tworek, J., Hilton, J., Nakano, R., Hesse, C., & Schulman, J. (2021). Training Verifiers to Solve Math Word Problems.

Copyright © 2024 Learn Prompting.