Skip to content

Wangmerlyn/MCTS-GSM8k-Demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MCTS-GSM8k-Demo

DOI

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.

Shoutout

  • 🥳 A huge shoutout to @euyis1019, this demo now supports both openai and deepseek api calling, along with token usage statistics.

MCTS code template

The MCTS implementation template is from minimal MCTS.

Explaination

Watch how I implemented this Monte Carlo Search Tree on Bilibili(Chinese)

Installation

pip install -r requirements.txt

Run

Command Line Arguments

The project supports the following command line arguments:

  • --provider: Select model provider, options: openai (default) or deepseek
  • --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"

📖Citation

If you find MCTS-GSM8k-Demo useful in your research or work, please cite it as:

@software{Wangmerlyn_MCTS_GSM8k_Demo_2025,
  author       = {Wang, Siyuan and {Eric} and Singh, Sudhanshu},
  title        = {MCTS-GSM8k-Demo},
  year         = {2025},
  publisher    = {Zenodo},
  doi          = {10.5281/zenodo.17587990},
  url          = {https://doi.org/10.5281/zenodo.17587990},
  note         = {Zenodo release. Video demo: https://www.bilibili.com/video/BV1BArPYQE8x},
  keywords     = {mcts, llm, gsm8k, reasoning, demo}
}

About

This is a repo for showcasing using MCTS with LLMs to solve gsm8k problems

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages