{"id":75064,"date":"2023-06-07T12:31:17","date_gmt":"2023-06-07T12:31:17","guid":{"rendered":"https:\/\/www.techopedia.com"},"modified":"2023-12-14T11:08:48","modified_gmt":"2023-12-14T11:08:48","slug":"enhancing-ais-cognitive-abilities-through-chain-of-thought-reasoning","status":"publish","type":"post","link":"https:\/\/www.techopedia.com\/enhancing-ais-cognitive-abilities-through-chain-of-thought-reasoning","title":{"rendered":"Enhancing AI’s Cognitive Abilities Through Chain-of-Thought Reasoning"},"content":{"rendered":"

Recently, artificial intelligence<\/a> (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<\/a>, machine translation, text generation, and summarization.<\/p>\n

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<\/a> and commonsense reasoning.<\/p>\n

This article introduces the latest development known as chain-of-thought (CoT) reasoning, a prompt-based<\/a> technique that enables AI models to exhibit cognitive abilities.<\/p>\n

What Is a Prompt?<\/span><\/h2>\n

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.<\/p>\n

We can prompt language models like ChatGPT<\/a> 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.<\/p>\n

How Does Prompt Engineering Work?<\/span><\/h2>\n

Prompt engineering<\/a> 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.<\/p>\n

For instance, if we aim to determine the sentiment of the movie review “Don\u2019t watch it,” we can add the prompt “It is” to the sentence, making it \u201cDon\u2019t watch it. It is ____.” In this case, we would anticipate a higher probability from the language model<\/a> to generate “terrible” rather than “great.”<\/p>\n

The goal of AI prompt engineering is to generate high-quality prompts that allow the AI model to make accurate predictions.<\/p>\n

Prompt-Based Learning<\/h3>\n

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.<\/p>\n

For example, we can prompt the model with some numeric questions and their answers, asking it to solve other questions:<\/p>\n

\n\n\n\n
Q: The cafeteria had 23 apples. If they used 20 to make lunch and bought 6 more, how many apples do they have?
\n<\/span>A: 9<\/span>Q: There are 15 students in a class. If 7 more students join the class, how many students are there in total?
\n<\/span>A: ______<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

<\/div><\/span><\/p>\n

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.<\/p>\n

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.<\/p>\n

Chain-Of-Thought Reasoning<\/span><\/h2>\n

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.<\/p>\n

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.<\/p>\n

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.<\/p>\n

\n\n\n\n\n\n
<\/td>\nExample of a standard prompt<\/b><\/td>\nExample of a chain-of-thought prompt<\/b><\/td>\n<\/tr>\n
Question<\/b><\/td>\nImagine 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.<\/span><\/td>\nImagine 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.<\/span><\/td>\n<\/tr>\n
Answer<\/b><\/td>\n$59.50.<\/span><\/td>\n\n
    \n
  1. To calculate the total cost of fuel, we need to determine the total number of gallons of fuel required for the trip.<\/span><\/li>\n
  2. First, let’s calculate how many gallons of fuel are needed to cover the entire distance. We divide the total distance of 500 miles by the car’s average fuel efficiency of 30 miles per gallon: 500 miles \/ 30 miles per gallon = 16.67 gallons.<\/span><\/li>\n
  3. Since we cannot have a fraction of a gallon, we need to round up to the nearest whole number. Therefore, the car will require approximately 17 gallons of fuel for the entire trip.<\/span><\/li>\n
  4. Next, we multiply the total number of gallons (17) by the price per gallon ($3.50) to find the total cost of fuel: 17 gallons * $3.50 per gallon = $59.50.<\/span><\/li>\n
  5. Therefore, the estimated total cost of fuel for the road trip is $59.50.<\/span><\/li>\n<\/ol>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n

    Benefits of the Chain-Of-Thought Technique<\/span><\/h2>\n

    Chain-of-thought offers several advantages when it comes to enhancing the cognitive abilities of AI models:<\/p>\n