Tree-of-Thought Puzzle Solver Project
Overview
The Tree-of-Thought (ToT) Puzzle Solver is an innovative project designed to enhance the problem-solving capabilities of auto-regressive large language models (LLMs) using the Tree-of-Thought (ToT) framework. This framework draws inspiration from the human cognitive process, especially how people address complex reasoning tasks through trial and error. By mimicking a tree-like exploration of solutions, the ToT framework allows the system to backtrack and reassess previous steps, much like humans do when exploring multiple avenues to solve a problem.
Key Features
The core of the Tree-of-Thought Puzzle Solver is its integration of several modules with a large language model. These modules include:
- Prompter Agent: This module helps initiate the problem-solving process by framing problems for the LLM.
- Checker Module: It ensures that the solutions proposed meet the problem’s requirements.
- Memory Module: This component retains information, helping the solver remember previous steps and decisions.
- ToT Controller: The controller manages the entire thought process, facilitating backtracking and exploration of alternate solutions.
In a given session, these components work collectively, engaging in a conversation with the LLM to approach and solve the puzzle effectively.
How It Works
Unlike traditional auto-regressive LLMs, which develop sequences based solely on prior outputs, the ToT framework allows for a more dynamic approach. This framework enables the model to revisit previous decisions and adjust its course of action, allowing thorough exploration of the puzzle's solution space. This mimics human cognitive strategies, where reconsideration of earlier steps is often necessary to reach an optimal solution.
Setting Up the Project
To begin utilizing the Tree-of-Thought Puzzle Solver, one must clone the repository and install necessary dependencies with Python 3.9 or later. Initial configuration involves creating and editing a YAML configuration file to set the preferred language model (such as "gpt-3.5-turbo") and the relevant OpenAI API Key.
Steps to Set Up:
git clone https://github.com/jieyilong/tree-of-thought-puzzle-solver
cd tree-of-thought-puzzle-solver
pip install -r requirements.txt
touch config.yaml
The configuration file config.yaml
must contain specifics about the chatbot type and OpenAI credentials.
Running the Solver
To run the Tree-of-Thought Puzzle Solver, execute the command with details of the puzzle to be solved.
Example:
python run_tot.py "please solve this 4x4 sudoku puzzle [[*,1,*,*],[*,*,2,*],[*,*,*,4],[1,*,*,*]] where * represents a cell to be filled in."
Conducting Experiments
Experiments can be conducted to evaluate the solver's performance using different strategies such as zero-shot or few-shot with chain-of-thought prompting, alongside the Tree-of-Thought method itself.
Example Commands:
python run_expr.py zero_shot data/benchmarks/sudoku/3x3_sudoku_puzzles.json
python run_expr.py one_shot_with_cot data/benchmarks/sudoku/3x3_sudoku_puzzles.json
python run_expr.py few_shot_with_cot data/benchmarks/sudoku/3x3_sudoku_puzzles.json
python run_expr.py tot data/benchmarks/sudoku/3x3_sudoku_puzzles.json
Acknowledgments
The Tree-of-Thought framework is part of ongoing research into enhancing LLM's efficiency in complex problem-solving domains, as highlighted in the preprint "Large Language Model Guided Tree-of-Thought" by Jieyi Long. For more insights, one can refer to the preprint. The foundational work for this innovative approach is cited below using the appropriate BibTeX format for scholarly use.
This project represents a significant step forward in utilizing the inherent potential of LLMs to solve intricate puzzles by emulating human cognitive abilities.