Table of Contents
Fetching ...

Strategies of cooperation and defection in five large language models

Saptarshi Pal, Abhishek Mallela, Christian Hilbe, Lenz Pracher, Chiyu Wei, Feng Fu, Santiago Schnell, Martin A Nowak

Abstract

Large language models (LLMs) are increasingly deployed to support human decision-making. This use of LLMs has concerning implications, especially when their prescriptions affect the welfare of others. To gauge how LLMs make social decisions, we explore whether five leading models produce sensible strategies in the repeated prisoner's dilemma, which is the main metaphor of reciprocal cooperation. First, we measure the propensity of LLMs to cooperate in a neutral setting, without using language reminiscent of how this game is usually presented. We record to what extent LLMs implement Nash equilibria or other well-known strategy classes. Thereafter, we explore how LLMs adapt their strategies to changes in parameter values. We vary the game's continuation probability, the payoff values, and whether the total number of rounds is commonly known. We also study the effect of different framings. In each case, we test whether the adaptations of the LLMs are in line with basic intuition, theoretical predictions of evolutionary game theory, and experimental evidence from human participants. While all LLMs perform well in many of the tasks, none of them exhibit full consistency over all tasks. We also conduct tournaments between the inferred LLM strategies and study direct interaction between LLMs in games over ten rounds with a known or unknown last round. Our experiments shed light on how current LLMs instantiate reciprocal cooperation.

Strategies of cooperation and defection in five large language models

Abstract

Large language models (LLMs) are increasingly deployed to support human decision-making. This use of LLMs has concerning implications, especially when their prescriptions affect the welfare of others. To gauge how LLMs make social decisions, we explore whether five leading models produce sensible strategies in the repeated prisoner's dilemma, which is the main metaphor of reciprocal cooperation. First, we measure the propensity of LLMs to cooperate in a neutral setting, without using language reminiscent of how this game is usually presented. We record to what extent LLMs implement Nash equilibria or other well-known strategy classes. Thereafter, we explore how LLMs adapt their strategies to changes in parameter values. We vary the game's continuation probability, the payoff values, and whether the total number of rounds is commonly known. We also study the effect of different framings. In each case, we test whether the adaptations of the LLMs are in line with basic intuition, theoretical predictions of evolutionary game theory, and experimental evidence from human participants. While all LLMs perform well in many of the tasks, none of them exhibit full consistency over all tasks. We also conduct tournaments between the inferred LLM strategies and study direct interaction between LLMs in games over ten rounds with a known or unknown last round. Our experiments shed light on how current LLMs instantiate reciprocal cooperation.
Paper Structure (9 sections, 1 equation, 5 figures, 1 table)

This paper contains 9 sections, 1 equation, 5 figures, 1 table.

Figures (5)

  • Figure 1: How do LLMs respond to memory-1 scenarios of the repeated prisoner’s dilemma?A, We consider five state-of-the-art Large Language Models (LLMs)—claude-sonnet-4 by Anthropic, gemini-2.5-pro by Google DeepMind, Gpt-4o and Gpt-5 by Open AI and llama-3.3-70b by Meta AI. We refer to these models Claude, Gemini, Gpt-4o, Gpt-5 and Llama. We present five repeated prisoner’s dilemma scenarios to the LLMs and request their choices. The five scenarios elicit the LLM's response in the first round, and after the four possible outcomes of the previous round (see Box 1 for the prompts). B, We report how often the five LLMs choose the cooperative action 'L' in each scenario across fifty independent trials. See Tables S4-S8 for the data. C, We show the range of expected per-round payoffs possible when inferred LLM memory-1 strategies play arbitrary opponents. We show these ranges for games with infinitely many rounds (top row) and games with 100 rounds in expectation (bottom row). We indicate whether an LLM strategy gives rise to a Nash equilibrium with a yellow square; otherwise, we report the percentage of randomly sampled memory-1 opponents (out of $10^6$) that achieve a higher payoff against it than it earns against itself. With 'P' or 'R' we denote if the LLM strategy is a partner or a rival.
  • Figure 2: How does conditional cooperation by LLMs vary with the game parameters? We vary two key game parameters: the interaction's stopping probability (panel A) and the game payoffs (panel B). For the first, we add a single line to the original prompt in Box 1: "After each round the interaction ends with probability $\{w\}$." We vary $w$ and record how often the five LLMs choose the cooperative action 'L' in the five memory-1 scenarios across fifty independent trials. The payoff parameters match those used in the previous figure, $(a_{\mathrm{LL}},\, a_{\mathrm{LR}},\, a_{\mathrm{RL}},\, a_{\mathrm{RR}}) = (3, 0, 5, 1)$. For the second, we use the special payoff values $(a_\mathrm{LL},a_\mathrm{LR},a_\mathrm{RL},a_\mathrm{RR})=(10,0,10+x,x)$, representing games with the 'equal gains from switching' property nowak:AAM:1990. Here, $x$ is the gain in payoff when unilaterally shifting from the cooperative action 'L' to the defective action 'R'. At $x\!=\!0$, a player's payoff is independent of its own action. At $x\!=\!10$, cooperation ceases to be socially optimal since mutual defection is as beneficial as mutual cooperation. We vary $x$ and plot how often the five LLMs cooperate in the five memory-1 scenarios. For more data and information on whether the inferred strategies form Nash equilibria or act as partners or rivals, see Section 6.2 of the Supplementary Information.
  • Figure 3: How do LLMs act when responding to the outcome of the last two rounds?A, We display the frequency with which the LLMs choose the cooperative choice 'L' in scenarios that include information about the previous two rounds. There are 21 such scenarios: the first five correspond to rounds one and two; the remaining sixteen correspond to later rounds (see Section 4.4 of Supplementary Information for the exact prompts, and Section 4.5 for the resulting data). As before, we perform 50 independent trials for each LLM-scenario combination. We compare the LLMs’ choices to five well-known strategies from the literature: Win-Stay, Lose-shift Nowak:Nature:1993, GRIM Dal:AER:2019, All-or-None-2 Hilbe:PNAS:2017, Tit-for-two-tats Boyd:Nature:1987, and a strategy combining Tit-for-Tat with anti-Tit-for-Tat Do:JTB:2017, see also Table S3. B, We show how arbitrary strategies perform against the elicited LLM strategies, as well as against the five well-known strategies. Payoff computations are performed for stopping probability $w\!=\!10^{-10}$; other parameters are the same as in Fig. \ref{['fig:Fig1']}. Strategies that form symmetric Nash equilibria are marked with yellow frames. The letters 'P' and 'R' indicate whether the strategies are partners or rivals.
  • Figure 4: How is LLM choice affected by cooperative or competitive framings used in the prompts?A, We conduct nine new treatments in the style of our original memory-1 experiment, each adding a colored framing to the original prompts. Each framing tells the LLM to focus on a specific goal. Four framings are competitive, four are cooperative, and one is neutral. Using heatmaps, we show how often each LLM chooses the cooperative action “L” across 50 independent trials for each scenario and framing. For the exact prompt see Section 4.1 in Supplementary Matrials. B, We compute if the inferred LLM strategies form a symmetric Nash equilibrium ('N'), whether they are partners ('P'), or rivals ('R') for the infinitely repeated game $(w\!\to\!0)$. If a strategy is not a Nash equilibrium, we report the fraction of uniformly randomly sampled memory-1 opponents (out of $10^6$) that achieve a larger payoff against it, as in Fig. \ref{['fig:Fig1']}. The payoff parameters are the same as those in Fig. \ref{['fig:Fig1']}.
  • Figure 5: Performance of LLM strategies in fifteen pairwise tournaments, each corresponding to a memory-1 treatment. For fifteen non-framed memory-1 treatments, we compute the exact outcomes of pairwise tournaments between strategies inferred for the five LLMs. These treatments include the baseline experiment, a neutral framing treatment ("play like a pro"), four stopping-probability treatments ($w=0.01,0.1,0.2,0.5$), and nine payoff-matrix treatments ($x = 1,\dots,9$). A, We show how the inferred LLM strategies rank across these tournaments. All pairwise games use a stopping probability of $w = 0.01$, except for the stopping-probability treatments, where we use the value of $w$ specified in the prompt. Numbers on the bars indicate how often each LLM attains a given rank. Filled bars include self-play outcomes, whereas hollow bars exclude them. We exclude the cases $x\!=\!0$ and $x\!=\!10$ because they do not constitute Prisoner’s Dilemmas. B, We show the average memory-1 strategy inferred for each LLM across these fifteen experiments.