MC Tree Search as Policy Optimization
What AlphaZero's search rule is really optimizing
AlphaZero (Silver et al., 2017) and MuZero (Schrittwieser et al., 2020) combine deep RL with Monte-Carlo tree search (MCTS), but their action selection rule is handcrafted and only partially understood. (Grill et al., 2020) shows that this heuristic approximately solves a regularized policy optimization problem, closely related to MPO (Abdolmaleki et al., 2018).
Background: How MCTS Works
Before taking an action from state \(\mathrm{x}\), MCTS looks ahead by building a tree whose edges store visits and returns \(\mathrm{\big(n(x,a),\,Q(x,a)\big)}\), using \(\mathrm{N_{sim}}\) simulations, each with three steps (Kocsis & Szepesvári, 2006):
- Selection: from the root, pick actions until a leaf.
- Expansion and evaluation: add the leaf and score it (rollout, or value network \(\mathrm{v_\theta}\)).
- Backup: along the visited path, update each edge’s average return,
where \(\mathrm{G}\) is the new noisy return below that edge.
Each simulation is one root-to-leaf path; across simulations, high-value and under-visited branches get more visits (best-first, not DFS/BFS). After search, play the most visited root action.
Each Node is a Multi-Armed Bandit
At one node, picking an action is like a bandit with unknown mean payoff. Greedy \(\mathrm{Q}\) is risky, so UCB1 adds a bonus that favors rarely tried arms:
\[\begin{align} \mathrm{a^\star=\arg\max_a\bigg[Q(x,a)+c\sqrt{\frac{\log N}{n(x,a)}}\bigg]},\qquad \mathrm{N=\textstyle\sum_b n(x,b)}.\notag \end{align}\]The bonus shrinks like \(\mathrm{1/\sqrt{n}}\) as the estimate gets sharper, while \(\mathrm{\log N}\) keeps every arm revisited. Applying UCB1 at every node gives UCT (≈ MCTS + UCB1-as-selection) (Kocsis & Szepesvári, 2006).
AlphaZero: Adding a Learned Prior
UCT treats all actions equally — hopeless in Go with ~250 legal moves. AlphaZero instead uses PUCT (Predictor + UCT) (Rosin, 2011), which weights the bonus by a policy prior \(\mathrm{\pi_\theta}\):
\[\begin{align}\label{puct} \mathrm{a^\star=\arg\max_a \bigg[\underbrace{Q(x,a)}_{exploit}+\underbrace{c\cdot\pi_\theta(a\mid x)\cdot\frac{\sqrt{\sum_b n(x,b)}}{1+n(x,a)}}_{explore}\bigg]}. \end{align}\]- \(\mathrm{\pi_\theta}\): where to explore (implausible moves get almost no visits).
- \(\mathrm{1/(1+n)}\): bonus decays as \(\mathrm{Q}\) gets reliable.
- \(\mathrm{\sqrt{N}}\): neglected actions slowly regain priority.
- \(\mathrm{c}\): explore–exploit trade-off.
Toy example. With \(\mathrm{c=1}\), \(\mathrm{N=100}\): A has \(\mathrm{(Q,\pi,n)=(0.50,0.6,80)}\), B has \(\mathrm{(0.45,0.3,10)}\). Scores:
\[\begin{align} \mathrm{A: 0.50+0.6\cdot\frac{10}{81}\approx 0.57},\qquad \mathrm{B: 0.45+0.3\cdot\frac{10}{11}\approx 0.72}.\notag \end{align}\]B wins despite lower \(\mathrm{Q}\), because it is under-visited relative to its prior.
Regularized Policy Optimization
Model-free policy optimization improves \(\mathrm{\pi_\theta}\) one step at a time. Given a value estimate \(\mathrm{q}\), it picks a new action distribution \(\mathrm{y}\) in the probability simplex \(\mathrm{\mathcal{S}=\{y\geq 0:\sum_a y_a=1\}}\), trading expected value against a penalty that keeps \(\mathrm{y}\) near \(\mathrm{\pi_\theta}\):
\[\begin{align} \mathrm{\pi_{\theta'}=\arg\max_{y\in\mathcal{S}}\ q^\intercal y-\mathcal{R}(y, \pi_\theta)}.\notag \end{align}\]Setting \(\mathrm{\mathcal{R}=0}\) gives classical policy iteration (greedy on \(\mathrm{q}\)), \(\mathrm{\mathcal{R}=-H(y)}\) gives maximum-entropy RL (softmax), and a forward KL \(\mathrm{KL(y\Vert\pi_\theta)}\) gives MPO-style trust regions.
MCTS Tracks a Regularized Solution
Define the empirical visit distribution and a multiplier with \(\mathrm{N=\sum_b n_b}\):
\[\begin{align} \mathrm{\hat\pi(a)=\frac{1+n_a}{\vert\mathcal{A}\vert+N}, \qquad \lambda_N=c\cdot\frac{\sqrt{N}}{\vert\mathcal{A}\vert+N}}.\notag \end{align}\]A simple algebra rewrites the selection rule \eqref{puct} as
\[\begin{align} \mathrm{a^\star=\arg\max_a\bigg[q_a+\lambda_N\frac{\pi_\theta(a)}{\hat\pi(a)}\bigg]}.\notag \end{align}\]Now consider the regularized problem with a reverse KL penalty:
\[\begin{align}\label{pibar} \mathrm{\bar\pi=\arg\max_{y\in\mathcal{S}}\ q^\intercal y-\lambda_N KL(\pi_\theta\Vert y)}. \end{align}\]The KKT condition gives the closed form
\[\begin{align} \mathrm{\bar\pi(a)=\lambda_N\frac{\pi_\theta(a)}{\alpha-q_a}},\notag \end{align}\]where \(\mathrm{\alpha}\) is chosen such that \(\mathrm{\bar\pi}\) sums to one. This differs slightly from the softmax \(\mathrm{\pi_\theta\exp(q/\lambda_N)}\) obtained with the forward KL \(\mathrm{KL(y\Vert\pi_\theta)}\).
(Grill et al., 2020) shows that MCTS is chasing \(\mathrm{\bar\pi}\) in two complementary ways:
- Gradient ascent on counts: the selected action maximizes the partial derivative of the objective in \eqref{pibar} w.r.t. visit counts:
- Tracking: the selected action is always under-visited, i.e. \(\mathrm{\hat\pi(a^\star)\leq\bar\pi(a^\star)}\). If \(\mathrm{\bar\pi}\) is held fixed, then
which matches the best \(\mathrm{O(1/N)}\) rate achievable by any count-based distribution.
Since \(\mathrm{\lambda_N=\tilde{O}(1/\sqrt{N})}\), the prior dominates at small budgets and the search Q-values dominate as \(\mathrm{N}\) grows.
More generally, any \(\mathrm{f}\)-divergence \(\mathrm{D_f(p,q)=\sum_b q(b)f(p(b)/q(b))}\) yields a selection rule \(\mathrm{\arg\max_a[q_a-\lambda f'(\hat\pi(a)/\pi_\theta(a))]}\); AlphaZero and UCT are the main practical cases ((Grill et al., 2020) also derives a forward-KL variant that is not widely used).
Replacing Visit Counts with the Exact Solution
The visit distribution \(\mathrm{\hat\pi}\) is only an approximation of \(\mathrm{\bar\pi}\), and it is a poor one when the simulation budget is small:
- A newly discovered high-value leaf needs many extra simulations before it shows up in \(\mathrm{\hat\pi}\), while \(\mathrm{\bar\pi}\) reads it from the Q-values immediately.
- \(\mathrm{\hat\pi}\) is a ratio of integers, so it has limited resolution when \(\mathrm{N_{sim}}\) is small.
- Actions that are never visited receive no improvement signal in the distillation target.
The authors therefore use \(\mathrm{\bar\pi}\) directly in three places: sampling real actions from \(\mathrm{\bar\pi}\) (Act), sampling tree actions from \(\mathrm{\bar\pi}\) instead of the deterministic rule \eqref{puct} (Search), and distilling \(\mathrm{\bar\pi}\) into the prior (Learn):
\[\begin{align} \mathrm{\theta\leftarrow\theta-\eta\nabla_\theta E_{x_{root}}\Big[KL\big(\bar\pi(\cdot\mid x_{root})\Vert\pi_\theta(\cdot\mid x_{root})\big)\Big]}.\notag \end{align}\]Computing \(\mathrm{\bar\pi}\) is cheap: the normalizer \(\mathrm{\sum_b\lambda_N\pi_\theta(b)/(\alpha-q_b)}\) is monotone in \(\mathrm{\alpha}\), so a bisection over
\[\begin{align} \mathrm{\alpha\in\Big[\max_b\big(q_b+\lambda_N\pi_\theta(b)\big),\ \max_b q_b+\lambda_N\Big]}\notag \end{align}\]suffices. Combining all three variants (All) turns the whole procedure into MPO-style updates both inside the tree and at the root.
Empirical Results
With MuZero as the baseline, the gains are largest when the budget is low relative to the number of actions. On Ms Pacman with \(\mathrm{N_{sim}=5}\), All significantly outperforms MuZero in both learning speed and final score, while the two become comparable around \(\mathrm{N_{sim}\geq 24}\). The ablation shows that Learn drives the gains at 5 simulations, whereas Search matters most at 50 simulations because deeper nodes still receive few visits.
For continuous control (DeepMind Control Suite from pixels), each action dimension is discretized into a few bins, which yields a large branching factor. All again outperforms MuZero at low budgets and converges faster at higher budgets.
Takeaway
MCTS and model-free policy optimization are closer than they look: the AlphaZero search computes an approximate reverse-KL-regularized policy improvement with tree-estimated Q-values. Making this connection explicit removes the discretization noise of visit counts and makes the search robust to small simulation budgets, a regime that also matters for test-time search in LLM reasoning.
Citation
@misc{deng2026_mcts_policy_opt,
title ={{Monte-Carlo Tree Search as Policy Optimization}},
author ={Wei Deng, Claude},
journal ={A Sampler's Blog},
year ={2026},
howpublished = {\url{https://www.weideng.org/posts/mcts_policy_opt/}}
}
- Silver, D., Hubert, T., Schrittwieser, J., Antonoglou, I., Lai, M., Guez, A., Lanctot, M., Sifre, L., Kumaran, D., Graepel, T., & others. (2017). Mastering Chess and Shogi by Self-Play with a General Reinforcement Learning Algorithm. ArXiv Preprint ArXiv:1712.01815.
- Schrittwieser, J., Antonoglou, I., Hubert, T., Simonyan, K., Sifre, L., Schmitt, S., Guez, A., Lockhart, E., Hassabis, D., Graepel, T., & others. (2020). Mastering Atari, Go, Chess and Shogi by Planning with a Learned Model. Nature, 588, 604–609.
- Grill, J.-B., Altché, F., Tang, Y., Hubert, T., Valko, M., Antonoglou, I., & Munos, R. (2020). Monte-Carlo Tree Search as Regularized Policy Optimization. ICML.
- Abdolmaleki, A., Springenberg, J. T., Tassa, Y., Munos, R., Heess, N., & Riedmiller, M. (2018). Maximum a Posteriori Policy Optimisation. ICLR.
- Kocsis, L., & Szepesvári, C. (2006). Bandit Based Monte-Carlo Planning. European Conference on Machine Learning, 282–293.
- Browne, C. B., Powley, E., Whitehouse, D., Lucas, S. M., Cowling, P. I., Rohlfshagen, P., Tavener, S., Perez, D., Samothrakis, S., & Colton, S. (2012). A Survey of Monte Carlo Tree Search Methods. IEEE Transactions on Computational Intelligence and AI in Games, 4(1), 1–43.
- Rosin, C. D. (2011). Multi-armed Bandits with Episode Context. Annals of Mathematics and Artificial Intelligence, 61(3), 203–230.