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).
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.
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.
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.)
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.
No language models were hurt finetuned in the process of writing this chapter π.
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
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. β©
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. β©