This is a repo for showcasing using Monte Carlo Search Tree(MCTS) with LLMs to solve gsm8k problems.
This is just a demo project that goes with my MCTS lecture video, so the implementation and code style can be a little bit rough, feel free to leave any issues or open PRs to contribute.
- 🥳 A huge shoutout to @euyis1019, this demo now supports both
openai
anddeepseek
api calling, along with token usage statistics.
The MCTS implementation template is from minimal MCTS.
Watch how I implemented this Monte Carlo Search Tree on Bilibili(Chinese)
pip install -r requirements.txt
The project supports the following command line arguments:
--provider
: Select model provider, options:openai
(default) ordeepseek
--model
: Specify model name, defaults to provider-specific model if not specified--api-key
: Directly provide API key, reads from environment variables if not specified--base-url
: Specify API base URL, defaults to provider-specific URL if not specified--iterations
: Specify number of MCTS iterations, default is 4
Example:
export OPENAI_API_KEY="Your API Key"
python main.py
or
python main.py --provider deepseek --model deepseek-chat --iterations 4 --api-key "Your DeepSeek API Key"