- The Prompt Craftsman
- Posts
- 🔥 ChatGPT Tips Tuesday #16: Let's explore the tree of thoughts!
🔥 ChatGPT Tips Tuesday #16: Let's explore the tree of thoughts!
Tree of Thoughts is a cool technique for complex problem solving
💡 ChatGPT Tips for the day
Tree of Thoughts mimics how a person would think through the solution and incorporating this in prompting would achieve some interesting results.
Based on popular demand, we will discuss the Tree of Thoughts technique for prompting.
The concept of this technique comes from this academic paper, Tree of Thoughts: Deliberate Problem Solving with Large Language Models.
To explain the different types of prompting with the LLMs, the following graph from this paper is a great summarization.

Credit: Tree of Thoughts: Deliberate Problem Solving with Large Language Models
According to the authors, there is a way to implement this technique directly. However, one would need to play with the code to try it. See the GitHub page for this proposed approach.
Well, for someone who is less technical, I am keen to see how you can incorporate this technique with ChatGPT just via natural language prompting. To do that, we would need to understand what is the structure that is proposed in this paper. This is what I can gather are the steps for this technique:
Generate ideas: this mimics a person coming up with multiple ideas for each step of the problem-solving process.
Evaluate ideas: at the end of each step, all the ideas would be evaluated to see if it is worthwhile to proceed to the next step from the idea proposed based on specific criteria.
Repeat the process to generate and evaluate ideas.
If it is known a step won’t lead to the result wanted, go back to the previous step.
Now, let’s craft the prompt. For that, I am planning to let ChatGPT play with the Game of 24 so that we can see whether the prompt you would actually go through the steps as planned above. Here is the prompt I have created.
Let's play a game of 24. The object of the game is to make the number 24 from the four numbers provided. Here are the general rules for this game:
- You can add, subtract, multiply and divide with the numbers.
- You must use all four numbers provide, but use each number only once.
- You do not have to use all four operations.
- Each game has 3 rounds.
You are acting as the 3 players that are playing this game together, who are Player 1, Player 2, Player3.
For each round
- Each player would propose a calculation step where it would only use 2 numbers.
- After all players have proposed their step, all players would discuss and judge together whether the step would lead them closer to getting 24 using the result and the remaining numbers. They will assign each proposal a score out of 100.
- The proposed calculation step with the highest score would be considered and the result of this calculation along with the numbers haven't been used from the provided list would be used for the next round.
Now, I will provide you with 2 3 10 6 and let's play with these 3 players for the first round.
After trying several attempts with the above prompt, I was actually able to get the results as planned. Here is the link to the actual conversation I have got: https://chat.openai.com/share/01c87916-6a68-4a53-800d-984feed0acee
It is actually a great example where we can ask ChatGPT to go back and pick up another option so it perfectly mimics the steps shown from that academic article. Looks like I did it! 🥳
Obviously, we want to use this technique to do more things other than the Game of 24 so the prompt above won’t be useful for you straightaway, however, the concept still holds. Here is what to consider in your next prompt to use the Tree of Thoughts technique:
Define the rules and limitations for solving the problem
Propose multiple personas so that different ideas can be generated
Ask the personas to discuss and evaluate the ideas so that a single proposal could be proposed for the next step
I hope you find the prompt structure valuable. If you do have any particular problem while implementing this for the problem you are trying to solve, give me a shout!
🎧 What to discuss in the next issue?Choose the topic you would like to learn and I might write it next. |
🔤 Word of the day
Token
n. Think of it as a building block or a piece of a puzzle that the model uses to understand and generate text.
When you interact with ChatGPT, every word, punctuation mark, or even some shorter units like parts of words or special characters are considered as tokens. For example, in the sentence "I love dogs," there are four tokens: "I," "love," "dogs," and the punctuation mark ",".
Tokens are important because the model processes text in chunks, and each token carries meaning and context. By breaking down text into tokens, the model can analyze and understand the structure, grammar, and semantics of the input. It allows the model to capture relationships between words and generate coherent and meaningful responses.
So, in simpler terms, tokens in a language model like ChatGPT are like puzzle pieces that help the model understand and generate text.
🖼️ Image of the day
Didn’t realise that ChatGPT is well-versed in cat language as well 🤣
That is it for the day!
Until I see you next time, stay awesome my friend!
Cheers,
Minjie6
Reply