Recently, artificial intelligence (AI) has made remarkable advances in natural language processing (NLP). This is primarily due to its ability to train large-scale models using textual data. With the development of these language models, AI becomes proficient in tasks like sentiment analysis, machine translation, text generation, and summarization.
However, despite these advances, AI continues to struggle with its cognitive abilities when it comes to addressing multi-step reasoning tasks such as math word problems and symbolic and commonsense reasoning.
This article introduces the latest development known as chain-of-thought (CoT) reasoning, a prompt-based technique that enables AI models to exhibit cognitive abilities.
What Is a Prompt?
The prompt is an instruction for the model to generate a response. It is similar to asking someone to write an essay on a specific topic. Similar to human writers, AI models employ prompts as a foundation for writing essays or generating responses.
We can prompt language models like ChatGPT with simple queries like “Who is the king of the United Kingdom?” to complex problems with detailed task descriptions. Even a request like “Tell me a joke” can be seen as an open-ended prompt.
How Does Prompt Engineering Work?
Prompt engineering deals with creating and designing prompts that enable AI models to perform specific tasks. During this process, it is crucial to carefully choose the data and format of the prompt to ensure that the model can effectively leverage it for executing the task.
For instance, if we aim to determine the sentiment of the movie review “Don’t watch it,” we can add the prompt “It is” to the sentence, making it “Don’t watch it. It is ____.” In this case, we would anticipate a higher probability from the language model to generate “terrible” rather than “great.”
The goal of AI prompt engineering is to generate high-quality prompts that allow the AI model to make accurate predictions.
The prompts can also be used to teach an AI model to produce desired outcomes. The technique, known as prompt-based learning, involves providing the model with queries and correct answers before asking it to answer other queries.
For example, we can prompt the model with some numeric questions and their answers, asking it to solve other questions:
|Q: The cafeteria had 23 apples. If they used 20 to make lunch and bought 6 more, how many apples do they have?
A: 9Q: There are 15 students in a class. If 7 more students join the class, how many students are there in total?
However, it has been noticed that simple prompts, consisting of only a question and its answer, often lead to incorrect results in cognitive tasks like math word problems, symbolic reasoning, and commonsense reasoning.
To address these challenges, chain-of-thought reasoning is a promising new technique specifically designed to enable AI models to successfully tackle these cognitive tasks.
In standard prompting, the model learns from question-answer examples and then predicts answers for new questions. On the other hand, the chain-of-thought prompting deals with instructing the model to divide complex problems into smaller steps and provide both the intermediate reasoning steps and the final solution.
Chain-of-thought has drawn its inspiration from arithmetic reasoning, where natural language rationale is used to build an argument, leading to producing the final answer. This helps the model tackle multi-step problems more effectively because it enables the model to break down complicated problems into smaller, convenient steps that can be solved easily.
Additionally, as chain-of-thought relies on language, it can be applied to any task that a person could solve using language. An example of a standard prompt versus a chain-of-thought prompt is shown below.
|Example of a standard prompt||Example of a chain-of-thought prompt|
|Question||Imagine you are planning a road trip with your friends. You want to calculate the total cost of fuel for the trip. The distance between your starting point and destination is 500 miles, and your car’s average fuel efficiency is 30 miles per gallon. The current price of fuel is $3.50 per gallon. Calculate the estimated total cost of fuel for the trip.||Imagine you are planning a road trip with your friends. You want to calculate the total cost of fuel for the trip. The distance between your starting point and destination is 500 miles, and your car’s average fuel efficiency is 30 miles per gallon. The current price of fuel is $3.50 per gallon. Calculate the estimated total cost of fuel for the trip and explain your calculations step by step.|
Benefits of the Chain-Of-Thought Technique
Chain-of-thought offers several advantages when it comes to enhancing the cognitive abilities of AI models:
- Problem Decomposition: Chain-of-thought enables AI models to break down complicated problems into easy-to-handle intermediate steps, leading them to solve complex multi-step reasoning problems.
- Model Interpretability: By enabling the AI model to generate intermediate reasoning steps with solutions, a chain of thought provides us a way to interpret the model’s behavior; how the model has reached a particular solution. This allows us to identify and debug potential errors in the reasoning path.
- Broad Applicability: Chain-of-thought reasoning is shown to be useful across various tasks, including math word problems, commonsense reasoning, and symbolic manipulation. In essence, it can be potentially applied to any task that humans can solve using language, making it a versatile approach.
- Easy Integration: Chain-of-thought reasoning could easily be integrated into the existing language-based AI models. It requires no extra computing resources to re-train or fine-tune the models. All it needs is some chain-of-thought examples instructing the model on how to break down the problems.
The use of chain-of-thought reasoning has been demonstrated to effectively improve the cognitive abilities of AI models in the areas mentioned below.
Arithmetic reasoning is a cognitive ability that involves the skill to solve math word problems by performing multiple-step calculations. This ability helps students to develop problem-solving strategies require to solve mathematical problems. The researchers have demonstrated that chain-of-thought helps AI models to learn this cognitive ability.
Commonsense reasoning is a crucial cognitive skill that deals with answering questions related to everyday scenarios by drawing inferences from general knowledge. Scientists have established that chain-of-thought allows AI models to incorporate this ability, enabling them to understand common situations.
Symbolic reasoning is a fundamental cognitive skill that involves manipulating and evaluating symbolic expressions. Researchers have reported that chain-of-thought empowers AI models with this ability, which enables them to perform effective symbolic reasoning in various domains.
Chain-of-thought is a promising approach to enhance the cognitive abilities of AI models, especially in areas like arithmetic reasoning, common sense reasoning, and symbolic reasoning.
In contrast to a simple prompt, a chain-of-thought prompt instructs the model to break down complex problems into smaller steps to produce intermediate reasoning along with the final solution.
Chain-of-thought not only solves cognitive tasks but also provides insights into the inner workings of the model. It can also be easily deployed across various tasks, requiring no extra computing resources.
By further exploring and refining chain-of-thought reasoning, we can empower AI models to effectively demonstrate enhanced cognitive abilities.