diff --git a/projects/Loxias.dj b/projects/Loxias.djindex 7ddf155..ce3586e 100644--- a/projects/Loxias.dj+++ b/projects/Loxias.dj@@ -1,14 +1,14 @@
{% visibility: public %}
# Loxias
-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](https://pkmn.bot) (Gen 1) and [vgc.bot](https://vgc.bot); the VGC bots use separate models.+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](https://pkmn.bot) and [vgc.bot](https://vgc.bot).
## Setup
-- Engine: custom Rust Gen 1 battle engine for training and evaluation.-- Hardware: one RTX 5090 on vast.ai.+- Engine: custom Rust Gen 1 battle engine for RBY; [pikapro](https://github.com/spedr/pikapro-engine) for VGC.+- Hardware: one RTX 5090 per format on vast.ai.
- Algorithm: [PPO](https://arxiv.org/abs/1707.06347) self-play.
-- Formats: random battles and OU. OU teams are 50% generated by [poke-env's Smogon usage-stats teambuilder](https://poke-env.readthedocs.io/en/stable/modules/teambuilder.html#smogon-stats-teambuilder) and 50% drawn from a pool of top ladder teams.+- Formats: for RBY, random battles and OU. OU teams are 50% generated by [poke-env's Smogon usage-stats teambuilder](https://poke-env.readthedocs.io/en/stable/modules/teambuilder.html#smogon-stats-teambuilder) and 50% drawn from a pool of top ladder teams. For VGC, Reg M-C with open and closed team sheets.
## Model
@@ -21,27 +21,29 @@ Heads:
- *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 |-^ Model sizes, in training order+The VGC model adds a team-preview head and chooses its two active slots jointly.-RBY Loxias 0.0.0 uses a model of size l.+| 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 |+^ Model sizes (width × layers, parameters), in training order++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:
-1. *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.-2. *Anchored PPO*, ~2--3M games: PPO plus a KL anchor to the distilled checkpoint, weight annealed 1 → 0.+1. *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.+2. *Anchored PPO*, ~2--5M games: PPO plus a KL anchor to the distilled checkpoint, weight annealed 1 → 0.
3. *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.+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
@@ -49,12 +51,14 @@ Opponents are drawn from a league of past versions of the smaller models, past a
## Search
-Tested on top of the network:+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 arena version plays from the policy network alone, without search.+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](https://github.com/pkmnbotguy/mewstruck-vgc).
## A/B testing on live ladders
@@ -64,4 +68,4 @@ Offline metrics (self-play, fixed benchmark bots) frequently disagreed with live
- 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.+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.