Gen 1 OU (RBY) agent trained with reinforcement learning only: PPO self-play, no imitation of human logs. The project also runs bots on pkmn.bot (Gen 1) and vgc.bot; the VGC bots use separate models.
Setup
- Engine: custom Rust Gen 1 battle engine for training and evaluation.
- Hardware: one RTX 5090 on vast.ai.
- Algorithm: PPO self-play.
- Formats: 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.
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.
| Name | Width × layers | Parameters |
|---|---|---|
| n | 64 × 2 | 0.13M |
| xs | 128 × 4 | 0.6M |
| s | 192 × 6 | 1.9M |
| m | 256 × 8 | 4.4M |
| l | 384 × 8 | 9.8M |
| xl | 384 × 12 | 14.6M |
Distillation
Each size is initialised from the previous best model:
- Online distillation, ~4–6M 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–3M 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 across all sizes; the larger runs are 150M+ 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 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 arena version plays from the policy network alone, without search.
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. In our case many offline gains (small eval-score gaps between checkpoints, search versus no search) did not hold on the live ladder.