Chain-of-thought Prompting is a technique that involves breaking down a complex task into multiple simpler prompts.
This technique is used best with tasks that can be broken down into multiple steps, however, it does not add much value to open ended or more creative tasks.
For example, instead of asking:
Sally (a girl) has 3 brothers. Each brother has 2 sisters. How many sisters does Sally have?
Sally has 3 brothers. Each of these brothers has 2 sisters, including Sally herself. So, in total, Sally has 3 sisters (her 3 brothers' sisters, which include her).
The conversation can be broken down into multiple prompts, like:
User: Sally has 3 brothers.
Assistant: I see. You mentioned that Sally has 3 brothers. How can I assist you further with this information?
User: Each brother has 2 sisters.
Assistant: Given that each brother has 2 sisters, it implies that Sally is one of the sisters for each brother. Therefore, Sally and her 3 brothers form a family of 4 siblings. Is there anything else you would like to know or discuss?
User: So, how many sisters does Sally have?
Sally has one sister. This is based on the information you provided that each of Sally’s three brothers has two sisters. The two sisters are Sally and her sister. So, Sally has one sister.
Sometimes, it can be difficult or time consuming to split a single prompt into multiple parts. To achieve similar results, use zero-shot chain-of-thought prompting.
Zero-shot chain-of-thought prompting involves involves adding "Think step by step", or a similar phrase in the prompt to have the model automatically break down the task into smaller, more manageable parts.
For example, instead of asking:
Sally (a girl) has 3 brothers. Each brother has 2 sisters. How many sisters does Sally have?
Sally has 3 brothers. Each of these brothers has 2 sisters, including Sally herself. So, in total, Sally has 3 sisters (her 3 brothers' sisters, which include her).
Zero-shot chain-of-thought prompting can be used to automatically break down the task:
Sally (a girl) has 3 brothers. Each brother has 2 sisters. How many sisters does Sally have? Let's think step by step.
Sure, let’s break it down:
1. Sally has 3 brothers.
2. Each brother has 2 sisters.
Given that each brother has 2 sisters, and we know that Sally is one of the sisters, it means that there is 1 other sister. Therefore, Sally has 1 sister. The brothers and sisters together make up a family of 5 children.
Chain-of-thought prompting works best for complex tasks that require multiple steps, such as logical reasoning, math, and similar tasks.