Making GPTs Think: A Guide to Deliberate Problem Solving with AI

stonediggity

Liam Stone

Posted on June 26, 2023

Making GPTs Think: A Guide to Deliberate Problem Solving with AI

Image Credit: OpenAI

Introduction

We've all encountered that quick-to-react friend who, although often correct, occasionally misses the mark by rushing. Our AI models can behave similarly - they are prompt and efficient, but sometimes they overlook essential details in their haste. So, how can we encourage our AI to think more deeply? The answer is simple: give them time to "think" and evaluate from the ground up. It's the equivalent of asking your quick-witted friend to pause, ponder, and then make a decision.

We'll explore three tactics:

  1. Giving GPTs time to "think"
  2. Using an inner monologue or a sequence of queries to hide the model's reasoning process
  3. Asking the model if it missed anything on previous passes

Tactic 1: Giving GPTs time to "think"

Sometimes, we get better results by instructing the model to reason from first principles before coming to a conclusion. Let's consider an example where we want GPT to evaluate a student’s solution to a math problem. The most obvious approach would be to directly ask GPT if the student's solution is correct or not.
Sometimes, we get better results by instructing the model to reason from first principles before coming to a conclusion. Let's consider an example where we want GPT to evaluate a student’s solution to a math problem. The most obvious approach would be to directly ask GPT if the student's solution is correct or not.

For example:

User: Problem Statement: I'm building a solar power installation and I need help working out the financials.
- Land costs $100 / square foot
- I can buy solar panels for $250 / square foot
- I negotiated a contract for maintenance that will cost me a flat $100k per year, and an additional $10 / square foot
What is the total cost for the first year of operations as a function of the number of square feet?

Student's Solution: Let x be the size of the installation in square feet.
1. Land cost: 100x
2. Solar panel cost: 250x
3. Maintenance cost: 100,000 + 100x
Total cost: 100x + 250x + 100,000 + 100x = 450x + 100,000

Assistant: The student's solution is correct.
Enter fullscreen mode Exit fullscreen mode

But the student's solution was incorrect! To correct this, we can ask the model to generate its own solution first and then compare it to the student's solution.

User: Problem Statement: I'm building a solar power installation and I need help working out the financials.
- Land costs $100 / square foot
- I can buy solar panels for $250 / square foot
- I negotiated a contract for maintenance that will cost me a flat $100k per year, and an additional $10 / square foot
What is the total cost for the first year of operations as a function of the number of square feet?

Student's Solution: Let x be the size of the installation in square feet.
1. Land cost: 100x
2. Solar panel cost: 250x
3. Maintenance cost: 100,000 + 100x
Total cost: 100x + 250x + 100,000 + 100x = 450x + 100,000

Assistant: Let x be the size of the installation in square feet.
1. Land cost: 100x
2. Solar panel cost: 250x
3. Maintenance cost: 100,000 + 10x
Total cost: 100x + 250x + 100,000 + 10x = 360x + 100,000

The student's solution is incorrect. They made an error in the maintenance cost calculation, using 100x instead of 10x. The correct total cost for the first year of operations is 360x + 100,000.
Enter fullscreen mode Exit fullscreen mode

Tactic 2: Using an inner monologue or a sequence of queries to hide the model's reasoning process

Sometimes, revealing the reasoning process that a model uses to arrive at a final answer can be inappropriate, especially in tutoring applications. We may want to encourage students to work out their own answers, but a model’s reasoning process about the student’s solution could reveal the answer to the student.

We can use inner monologue or a sequence of queries to instruct the model to put parts of the output that are meant to be hidden from the user into a structured format. Then, the output is parsed and only part of it is made visible to the user.

For example, we can ask the model to work out its own solution, compare it to the student's, determine a hint if there's a mistake, and then provide that hint to the student.

SYSTEM
Follow these steps to answer the user queries.

Step 1 - First work out your own solution to the problem. Don't rely on the student's solution since it may be incorrect. Enclose all your work for this step within triple quotes (""").

Step 2 - Compare your solution to the student's solution and evaluate if the student's solution is correct or not. Enclose all your work for this step within triple quotes (""").

Step 3 - If the student made a mistake, determine what hint you could give the student without giving away the answer. Enclose all your work for this step within triple quotes (""").

Step 4 - If the student made a mistake, provide the hint from the previous step to the student (outside of triple quotes). Instead of writing "Step 4 - ..." write "Hint:".
USER
Problem Statement: <insert problem statement>

Student Solution: <insert student solution>
Enter fullscreen mode Exit fullscreen mode

Tactic 3: Asking the model if it missed anything on previous passes

When using a model to list excerpts from a source relevant to a particular question, it's common for the model to stop early and fail to list all relevant excerpts. In such cases, we can prompt the model with followup queries to find any excerpts it missed on previous passes.

SYSTEM
You will be provided with a document delimited by triple quotes. Your task is to select excerpts which pertain to the following question: "What significant paradigm shifts have occurred in the history of artificial intelligence."

Ensure that excerpts contain all relevant context needed to interpret them - in other words don't extract small snippets that are missing important context. Provide output in JSON format as follows:

[{"excerpt": "..."},
...
{"excerpt": "..."}]
USER
"""<insert document here>"""
ASSISTANT
[{"excerpt": "the model writes an excerpt here"},
...
{"excerpt": "the model writes another excerpt here"}]
USER
Are there more relevant excerpts? Take care not to repeat excerpts. Also ensure that excerpts contain all relevant context needed to interpret them - in other words don't extract small snippets that are missing important context.
Enter fullscreen mode Exit fullscreen mode

Conclusion

As Abraham Lincoln once said,

"Give me six hours to chop down a tree and I will spend the first four sharpening the axe."

This underscores the value of taking time to prepare and think things through - a principle that should apply not only to humans but to AI models as well. In our quest for quick and efficient AI, we have created models that are often quick to respond but sometimes miss essential details in their haste. But what if our AI could be like Lincoln, spending time 'sharpening the axe' before making a decision?

By implementing tactics like asking our models to reason more deeply, structuring their thought process, and prompting them for any overlooked information, we can elevate their ability to tackle complex problems and deliver thoughtful, accurate solutions. In the end, a more reflective, more "thoughtful" AI will emerge, one that understands that sometimes the best answers are not rushed, but rather the result of careful and meticulous thought. So, here's to a more Lincoln-like AI, because often, the best answers are indeed worth the wait.

Reference: Give GPTs Time to Think

💖 💪 🙅 🚩
stonediggity
Liam Stone

Posted on June 26, 2023

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related