MCTransformer: Combining Transformers And Monte-Carlo Tree Search For Offline Reinforcement Learning

Gur Yaari, Lior Rokach, Rami Puzis, Gilad KatzICLR 2023

TL;DR

This paper introduces MCTransformer, a novel framework that synergistically combines Monte-Carlo Tree Search (MCTS) with Transformers for offline reinforcement learning. By leveraging MCTS for exploration and Transformers for efficient state-action evaluation and strategy generation, MCTransformer achieves superior performance on the challenging SameGame benchmark compared to existing Transformer-only and MCTS-only approaches.

What Problem Does This Paper Address?

Reinforcement learning (RL) has seen success by framing problems as sequence modeling tasks, with Transformers proving adept at generating effective solutions. However, a key limitation of purely Transformer-based approaches in offline RL is the lack of exploration during evaluation. This makes them brittle and unable to adapt to novel situations. While online fine-tuning can help, it often requires substantial training data. This paper addresses the challenge of enabling efficient and effective exploration in offline RL, particularly in domains with high volatility and complex decision-making, by integrating the strengths of MCTS with the powerful sequence modeling capabilities of Transformers.

Methods

The core innovation is the MCTransformer framework, which adopts an actor-critic structure.

  • MCTS Component: This part of the system is responsible for navigating the search tree and balancing the exploration-exploitation trade-off. It uses a PUCT (Predictor-UCT) algorithm for action selection during the tree traversal.
  • Transformer Component: The Transformer plays a dual role:
  • State-Action Evaluation & Exploration: It provides initial scores for potential actions in unexplored nodes, guiding the MCTS exploration.
  • Rollout Policy: It acts as the policy for simulating game trajectories (rollouts) within MCTS. This is a key efficiency gain, as the Transformer's advanced modeling allows for a very small number of simulations per node without performance degradation.

The training process involves generating a large dataset of games using MCTS, then training the Transformer on these trajectories. At test time, MCTS guides the search to a leaf node, and the Transformer is used for action selection and rollouts.

Datasets

  • Training Data: The paper generates 250,000 games of SameGame using an MCTS-based model. These games form the dataset for training the Transformer component.
  • Evaluation Datasets: Three distinct datasets of SameGame boards were used for evaluation:
  • 100 fully-random boards: Tile colors are assigned randomly.
  • 25 balanced boards: Each board contains an equal distribution of tiles for each color, posing a more difficult planning challenge due to a lower likelihood of forming large blocks.
  • 25 dominant-color boards: One color dominates the board, making it easier to form large blocks and potentially simplifying planning.

All evaluation boards are 10x10 with five colors.

Key Insights and Ideas

  • Synergistic Combination: The paper demonstrates that combining MCTS and Transformers is more than just an additive improvement; it creates a system that overcomes the limitations of each individual approach. MCTS provides exploration, while Transformers offer efficient and informed decision-making.
  • Efficient Exploration: By using the Transformer as a rollout policy, MCTransformer significantly reduces the number of simulations required per move compared to traditional MCTS, leading to greater efficiency without sacrificing performance.
  • Transformer as a "Smart" Explorer: The Transformer's ability to learn from past experiences (across multiple boards) means the MCTS doesn't start from scratch for each new, randomly initialized board, which is a significant advantage in domains like SameGame.
  • Bridging Action Spaces: A clever solution is employed to bridge the gap between MCTS selecting blocks and the Transformer selecting tiles: the top-left tile of a block is designated as its representative. The Transformer is considered correct if it selects this representative tile.

Key Results

  • Outperformance: MCTransformer significantly outperforms both Transformer-only and MCTS-only baselines on the SameGame benchmark, achieving up to three times better performance.
  • Efficiency: MCTransformer requires a substantially smaller number of simulations per move to achieve competitive or superior results compared to MCTS. For instance, MCTransformer with 16 simulations per move often outperforms MCTS with 128 simulations per move.
  • Pareto Front: The results show MCTransformer forming a Pareto front against MCTS, indicating a better score-to-simulation trade-off across various simulation budgets.
  • Transformer's Learning Capability: The Transformer-based player, even when evaluated against a random agent, shows significant improvements across various metrics, demonstrating its ability to learn meaningful strategies from the generated data.

Limitations and Future Work

  • Offline RL Focus: The current work is focused on offline RL. Extending MCTransformer to online settings or scenarios requiring continuous adaptation could be a future direction.
  • Domain Specificity: While SameGame is a challenging benchmark, evaluating MCTransformer on a wider range of complex RL tasks would further validate its generalizability.
  • Computational Cost of Training Data Generation: The initial generation of MCTS-based trajectories is computationally intensive, though it's an offline process. Optimizing this data generation phase could be beneficial.

Summary updated

BibTeX
@inproceedings{yaari2023mctransformer,
  author = {Gur Yaari and Lior Rokach and Rami Puzis and Gilad Katz},
  title = {{MCTransformer: Combining Transformers And Monte-Carlo Tree Search For Offline Reinforcement Learning}},
  booktitle = {International Conference on Learning Representations},
  year = {2023},
  url = {https://openreview.net/forum?id=-94tJCOo7OM},
}
Figure