Shall We Team Up: Exploring Spontaneous Cooperation of Competing LLM Agents (2024)

Abstract: Large Language Models (LLMs) have increasingly been utilized in social simulations, where they are often guided by carefully crafted instructions to stably exhibit human-like behaviors during simulations. Nevertheless, we doubt the necessity of shaping agents’ behaviors for accurate social simulations. Instead, this paper emphasizes the importance of spontaneous phenomena, wherein agents deeply engage in contexts and make adaptive decisions without explicit directions. We explored spontaneous cooperation across three competitive scenarios and successfully simulated the gradual emergence of cooperation, findings that align closely with human behavioral data. This approach not only aids the computational social science community in bridging the gap between simulations and real-world dynamics but also offers the AI community a novel method to assess LLMs’ capability of deliberate reasoning.Our source code is available at https://github.com/wuzengqing001225/SABM_ShallWeTeamUp

## introduction llm agent in social simulation has emerged as a trending research topic with the improvement of generative ai @xcite @xcite @xcite . instead of traditional rule-based agent modeling, using llms as agents provides much more flexibility and generalizability @xcite . this in return, is also widely regarded as a verification as well as enhancement method for llm's capability on human-like deliberate reasoning @xcite @xcite . a crucial question of agent modeling is how well it mirrors real-world situations. some research has revealed llm's capability to mimic basic human behaviors or reasoning abilities @xcite figure 1 : (depicted by gpt-4o) two potential scenarios during a fire. people might panic and rush into crowds, trying to exit first (left) or may stay calm, keep in line, and encourage others (right). in this study, we explore whether llm agents can simulate the gradual transition from non-cooperative to cooperative behaviors of agents. @xcite @xcite . meanwhile, data contamination as well as value alignment may also introduce unwanted priors to let llm models be over familiar or biased with the studied problems @xcite @xcite @xcite . it potentially affects the quality of social simulations in complex, long-term scenarios where higher level of interactions, e.g. cooperation, confrontation, deception, and persuasion are jointly involved. instead, we argue that in social simulations, agents must be independent of prior assumptions, focus on the context, and actively adapt their actions based on historical interactions. we highly value the deliberate in-context reasoning capability as one of the significant components towards a human-like llm agent for real-world simulations. to properly verify such capability, we study a counter-intuitive social situation where agents can hardly use their prior knowledge for decision making. to be specific, we investigate whether cooperation can naturally develop among agents, even in a competitive environment. consider two snack companies competing for dominance in the candy market. they might continuously reduce their prices to draw in more customers or decide to simultaneously increase their prices to establish a mutually beneficial relationship. fig. 1 shows another example when agents are in a room with fire. under competitive conditions, it is not instinctive for agents to cooperate with their opponents. however, as interactions progress, they may discover the advantages of cooperation through contexts and accordingly adjust their strategies. meanwhile, we carefully design the prompts to avoid instructive descriptions (e.g. "you may cooperate") and keywords that might reveal to the agent (e.g. "price war") the specific nature of the social simulation it is conducting. in these ways, we try our best to eliminate the influence from both internal and external bias, and observe that llm agents can actively adapt their strategies to the dynamic contexts, spontaneously learning to cooperate in the wild. we select three social phenomenons that follow the aforementioned features to conduct case studies, where we capture different ways of spontaneous cooperation emerge under competitive scenarios without instructive guidance. extensive ablation studies are done to prove the significance of bias elimination, and experiments are carefully designed to ensure reproducibility. to conclude, our contributions are twofold and can serve both the ai and computational social science (css) communities: 1) we observe the spontaneous cooperation between llm agents in diverse competitive scenarios, which reflects llm's potential in longhorizon in-context learning tasks. 2) i) from the perspective of css, we reveal and stress the significance of eliminating bias in llm agents for social simulations. this largely helps to build up diverse human-like llm agents for real-world simulations. there are also well-developed platforms that support multi-agent simulation with llms, including langchain @xcite , autogen @xcite , and agent-oriented frameworks such as agentlite @xcite , agentverse @xcite , and sabm @xcite . here, we use sabm as the main framework in our case studies for its lightweight, user-friendly implementation. a primer on sabm is available in appendix f. ## spontaneous cooperation in competition we define spontaneous cooperation as cooperative behavior that arises without any explicit instructions or prompts directing the agents to cooperate. our main focus is to investigate whether agents with different or even conflicting goals can choose to cooperate based on their realization that cooperation is beneficial during the interaction. llms are generally aligned well to human values, and internally fine-tuned to be cooperative. such cooperation driven by prior knowledge or value alignment is not regarded as spontaneous cooperation in our scope. besides, we carefully design the prompts to avoid explicit instructions to shape agents' behaviors, and avoid keywords to hint the llms about the nature of the social simulation it is conducting. otherwise, it is not be regarded as spontaneous cooperation in our scope. ## discussion significance of "spontaneous" phenomena bridging the gap between the real world and synthetic simulations remains a primary objective for researchers in computational social science. this study investigates the potential for spontaneous cooperation even under competition, demonstrating that llms can simulate a gradual shift from noncooperation to cooperation without explicit guidance through prompts. we performed extensive ablation studies comparing agents with and without explicit instructions on task completion. the results suggest that our baseline, which lacks explicit instructions, aligns more closely with natural human behavior. therefore, when using specific llms (e.g., gpt-4) for social simulations, minimizing instructions could better reflect real-world situations. ## conclusion we investigated spontaneous cooperation in three case studies, and observed that llm agents can gradually develop cooperative behaviors over time without explicit instructions. the phenomenon aligns well with real-world data, which stresses the significance of eliminating prior knowledge when doing social simulation. we believe this approach not only aids the css community in bridging the gap between synthetic simulations and real-world dynamics but also offers the ai community a novel way to assess llms' deliberate reasoning.