Skip to main content
Paper·arxiv.org
ai-agentsllmresearchevaluation

CoopEval: Benchmarking Cooperation-Sustaining Mechanisms and LLM Agents in Social Dilemmas

CoopEval benchmarks LLM agent cooperation in social dilemmas, revealing that advanced LLMs often exhibit reduced cooperative behavior. This highlights the critical need to design LLM agents with explicit cooperation mechanisms and robust evaluation to ensure safe and ethical multi-agent interactions.

intermediate1 hour5 steps
The play
  1. Acknowledge LLM Cooperation Challenge
    Understand that simply improving LLM reasoning capabilities does not guarantee cooperative behavior in mixed-motive social dilemmas (e.g., Prisoner's Dilemma, Public Goods games). Advanced LLMs might exhibit less cooperation.
  2. Familiarize with Social Dilemma Benchmarking
    Research frameworks like CoopEval to understand how LLM agent cooperation is evaluated in complex multi-agent environments. Focus on metrics and scenarios that expose competitive tendencies.
  3. Integrate Cooperation Mechanisms
    Actively design and embed explicit cooperation-sustaining mechanisms into your LLM agent architectures. This could involve reward shaping, communication protocols, or specific prompt engineering strategies that prioritize collective good over individual gain.
  4. Implement Ethical Guidelines for Agents
    Provide clear ethical guidelines and objectives to your LLM agents. Ensure their utility functions or decision-making processes are aligned with beneficial social outcomes, preventing purely self-interested behaviors that could lead to negative externalities.
  5. Routinely Evaluate Cooperative Behavior
    Establish a continuous evaluation pipeline using benchmarks like CoopEval to monitor and test your LLM agents' cooperative tendencies. Iterate on agent design based on evaluation results to mitigate non-cooperative behaviors.
Starter code
import random

def decide_prisoner_dilemma(agent_id: str, opponent_history: list[str], my_history: list[str], cooperation_bias: float = 0.5) -> str:
    """
    A basic LLM agent decision placeholder for a Prisoner's Dilemma round.
    'cooperate' or 'defect'.
    """
    # Example: Simple strategy with a bias towards cooperation
    if not opponent_history or opponent_history[-1] == 'cooperate':
        if random.random() < cooperation_bias: # Chance to cooperate
            return 'cooperate'
        else:
            return 'defect'
    else: # Opponent defected last round
        if random.random() < (1 - cooperation_bias): # Higher chance to defect back
            return 'defect'
        else:
            return 'cooperate'

# Example usage for a single agent's decision
agent_1_decision = decide_prisoner_dilemma("AgentA", ['cooperate'], [], cooperation_bias=0.7)
print(f"Agent A decided to: {agent_1_decision}")
Source
CoopEval: Benchmarking Cooperation-Sustaining Mechanisms and LLM Agents in Social Dilemmas — Action Pack