Communication & Social Dilemmas
Emergent communication, sequential social dilemmas and opponent shaping.
Give agents a channel and a shared goal, and you might expect them to learn to talk; give them partly opposed goals in a shared world, and you might expect them to learn to cooperate when it pays. Neither happens easily. Learned protocols are hard to find and harder to interpret, and independent learners defect in social dilemmas they could have escaped. This lesson covers learned communication and how to measure it, social dilemmas from Axelrod's tournaments to gridworld commons, the incentives that inequity aversion creates, and opponent shaping, in which an agent learns by reasoning about how others learn.
What you’ll learn
- Explain RIAL, DIAL and CommNet, prove that an uninformative "babbling" equilibrium always exists, and distinguish positive signaling from positive listening.
- Derive the condition under which tit-for-tat is a best response to itself in the iterated prisoner's dilemma, and relate it to Axelrod's tournaments.
- Define sequential social dilemmas, and show how inequity aversion can turn a prisoner's dilemma into a coordination game.
- Derive LOLA's update from a first-order expansion of the opponent's learning step, and explain what SOS, POLA and M-FOS change.
- Describe how Melting Pot evaluates generalization to new social situations.
Learning to communicate
Give agents a channel, discrete symbols or real vectors, and train them only on the team's reward: whatever protocol appears is emergent communication. Foerster, Assael, de Freitas & Whiteson (2016) introduced two ways to learn it. In RIAL, messages are just more actions, learned by Q-learning, and no gradient passes between agents. In DIAL, messages are real-valued during centralized training, so the gradient of the listener's loss flows back through the channel into the speaker; at execution they are discretized. A discretize/regularize unit bridges the two: in training it passes the message through a logistic function after adding Gaussian noise (standard deviation 2 by default, which the authors found essential), which pushes messages toward the saturated ends; at execution it sends . On the "switch riddle", a logic puzzle for 3 or 4 prisoners, and on MNIST-based games, DIAL with parameter sharing learned much faster than RIAL, and RIAL failed on the multi-step MNIST game.
CommNet (Sukhbaatar, Szlam & Fergus, 2016) makes communication continuous and built in: at each layer, every agent's hidden state receives the mean of the other agents' hidden states, and the whole system is trained end to end. TarMAC (Das et al., 2019) lets agents choose recipients with attention.
Let a speaker observe a private and send a message , and a listener see and choose ; both receive . Suppose the speaker's messages are independent of . Then carries no information, and the listener's best response ignores it:
Suppose the listener ignores the messages. Then the speaker's payoff does not depend on what it sends, so every messaging strategy, the uninformative one included, is a best response. Together, uninformative messages and an ignoring listener form an equilibrium of every such game: the babbling equilibrium familiar from cheap-talk games (Crawford & Sobel, 1982).
Learning starts near it. Randomly initialized speakers send messages unrelated to what they see, and listeners rightly learn to ignore them, which in turn leaves speakers no reason to change. Escaping requires speakers and listeners to improve together, a joint exploration problem; DIAL's gradients through the channel and auxiliary losses that encourage positive signaling and listening (Eccles et al., 2019) are ways out.
Measuring a protocol is subtle. Lowe, Foerster, Boureau, Pineau & Dauphin (2019) separate positive signaling, messages that depend on what the speaker observes or does, from positive listening, messages that change what the listener does. Common metrics such as speaker consistency, and inspection of message–meaning tables, test only the first; agents can signal positively while no one listens. They propose the causal influence of communication: the mutual information between a message and the listener's action, measured by intervening on the message. Interpretation is harder still. In referential games, ungrounded symbols tracked broad categories only loosely (though above chance), and many became directly interpretable only when grounded: mixing in supervised image classification led senders to use the symbol for an image's label in 47% of eligible cases, against 1% by chance (Lazaridou, Peysakhovich & Baroni, 2017). And protocols that work need not be compositional: Kottur et al. (2017) obtained compositional language only under restrictions such as limiting the answering agent to four symbols and erasing its memory between rounds, which raised accuracy on unseen combinations to 74.4% from 25.6%.
A speaker's messages are almost perfectly predictable from what it observes, but intervening on the messages leaves the listener's actions unchanged. Which statement is right?
- The agents communicate successfully, because the messages encode the observations
- The speaker shows positive signaling but the listener shows no positive listening, so the messages do not influence the team's behavior
- The listener is broken and should be retrained
- This cannot happen if both are trained on the team reward
Show the answer
B. The speaker shows positive signaling but the listener shows no positive listening, so the messages do not influence the team's behavior
Encoding information is necessary for communication but not sufficient: it also has to change what someone does. Lowe et al. (2019) show that this case occurs in trained agents and that metrics built on the speaker side alone miss it; the causal influence of communication measures the listener's side directly.
Social dilemmas: from matrices to Markov games
In a social dilemma individually rational choices produce an outcome worse for everyone than cooperation would. The prisoner's dilemma is the canonical case: payoffs to the row player of for mutual cooperation, for mutual defection, for defecting on a cooperator and for being defected on, with and . Axelrod used , , , . Defection strictly dominates in a single round, so memoryless learners have nothing on which to condition cooperation.
Repetition changes the picture. In the first of two tournaments reported in 1980, Robert Axelrod invited experts in game theory to submit programs for a round-robin iterated prisoner's dilemma: 14 entries and a random strategy, games of 200 moves. The simplest program, Anatol Rapoport's tit-for-tat (cooperate first, then copy the opponent's last move), scored highest. A second tournament drew 62 entries from six countries, with games of random length (another move with probability 0.99654), and tit-for-tat won again (Axelrod & Hamilton, 1981). Whether reciprocity is rational depends on how much the future counts.
Let each round be followed by another with probability , which acts as a discount factor. Two tit-for-tat players cooperate forever:
Tit-for-tat's next move is your last one, so against it you face a two-state MDP, and stationary deterministic policies suffice: always cooperate (which earns ), always defect, or alternate defect and cooperate:
Tit-for-tat is a best response to itself exactly when neither deviation pays:
With Axelrod's payoffs , , , , what is the smallest continuation probability at which tit-for-tat is a best response to itself?
Show the answer
0.67
The two conditions give against always defecting and against alternating, so the threshold is ; alternation, exploiting tit-for-tat's forgiveness, is the binding deviation. Axelrod's second tournament used , far above it. Below the threshold the shadow of the future is too short to sustain reciprocity.
Learners do not find reciprocity easily. Sandholm & Crites (1996) found that Q-learners learned to play optimally against tit-for-tat, but that learning against another learner was harder. Leibo, Zambaldi, Lanctot, Marecki & Graepel (2017) moved the question into Markov games, where cooperating and defecting are properties of whole policies. In a sequential social dilemma there are states in which the empirical payoff matrix of cooperative versus defecting policies, classified by a behavioral measure, satisfies the social-dilemma inequalities of Macy & Flache (2002): , , , and either greed () or fear ().
In their Gathering game two agents collect apples and can tag each other out with a beam; independent deep Q-learners learned aggressive policies when apples were scarce. In Wolfpack agents earn more by hunting together. Less discounting produced more defection in both games, and larger networks more defection in Gathering but less in Wolfpack. Later games separated two classic structures: Harvest, a commons in which over-harvesting kills the apple supply, and Cleanup, a public-goods game in which someone must clean a river for apples to grow (Pérolat et al., 2017; Hughes et al., 2018).
Changing the incentives: inequity aversion and social influence
One response to dilemmas is to change what agents optimize. Behavioral economics offers a model of people who dislike unequal outcomes, and it can be given to learning agents as an intrinsic reward.
Two players with Axelrod's payoffs. Equal outcomes are untouched: still gives 3 each and 1 each. When one player defects on a cooperator, the defector's 5 is reduced by the advantageous term and the cooperator's 0 by the disadvantageous term:
Mutual cooperation is an equilibrium when defecting on a cooperator no longer pays, and mutual defection remains one, since cooperating against a defector is even worse than before:
With the game has two pure equilibria, mutual cooperation, better for both, and mutual defection: a stag hunt. The dilemma becomes a coordination problem, and the learners face the equilibrium-selection question of Cooperative Multi-Agent RL, where in the stag hunt different learning rules from the same start reached different equilibria.
Hughes et al. (2018) gave deep RL agents Fehr–Schmidt utilities computed on temporally smoothed rewards and found a division of labor between the two terms: advantageous inequity aversion promoted cooperation in Cleanup, the public-goods game, while disadvantageous inequity aversion helped in Harvest, the commons, by motivating agents to punish over-harvesters, and had no positive effect in Cleanup.
Jaques et al. (2019) proposed a different intrinsic reward, social influence: an agent is rewarded for the causal influence of its action on other agents' actions, estimated counterfactually, which equals rewarding the mutual information between their actions. It improved coordination and communication in Cleanup and Harvest, and with a learned model of other agents it can be computed without centralized access.
Opponent shaping
A naive learner differentiates its value as if the other agents' policies were fixed. But they learn too, and opponent shaping takes that into account. Learning with Opponent-Learning Awareness (LOLA; Foerster, Chen, Al-Shedivat, Whiteson, Abbeel & Mordatch, 2018) lets agent 1 anticipate one naive gradient step of agent 2, , and optimize its value after that step.
Expand agent 1's value after the opponent's anticipated step to first order:
Differentiate with respect to through the dependence of on . Writing for the matrix of mixed second derivatives, LOLA's update adds a shaping term to the naive gradient:
The shaping term moves in the direction that changes agent 2's own gradient so that agent 2's next step helps agent 1. Differentiating the expansion fully also produces a term in the second derivatives of ; LOLA's update keeps the shaping term and drops that one, and the analysis of Letcher et al. (2019) treats the two separately.
In the iterated prisoner's dilemma with memory-one policies (using payoffs for mutual cooperation, for mutual defection, and 0 and when one defects), pairs of LOLA agents with exact gradients learned tit-for-tat-like reciprocity in most runs, averaging per step, while naive learners mostly learned to defect, averaging . In iterated matching pennies LOLA agents converged to the Nash equilibrium, while naive learners did not.
| Method | Idea | What it fixes or adds |
|---|---|---|
| SOS (Letcher, Foerster, Balduzzi, Rocktäschel & Whiteson, 2019) | Interpolate between LOLA's shaping and a plain look-ahead | LOLA can destroy stable fixed points: in the "tandem" game with losses and , the shaping term pushes both agents off the stable line . SOS provably converges locally to stable fixed points and avoids strict saddles, for small step sizes |
| COLA (Willi, Letcher, Treutlein & Foerster, 2022) | Learn update functions that are consistent with each other | LOLA assumes the other is naive even when it is not; consistent updates fix that, although even they need not preserve stable fixed points |
| POLA (Zhao, Lu, Grosse & Foerster, 2022) | Read LOLA as an approximate proximal step in policy space | Updates invariant to how the policy is parameterized; reaches reciprocity more reliably than LOLA |
| M-FOS (Lu, Willi, Schroeder de Witt & Foerster, 2022) | Treat each episode of the game as one step of a meta-game whose episode spans the opponent's whole learning process, solved model-free | Long-horizon shaping; exploits naive learners and even LOLA, and learns extortion strategies against naive learners |
What does LOLA's shaping term capture?
- How agent 1's value changes when agent 1 changes its own parameters
- An entropy bonus that keeps agent 1's policy stochastic
- The variance of agent 1's gradient estimate
- How agent 1's choice of parameters changes agent 2's next learning step, weighted by how much that step matters to agent 1
Show the answer
D. How agent 1's choice of parameters changes agent 2's next learning step, weighted by how much that step matters to agent 1
says how agent 2's gradient, and hence its next step, responds to agent 1's parameters; says how much agent 2's moves matter to agent 1. Their product is the direction in which agent 1 can steer its opponent's learning to its own benefit.
Melting Pot and the frontier
Agents trained together can do well against each other and badly against anyone else, the multi-agent version of overfitting. Melting Pot (Leibo et al., 2021) evaluates generalization to new social situations. A substrate is the physical environment, a multi-agent game such as a commons or a coordination task. A background population consists of pretrained agents. A scenario is a substrate together with a background population, and it is used only for testing: a focal population is trained in the substrate and then evaluated, without further learning, on held-out scenarios, by its per-capita return. In resident mode the focal agents are the majority; in visitor mode, a minority among strangers. The first release had over 80 test scenarios, and Melting Pot 2.0 more than 50 substrates and 250 scenarios.
Key takeaways
- RIAL learns messages as actions, DIAL passes gradients through a differentiable channel during centralized training, and CommNet averages hidden states; all must escape the babbling equilibrium that every communication game contains.
- Positive signaling (messages depend on observations) is not positive listening (messages change behavior); causal measures of the listener's response are needed, and emergent protocols are rarely interpretable or compositional without grounding or constraints.
- In the iterated prisoner's dilemma, tit-for-tat is a best response to itself iff , which is for Axelrod's payoffs; sequential social dilemmas pose the same tension in Markov games, where independent learners often defect.
- Inequity aversion reshapes incentives: with advantageous aversion , Axelrod's prisoner's dilemma becomes a stag hunt; in deep RL, advantageous aversion helped in a public-goods game and disadvantageous aversion, through punishment, in a commons.
- LOLA differentiates through the opponent's anticipated learning step, and its shaping term sustains reciprocity in the iterated prisoner's dilemma; SOS, COLA, POLA and M-FOS address its instability, inconsistency, parameterization dependence and short horizon, and the same tools can extort naive learners. Melting Pot tests whether learned social behavior carries over to strangers.
Check yourself
In the interactive lesson these are scored with your confidence, and what you miss comes back for review.
Why can agents trained to communicate get stuck with a channel that carries nothing?
- Because discrete messages cannot carry information
- Because the team reward is too large
- Because communication always requires a human language model
- Because uninformative messages paired with a listener who ignores them form an equilibrium: neither side gains by changing alone
Show the answer
D. Because uninformative messages paired with a listener who ignores them form an equilibrium: neither side gains by changing alone
If messages carry no information, ignoring them is optimal; if the listener ignores them, any messages are optimal. This babbling equilibrium exists in every such game, and random initialization starts learning near it, so speaker and listener must improve together to leave it.
With , , , and continuation probability , is tit-for-tat a best response to tit-for-tat?
- Yes, because
- Yes, because tit-for-tat won Axelrod's tournaments
- No: alternating defection and cooperation earns against tit-for-tat's
- No: always defecting earns more than mutual cooperation
Show the answer
C. No: alternating defection and cooperation earns against tit-for-tat's
Against always defecting the threshold is , which holds; against alternating it is , which fails at 0.6. Alternation exploits tit-for-tat's willingness to forgive: each defection is punished only once, by a round in which the deviator cooperates.
Two players with Fehr–Schmidt utilities play the prisoner's dilemma with , , , . When is mutual cooperation an equilibrium?
- When the disadvantageous weight satisfies
- When the advantageous weight satisfies
- For any positive inequity aversion
- Never, since defection still dominates
Show the answer
B. When the advantageous weight satisfies
Defecting on a cooperator yields against 3 for staying put, so cooperation is stable iff : what deters the defector is its own discomfort at being ahead. Mutual defection stays an equilibrium too, so the game becomes a stag hunt, a coordination problem.
In Melting Pot, what is a scenario, and how is it used?
- A substrate together with a background population of pretrained agents, used only to test a trained focal population, without further learning
- A training curriculum of increasingly hard substrates
- A reward function chosen by the evaluator
- A population of agents trained together from scratch
Show the answer
A. A substrate together with a background population of pretrained agents, used only to test a trained focal population, without further learning
Scenarios hold out the social situation: the focal population meets background agents it never trained with, and its per-capita return measures how well its learned behavior generalizes, as a majority (resident mode) or a minority (visitor mode).
Further reading
- J. N. Foerster, Y. M. Assael, N. de Freitas & S. Whiteson, "Learning to communicate with deep multi-agent reinforcement learning," Advances in Neural Information Processing Systems 29, 2137–2145 (2016).
- R. Axelrod & W. D. Hamilton, "The evolution of cooperation," Science 211(4489), 1390–1396 (1981).
- J. Z. Leibo, V. Zambaldi, M. Lanctot, J. Marecki & T. Graepel, "Multi-agent reinforcement learning in sequential social dilemmas," Proceedings of the 16th International Conference on Autonomous Agents and Multiagent Systems (AAMAS), 464–473 (2017).
- J. Foerster, R. Y. Chen, M. Al-Shedivat, S. Whiteson, P. Abbeel & I. Mordatch, "Learning with opponent-learning awareness," Proceedings of the 17th International Conference on Autonomous Agents and Multiagent Systems (AAMAS), 122–130 (2018).
- J. Z. Leibo, E. A. Duéñez-Guzmán, A. S. Vezhnevets, J. P. Agapiou, P. Sunehag, R. Koster, J. Matyas, C. Beattie, I. Mordatch & T. Graepel, "Scalable evaluation of multi-agent reinforcement learning with Melting Pot," Proceedings of the 38th International Conference on Machine Learning, PMLR 139, 6187–6199 (2021).