Today, we dive into the fascinating world of 'Tree of Thought prompting' or ToT, a unique framework that's significantly improved upon the existing advanced methods, changing the way we approach problem-solving using language models. All the tests within the article were run on ChatGPT 4, rendering this technique very much modern and relevant to us.
You are familiar with chain-of-thought prompting, right? The Tree of Thoughts framework is an expansion of that concept. It encourages an AI model to explore various intermediate thoughts that can aid in solving a problem.
But what does that look like? Picture a tree, with each branch representing a coherent analytical sequence. These branches are the 'thoughts' that the AI model creates and evaluates as it works towards the solution.
The ToT framework also enables the AI model to self-evaluate its progress, like it used to with self-consistency prompting. At every step, the model perceives its decisions in a tree and evaluates, whether the nodes bring her closer to the solution, or not.
Alright now, let's navigate the tree with an example! We take on a 'Game of 24' with 4 numbers.
The goal is to use arithmetic operations on the numbers in any order, to get 24 in the end. The research paper this article is based on picked the hardest 4-number combinations, as rated by human players. To solve it, we first prompt our
The first step is prompting the AI Model to give us multiple solutions. We'll keep only 5 of them 'till the next step. After we've generated many arithmetic operations with prompt (a), we go on to evaluate them. In the context of this game, ToT prompts the language model to evaluate each node as "sure/maybe/impossible" rating their chances of reaching 24. This method of evaluation helps in pruning the tree, focusing the search on the most promising branches, and ignoring the paths that lead to dead ends. Each node is evaluated multiple times to get a majority vote.
Repeat this for 2 more iterations, and you've got yourself an answer! So, how does ToT perform in comparison to other prompting methods?
Analyzing the left graph, the difference is staggering, even with fewer nodes visited Tree of Thought outperforms Chain of Thought and Zero-shot (IO) techniques. The data in research says - that ToT achieves a 75% success rate, whilst CoT gets it right only in 50% of the cases. On the right graph, we see, that CoT is sure to fail basically by the third step, which is surprisingly low, with only some sample runs giving the right answer.
The author poses that this prompting method is directly beneficial for Creative Writing, and crosswords.
In Yao et al. (2023) it was proposed that training a ToT controller alongside the LLM, could with time increase the speed and success rate of the process.
Hulbert (2023) has proposed Zero-Shot Tree-of-Thought Prompting as a simple yet possibly effective prompting technique.
An example of such a prompt is below:
Imagine three different experts are answering this question.
All experts will write down 1 step of their thinking,
then share it with the group.
Then all experts will go on to the next step, etc.
If any expert realizes they're wrong at any point then they leave.
The question is...
As you can see, implementing the ToT framework involves strategic prompting. This technique enables AI models to solve complex problems more efficiently and effectively than traditional methods.
The ToT framework yet again unlocks the new potential of AI with the help of simple prompting. It equips language models with the ability to think critically, evaluate options, and tackle complex tasks more efficiently. With further research on controllers and broader applications, ToT has the potential to revolutionize fields like creative writing and beyond.
All code in regards to the game of 24 and ToT is available here and here.
Test these prompts out with Our API on ChatGPT 4, or any other model you want from our collection.
We're excited to see what amazing projects you will bring to life. Happy prompting!