Chain of Thought Prompting

Stephen M. Walker II · Co-Founder / CEO

What is Chain of Thought?

Chain of Thought (CoT) prompting is a technique used to enhance the reasoning capabilities of large language models (LLMs). It was introduced by Wei et al. in 2022 and involves guiding the LLM to think step by step by providing it with a few-shot exemplar that outlines the reasoning process. The model is then expected to follow a similar chain of thought when answering the prompt. This approach is particularly effective for complex tasks that require a series of reasoning steps.

CoT prompting works by prompting the model to produce intermediate reasoning steps before giving the final answer to a problem. The idea is that a model-generated chain of thought would mimic an intuitive thought process when solving a problem. This method does not require a large training dataset or modifying the language model's weights.

Experiments on large language models show that CoT prompting improves performance on a range of arithmetic, commonsense, and symbolic reasoning tasks, especially as model size increases.

There are also variants of CoT prompting, such as tree-of-thought and graph-of-thought, which were inspired by the success of CoT prompting.

How does Chain of Thought Prompting work?

Chain of Thought (CoT) prompting is a method that improves the reasoning of large language models (LLMs) by guiding them through a structured thought process. This technique involves providing a model with an example that demonstrates how to approach a similar problem step by step. The model then applies this structured reasoning to new prompts, which is especially beneficial for complex tasks requiring arithmetic, commonsense, and symbolic reasoning.

CoT prompting comes in various forms, such as multimodal CoT, which combines text and visual inputs, and least-to-most prompting, where a model solves simpler subproblems first and then uses those results to solve harder ones.

A notable variant is zero-shot CoT, which adds a phrase like 'Let's think step by step' to a prompt, aiding the model when few examples are available. CoT prompting tends to be more effective for larger models, while smaller models may not consistently benefit.

Understanding Chain-of-Thought Prompting

For instance, consider a task where the model is asked to determine whether the odd numbers in a group add up to an even number. A CoT prompt would guide the model to first identify the odd numbers, then add them up, and finally determine whether the sum is even or odd.

Automatic Chain-of-Thought (Auto-CoT)

While CoT prompting can be effective, it often involves hand-crafting examples, which can be time-consuming and may lead to suboptimal solutions. To address this, researchers have proposed an approach known as Automatic Chain-of-Thought (Auto-CoT). This method leverages LLMs to generate reasoning chains for demonstrations automatically, thereby eliminating the need for manual effort.

Limitations and Future Research

Despite its advantages, CoT prompting has limitations. It can produce plausible but incorrect rationales, and a generated explanation is not necessarily a faithful account of how the model reached its answer. Its effectiveness varies by task, model, and prompt, so results should be evaluated rather than assumed.

More terms

Continue exploring the glossary.

Learn how teams define, measure, and improve LLM systems.

Glossary term

RAGAS

RAGAS, which stands for Retrieval Augmented Generation Assessment, is a framework designed to evaluate Retrieval Augmented Generation (RAG) pipelines. RAG pipelines are a class of Large Language Model (LLM) applications that use external data to augment the LLM's context.
Read term

Glossary term

What is an API?

An API, or Application Programming Interface, is a set of defined rules that lets different software applications communicate with each other. AI APIs are a specific type of API that give developers access to machine learning models and services, such as natural language processing, image recognition, and speech-to-text, without building the underlying algorithms themselves.
Read term

It's time to build

Collaborate with your team on reliable Generative AI features.
Want expert guidance? Book a 1:1 onboarding session from your dashboard.

Talk to sales