Agents for Gen 1 OU (RBY) and VGC (Champions Reg M-C), trained with reinforcement learning only: PPO self-play, no imitation of human logs. The two formats share the method but use separate engines and models. The project also runs bots on pkmn.bot and vgc.bot.
Setup
- Engine: custom Rust Gen 1 battle engine for RBY; pikapro for VGC.
- Hardware: one RTX 5090 per format on vast.ai.
- Algorithm: PPO self-play.
- Formats: for RBY, random battles and OU. OU teams are 50% generated by poke-env’s Smogon usage-stats teambuilder and 50% drawn from a pool of top ladder teams. For VGC, Reg M-C with open and closed team sheets.
Model
Transformer over the public battle state. Pure embedding of the current state - no direct history.
Heads:
- Move head: one logit per move token.
- Switch head: one logit per own Pokémon token. Move and switch logits form a single distribution over legal choices.
- Value head: win estimate from the global token.
- Opponent head: auxiliary prediction of the opponent’s action from the global token, trained with cross-entropy alongside the PPO loss.
The VGC model adds a team-preview head and chooses its two active slots jointly.
| Name | RBY | VGC |
|---|---|---|
| n | 64 × 2, 0.13M | 96 × 3, 0.4M |
| xs | 128 × 4, 0.6M | 128 × 4, 0.8M |
| s | 192 × 6, 1.9M | 192 × 6, 2.3M |
| m | 256 × 8, 4.4M | 256 × 8, 5.0M |
| l | 384 × 8, 9.8M | 320 × 10, 9.4M |
| xl | 384 × 12, 14.6M | 448 × 12, 21.3M |
RBY Loxias 0.0.0 uses a model of size l. VGC Loxias 0.0.0-vgc uses a model of size xl.
Distillation
Each size is initialised from the previous best model:
- Online distillation, ~4–10M games: the student plays its own games and regresses onto the teacher’s policy (KL) and value on the states it visits. Offline distillation on a fixed set of teacher positions overfit and collapsed once self-play began.
- Anchored PPO, ~2–5M games: PPO plus a KL anchor to the distilled checkpoint, weight annealed 1 → 0.
- Plain PPO, with the learning rate stepped down when evaluation scores plateau.
Total: on the order of 500M self-play games for RBY and 1.7 billion for VGC, across all sizes; the larger runs are 300M+ games each.
League
Opponents are drawn from a league of past versions of the smaller models, past and current versions of the model being trained, and heuristic bots. Sampling weights are rebalanced over the course of a run.
Search
Tested on top of the RBY network:
- depth-1 simultaneous-move search over sampled hidden-information worlds, solved as a matrix game with an opponent-prediction blend;
- decoupled-PUCT simultaneous-move MCTS.
Both help smaller models. For the largest models the gain was within noise, mainly because value error compounds with depth. The RBY arena version plays from the policy network alone, without search.
The VGC arena version uses a shallow search: one turn deep, with the value network at the leaves, for team preview and for moves. The design is inspired by Mew’s Truck.
A/B testing on live ladders
Offline metrics (self-play, fixed benchmark bots) frequently disagreed with live results. Recommended: test variants on pkmn.bot / vgc.bot with a bandit.
- Arms are combinations of levers, e.g. checkpoint × decision method.
- Fit a Bayesian win-probability model with additive lever effects and an opponent-rating term.
- Select arms per game by Thompson sampling; retire clearly worse arms.
Most games go to strong variants while the rest stay measured. For RBY, many offline gains (small eval-score gaps between checkpoints, search versus no search) did not hold on the live ladder.