Chain-of-Thought Prompting
"Chain-of-Thought Prompting"
This glossary explains various keywords that will help you understand the mindset necessary for data utilization and successful DX.
This time, we will introduce "Chain-of-Thought Prompting," a technique for utilizing conversational AI using large-scale language models such as ChatGPT.
What is Chain-of-Thought Prompting?
Chain-of-Thought prompting is a prompt creation technique that, when using conversational AI such as ChatGPT, allows you to obtain a more desired output by providing a thought process as a guide when giving input (prompts).
Chain-of-Thought is sometimes abbreviated as CoT. Also, output can sometimes be improved by letting ChatGPT think for itself without providing a thought process as input, and this technique is sometimes called Chain-of-Thought.
What kind of technique is it? (Example of use)
ChatGPT can do a lot of different things, for example it can do some (small) calculations.
You have five apples. If you eat two apples, how many are left?
You start with five apples, so after eating two you have three apples left.
It works as if it understands what is being said, calculates it, and returns the answer. It's a frightening behavior, but when it comes to difficult problems, ChatGPT sometimes makes calculation errors.
From the Google paper that inspired the name:
Chain-of-Thought prompting is a technique originally proposed in a Google paper.
⇒ [2201.11903] Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
Here is an example of a calculation failure from the paper. The performance of conversational AI is improving every day, so at this point it may often give correct answers.
The cafeteria had 23 apples. If they used 20 to make lunch and bought 6 more, how many apples do they have?
There are 23 apples in the cafeteria. If you use 20 to make lunch and then buy 6 more, how many apples will you have left?
The answer is 27.
(The answer is 27)
It may seem odd that a computer would make a calculation mistake, but ChatGPT is built on a large-scale language model called GPT, which has not been trained for the task of computation.
⇒Large Language Model (LLM) | Glossary
Even though it has not been trained, "when I made it, for some reason it was able to do calculations," but I don't know why it can do calculations, and it may or may not be able to do calculations depending on the problem it is given. In this way, ChatGPT can be used or not used for various tasks, not just calculations.
With assistance it becomes solvable
Researchers at Google have discovered and reported in a paper that problems that cannot be solved like this can sometimes be solved by providing some assistance with prompts (input).
Q: Roger has 5 tennis balls. He buys 2 more cans of tennis balls. Each can has 3 tennis balls. How many tennis balls does he have now?
Roger has 5 tennis balls. He buys 2 more cans of tennis balls. Each can contains 3 tennis balls. How many tennis balls does he now have?
A: Roger started with 5 balls. 2 cans of 3 tennis balls each is 6 tennis balls. 5 + 6 = 11. The answer is 11.
Roger started with 5 tennis balls. He bought two cans of 3 tennis balls each, so he got 6 extra tennis balls. 5 + 6 = 11. The answer is 11.
Q: The cafeteria had 23 apples. If they used 20 to make lunch and bought 6 more, how many apples do they have?
There were 23 apples in the cafeteria. They used 20 for lunch and then bought 6. How many apples do they have now?
A: The cafeteria had 23 apples originally. They used 20 to make lunch. So they had 23 - 20 = 3. They bought 6 more apples, so they have 3 + 6 = 9. The answer is 9.
(Initially, there were 23 apples in the cafeteria. They used 20 for lunch, leaving 23 - 20 = 3 apples. Then they buy 6 more apples, so now they have 3 + 6 = 9 apples. The answer is 9.)
First, the answer is correct (the answer is 9), and second, there's a lot more typing.
Chain-of-Thought prompting input explanation
Before asking a question, a complete question and answer set is added as an example. This uses Few-Shot Prompting, a technique that teaches by showing examples of the answers you want to see (please see the separate article).
⇒ Few-Shot Prompting | Glossary
So, what is the example taught by Few-Shot Prompting? The example is also a calculation problem, one that ChatGPT can solve on its own. However, when asked to answer it itself, it will only answer "The answer is 11." The following answer is given as an example, with the underlined part added by a human:
A: Roger started with 5 balls. 2 cans of 3 tennis balls each is 6 tennis balls. 5 + 6 = 11. The answer is 11.
Roger started with 5 tennis balls. He bought two cans of 3 tennis balls each, so he got 6 extra tennis balls. 5 + 6 = 11. The answer is 11.
ChatGPT will use this as an example answer and will respond to other questions in a similar format.
A: The cafeteria had 23 apples originally. They used 20 to make lunch. So they had 23 - 20 = 3. They bought 6 more apples, so they have 3 + 6 = 9. The answer is 9.
(Initially, there were 23 applesin the cafeteria. They used 20 for lunch, leaving 23 - 20 = 3apples. Then theybuy 6 more apples, so now they have 3 + 6 = 9 apples. The answer is 9.)
Without any assistance, he would simply answer "The answer is 27," which was incorrect, but when he began to organize the situation, show the corresponding formula, and indicate the calculation result, he began to give the correct answer.
What does Chain-of-Thought prompting do?
This means that before your answer, you provide a written transcript of the thought process that led you to the correct answer. ChatGPT will then use this as an example and try to provide an answer in a similar format.
As a result, it will not generate an answer right away. This is because the example instructs it to produce a different output (thought process) beforehand. Therefore, it first generates output in the instructed thought process format. In this example, it organizes the given conditions in order, presents the corresponding calculation formula, and then generates the answer. In other words, it can be said to be a "technique to control ChatGPT 's thought process."
Even if the answer is wrong, doing this can help you understand why it was wrong. Furthermore, for tasks like calculations where there is no correct answer, such as writing a persuasive explanation, it is possible to specify the logical structure you want the answer to be.
Chain-of-Thought (Zero-shot CoT) by adding just one phrase
This technique may seem effective, but it may seem like a bit of a time-consuming one. However, there is a very simple way to improve the accuracy of answers by having ChatGPT consider the thought process. Here is an example of using the technique from the Google paper mentioned earlier, which uses "mistake examples."
The cafeteria had 23 apples. If they used 20 to make lunch and bought 6 more, how many apples do they have?
There were 23 apples in the cafeteria. If they used 20 for lunch and then bought 6 more apples, how many apples do they now have?
Let's think step by step.
Let's think about it step by step.
Sure, let's break down the problem step by step.
Ok, let's break the problem down piece by piece.
- The cafeteria had 23 apples
- They used 20 apples to make lunch, so they have 23 - 20 = 3 apples left.
- They bought 6 more apples.
- Therefore, the total number of apples they have now is 3 + 6 = 9 apples.
So, the cafeteria has 9 apples now.
Here too, ChatGPT correctly answers that there are 9 apples. Moreover, even though we did not specifically instruct it to think in stages, it was able to think in stages on its own.
The only change I made to the input was to add one more phrase.
Let's think step by step.
Let's think about it step by step.
By simply adding this one phrase, ChatGPT was able to break down the problem into stages and think about it in order to answer the question. It is known that if you specify various other thinking styles in addition to this phrase, the output will change accordingly.
Because this technique achieves the effect aimed at by Chain-of-Thought even without a human providing an example, it is sometimes called "Zero-shot CoT (Zero-shot Chain-of-Though)." Alternatively, I think this technique is sometimes called Chain-of-Thought prompting.
It's very easy to use, just add one specific phrase to the end of the input, and yet it has the potential to significantly improve the output, so I think it's a technique worth remembering.
Keywords related to Generative AI/ChatGPT (for further understanding)
- Generation AI
- Large Language Model (LLM)
- ChatGPT
- Prompt Engineering
Glossary Column List
Alphanumeric characters and symbols
- The Cliff of 2025
- 5G
- AI
- API [Detailed version]
- API Infrastructure and API Management [Detailed Version]
- BCP
- BI
- BPR
- CCPA (California Consumer Privacy Act) [Detailed Version]
- Chain-of-Thought Prompting [Detailed Version]
- ChatGPT (Chat Generative Pre-trained Transformer) [Detailed version]
- CRM
- CX
- D2C
- DBaaS
- DevOps
- DWH [Detailed version]
- DX certified
- DX stocks
- DX Report
- EAI [Detailed version]
- EDI
- EDINET [Detailed version]
- ERP
- ETL [Detailed version]
- Excel Linkage [Detailed version]
- Few-shot prompting / Few-shot learning [detailed version]
- FIPS140 [Detailed version]
- FTP
- GDPR (EU General Data Protection Regulation) [Detailed version]
- Generated Knowledge Prompting (Detailed Version)
- GIGA School Initiative
- GUI
- IaaS [Detailed version]
- IoT
- iPaaS [Detailed version]
- MaaS
- MDM
- MFT (Managed File Transfer) [Detailed version]
- MJ+ (standard administrative characters) [Detailed version]
- NFT
- NoSQL [Detailed version]
- OCR
- PaaS [Detailed version]
- PCI DSS [Detailed version]
- PoC
- REST API (Representational State Transfer API) [Detailed version]
- RFID
- RPA
- SaaS (Software as a Service) [Detailed version]
- SaaS Integration [Detailed Version]
- SDGs
- Self-translate prompting / "Think in English, then answer in Japanese" [Detailed version]
- SFA
- SOC (System and Organization Controls) [Detailed version]
- Society 5.0
- STEM education
- The Flipped Interaction Pattern (Please ask if you have any questions) [Detailed version]
- UI
- UX
- VUCA
- Web3
- XaaS (SaaS, PaaS, IaaS, etc.) [Detailed version]
- XML
- ZStandard (lossless data compression algorithm) [detailed version]
A row
- Avatar
- Crypto assets
- Ethereum
- Elastic (elasticity/stretchability) [detailed version]
- Autoscale
- Open data (detailed version)
- On-premise [Detailed version]
Ka row
- Carbon Neutral
- Virtualization
- Government Cloud [Detailed Version]
- availability
- completeness
- Machine Learning [Detailed Version]
- mission-critical system, core system
- confidentiality
- Cashless payment
- Symmetric key cryptography / DES / AES (Advanced Encryption Standard) [Detailed version]
- Business automation
- Cloud
- Cloud Migration
- Cloud Native [Detailed Version]
- Cloud First
- Cloud Collaboration [Detailed Version]
- Retrieval Augmented Generation (RAG) [Detailed version]
- In-Context Learning (ICL) [Detailed version]
- Container [Detailed version]
- Container Orchestration [Detailed Version]
Sa row
- Serverless (FaaS) [Detailed version]
- Siloization [Detailed version]
- Subscription
- Supply Chain Management
- Singularity
- Single Sign-On (SSO) [Detailed version]
- Scalable (scale up/scale down) [Detailed version]
- Scale out
- Scale in
- Smart City
- Smart Factory
- Small start (detailed version)
- Generative AI (Detailed version)
- Self-service BI (IT self-service) [Detailed version]
- Loose coupling [detailed version]
Ta row
- Large Language Model (LLM) [Detailed version]
- Deep Learning
- Data Migration
- Data Catalog
- Data Utilization
- Data Governance
- Data Management
- Data Scientist
- Data-driven
- Data analysis
- Database
- Data Mart
- Data Mining
- Data Modeling
- Data Lineage
- Data Lake [Detailed version]
- data integration / data integration platform [Detailed Version]
- Digitization
- Digitalization
- Digital Twin
- Digital Disruption
- Digital Transformation
- Deadlock [Detailed version]
- Telework
- Transfer learning (detailed version)
- Electronic Payment
- Electronic Signature [Detailed Version]
Na row
Ha row
- Hybrid Cloud
- Batch Processing
- Unstructured Data
- Big Data
- File Linkage [Detailed version]
- Fine Tuning [Detailed Version]
- Private Cloud
- Blockchain
- Prompt template [detailed version]
- Vectorization/Embedding [Detailed version]
- Vector database (detailed version)
Ma row
- Marketplace
- migration
- Microservices (Detailed Version)
- Managed Services [Detailed Version]
- Multi-tenant
- Middleware
- Metadata
- Metaverse
Ya row
Ra row
- Leapfrogging (detailed version)
- quantum computer
- Route Optimization Solution
- Legacy System/Legacy Integration [Detailed Version]
- Low-code development (detailed version)
- Role-Play Prompting [Detailed Version]
