Multi-Agent RL & Games
Many learners in one world: competition, cooperation and equilibrium.
In 2019 a poker program beat elite professionals at six-player no-limit hold'em, and an agent reached the top league of human StarCraft II players. Both learned in worlds full of other learners, where the best move depends on what everyone else does, and everyone else keeps changing. This lesson shows what changes when an agent is not alone: equilibria instead of optima, cycles instead of steady progress, bluffing by the numbers, and teams that must share the credit.
What you’ll learn
- Explain why other learning agents make an agent's environment non-stationary, and classify a setting as competitive, cooperative or mixed.
- Describe a Nash equilibrium in plain words, and see why matching pennies forces both players to randomize.
- Explain why learners can cycle in games like rock–paper–scissors, and why averaging over past play helps.
- Describe self-play, and how regret minimization finds poker strategies that bluff at the right rate.
- Explain the credit problem of teams, and why social dilemmas trap independent learners in outcomes that are bad for everyone.
When the world learns back
A tennis player who always serves to the same corner soon faces a returner already leaning that way. The serve that won points last week loses them this week, not because the rules changed but because the other player learned.
Single-agent reinforcement learning assumes the opposite: the environment responds to an action the same way every time, so what the agent learns stays true. Multi-agent reinforcement learning studies several agents acting in one shared world, each with its own observations, actions and rewards. From any one agent's point of view the others are part of its environment, and they keep changing as they learn. Its environment is non-stationary: the target moves because the other learners move it.
| Kind of setting | What the agents want | Examples |
|---|---|---|
| Competitive (zero-sum) | Opposite things: one agent's gain is exactly the other's loss | Chess, Go, heads-up poker, a single tennis point |
| Cooperative | The same thing: one shared reward | A team of warehouse robots, a squad in a team video game |
| Mixed (general-sum) | Partly shared, partly opposed | Traffic, markets, negotiation, an ecosystem of trading bots |
Self-driving cars from different companies merge onto a busy highway. Each car's software is rewarded for getting its passenger through quickly, and every car involved loses heavily in a crash. What kind of setting is this?
- Mixed: the cars compete for space, but all of them want to avoid a crash
- Fully cooperative: all the cars share a single reward
- Zero-sum: any time one car gains, another loses the same amount
- Single-agent: each car can treat the others as fixed obstacles
Show the answer
A. Mixed: the cars compete for space, but all of them want to avoid a crash
The cars' interests partly conflict (only one can take the gap first) and partly coincide (a crash hurts everyone involved). Most real multi-agent problems are mixed like this, which is also what makes them hard: there is no single opponent to beat and no single team score to maximize.
Equilibrium: nobody wants to move alone
The smallest game that shows the difficulty is matching pennies. Two players each show a coin, heads or tails, at the same time. Player 1 wins a point from player 2 if the coins match; player 2 wins a point if they differ.
| Matching pennies | Player 2 shows heads | Player 2 shows tails |
|---|---|---|
| Player 1 shows heads | ||
| Player 1 shows tails |
Any predictable choice loses. If player 1 always shows heads, player 2 shows tails; then player 1 should switch to tails, and so on around the table. The way out is to randomize: a mixed strategy is a probability for each action. If both players show heads with probability , neither can do better by changing their own probability while the other keeps theirs.
That is a Nash equilibrium: a strategy for every player such that no player can gain by changing only its own strategy. Each player's strategy is a best response to the others'. In 1950 John Nash proved that every game with finitely many players and actions has at least one equilibrium, provided mixed strategies are allowed.
Player 2 shows heads 70% of the time. You are player 1 (you win when the coins match) and always show heads. What is your average payoff per round?
Show the answer
0.4
You win 1 when player 2 shows heads (70% of rounds) and lose 1 otherwise: . Any lean away from 50% can be exploited this way. At exactly 50%, heads and tails both earn 0 on average, so you have nothing to exploit: that is why 50/50 is the equilibrium.
Two learners, each sensible on its own, chase each other in circles and never settle. Yet the history of their play, averaged, approaches the equilibrium. Keep both facts in mind: they come back in self-play, in poker, and in the theory of the later lessons.
Self-play, and chasing your own tail
Where do you find a good opponent for a program that may become better than any human? Play it against itself. In self-play the agent trains against copies of itself, so its opponent improves exactly as fast as it does and always offers a challenge of the right difficulty.
Self-play has a trap. Imagine training a rock–paper–scissors agent that always learns to beat its latest version. Start with "always rock". The next version learns "always paper", the next "always scissors", the next "always rock" again. Every new version beats the previous one, so progress seems steady, yet the agent goes round in a circle forever. Strategies that beat each other in cycles are called non-transitive, and real games contain such cycles: in StarCraft, some strategies beat each other the way rock, paper and scissors do.
The cure echoes the time average of the last widget. Train each new version against a mixture of all past versions, not just the latest. Against "rock, then paper, then scissors, equally often", no single choice wins, and the mixture of versions approaches the equilibrium: one third each. This idea, fictitious play, dates from 1951; AlphaStar's league is an industrial-scale version of it.
An agent trained only against its latest version keeps beating that version by a wide margin. What can you safely conclude?
- It must also beat every earlier version
- It is close to an equilibrium strategy
- Nothing much: in a game with cycles it may have forgotten how to beat older strategies
- Its rating against humans must be rising
Show the answer
C. Nothing much: in a game with cycles it may have forgotten how to beat older strategies
Beating your predecessor is not the same as getting better. In a non-transitive game the newest version can lose to a version from long ago, as paper loses to scissors. That is why serious self-play systems test against, and train against, many past versions.
Poker: bluffing by the numbers
Chess and Go show both players everything. In poker you cannot see your opponent's cards: the game has imperfect information, and that changes what good play looks like. A player who bets only with strong hands is easy to read: opponents fold whenever it bets, and it never wins a big pot. A player who never folds is just as easy to exploit. Good play mixes: it sometimes bets with weak hands (a bluff) and sometimes checks with strong ones, at frequencies that leave the opponent no profitable answer.
How can a program find those frequencies? Through regret. After each hand, ask of every decision: how much more would I have won with each other action, given what the opponent did? Add the regrets up over many hands, and from then on play each action in proportion to its total positive regret. This is regret matching: actions you keep regretting not taking get played more. Counterfactual regret minimization (CFR, 2007) runs regret matching at every decision point at once, weighting what happens there by how likely the opponent's choices and the deal are to lead play there. In two-player zero-sum games the average of its strategies over all iterations converges to an equilibrium. Averaging, again.
The widget solves Kuhn poker, a toy poker from 1950. The deck has three cards (jack, queen, king), each player antes 1 chip and gets one card, and there is at most one bet of 1 chip. Player 1 checks or bets; after a check, player 2 checks or bets; a player facing a bet calls or folds; the higher card wins at showdown. A player's decision can depend only on its own card and the actions so far, so the game has 12 decision situations, its information sets, six for each player.
In Kuhn poker's equilibrium, player 2 bluffs with the jack exactly one third of the time after player 1 checks. Why that rate, and not never or always?
- Bluffing is random so that the program cannot be predicted; any rate would do
- The program bluffs as often as it can without losing chips on the bluffs themselves
- One third is the probability that player 1 holds the king
- At that rate a player 1 holding the queen gains nothing by calling or by folding, so bluffing more or less often would hand player 1 a profitable answer
Show the answer
D. At that rate a player 1 holding the queen gains nothing by calling or by folding, so bluffing more or less often would hand player 1 a profitable answer
Facing a bet with the queen, player 1 beats only a bluff. Player 2 bets every king and a third of its jacks, so a bet is a bluff with probability . Calling then wins 2 a quarter of the time and loses 2 otherwise, an average of , exactly what folding loses (the ante). Bluff more and player 1 should always call; bluff less and player 1 should always fold. The equilibrium rate leaves no profitable deviation.
Teams, credit and dilemmas
In a cooperative game every agent receives the same team reward. That removes the conflict but creates a new problem: credit assignment among agents. If five warehouse robots finish a job and the team earns , which robots helped? A robot that idled while the others worked is rewarded just as much, so the team reward is a noisy signal that mostly reflects what the other robots did.
Many practical systems use centralized training with decentralized execution (CTDE). During training, usually in simulation, the learning algorithm may see everything, every robot's observations and actions, and can work out who contributed what. Once deployed, each robot acts on its own observations alone.
Mixed games add a sharper problem. In a social dilemma, each agent does better for itself with a selfish action, yet when everyone acts selfishly all end up worse off. The prisoner's dilemma is the classic example:
| Prisoner's dilemma | Player 2 cooperates | Player 2 defects |
|---|---|---|
| Player 1 cooperates | ||
| Player 1 defects |
The map ahead
| Setting | What to aim for | Main tools |
|---|---|---|
| Two players, zero-sum | An equilibrium strategy: unexploitable whatever the opponent does | Self-play with averaging, fictitious play, populations of policies, CFR |
| Cooperative team | The best joint policy the team can carry out | Centralized training with decentralized execution, value decomposition, centralized critics |
| Mixed (general-sum) | An equilibrium, and preferably a good one for everyone | Largely open: correlated equilibria, social dilemmas, agents that shape how others learn |
In the Bootstrapping lessons you'll make all of this precise. Games, Equilibria & Markov Games defines games and mixed strategies, computes equilibria by hand, shows why zero-sum games reduce to a linear program, and extends games to many states with Markov games. Self-Play & Populations follows self-play from TD-Gammon to AlphaStar's league and builds fictitious self-play. Imperfect-Information Games: Poker develops information sets and counterfactual regret minimization, and works through Kuhn poker. Cooperative Multi-Agent RL covers teams: decentralized decision making, centralized training with decentralized execution, and splitting a team's value among its members. The Fixed Point lessons then prove when learning in games converges, why equilibria are hard to compute, and how the systems that mastered poker and StarCraft really worked.
Key takeaways
- With several learners in one world, each agent's environment is non-stationary: the others adapt, so what worked yesterday may not work today.
- A Nash equilibrium is a strategy for each player such that no one gains by changing alone. It always exists if players may randomize, but it need not be good for anyone.
- Learners adapting to each other can circle forever, as in matching pennies; the time average of their play can still converge to equilibrium.
- Self-play gives an agent an opponent that improves with it, but in games with cycles it can chase its own tail; training against mixtures of past versions fixes this.
- With hidden information, good play must randomize at exact frequencies; regret minimization (CFR) finds them, and its average strategy converges to equilibrium in two-player zero-sum games.
- Teams face credit assignment, and mixed games face social dilemmas: independent learners can settle on equilibria that are worse for everyone.
Check yourself
In the interactive lesson these are scored with your confidence, and what you miss comes back for review.
A pair of strategies is a Nash equilibrium when what holds?
- Both players get the highest payoff possible in the game
- The players' total payoff is as large as possible
- Neither player can gain by changing its own strategy while the other keeps theirs
- Both players choose the same action
Show the answer
C. Neither player can gain by changing its own strategy while the other keeps theirs
An equilibrium is a point of mutual best responses: a stable outcome, not necessarily a good one. In the prisoner's dilemma the only equilibrium gives both players less than they could get by cooperating.
In the matching-pennies simulation, two gradient learners' current strategies circle the equilibrium without settling. Which statement is true?
- The average of their past strategies approaches the equilibrium, even though their current strategies do not
- The learners are broken: correct learners always converge to the equilibrium
- The equilibrium does not exist, which is why they circle
- With a small enough step size, the current strategies converge
Show the answer
A. The average of their past strategies approaches the equilibrium, even though their current strategies do not
Each learner improves against the other's current strategy, so they chase each other around the equilibrium; with discrete steps they even spiral outward. Averaging over time cancels the circling, and the average converges. Later lessons show which learning rules make even the current strategies converge.
Why can naive self-play, always training against the latest version of yourself, stall in a game like rock–paper–scissors?
- Because playing against yourself gives no reward signal
- Because each new version only needs to beat the previous one, so strategies can cycle forever and old weaknesses return
- Because rock–paper–scissors has no equilibrium
- Because self-play only works with tree search
Show the answer
B. Because each new version only needs to beat the previous one, so strategies can cycle forever and old weaknesses return
In a non-transitive game, "beats the latest version" does not mean "better overall": paper beats rock, scissors beats paper, rock beats scissors. Training against a mixture of past versions (fictitious play, leagues) breaks the cycle.
In a two-player zero-sum game such as Kuhn poker, which strategy produced by counterfactual regret minimization is guaranteed to approach an equilibrium?
- The strategy of the latest iteration
- The strategy at the iteration with the largest regret
- The average of its strategies over all iterations
- None: CFR only works when all cards are visible
Show the answer
C. The average of its strategies over all iterations
As with the matching-pennies learners, the guarantee is about the average. In the widget, plain CFR's current strategy keeps jumping and stays far from equilibrium, while its average converges; CFR+ makes the current strategy behave much better, but the average is still what is guaranteed.
Two learners repeatedly play the one-shot prisoner's dilemma, each learning only from its own payoffs and remembering nothing about past rounds. Defecting pays more than cooperating whatever the other does. Where do they end up?
- Both cooperate, because cooperation pays both players more
- They alternate between cooperating and defecting
- One cooperates and the other defects
- Both defect, although both would be better off cooperating
Show the answer
D. Both defect, although both would be better off cooperating
Each learner discovers that defecting beats cooperating against anything the other does, so both end at (defect, defect) and earn 1 each instead of 3. This is a social dilemma: individual learning leads to an outcome that is worse for everyone. With memory of past rounds, cooperation can be sustained, which is one subject of the cooperative lessons.
Go deeper
- Games, Equilibria & Markov Games · Nash equilibria, zero-sum games and their multi-state version.
- Self-Play & Populations · Agents that improve by playing copies of themselves, from TD-Gammon to AlphaStar.
- Imperfect-Information Games: Poker · Hidden information, counterfactual regret minimization and superhuman poker.
- Cooperative Multi-Agent RL · Teams of learners: centralized training with decentralized execution.
Further reading
- S. V. Albrecht, F. Christianos & L. Schäfer, Multi-Agent Reinforcement Learning: Foundations and Modern Approaches (MIT Press, 2024).
- Y. Shoham & K. Leyton-Brown, Multiagent Systems: Algorithmic, Game-Theoretic, and Logical Foundations (Cambridge University Press, 2009).