Self-Play & Populations
Agents that improve by playing copies of themselves, from TD-Gammon to AlphaStar.
Self-play turns a two-player game into its own curriculum: the opponent is always exactly as strong as you are. It produced superhuman play in Go and chess, world-class backgammon and Grandmaster-level StarCraft II, and it can also run in circles, forget what it once knew, and overfit to its own habits. This lesson builds self-play from the game-theoretic side: why it works when the game is mostly transitive, why it cycles when it is not, how fictitious self-play and its neural version fix the cycle, and how populations and leagues scaled the fix to StarCraft II and Dota 2.
What you’ll learn
- Write the generic self-play loop with its opponent-sampling rule, and explain why it acts as an automatic curriculum in mostly transitive games.
- Explain why naive self-play cycles or forgets in non-transitive games, using iterated best response in rock–paper–scissors and gradient self-play in the simulator.
- Derive fictitious self-play as a best response to the average of past policies, including the reach-weighted average for extensive-form games, and describe NFSP's two networks and memories.
- Describe population-based training and AlphaStar's league (main agents, exploiters, prioritized fictitious self-play), and compare them with OpenAI Five's scheme.
Self-play as an automatic curriculum
Consider a symmetric two-player zero-sum game, such as Go with colors assigned at random. Write for the expected payoff of policy against ; symmetry and zero sum make it antisymmetric, . Self-play trains a policy against opponents drawn from its own history. Everything that distinguishes one self-play method from another is in one line of the loop: which past selves you play against.
pool ← {π₀}
repeat:
for each training game:
o ← sample an opponent from pool by RULE
play π against o and store the trajectory
update π by reinforcement learning on the stored games
periodically add a frozen copy of π to pool
RULE = the latest copy → naive self-play (iterated best response)
RULE = uniform over pool → fictitious self-play
RULE = weighted by f(P[π beats o]) → prioritized fictitious self-play (AlphaStar)The policy update can be anything: TD learning for TD-Gammon, imitation of search results for AlphaZero, actor–critic methods for AlphaStar, PPO for OpenAI Five.
Why does this work at all? If the game is transitive, for some strength , then beating your current self is exactly the same as getting stronger, and the opponent hardens precisely as fast as you improve: an automatic curriculum that never becomes too easy or too hard. Samuel's checkers program (1959) already improved partly by playing against a copy of itself, and Tesauro's TD-Gammon learned backgammon from more than a million games against itself in the early 1990s, reaching close to the level of the best human players.
The AlphaZero family adds a second engine. Search is a policy-improvement operator: Monte Carlo tree search guided by the current network chooses better moves than the network alone, the network is trained to imitate the search's visit counts and predict the game's outcome, and the improved network makes the next search stronger. Self-play supplies the positions; search supplies the targets.
When self-play goes in circles
Real games are not purely transitive. In rock–paper–scissors, naive self-play, always best-responding to the latest copy, is iterated best response: rock → paper → scissors → rock, forever. Each new policy beats its predecessor by the maximum margin, so training looks like steady progress while nothing improves. Gradient-based self-play does the same thing more smoothly: the policy chases the best response to itself around the equilibrium.
Cycles have a second cost, forgetting. A policy that drifted from rock to paper to scissors has lost its answer to scissors players, so old weaknesses resurface, which OpenAI Five's authors called strategy collapse. AlphaStar's ablations measured it: on a reduced setup, naive self-play reached a higher Elo than fictitious self-play against held-out test agents (1,519 against 1,143) but a far lower minimum win rate against its own past versions (46% against 69%). It got better on average while forgetting how to beat some of its earlier strategies.
In AlphaStar's ablation, naive self-play beat held-out test agents more often than fictitious self-play did, but had a much lower minimum win rate against its own past versions. What does that combination indicate?
- A measurement error: an agent that is stronger on average must also beat all its past versions
- The past versions were trained on a different map
- Fictitious self-play is simply a weaker algorithm
- The agent improved against the test opponents while losing its answers to some strategies it had once beaten, so average strength and robustness diverged
Show the answer
D. The agent improved against the test opponents while losing its answers to some strategies it had once beaten, so average strength and robustness diverged
In a non-transitive game, "stronger on average" and "beats everything it used to beat" can come apart. Naive self-play tracks the current opponent and forgets earlier ones; fictitious play keeps answering the whole history, at the price of slower progress. AlphaStar's league combined both: some self-play for speed, prioritized fictitious self-play against the past for robustness.
Fictitious self-play and NFSP
Fictitious play best-responds to the average of the opponent's past strategies, and in two-player zero-sum games the averages converge to an equilibrium (Robinson, 1951). Translated to self-play: train each new policy against the uniform mixture of all previous ones, and report the average of the policies, not the last one. In rock–paper–scissors, the best response to "rock, paper and scissors equally often" can be anything, and the average converges to one third each.
Two difficulties appear in sequential games. The best response to a mixture must be learned, which is a full RL problem, and the average of policies is not the average of their action probabilities. Heinrich, Lanctot and Silver's fictitious self-play (FSP, 2015) handles both: approximate best responses come from reinforcement learning, and the average is learned by supervised learning on the agent's own past behavior, which weights each information set correctly.
Let a player with perfect recall mix two behavioral strategies with weights and : flip a coin once, then play the chosen strategy for the whole game. Let be the probability that 's own actions lead to information set (the opponent's and chance's moves cancel in what follows). The behavioral strategy that produces the same distribution over outcomes against every opponent is
By Bayes' rule, given that play has reached , the coin chose with probability proportional to its weight times , so the action at is distributed as this posterior mixture. Naive averaging, , is wrong whenever the strategies reach with different probabilities. In the extreme, if never reaches , then , whatever says there.
Supervised learning gets this weighting for free: record pairs while actually playing each past best response, and fit a classifier. Information sets a strategy rarely reaches contribute few samples, exactly the factor .
Neural fictitious self-play (NFSP; Heinrich & Silver, 2016) makes FSP end-to-end with deep networks. Each agent keeps two networks: a Q-network trained by DQN-style RL to approximate a best response to the opponents, and an average-policy network trained by classification to imitate the agent's own past best-response actions.
Q ← Q-network (approximate best response β = ε-greedy(Q))
Π ← average-policy network
M_RL ← circular buffer of transitions (recent experience only)
M_SL ← reservoir buffer of (state, action) pairs (uniform over all time)
for each episode:
policy ← β with probability η, else Π # η = anticipatory parameter, 0.1 in the paper
for each step:
act with policy; store (s, a, r, s') in M_RL
if policy is β: store (s, a) in M_SL
train Q on minibatches from M_RL # tracks the opponents' current play
train Π to maximize log Π(a | s) on M_SL # the average of past best responsesThe two memories are the point. The RL memory must reflect the opponents now, so it is a sliding window; the supervised memory must represent the average over all past best responses, so it uses reservoir sampling. In Leduc poker the authors report that a sliding window for the supervised memory made learning diverge.
In Leduc poker NFSP approached a Nash equilibrium (exploitability around 0.06 in the paper's units) where DQN alone, a pure best-response learner, was highly exploitable and its average strategy did not converge; in limit Texas hold'em it approached the performance of state-of-the-art programs built with substantial poker expertise. Mixing in the best response with probability lets each agent's actual play run slightly ahead of its slowly moving average, which is why is called the anticipatory parameter.
Populations and leagues
Population-based training (PBT; Jaderberg et al., 2017) trains many agents in parallel and periodically lets a poor performer exploit a better one, copying its weights and hyperparameters, then explore by perturbing the copied hyperparameters. The population discovers a hyperparameter schedule online. In multi-agent training the population doubles as a supply of diverse partners and opponents: in Quake III Arena Capture the Flag, a population of agents played with and against each other on randomly generated maps, PBT also adapted each agent's internal reward for game events, and the resulting agents beat strong human players in tournaments (Jaderberg et al., 2019).
AlphaStar (Vinyals et al., 2019) turned the population into a league with specialized roles. Frozen snapshots of every learner join the league as opponents, and opponents are chosen by prioritized fictitious self-play (PFSP): a learner faces a league member with probability proportional to a function of its current win rate against it,
| Agent type | Trains against | Joins the league | Reset |
|---|---|---|---|
| Main agents (3, one per race) | 35% self-play, 50% PFSP against all past players, 15% PFSP against forgotten main players and past main exploiters | A snapshot at fixed intervals | Never |
| Main exploiters (3) | The current main agents (while their win rate is below 20%, half their games are PFSP with against past snapshots of the main agents) | On beating all three main agents in over 70% of games, or after a timeout | To the supervised initialization, every time |
| League exploiters (6) | PFSP against the whole league | On beating every league member in over 70% of games, or after a timeout | With probability 25% |
With , a main agent beats opponent A 90% of the time and opponent B 50% of the time. How many times more often does PFSP schedule B than A?
Show the answer
25
. Larger exponents focus even harder on the toughest opponents, and an opponent the agent always beats gets weight : no time is wasted on solved matchups.
Think first Why would a freshly reset exploiter use rather than when it is losing to nearly everyone?
would send it almost exclusively against the opponents it never beats, where every game is lost and the reward carries almost no information about what works. peaks at and vanishes at 0 and 1, so it picks opponents the learner sometimes beats, where outcomes are most informative. AlphaStar used exactly this curriculum for main exploiters whose win rate was below 20%.
The league design paid off in the paper's ablations: adding main exploiters and then league exploiters raised the main agents' Elo against held-out test agents from 1,540 to 1,693 to 1,824, and the league's relative population performance, the paper's population-level measure of exploitability, from 6% to 35% to 62%. The final agents reached Grandmaster level for all three StarCraft II races, above 99.8% of officially ranked human players, while limited to a human-like rate of actions.
OpenAI Five (Berner et al., 2019) took a simpler route for Dota 2: PPO at very large scale, with 80% of games against the latest parameters and 20% against past versions, the past opponents favored when they still win, to "avoid strategy collapse". Training ran for about ten months, with "surgery" to carry the learned weights through changes to the model and to the game itself. In April 2019 it defeated the reigning world champions, team OG, and it later won 99.4% of more than 7,000 games against the public.
Where the Fixed Point lessons go
Key takeaways
- Self-play is one loop with one design choice, which past selves to play against: the latest (naive self-play), all of them uniformly (fictitious self-play), or a prioritized mixture (AlphaStar's league).
- In transitive games beating yourself means getting stronger, and search-based self-play (AlphaZero) adds a policy-improvement operator; in non-transitive games naive self-play cycles and forgets, as AlphaStar's ablation measured.
- Fictitious self-play best-responds to the average of past policies; the correct average of behavioral strategies is reach-weighted, which supervised learning on actual play produces, and NFSP pairs a DQN best response with a reservoir-trained average policy.
- AlphaStar's league mixes self-play with prioritized fictitious self-play (, ) and adds main and league exploiters that are reset to keep finding weaknesses; OpenAI Five reserved 20% of its games for past versions to prevent strategy collapse.
Check yourself
In the interactive lesson these are scored with your confidence, and what you miss comes back for review.
Why does fictitious self-play learn its average policy by supervised learning on the agent's own past play, rather than by averaging the action probabilities of past policies at each information set?
- Supervised learning is cheaper than storing past policies
- The correct average weights each past policy at an information set by how likely that policy is to reach it, and sampling actual play produces exactly that weighting
- Averaging action probabilities would give a strategy that is not a probability distribution
- Supervised learning makes the average policy deterministic
Show the answer
B. The correct average weights each past policy at an information set by how likely that policy is to reach it, and sampling actual play produces exactly that weighting
Mixing whole strategies and then conditioning on reaching an information set gives the reach-weighted average . Naive averaging ignores the reach probabilities, while samples of actual play visit each information set in proportion to them.
NFSP stores the data for its average-policy network with reservoir sampling rather than in a sliding window of recent experience. Why?
- The average policy should imitate the agent's best responses over its whole history, and a reservoir keeps a uniform sample of that history; a window would track only recent behavior, undoing the averaging
- Reservoir sampling uses less memory than a sliding window
- Reservoir sampling removes the correlation between consecutive transitions, which DQN requires
- It makes the Q-network converge faster
Show the answer
A. The average policy should imitate the agent's best responses over its whole history, and a reservoir keeps a uniform sample of that history; a window would track only recent behavior, undoing the averaging
Fictitious play's guarantee is about the average over all iterations. A sliding window would make the "average" policy follow recent best responses, reintroducing the cycling, and the authors report that this diverged in Leduc poker. The RL memory, by contrast, should be recent, because the best response must track the opponents' current play.
In the generic self-play loop, which opponent-sampling rule turns self-play into fictitious play?
- Always the latest copy of the policy
- Human players sampled from replays
- Only opponents the current policy beats
- Uniformly over all past policies in the pool
Show the answer
D. Uniformly over all past policies in the pool
Fictitious play best-responds to the empirical average of past play, and a uniform mixture over all past policies is that average. Playing only the latest copy is iterated best response, which cycles in rock–paper–scissors.
What is the role of the main exploiters in AlphaStar's league?
- They are the agents finally deployed against human players
- They play the whole league to find strategies that no league member can beat
- They train only against the current main agents to expose their weaknesses, are added to the league, and are reset so that they search again
- They imitate human replays to keep the league close to human play
Show the answer
C. They train only against the current main agents to expose their weaknesses, are added to the league, and are reset so that they search again
An exploiter that beats the main agents becomes a league member, and the main agents, who play PFSP against the league, must then learn to beat it. Resetting the exploiter keeps the search for new weaknesses going instead of letting it drift into a second main agent.
Under prioritized fictitious self-play with , how often is a learner matched against an opponent it beats 100% of the time?
- Never
- As often as any other opponent
- With probability
- Most often, to consolidate its strengths
Show the answer
A. Never
, so solved matchups get no games. Combined with the 15% of main-agent games reserved for forgotten opponents, the league spends its compute where the agent is still beatable.
Go deeper
- Double Oracle & PSRO · Growing a population of best responses toward an equilibrium.
- Non-Transitivity & League Training · Rock–paper–scissors cycles in real games, and how AlphaStar’s league handled them.
- Evaluating Agents: Elo, Nash Averaging & Beyond · Ratings that assume transitivity, and what to use when it fails.
Further reading
- J. Heinrich, M. Lanctot & D. Silver, "Fictitious self-play in extensive-form games," ICML (2015).
- J. Heinrich & D. Silver, "Deep reinforcement learning from self-play in imperfect-information games," arXiv:1603.01121 (2016).
- O. Vinyals et al., "Grandmaster level in StarCraft II using multi-agent reinforcement learning," Nature 575, 350–354 (2019).
- C. Berner et al., "Dota 2 with large scale deep reinforcement learning," arXiv:1912.06680 (2019).