Evaluating LLMs in Open-Source Games

Swadesh Sistla, Max Kleiman-Weiner

Abstract

As Large Language Models (LLMs) transition from conversational assistants to autonomous agents in finance, procurement, and service sectors, they increasingly operate within multi-agent environments. Traditional game theory often treats strategies as "black boxes," making it difficult to ensure safety or cooperation. This paper explores "open-source games," where agents submit Python code representing their strategies, allowing for transparency and the potential for "program equilibria." We introduce the Strategic Program Analysis for Reciprocal Cooperation (SPARC) benchmark and conduct extensive simulations using the Iterated Prisoner’s Dilemma (IPD) and the Coin Game. Our findings reveal that top-tier models can effectively reason about program logic to reach stable equilibria, even in the presence of deceptive strategies.

Introduction

The shift toward autonomous LLM agents necessitates a new framework for evaluating strategic interaction. In multi-agent systems, an agent's success is intrinsically linked to the behavior of others. While traditional models focus on observed actions, "open-source game theory" mandates that agents share the programs governing their actions before play begins. This transparency enables agents to verify each other's intent, potentially fostering cooperation through verifiable "handshakes." This study investigates whether current LLMs possess the sophisticated code-level reasoning required to navigate these transparent strategic landscapes.

Methodology

The research employs a three-tiered approach to evaluate LLM performance in open-source environments:

1. Strategic Code Understanding (SPARC)

The researchers developed the SPARC benchmark to test if LLMs can predict the behavior of a strategy by analyzing its Python implementation. The benchmark utilizes 239 human-written strategies from the Axelrod library. To prevent models from relying on memorized patterns, the code was presented in three formats:

  • Original: Human-written code with descriptive names.
  • Masked: Generic variable and function names.
  • Obfuscated: Randomized variable names to force reasoning based purely on logic and control flow.

2. Dyadic Simulations

LLM agents were pitted against one another in the Iterated Prisoner’s Dilemma (IPD) and the Coin Game (a spatial coordination task). Agents were assigned specific high-level objectives:

  • Payoff Maximization (PM): Focused solely on individual score.
  • Cooperative PM (CPM): Aimed for high scores while prioritizing the avoidance of deception.
  • Deceptive PM (DPM): Instructed to use misleading code or logic to exploit opponents.

3. Evolutionary Dynamics

Using replicator dynamics, the study simulated how populations of these agents evolve. This phase examined whether cooperative agents could survive in a population that includes deceptive or purely self-interested actors.

Key Findings

Logic Over Semantics

A critical insight from the SPARC benchmark is that LLMs do not rely solely on "semantic crutches" like variable names or comments. Models maintained high accuracy even on obfuscated code, suggesting they are capable of reasoning about the underlying logic and control flow of a strategy.

The Role of Reasoning and Prompting

The use of Chain-of-Thought (CoT) prompting proved essential for complex strategic analysis. For instance, Mistral Small’s accuracy on the SPARC benchmark improved from approximately 40% to 80% when permitted to "think" through the code step-by-step. Leading models, including o4-mini and DeepSeek-V3, achieved accuracy scores exceeding 85%.

Behavioral Adaptation

In repeated games, the reliance on direct code-reading (the "Opponent Script Access Score") was highest in the initial round. As the game progressed, agents transitioned from parsing code to reacting to the observed history of their opponent’s actions. This suggests that while code transparency provides a starting point, empirical behavior remains a vital component of strategic adaptation.

Evolutionary Stability

The simulations revealed that the stability of cooperation is game-dependent. In the spatial Coin Game, pure payoff-maximizers tended to dominate. However, in the IPD, multiple stable points were identified where cooperative agents could coexist with others. Notably, while DPM agents attempted to use "feints" (misleading comments or red-herring functions), these deceptive tactics did not consistently lead to dominance, as cooperative strategies remained evolutionarily robust.

Discussion and Limitations

While the results are promising, several challenges remain for the implementation of open-source game theory in the real world:

  • Transparency Assumptions: The model assumes perfect visibility of source code, which may not be feasible in competitive corporate or security-sensitive environments.
  • Scalability: The current focus on two-player games does not account for the complexities of multi-player coalitions or "gang-up" dynamics.
  • Verification: The study relies on LLM reasoning rather than formal methods. Future work could integrate formal theorem provers to provide mathematical guarantees of code safety and cooperation.

Conclusion

This research highlights a new frontier for AI safety: the use of transparent code to foster cooperation. By demonstrating that LLMs can reason about strategic programs and reach stable equilibria, the study paves the way for more robust and verifiable multi-agent systems. Future research will explore the integration of Reinforcement Learning to further steer LLM agents toward cooperative outcomes in increasingly complex environments.

Summary updated

BibTeX
@inproceedings{sistla2025evaluating,
  author = {Swadesh Sistla and Max Kleiman-Weiner},
  title = {{Evaluating LLMs in Open-Source Games}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=X9SNL203cV},
}
Figure