Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

League Training

AlphaStar-style multi-agent training with role-based specialization. Multiple agents train simultaneously with different objectives.

Agent Roles

RoleOpponentsPurpose
Main Agent35% self-play + 65% PFSP poolGeneral strength
Main ExploiterOnly the main agentFind main agent’s weaknesses
League ExploiterPFSP across full poolFind weaknesses across all strategies

API

use rl4burn::{League, AgentRole, LeagueAgentConfig};

let mut league = League::new();
league.set_initial_model(initial_model.clone());

// Add agents
league.add_agent(model.clone(), LeagueAgentConfig {
    role: AgentRole::MainAgent,
    checkpoint_interval: 1000,
    reset_threshold: 0,
});
league.add_agent(model.clone(), LeagueAgentConfig {
    role: AgentRole::MainExploiter,
    checkpoint_interval: 2000,
    reset_threshold: 50000,
});

// Training loop
let opponent = league.get_opponent(agent_idx, &mut rng);
// ... play game, update model ...
league.update_agent(agent_idx); // handles checkpointing

Checkpointing

Every checkpoint_interval steps, the agent’s current weights are frozen and added to the opponent pool. All agents can then play against these frozen snapshots.

Exploiter resets

Exploiters that stop improving get reset to the initial model weights:

league.reset_exploiter(exploiter_idx);