Our work presents the results of an analysis of the Iterated Prisoner’s Dilemma in which the players are Large Language Models (LLMs) embodying individuals with predefined age and gender characteristics (hereafter, LLM agents). The cooperative behavior of LLM agents is examined within the framework of Markov strategies, where a player’s action in the next round is conditioned on the opponent’s previous action and characterized by two parameters: mutual cooperation (the probability of cooperating in response to cooperation) and tolerance to defection (the probability of cooperating in response to the opponent’s defection).
We find no evidence of an age effect on the probability of cooperation. However, we identify systematic gender- related differences. LLMs impersonating male individuals exhibit consistently low, near-zero levels of cooperation, whereas LLMs impersonating female individuals demonstrate a substantially higher propensity to cooperate. Moreover, for the “female” LLM agents, tolerance to defection depends significantly on the memory window size m, defined as the number of previous rounds included in the prompt. Tolerance initially increases with m, reaches a peak at m=3, and subsequently declines.
To interpret the observed effect, we propose a decision-making model in which the probability of an agent’s cooperation is determined by a function f(N_d, D_c, m), where N_d denotes the number of the opponent’s defections within the memory window, and D_c represents the distance to the most recent cooperation within that window. An analytical expression for the tolerance to defection is also derived. Numerical experiments made it possible to identify the specifications of the functional dependencies under which the constructed model qualitatively reproduces the empirical pattern, and to substantiate the accuracy of the proposed analytical estimate for the tolerance to defection.