--- license: mit library_name: pytorch pipeline_tag: reinforcement-learning tags: - reinforcement-learning - multi-agent - self-play - alphazero - mcts - pomdp - board-game --- # RAVEN: self-play agent for a moving-maze board game RAVEN plays a 4-player moving-maze board game **inspired by** *Labyrinth*. It is an AlphaZero-style policy/value/belief network, used together with information-set MCTS. Code, environment and paper: https://github.com/Arkadian378/Raven > Independent research project. Not affiliated with, endorsed by or sponsored by Ravensburger. *Labyrinth* and *Ravensburger* are trademarks of Ravensburger AG. ## Files | File | What it is | |---|---| | `raven.pt` | Network weights and the architecture arguments. There is no optimizer state, so this file is not meant for resuming training. | ## Usage ```bash pip install "labyrinth-rl[rl] @ git+https://github.com/Arkadian378/Raven" hf download Gab378/raven raven.pt --local-dir . python -m labyrinth.hub --agent mcts:raven.pt:512 # play against it at http://127.0.0.1:8000 ``` ```python from train.model import load_checkpoint net = load_checkpoint("raven.pt") ``` The file is a PyTorch pickle, so load it only from a source you trust. ## Model - **Input:** an ego-centric encoding of the 7×7 board, with planes for the board plus a vector of extra features. Observability is partial, following the official rules: the agent sees only its own target card. - **Network:** a residual convolutional tower with four heads: - shift head: 48 logits; - move head: 49 logits; - value head: one value per seat; - belief head: predicts each opponent's target treasure. - **Search:** single-observer IS-MCTS with max^n backups, where opponents' targets are sampled from the belief head. Root selection uses PUCT or Gumbel. ## Training 1. Behaviour cloning from a greedy expert. 2. AlphaZero self-play, with greedy opponents in a share of the seats. 3. Fine-tuning with a per-turn win discount, then gated against the previous network. ## Evaluation Each evaluation is one agent in a rotating seat against 3 opponents. In a 4-player game the parity win rate is 25%. Reproduce with `python -m train.evaluate --agent mcts:raven.pt:128 --opponent greedy --games 200`. ## Limitations - The game has a lot of luck, so small differences in win rate need many games to measure. - The agent was trained and tested only in the 4-player setting. - Where the rules differ from the boxed game, `RULES.md` in the code repository lists the differences.