Skip to Content
Ask ChatGPT to Use Chain of Thought: Reasoning by Example
shortcut

Ask ChatGPT to Use Chain of Thought: Reasoning by Example

by Mike Loukides
October 2023
Intermediate
5 pages
3m
English
O'Reilly Media, Inc.
Content preview from Ask ChatGPT to Use Chain of Thought: Reasoning by Example

Ask ChatGPT to Use Chain of Thought: Reasoning by Example

Chain of thought (CoT) is a prompting technique described in “Chain-of-Thought Prompting Elicits Reasoning in Large Language Models” by Jason Wei et al. The idea behind CoT is that large language models are not good at logical reasoning or solving word problems. However, if you can construct a prompt that includes a similar word problem and its solution, followed by the problem that you want to solve, ChatGPT will follow the style of logic in your prompt and use it to solve your problem.

For example:

Prompt: Question: Jane is biking to school from her house. The ride to school normally takes 20 minutes. If she has biked 3 miles in 15 minutes, how far is the school from her house?

Answer: Use the formula distance = rate × time where rate is Jane’s speed and time is the time it takes her to travel a certain distance. We know that Jane has biked 3 miles in 15 minutes, so her speed is:

rate = distance / time = 3 miles / 15 minutes = 0.2 miles per minute

We also know that the ride to school normally takes 20 minutes. Using the rate we just calculated, we can find the distance to school as follows:

distance = rate × time = 0.2 miles per minute × 20 minutes = 4 miles

Therefore, the school is 4 miles away from Jane’s house.

Question: My commute to work requires an hour-long commuter train trip. If I have traveled 40 miles in 45 minutes, how far is the commute?

I haven’t ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Use ChatGPT to Provide Context with Quoting

Use ChatGPT to Provide Context with Quoting

Mike Loukides

Publisher Resources

ISBN: 9781098163112