Over the past few months, I built an efficient MCTS implementation in Python/numba.
As I was building a self-play environment from scratch (for learning purposes), I realized that there were few efficient implementation of this algorithm.
I spent a lot of time validating it against a golden standard baseline [1].
My PUCT implementation is 2-15X faster than the baseline while providing the exact same policy.
I also implemented a Gumbel MCTS, both dense and sparse. The sparse version is useful for games with large action spaces such as chess.
Gumbel makes much better usage of low simulation budgets than PUCT.
Overall, I think this could be useful for the community. I used coding agents to help me along the way, but spent a significant amount of manual work to validate everything myself.
Feedback welcome.
[1] https://github.com/michaelnny/alpha_zero/blob/main/alpha_zer...