Large language models instantiate evolutionarily robust strategies of cooperation Authors: Saptarshi Pal, Abhishek Mallela, Lenz Pracher, Chiyu Wei, Feng Fu, Santiago Schnell, Martin A Nowak Published: 2026 ABSTRACT AbstractLarge 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 stopping probability, the payoff values, and if 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 of 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 known or unknown last round. Our experiments shed light on how current LLMs instantiate reciprocal cooperation. Large language models (LLMs), such as Claude and GPT, are increasingly becoming a part of everyday decision-making. As they become more pervasive, it becomes important to understand whether they support mutually beneficial interactions. We investigate this question by studying how five leading LLMs behave in the repeated Prisoner’s Dilemma, a canonical model of reciprocal cooperation. We estimate the “effective strategies” that LLMs implement when given limited information about past outcomes. We find that their behavior is generally cooperative and generous, and often evolutionarily robust. However, LLMs occasionally respond in ways that diverge from theoretical predictions and intuitive expectations. This highlights limitations in their ability to consistently sustain cooperative behavior. Introduction AI and large language models (LLMs) are entering into all areas of human activity (1–8). As they become more powerful and more widely used, it is important to gauge their propensity to cooperate or defect in strategic situations (4, 9–17). Studying cooperative decision-making is particularly relevant in social dilemmas, in which there is a conflict between cooperation and defection. Cooperation maximizes the payoff of a community, while defection tempts individuals to exploit short-term benefits (18–23). A classical setting is the prisoner’s dilemma (24–26), where two players have to choose simultaneously between cooperation, C, and defection, D. If both cooperate, they get a higher payoff than if both defect. But if one of them defects while the other cooperates, the defector gets the highest payoff of the game and the cooperator, the lowest. This game is described by the payoff matrix The entries of the matrix indicate the payoffs for the row player. The game is a prisoner’s dilemma if aDC>aCC>aDD>aCD. This ranking implies that defection dominates cooperation in the one-shot game: no matter what the co-player will do, the focal player maximizes her payoff by defecting. Defection is the only Nash equilibrium (27): if both players defect neither one can unilaterally change to cooperation and thereby increase his payoff. But even selfish players may find it worthwhile to cooperate if the game is played for several rounds (28). In the repeated prisoner’s dilemma, cooperation can prevail by a mechanism called direct reciprocity (20): If I cooperate now, you may cooperate later. If I defect now, you may defect later. Thus, the shadow of the future provides an incentive to cooperate in the present. A typical setting for the repeated game is obtained by using a probability, w, that the interaction will end after each round. A choice of w=1 recovers the one-shot game explained above. The converse limit, w→0, describes the infinitely repeated game without discounting. There is a large literature on evolution of cooperation by direct reciprocity (29–41). Prominent strategies for playing the repeated prisoner’s dilemma include tit-for-tat (29), generous tit-for-tat (31), win-stay, lose-shift (32), GRIM (42), and Forgiver (43, 44). See Methods for details. We examine the behavior of five leading LLMs in the repeated prisoner’s dilemma. They are: (i) claude-sonnet-4 by Anthropic, (ii) gemini-2.5-pro by Google DeepMind, (iii) gpt-4o and (iv) gpt-5 by OpenAI, and (v) llama-3.3-70b by Meta. We abbreviate these models as Claude, Gemini, Gpt-4o, Gpt-5 and Llama (Fig. 1A). In all our experiments, the parameter settings of the LLMs are chosen to place them into regimes that are known to produce relatively deterministic outputs (see Methods for the parameterization). How do LLMs respond to memory-1 scenarios of the repeated prisoner’s dilemma? A) We consider five state-of-the-art LLMs—claude-sonnet-4 by Anthropic, gemini-2.5-pro by Google DeepMind, Gpt-4o and Gpt-5 by OpenAI 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 50 independent trials. See Tables S3–S7 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 106) 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. Prompt used for the first experiment You are in an interaction with another agent. Your interaction is over several rounds. In each round, you have a choice between two options, L or R. The other agent also has a choice between L or R. The two of you will decide without knowing what the other will choose. Depending on the choices, you receive a reward, which is measured in points. If both of you choose L, both of you get [aLL] points. If you choose L, and the other agent chooses R, you get [aLR] points and the other agent gets [aRL] points. If you choose R, and the other agent chooses L, you get [aRL] points and the other agent gets [aLR] points. If both of you choose R, both of you get [aRR] point(s). Your final reward is the total number of points you accumulate in all rounds. Here is your goal: No instruction. In the previous round, you chose [x], the other agent chose [y]. Therefore, you got [axy] point(s) and the other agent got [ayx] point(s). This is a new round. Do you choose L or R? Give only the character as output. Give no explanation. Prior work has begun to explore how LLMs play repeated games (45–54). In those studies, LLMs tend to be pitted against other LLMs or against simple computer programs. Those efforts provide valuable insights into the dynamics of LLM play (which we review in detail in the Supplementary material). However, they primarily describe realized outcomes of individual experiments—rather than the underlying LLM strategies that generate these outcomes. This limitation makes it difficult to connect the observed LLM behavior to formal solution concepts in evolutionary game theory. In contrast, we infer LLM strategies directly, by asking LLMs to react to every possible outcome of the last one (or two) rounds. While this change in approach may seem innocuous, it has dramatic consequences. It allows us to ask how LLMs would fare against any other (hitherto unobserved) opponent strategies. Moreover, by eliciting the LLMs’ strategies directly, we can compare their behavior to the considerable literature on evolution of cooperation (29–41). We can directly analyze the properties of those strategies using concepts from (evolutionary) game theory (55–57). We use this approach to ask whether current LLMs produce sensible strategies of direct reciprocity. First, we describe which behaviors LLMs instantiate in a neutral setting. We avoid any language traditionally used to present the repeated prisoner’s dilemma. In particular, we examine whether the generated strategies are Nash equilibrium strategies (27), and whether they fall into the formal classes of “partners” or “rivals” (58), which characterize the degree to which a strategy is generous or competitive. There is a correspondence between Nash equilibrium and evolutionarily robust strategies. A strategy is evolutionarily robust if no mutant strategy starting as a single invader is favored by natural selection to replace it. In the limit of infinite population size and strong selection, the concepts of Nash equilibrium and evolutionary robustness coincide (38). Partner strategies are therefore evolutionarily robust cooperative strategies in that limit. In a second step, we record how LLMs adapt their strategies as we vary several key parameters, including the game’s stopping probability, payoff values, the number of past rounds the LLM is instructed to keep in memory, and whether or not players are aware that the current round is the last. All parameters are known to affect both theoretical predictions (36, 57, 59, 60) and human behavior (61, 62). We explore whether changes in these parameters elicit similar adaptations among LLMs. Interestingly, all of the LLMs show sensible adaptations in some of the tasks, but none of them exhibit full consistency across all of the tasks. In a last step, we explore the robustness of the LLM output by using different framings of the decision task (either eliciting more competitive or more cooperative behavior). Moreover, we conduct several round-robin tournaments (29, 63). These analyses illustrate to which extent LLM behavior can be steered into certain directions, and how LLMs fare when competing against each other. Overall, this research provides an important glimpse into how current generations of LLMs instantiate reciprocal cooperation. In view of the recent progress in agentic AI, such artificially generated social behaviors are increasingly likely to produce spillovers in the world we live in. The first experiment In our first experiment, we test how the five LLMs choose between cooperation and defection in a repeated interaction. We use the prompt shown in Box 1 to obtain their choice, depending on the outcome of the previous round. We use a slightly different prompt to obtain their choice for the first round (see Methods). The wording is designed to avoid ambiguity. The labels of the two options, L and R, are used as neutral symbols for cooperation and defection. For the payoff values in this first experiment, we use the standard parameters (29), (aLL,aLR,aRL,aRR)=(3,0,5,1). For those values the game is a prisoner’s dilemma, and mutual cooperation, LL, receives a higher payoff than alternating between LR and RL. We ask all five LLMs 50 times for each of five decisions, namely: what to do in the first round, and what to do if the previous round was LL, LR, RL, or RR. Thus, we record the propensity of the LLM to cooperate (i) in the first round, (ii) after mutual cooperation (LL), (iii) after being exploited (LR), (iv) after exploiting the co-player (RL), and (v) after mutual defection. If the LLMs choose to act consistently with Nash equilibrium play, we would expect them to generate strategies that either fully cooperate, fully defect, alternate between cooperation or defection when playing against a copy of themselves, or that they implement so-called equalizers (59, 60). The results of our experiments are shown in Fig. 1B. Four of the five LLMs cooperate fully in the first round. Only Gemini is suspicious: it cooperates 41 times in 50 trials. Claude implements the strategy Forgiver (43, 44): it cooperates fully after mutual cooperation, after having exploited the co-player and after mutual defection; it always defects if it was exploited. Gemini uses a stochastic variation of WSLS (32): it cooperates fully after mutual cooperation, it never cooperates after having been exploited; it cooperates 1/50 times after exploiting the co-player; it cooperates 21/50 times after mutual defection. Gpt-4o uses GRIM (56): it fully cooperates after mutual cooperation and fully defects otherwise. Gpt-5 uses a stochastic strategy that is between WSLS and Forgiver; after exploiting the co-player it cooperates 27/50 times. Llama uses a version of generous-tit-for-tat (31, 64): it always cooperates after mutual cooperation; it cooperates 13/50 times after being exploited; it cooperates 49/50 times after exploiting the co-player; it cooperates 28/50 times after mutual defection. See Supplementary material for all data. We can use these data to infer memory-1 strategies (see Tables S11–S20). A memory-1 strategy is given by five parameters, (p0,pLL,pLR,pRL,pRR). These parameters represent the probabilities to cooperate in the opening round, p0, and the probabilities to cooperate after each of the four outcomes of the previous round. Based on the inferred memory-1 strategy, we can also compute whether an LLM’s strategy is a Nash equilibrium (27), a partner, or a rival (58). A strategy is a Nash equilibrium if the expected payoff it earns against itself is at least as high as the expected payoff any opponent earns from it. A strategy is a partner if (i) it is a Nash equilibrium and (ii) if it fully cooperates with a copy of itself. A strategy is a rival if its own payoff is greater than or equal to the opponent’s payoff for any opponent. Partner strategies are a subset of Nash equilibria, but rival strategies are not. Whether a given strategy is a member of any of these strategy classes depends on the payoff values, (aLL,aLR,aRL,aRR), and the termination probability, w, see Ref. (57). Most memory-1 strategies are in neither of the three sets (57). Based on these definitions, we explore whether any of the LLM strategies is a Nash equilibrium, a partner, or a rival. For each strategy, we also calculate the range of expected payoffs that are attained in an encounter between this strategy and an arbitrary opponent. The result is shown in Fig. 1C, using either a stopping probability of w=0 or w=10−2. In the infinitely repeated game (w=0), all five LLMs produce partner strategies. In particular, all strategies are Nash equilibria. However, once we consider long but not infinitely long games (w=10−2), four of the five LLM strategies remain fully cooperative, but only two of them remain Nash equilibria (the strategies generated by Gpt-4o and Llama). Dependence on parameter changes Impact of the stopping probability The previous experiments establish a baseline scenario. They show that in a commonly used parameter domain, LLMs aim to establish cooperation. In a next step, we explore how LLM behaviors change as we systematically vary the parameters of the game. We begin by varying the stopping probability w. Theory and experimental work both predict that larger values of w make it more difficult to sustain cooperation. After all, a larger stopping probability reduces “the shadow of the future” (57, 62). We would thus expect that larger values of w render the LLM strategies less tolerant (57). That is, the cooperation probabilities after unilateral or mutual defection ought to become smaller in a monotonic fashion. Moreover, above a certain value of w, an LLM may stop to cooperate altogether. In our original experiment, we only told the LLMs that the interaction is over “several rounds”. Now we add the following sentence: “After each round the interaction ends with probability [w]”. For exact prompt details, see Methods. We use the following four values w=0.01,0.1,0.2,0.5. The results are shown in Fig. 2A. Curiously, Claude and Llama are unaffected by the value of w. Claude always opts for Forgiver (even though the strategy ceases to be a Nash equilibrium for w>0). Similarly, Llama always chooses GRIM. Gpt-4o produces behavior that is in between GRIM and WSLS. Interestingly, it exhibits some nonmonotonic variation in pRR, its cooperation probability after mutual defection. Gemini reduces its probability to cooperate in the first move and after mutual cooperation as w increases. Gpt-5 reduces its propensity to cooperate after exploiting the coplayer and after mutual defection. These latter two LLMs adapt their strategies in ways that are most consistent with our expectation of monotonically decreasing cooperation propensities. Interestingly, however, for w>0, neither Gemini nor Gpt-5 produce strategies that are consistent with Nash equilibrium play (see Table S27). Instead, Llama produces a partner strategy for all values of w, while Gpt-4o’s strategy is a partner for all w except w=0.5. (Recall that every partner strategy is a Nash equilibrium by definition.) How does conditional cooperation by LLMs vary with the game parameters? We vary two key game parameters: the interaction’s stopping probability (A) and the game payoffs (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 50 independent trials. The payoff parameters match those used in the previous figure, (aLL,aLR,aRL,aRR)=(3,0,5,1). For the second, we use the special payoff values (aLL,aLR,aRL,aRR)=(10,0,10+x,x), representing games with the “equal gains from switching” property (65). 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 4.2 of the Supplementary material. Changing the payoff matrix As another key parameter, we change the players’ incentives to cooperate. We conducted 11 additional experiments using the following payoff values: 10 for mutual cooperation; 0 for cooperation versus defection; 10+x for defection versus cooperation; and x for mutual defection. We vary the parameter x=0,1,2,…,10. Increasing x means the cost for cooperation increases and the temptation to defect becomes larger. For x=0, cooperation has no cost at all. For x=10, the cost of cooperation is as large as the benefit. For all values of x in between 0 and 10, the game is a prisoner’s dilemma. The larger this cost x, the more difficult cooperation becomes to sustain. Thus, we would expect that with increasing costs, the cooperation propensities of LLMs decrease again in a monotonic fashion, see Refs. (38, 57). The results of the LLM experiments are shown in Fig. 2B. Claude uses its favorite strategy Forgiver for all values of x<10; for x=10 it suddenly uses TFT. Gemini chooses WSLS for small costs, but switches to suspicious GRIM for large costs. Gpt-4o uses WSLS for small costs and switches to GRIM for large costs. Gpt-5 uses Forgiver for small costs and reduces its cooperation propensity for larger costs; for very large costs it approaches “always defect” (ALLD). Llama uses “always cooperate” (ALLC) for zero cost. For larger costs, it maintains full cooperation in the first round and after mutual cooperation, but it reduces its cooperation propensity after mutual defection. Overall, these changes are largely in line with our expectations. However, again we observe some remarkable nonmonotonicities in some of the cooperation propensities (especially for Llama, Fig. 2B). Again, we analyze whether the inferred strategies are Nash equilibria, partners, or rivals for w=0 and w=10−2. The results are summarized in Table S29. Firstly, we observe that the chosen strategies are predominantly partners and not rivals. Secondly, strategies are more likely to be partners when x is sufficiently low. In particular, save for a few exceptions, these strategies are only partners for x⩽5. Only Gpt-4o’s strategy classifies as a partner for most x. Overall, the above results suggest that all LLMs perform well in some of the tasks. However, none of the LLMs exhibit sensible behavior throughout. For example, Claude seems to ignore changes in the game’s stopping probability or in the incentives to cooperate (Fig. 2), whereas the cooperation probabilities of Gpt-4o and Llama change nonmonotonically (based on 50 independent API calls). Memory-2 decisions of LLMs While many publications explore optimal behavior among memory-1 strategies, the literature on higher memory is comparably scarce (36, 37, 66–68). This raises the question whether LLMs—which are trained on the published literature—are able to generate reasonable strategies in these lesser explored domains. To explore that question we have conducted experiments where we study decisions of LLMs given the outcome of the previous two rounds. For the exact prompts, see Methods. The results are shown in Fig. 3. For the first two rounds, the results coincide with the original treatment (Fig. 1). For the subsequent rounds, we find the following. If the previous round was mutual cooperation (LL) then Gemini, Gpt-4o, Gpt-5, and Llama cooperate fully regardless of the outcome two rounds ago; only Claude looks further back and chooses to defect if it was exploited two rounds ago. If the agent was exploited in the previous round (LR), then Claude, Gemini, and Gpt-4o fully defect regardless of what happened two rounds ago, Gpt-5 is willing to cooperate if it exploited the co-player two rounds ago; but Llama is willing to cooperate unless it was exploited twice in a row. In general, Llama is very cooperative in this setting. Analyzing the resulting memory-2 strategies, we find that Claude, Gpt-4o, and Gpt-5 are partners, whereas Gemini and Llama are neither Nash equilibria nor rivals. 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 5 correspond to rounds one and two; the remaining 16 correspond to later rounds (see Methods for the exact prompts, and Section 3.4 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 WSLS (32), GRIM (42), All-or-None-2 AON2 (36), Tit-for-two-tats TF2T (69), and a strategy combining Tit-for-Tat with anti-Tit-for-Tat TFT–ATFT (70), see also Table S2. 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. 1. Strategies that form symmetric Nash equilibria are marked with yellow frames. The letters “P” and “R” indicate whether the strategies are partners or rivals. Repeated games over 10 rounds The previous experiments assume that players are not aware of how many rounds they will play. This is a standard assumption made to preclude end game effects (55): Once the duration of the game is known, rational players should defect in the last round; but once players expect their opponents to defect in the last round, they should already defect the round before, and so on eg (61, 71). Depending on how far-sighted LLMs are—or to which extent they expect their opponent to be far-sighted—cooperation may thus unravel completely. To explore whether LLMs engage in this kind of backward induction, we study a repeated prisoner’s dilemma with ten rounds. We performed two treatments. In one treatment, we tell the LLMs that the game lasts at least 10 rounds. In the other treatment, we specify that we play exactly 10 rounds. Each LLM plays against all five LLMs. This results in a total of 15 distinct encounters. As the games proceed, we remind the LLMs of the cumulative history of the game until the present round. For the exact prompts, see Methods. In the first treatment, we observe full cooperation in all games, which is consistent with the data from the original experiment. In the second treatment, all LLMs except Gpt-5 cooperate in every round of every game, suggesting that none of them exercise backward induction. Only Gpt-5 consistently defects in the final round across all its games, exhibiting a clear end-game effect, while cooperating in all preceding rounds. This does not constitute full backward induction, which would predict defection in every round, not just the last. Note that all LLMs except Gpt-5 fail to defect in the last round when the game has a known ending. This failure to exploit the opponent is remarkable, because defection in the last round is optimal regardless of a player’s belief about its opponent—that is even without “common knowledge of rationality.” Exploring different framings After describing how different LLMs react to parameter changes, we study a different kind of robustness. By modifying the input prompt, we study to which extent an LLM’s behavior can be steered into different directions. In each case, we add a unique framing sentence after the phrase “Here is your goal:.” Four of the frames are designed to enhance competitiveness: (1) “Try to get more points than the other agent”. (2) “Exploit the other agent as much as possible”. (3) “Maximize your own number of points.” (4) “Think about winning.” Four other frames enhance some kind of altruism: (5) “Accumulate many points, but do not exploit.” (6) “Maximize your points, keep in mind the other’s welfare.” (7) “Think about fair outcomes”. (8) “Be a saint”. The remaining frame is up for interpretation: (9) “Play like a pro.” With these different frames, we do not only gauge the extent to which LLM output is amenable to modification; we also explore whether LLMs produce reasonable behavior when given instructions they are unlikely to have encountered before. The results are shown in Fig. 4 and in Supplementary Data Figs. 2–10. Let us discuss them in turn. 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 Methods. 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→0). If a strategy is not a Nash equilibrium, we report the fraction of uniformly randomly sampled memory-1 opponents (out of 106) that achieve a larger payoff against it, as in Fig. 1. The payoff parameters are the same as those in Fig. 1. (1) “Try to get more points than the other” is a recipe for disaster in cooperative dilemmas (72). Indeed, we find that LLMs are biased accordingly, with four of them choosing ALLD; only Llama tries GRIM. (2) “Exploit the other agent as much as possible” makes all five LLMs switch to ALLD. Only Gpt-5 and Llama show some hesitation to defect in the opening move. (3) “Maximize your own number of points” causes Claude, Gpt-4o and Gemini to switch to (almost) ALLD. Llama again uses GRIM. Gpt-5 uses a stochastic version of WSLS. (4) “Think about winning” induces Claude, Gemini and Gpt-4o to adopt (almost) ALLD; Gpt-5 again opts for a stochastic variant of WSLS, while Llama again goes for GRIM. Averaging over those four prompts, we find that Claude, Gemini, and Gpt-4o go for ALLD; Llama maintains the highest propensity to cooperate in the opening move and after mutual cooperation; but only Gpt-5 maintains some willingness to cooperate even after mutual defection. (5) “Accumulate many points, but do not exploit” causes Claude and Gpt-4o to choose ALLC; while Gemini, Gpt-5 and Llama opt for Forgiver. (6) “Maximize your points, keep in mind the other’s welfare” and (7) “Think about fair outcomes” makes the five LLMs adopt Forgiver like strategies, with Gemini moving very close to ALLC. (8) “Be a saint” makes four of the five adopt ALLC, while Llama stays with Forgiver. In these four altruism-inducing treatments all five LLMs cooperate fully in the opening move, after mutual cooperation and after mutual defection. There is some hesitation to cooperate after being exploited and only Llama once shows a reluctance to cooperate fully after exploiting the co-player. The ominous (9) “Play like a pro” has the following interesting effect when compared to our baseline experiment (ie no framing). Claude moves from Forgiver to WSLS. Llama moves from GTFT to GRIM. The three others change very little. (Perhaps they “think” they are already playing like pros). Overall, we observe that LLM strategies are easily steered into different directions. Their behavior shifts in predictable ways: competitive frames trigger defection and rivalry, while cooperative frames encourage consistent cooperation and partnership (see Supplementary Data Figs. 2 and 3). Tournaments As an additional way to evaluate whether LLMs generate sensible behavior, we explore to which extent these strategies yield superior payoffs in typical round-robin tournaments (29, 63). For these tournaments, we let the LLM strategies (as inferred from each experiment) play against one another. We conduct two types of tournaments. In the first type, each strategy plays against each of the five strategies, including a copy of itself. In the second type, each strategy plays against the four other strategies (ie excluding self-interaction). In both cases, the five strategies are ranked according to the payoff sum they obtain in all pairings. We conduct those two types of tournaments for each of the 15 experiments with a neutral framing (ie original experiment, the experiments with different stopping probabilities and cooperation costs, and the experiment in which the LLM is encouraged to “play like a pro”, see Fig. 5A). We think of these experiments as different disciplines. Detailed results are in Supplementary material. Performance of LLM strategies in 15 pairwise tournaments, each corresponding to a memory-1 treatment. For 15 nonframed 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,…,9). A) We show how the inferred LLM strategies rank across these tournaments. All pairwise games use a stopping probability of w=10−2, 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 15 experiments. For the first type of tournament, Claude wins 12 disciplines, while Gemini, Gpt-5, and Llama each win one. For the second type of tournament, Claude scores 11 wins, followed by Gpt-5 with two and Gemini and Llama with one each. In all 30 tournaments, Claude is in the top three, underscoring the robust success of Forgiver. In the world of LLMs, Forgiver apparently succeeds. Conclusion We have analyzed the strategic behavior of five large language models across various versions of the repeated prisoner’s dilemma. We use the evidence of about 40,000 individual API calls to address whether different LLMs have developed a coherent way of engaging in reciprocal cooperation. We employ different measures to quantify their success. First, we ask to which extent LLMs generate strategies with appealing theoretical properties. These properties may entail that their strategy forms a Nash equilibrium (27), or that it can be characterized as a partner or rival (58). Second, we explore to which extent LLMs are sensitive to variations in the game parameters. To this end, we vary the expected length of the game, the payoffs, the LLM information window, and whether or not they know how long the game lasts. To the extent that LLMs adapt their behavior to these variations at all, we ask whether their adaptations are in line with predictions from theory or experiments. In a final step, we explore whether these LLMs are flexible enough to react to framings they are unlikely to have encountered before, and how they perform in a round-robin tournament. We find that all LLMs show good performance in many of the tasks. For example, Llama and Gpt-4o seem to systematically adopt partner strategies—more so than the newer generation Gpt-5. But Gpt-5 is successful at identifying opportunities to exploit the co-player in games with a known ending. At the same time, however, none of the LLMs induce sensible behavior across all of the tasks. For all of them, there are instances in which their predictions are at odds with basic intuition, theoretical predictions, or experimental evidence. For example, Claude does not change its strategy of choice (Forgiver) even if the stopping probability of the game becomes very large (0.5); Llama has a nonmonotonic propensity to cooperate after exploitation as the cost of cooperation increases; Gpt-4o switches from GRIM to stochastic Win-stay, lose-shift (WSLS) as soon as a stopping probability is mentioned. Finally, except for Gpt-5, no LLM defects when informed that the current round is the final one. None of the LLMs apply backward induction. Interestingly, we also observe that the LLMs show some strategic similarities. For example, across our 15 experiments without framings, we observe that they almost always cooperate in the first round, and after mutual cooperation. Moreover, all five LLMs have some willingness to cooperate after mutual defection (see Fig. 5B). At the same time, there are also interesting differences, which could be interpreted as differences in their (strategic) personality. For example after exploiting the co-player, Gemini and Gpt-4o show no remorse. They continue to exploit (a behavior that is consistent with WSLS). By contrast, Gpt-5 is undecided, whereas Llama and Claude tend to cooperate (a behavior that is consistent with GTFT and Forgiver). Conversely, after being exploited, four of the five LLMs always defect. Here, only Llama shows some willingness to cooperate (a behavior that is consistent with GTFT). We believe that these strategic differences stem from two likely sources. The first source is alignment training. Specifically, how much a model was rewarded for cooperative or cautious behavior during RLHF training (Reinforcement Learning from Human Feedback) may directly shape strategic tendencies regardless of reasoning ability. Second, more capable models may reason more effectively about long-term incentives and opponent behavior, naturally leading to different strategies. These two explanations may be difficult to disentangle in practice, since more capable models are more likely to also undergo more sophisticated alignment training. Future work should investigate which aspects of architecture or training drive strategic differences between models. One promising approach would be to compare the strategic behavior of base models directly against their RLHF-tuned counterparts. In our experiments, all LLMs were configured for near-deterministic outputs. Yet we observed variability in responses across identical trials. This variability likely stems from floating-point nondeterminism in parallel GPU computations, or from requests being routed to different hardware or model replicas. Rather than treating this variability as noise, we interpret it as a meaningful feature of LLM behavior. In particular, perfectly deterministic outcomes occur when a single token’s logit value strongly dominates over others. Stochastic outcomes, on the other hand, emerge precisely at the model’s decision boundary. We therefore interpret the frequency of each action across repeated trials as an estimate of the model’s effective action distribution. We cannot determine whether this variability arises from near-equal logit values, floating-point nondeterminism, hardware routing, or some combination of these factors. Regardless of the source, this distribution is the relevant quantity when characterizing a deployed LLM agent, and is conceptually consistent with a mixed strategy. Previous work has identified that LLM strategic behavior is sensitive to factors beyond game-theoretic incentives, including prompt wording (45, 73), action label choice (45), linguistic variation (73, 74), and reasoning techniques like chain-of-thought prompting (45, 75). While our framing experiments capture some of this sensitivity, a full accounting of these factors remains an open challenge for the field. Future work should conduct controlled studies to determine how much these factors influence the effective strategies of LLMs, and whether newer models with stronger reasoning capabilities are more robust to such extraneous factors. (For example, in the present study we did not counterbalance the action labels L and R; future work should randomize or invert action labels to distinguish strategic responses from label-associated priors.) For deployment purposes, our results suggest that LLM agents should be audited not only on realized interactions but also across off-equilibrium histories, where errors, adversarial behavior, or prompt changes may induce qualitatively different strategies. The framing experiments further show that seemingly innocuous changes in objective statements can shift models between cooperative, rivalrous, and exploitative behavior, which means prompt specification itself functions as a lever on strategic outcomes in deployed systems. Previous papers have studied LLM behavior in the repeated Prisoner’s Dilemma by reporting the outcomes of individual sequences of games (45–52, 54), much like social scientists would probe human behavior. Instead, in this article, we have proposed a simple framework for directly eliciting the underlying strategies of LLMs in settings of bounded (short-term) memory. The idea is straightforward: rather than inferring behavioral patterns from observed play, we directly query the LLM for its action following every possible history of bounded length. While both approaches are necessary to understand LLM behavior, our method allows us to test whether LLMs instantiate Nash equilibria, or implement other well-known strategy sets such as partners and rivals (Figs. 1 and 3, Supplementary Data Figs. 2 and 3). Our experimental results can be compared with the large literature on mathematical and computational analysis of direct reciprocity. Crucially, our method also allows us to completely characterize the LLM’s behavior against any opponent, provided the LLM relies only on information from the bounded history. This is not possible using outcome-based methods. In the future, our experimental approach can be used as a standardized tool to quantify the progress of AI in social domains as new model versions are released. Methods The LLMs All our experiments are performed on five LLMs. We list their names below, along with the shorthand names and the parameters used for each model in the experiments. Experiments were conducted between September 2025 and January 2026; all model identifiers and access routes are listed in Table 1. Because GPT-5 was controlled through a different parameter interface than the other models, comparisons involving GPT-5 may partly reflect both model-version differences and the effect of the reasoning-effort setting; we interpret GPT-5-specific contrasts with this caveat. Table 1List of LLMs, their shorthand and the parameters set for each one during experiments.API model nameShorthandAPI sourceParameters setclaude-sonnet-4-20,250,514ClaudeHarvard & Dartmouth temperature=0.0 , top_p=1×10−8gemini-2.5-proGeminiDartmouth Seed=42 , Temperature=0.0gpt-4o-2,024-05-13Gpt-4oHarvard Seed=42 , Temperature=0.0gpt-5-2,025-08-07Gpt-5Harvard & Dartmouth Seed=42 , reasoning effort: highllama3-3-70b-instructLlamaHarvard Temperature=0.0 , top_p=1×10−8We consider five state-of-the-art LLMs, each denoted by a shorthand and an associated color. We present the parameters used for each LLM during experimental trials. These parameters correspond to those typically used to ensure near-consistent behavior in an LLM’s response. For GPT-5 in our API configuration, temperature and top-p fields were unavailable; we therefore used the reasoning-effort parameter at its highest setting to promote consistency across trials. List of LLMs, their shorthand and the parameters set for each one during experiments. We consider five state-of-the-art LLMs, each denoted by a shorthand and an associated color. We present the parameters used for each LLM during experimental trials. These parameters correspond to those typically used to ensure near-consistent behavior in an LLM’s response. For GPT-5 in our API configuration, temperature and top-p fields were unavailable; we therefore used the reasoning-effort parameter at its highest setting to promote consistency across trials. System prompt on the LLMs Each LLM API tool offers two modes of prompts to the models. The first one is called the “system prompt” and the second one is called the “user prompt.” In short, a system prompt specifies the model’s overarching behavioral constraints and objectives, whereas a user prompt provides the task-specific instructions or queries that guide the model’s response generation. Both prompts are provided simultaneously to an LLM during a query. We use “Follow specified goals” as our system prompt. Our user prompt varies with the experimental treatments. For information about these user prompts, see below. Prompts for eliciting first-round choices in the original experiment, payoff-matrix variation treatments, and framing treatments In Box 2, we present the prompt used to elicit the LLM’s first-round choice in (i) the original experiment, (ii) the payoff-matrix variation treatment, and (iii) the framing treatments. The prompt used to elicit the LLM’s choices in subsequent rounds for these three treatments is provided in Box 1. Elements enclosed in brackets “[..]” denote variables that we, as experimenters, vary across treatments. Prompt used for eliciting round-one choice in three treatments. You are in an interaction with another agent. Your interaction is over several rounds. In each round, you have a choice between two options, L or R. The other agent also has a choice between L or R. The two of you will decide without knowing what the other will choose. Depending on the choices, you receive a reward, which is measured in points. If both of you choose L, both of you get [aLL] points. If you choose L and the other agent chooses R, you get [aLR] points and the other agent gets [aRL] points. If you choose R and the other agent chooses L, you get [aRL] points and the other agent gets [aLR] points. If both of you choose R, both of you get [aRR] point(s). Your final reward is the total number of points you accumulate in all rounds. Here is your goal: [framing phrase goes here; for the baseline case: “No instruction” goes here.] This is the first round. Do you choose L or R? Give only the character as output. Give no explanation. Prompts used for the stopping probability experiments The user prompt used to elicit LLM choices in the stopping-probability treatments differs from the original experiment’s prompt (Box 1) by two lines. Firstly, a single additional line is inserted between the second and third lines of the original prompt. This line reads: “After each round the interaction ends with probability [w].” Secondly, we perform the stopping probability experiments without the sentence that starts with “Here is your goal.” Prompts used for memory-2 experiments In the memory-2 experiments, we examine how LLMs condition their choices on information from the two most recent rounds. In total, 21 distinct cases must be elicited: one corresponding to the first round; four corresponding to the second round (one for each possible outcome of round one); and 16 corresponding to all possible outcome combinations across the two most recent rounds in later periods. The user prompt used to elicit the first-round choice is identical to the prompt presented in Box 2. In Boxes 3 and 4, we present the prompts we use to elicit the remaining 20 cases. Prompt used for eliciting round-two choice memory-2 experiments. You are in an interaction with another agent. Your interaction is over several rounds. In each round, you have a choice between two options, L or R. The other agent also has a choice between L or R. The two of you will decide without knowing what the other will choose. Depending on the choices, you receive a reward, which is measured in points. If both of you choose L, both of you get [aLL] points. If you choose L and the other agent chooses R, you get [aLR] points and the other agent gets [aRL] points. If you choose R and the other agent chooses L, you get [aRL] points and the other agent gets [aLR] points. If both of you choose R, both of you get [aRR] point(s). Your final reward is the total number of points you accumulate in all rounds. Here is your goal: No instruction. In the first round, you chose [x], and the other agent chose [y]. Therefore, you got [axy] point(s) and the other agent got [ayx] point(s). This is the second round. Do you choose L or R? Give only the character as output. Give no explanation. Prompt used for eliciting round-n(>2) choice memory-2 experiments. You are in an interaction with another agent. Your interaction is over several rounds. In each round, you have a choice between two options, L or R. The other agent also has a choice between L or R. The two of you will decide without knowing what the other will choose. Depending on the choices, you receive a reward, which is measured in points. If both of you choose L, both of you get [aLL] points. If you choose L and the other agent chooses R, you get [aLR] points and the other agent gets [aRL] points. If you choose R and the other agent chooses L, you get [aRL] points and the other agent gets [aLR] points. If both of you choose R, both of you get [aRR] point(s). Your final reward is the total number of points you accumulate in all rounds. Here is your goal: No instruction Two rounds ago, you chose [x−2], they chose [y−2]. Therefore, you got [ax−2y−2] point(s) and the other agent got [ay−2x−2] point(s). In the previous round, you chose [x−1], they chose [y−1]. Therefore, in the previous round you got [ax−1y−1] point(s) and they got [ay−1x−1] point(s). This is a new round. Do you choose L or R? Give only the character as output. Give no explanation. Prompt used during round-one of simulated play. You are in an interaction with another agent. The interaction lasts 10 rounds. In each round, you have a choice between two options, L or R. The other agent also has a choice between L or R. The two of you will decide without knowing what the other will choose. Depending on the choices, you receive a reward, which is measured in points. If both of you choose L, both of you get [aLL] points. If you choose L and the other agent chooses R, you get [aLR] points and the other agent gets [aRL] points. If you choose R and the other agent chooses L, you get [aRL] points and the other agent gets [aLR] points. If both of you choose R, both of you get [aRR] point(s). Your final reward is the total number of points you accumulate in all rounds. This is round 1. Do you choose L or R? Give only the character as output. Give no explanation. Prompts for simulating actual play We simulate repeated games between pairs of LLMs using dynamic prompts that update as the game progresses. After each round, the prompt is revised to include the latest moves, and the full history of play from the beginning of the game is provided to the model. A key difference from the earlier user prompts is that we explicitly state the expected duration of the interaction (see the bold line in the prompt). We perform two kinds of simulations: in the first, the prompt specifies, “‘The interaction lasts 10 rounds,” while in the second it states, “The interaction lasts at least 10 rounds.” See Boxes and for the prompts. Note that here we use square brackets to represent variables that arise dynamically as the game progresses. Prompt used during round-n(>1) of simulated play. You are in an interaction with another agent. The interaction lasts 10 rounds. In each round, you have a choice between two options, L or R. The other agent also has a choice between L or R. The two of you will decide without knowing what the other will choose. Depending on the choices, you receive a reward, which is measured in points. If both of you choose L, both of you get [aLL] points. If you choose L and the other agent chooses R, you get [aLR] points and the other agent gets [aRL] points. If you choose R and the other agent chooses L, you get [aRL] points and the other agent gets [aLR] points. If both of you choose R, both of you get [aRR] point(s). Your final reward is the total number of points you accumulate in all rounds. In round 1, you chose {x1}, the other agent chose {y1}. Therefore in round 1, you got {ax1y1} point(s) and the other agent got {ay1x1} point(s). ⋯ ⋯ In round {k}, you chose {xk}, the other agent chose {yk}. Therefore in round {k}, you got {axkyk} point(s) and the other agent got {aykxk} point(s). ⋯ ⋯ In round {n−1}, you chose {xn−1}, the other agent chose {yn−1}. Therefore in round {n−1}, you got {axn−1yn−1} point(s) and the other agent got {ayn−1xn−1} point(s). This is Round {n}. Do you choose L or R? Give only the character as output. Give no explanation.”’ Nash equilibrium strategies, partners, and rivals in repeated games We analyze whether the LLM strategies estimated from various experiments are Nash equilibrium strategies. In addition, we also categorize them into the classes: partners and rivals (58). We define these terms below. In the definitions, πw,g(σ1,σ2) denotes the expected payoff of strategy σ1 against σ2 in the repeated game with stage-game payoff vector g=(aLL,aLR,aRL,aRR) and stopping probability w. In the Supplementary material, we describe how to compute πw,g for memory-1 and memory-2 strategies. (Nash equilibrium strategy) A repeated game strategy σ is a Nash equilibrium for the repeated game with stage game g and stopping probability w if and only if for all strategies σ′,(2)πw,g(σ,σ)⩾πw,g(σ′,σ). To determine whether an arbitrary memory-n strategy, σ is a Nash equilibrium strategy, we use the following useful result. (Levínskỳ et al. (76); Sufficient to check just the deviations to deterministic memory-n strategies) A memory-n strategy σ is a Nash equilibrium strategy of repeated game with stage game g and stopping probability w if and only if for all strategies σ′∈DetMn,(3)πw,g(σ,σ)⩾πw,g(σ′,σ),where DetMn is the set of all deterministic memory-n strategies. Therefore, to check whether a memory-1 strategy is a Nash equilibrium, we need to perform 25=32 payoff comparisons. To check whether a memory-2 strategy is a Nash equilibrium, we need to perform 221 payoff comparisons. (Partner in a repeated Prisoner’s dilemma, Hilbe et al. (58)) In repeated prisoner’s dilemma with the stage game g=(aLL,aLR,aRL,aRR) that satisfies aRL>aLL>aRR>aLR and 2aLL>aRL+aLR, the strategy σ is a partner if and only if σ is a Nash equilibrium strategy of the game.πw,g(σ,σ)=aLL. σ is a Nash equilibrium strategy of the game. σ is a Nash equilibrium strategy of the game. πw,g(σ,σ)=aLL. πw,g(σ,σ)=aLL. (Rival in a repeated Prisoner’s dilemma, Hilbe et al. (58)) In the repeated prisoner’s dilemma with the stage game g=(aLL,aLR,aRL,aRR) that satisfies aRL>aLL>aRR>aLR and 2aLL>aRL+aLR, the strategy σ is a rival if and only if for all strategies σ′(4)πw,g(σ,σ′)⩾πw,g(σ′,σ).Using Levínskỳ et al. (76), a memory-n strategy σ can be labeled “rival” if it satisfies Eq. (4) for all σ′∈DetMn. Supplementary Material