Proceedings

Combining Code Generating Large Language Models and Self-Play to Iteratively Refine Strategies in Games

Download BibTeX Cite

Proceedings of the Thirty-Fourth International Joint Conference on Artificial Intelligence. Demo Track. Pages 10999-11003.

https://doi.org/10.24963/ijcai.2025/1249

Abstract

We propose a self-play approach to generating strategies for playing in multi-player games, where strategies are represented as computer code. We use large language models (LLMs) to generate pieces of code to play in the game, which we refer to as generated bots. We engage the LLM generated bots in competitions, designed to generate increasingly stronger strategies. We follow game theoretic principles in organizing these tournaments, and use a Policy Space Response Oracle (PSRO) approach. We start with an initial set of LLM generated bots, and continue in rounds for adding new bots into the population. Each round adds a bot to the population by asking the LLM to produce code for playing against a bot representing the Nash equilibrium mixture over the current population. Our analysis shows that even a few rounds are sufficient to produces strong bots for playing the game. Our demo shows the process for the game of Checkers. We allow users to select initial bots in the population, run the process, inspect how the bots evolve over time, and play against the generated bots.

  1. [Allis, 1994] Louis Victor Allis. Searching for solutions in games and artificial intelligence. 1994.
  2. [Alsadat and Xu, 2024] Shayan Meshkat Alsadat and Zhe Xu. Multi-agent reinforcement learning in non- cooperative stochastic games using large language models. IEEE Control Systems Letters, 2024.
  3. [Angelov et al., 2021] Plamen P Angelov, Eduardo A Soares, Richard Jiang, Nicholas I Arnold, and Peter M Atkinson. Explainable artificial intelligence: an analyti- cal review. Wiley Interdisciplinary Reviews: Data Mining and Knowledge Discovery, 11(5):e1424, 2021.
  4. [Antoniades et al., 2024] Antonis Antoniades, Albert Örwall, Kexun Zhang, Yuxi Xie, Anirudh Goyal, and William Wang. Swe-search: Enhancing software agents with monte carlo tree search and iterative refinement. arXiv preprint arXiv:2410.20285, 2024.
  5. [Aung et al., 2022] Aye Phyu Phyu Aung, Xinrun Wang, Runsheng Yu, Bo An, Senthilnath Jayavelu, and Xiaoli Li. Do-gan: A double oracle framework for generative adver- sarial networks. In Proceedings of the IEEE/CVF confer- ence on computer vision and pattern recognition, pages 11275-11284, 2022.
  6. [Bachrach and Porat, 2010] Yoram Bachrach and Ely Porat. Path disruption games. In Proceedings of the 9th Interna- tional Conference on Autonomous Agents and Multiagent Systems: volume 1-Volume 1, pages 1123-1130, 2010.
  7. [Bachrach et al., 2012] Yoram Bachrach, Reshef Meir, Michal Feldman, and Moshe Tennenholtz. Solving coop- erative reliability games. arXiv preprint arXiv:1202.3700, 2012.
  8. [Bachrach et al., 2020] Yoram Bachrach, Richard Everett, Edward Hughes, Angeliki Lazaridou, Joel Z Leibo, Marc Lanctot, Michael Johanson, Wojciech M Czarnecki, and Thore Graepel. Negotiating team formation using deep re- inforcement learning. Artificial Intelligence, 288:103356, 2020.
  9. [Bowling and Veloso, 2000] Michael Bowling and Manuela Veloso. An analysis of stochastic game theory for multia- gent reinforcement learning. Citeseer, 2000.
  10. [Brown, 1951] George W Brown. Iterative solution of games by fictitious play. Act. Anal. Prod Allocation, 13(1):374, 1951.
  11. [Browne et al., 2012] Cameron B Browne, Edward Pow- ley, Daniel Whitehouse, Simon M Lucas, Peter I Cowl- ing, Philipp Rohlfshagen, Stephen Tavener, Diego Perez, Spyridon Samothrakis, and Simon Colton. A survey of monte carlo tree search methods. IEEE Transactions on Computational Intelligence and AI in games, 4(1):1-43, 2012.
  12. [Campbell et al., 2002] Murray Campbell, A Joseph Hoane Jr, and Feng-hsiung Hsu. Deep blue. Artificial intelligence, 134(1-2):57-83, 2002.
  13. [Coulom, 2006] Rémi Coulom. Efficient selectivity and backup operators in monte-carlo tree search. In Interna- tional conference on computers and games, pages 72-83. Springer, 2006.
  14. [Fan et al., 2023] Angela Fan, Beliz Gokkaya, Mark Har- man, Mitya Lyubarskiy, Shubho Sengupta, Shin Yoo, and Jie M Zhang. Large language models for software engi- neering: Survey and open problems. In 2023 IEEE/ACM International Conference on Software Engineering: Fu- ture of Software Engineering (ICSE-FoSE), pages 31-53. IEEE, 2023.
  15. [Fan et al., 2024] Caoyun Fan, Jindou Chen, Yaohui Jin, and Hao He. Can large language models serve as rational play- ers in game theory? a systematic analysis. In Proceed- ings of the AAAI Conference on Artificial Intelligence, vol- ume 38, pages 17960-17967, 2024.
  16. [Gemp et al., 2024] Ian Gemp, Yoram Bachrach, Marc Lanctot, Roma Patel, Vibhavari Dasagi, Luke Marris, Georgios Piliouras, Siqi Liu, and Karl Tuyls. States as strings as strategies: Steering language models with game- theoretic solvers. arXiv preprint arXiv:2402.01704, 2024.
  17. [Griffith, 1974] Arnold K Griffith. A comparison and evalua- tion of three machine learning procedures as applied to the game of checkers. Artificial Intelligence, 5(2):137-148, 1974.
  18. [Guo et al., 2024] Taicheng Guo, Xiuying Chen, Yaqi Wang, Ruidi Chang, Shichao Pei, Nitesh V Chawla, Olaf Wiest, and Xiangliang Zhang. Large language model based multi-agents: A survey of progress and challenges. arXiv preprint arXiv:2402.01680, 2024. IJCAI
  19. [Hernandez-Leal et al., 2019] Pablo Hernandez-Leal, Bilal Kartal, and Matthew E Taylor. A survey and critique of multiagent deep reinforcement learning. Autonomous Agents and Multi-Agent Systems, 33(6):750-797, 2019.
  20. [Hofbauer and Sandholm, 2002] Josef Hofbauer and William H Sandholm. On the global convergence of stochastic fictitious play. Econometrica, 70(6):2265- 2294, 2002.
  21. [Hou et al., 2024] Xinyi Hou, Yanjie Zhao, Yue Liu, Zhou Yang, Kailong Wang, Li Li, Xiapu Luo, David Lo, John Grundy, and Haoyu Wang. Large language models for software engineering: A systematic literature review. ACM Transactions on Software Engineering and Methodology, 33(8):1-79, 2024.
  22. [Huang et al., 2024] Jen-tse Huang, Eric John Li, Man Ho Lam, Tian Liang, Wenxuan Wang, Youliang Yuan, Wenx- iang Jiao, Xing Wang, Zhaopeng Tu, and Michael R Lyu. How far are we on the decision-making of llms? evaluating llms' gaming ability in multi-agent environments. arXiv preprint arXiv:2403.11807, 2024.
  23. [Knauer et al., 2020] Henning Knauer, Andrea Dederichs- Koch, and Daniel Schilberg. Developing a reinforcement learning agent for the game of checkers. In Advances in Human Factors in Training, Education, and Learning Sciences: Proceedings of the AHFE 2020 Virtual Con- ference on Human Factors in Training, Education, and Learning Sciences, July 16-20, 2020, USA, pages 164- 169. Springer, 2020.
  24. [Knuth and Moore, 1975] Donald E Knuth and Ronald W Moore. An analysis of alpha-beta pruning. Artificial in- telligence, 6(4):293-326, 1975.
  25. [Lanctot et al., 2017] Marc Lanctot, Vinicius Zambaldi, Au- drunas Gruslys, Angeliki Lazaridou, Karl Tuyls, Julien Pérolat, David Silver, and Thore Graepel. A unified game- theoretic approach to multiagent reinforcement learning. Advances in neural information processing systems, 30, 2017.
  26. [Li et al., 2022] Yujia Li, David Choi, Junyoung Chung, Nate Kushman, Julian Schrittwieser, Rémi Leblond, Tom Eccles, James Keeling, Felix Gimeno, Agustin Dal Lago, et al. Competition-level code generation with alphacode. Science, 378(6624):1092-1097, 2022.
  27. [Liu et al., 2024a] Jiawei Liu, Chunqiu Steven Xia, Yuyao Wang, and Lingming Zhang. Is your code generated by chatgpt really correct? rigorous evaluation of large lan- guage models for code generation. Advances in Neural Information Processing Systems, 36, 2024.
  28. [Liu et al., 2024b] Junwei Liu, Kaixin Wang, Yixuan Chen, Xin Peng, Zhenpeng Chen, Lingming Zhang, and Yiling Lou. Large language model-based agents for software en- gineering: A survey. arXiv preprint arXiv:2409.02977, 2024.
  29. [Mańdziuk et al., 2007] Jacek Mańdziuk, Magdalena Ku- siak, and Karol Waledzik. Evolutionary-based heuristic generators for checkers and give-away checkers. Expert Systems, 24(4):189-211, 2007.
  30. [Nagarajan and Sošić, 2008] Mahesh Nagarajan and Greys Sošić. Game-theoretic analysis of cooperation among sup- ply chain agents: Review and extensions. European jour- nal of operational research, 187(3):719-745, 2008.
  31. [Nathani et al., 2025] Deepak Nathani, Lovish Madaan, Nicholas Roberts, Nikolay Bashlykov, Ajay Menon, Vin- cent Moens, Amar Budhiraja, Despoina Magka, Vladislav Vorotilov, Gaurav Chaurasia, et al. Mlgym: A new frame- work and benchmark for advancing ai research agents. arXiv preprint arXiv:2502.14499, 2025.
  32. [Perolat et al., 2022] Julien Perolat, Bart De Vylder, Daniel Hennes, Eugene Tarassov, Florian Strub, Vincent de Boer, Paul Muller, Jerome T Connor, Neil Burch, Thomas Anthony, et al. Mastering the game of stratego with model-free multiagent reinforcement learning. Science, 378(6623):990-996, 2022.
  33. [Schaeffer et al., 2007] Jonathan Schaeffer, Neil Burch, Yn- gvi Bjornsson, Akihiro Kishimoto, Martin Muller, Robert Lake, Paul Lu, and Steve Sutphen. Checkers is solved. science, 317(5844):1518-1522, 2007.
  34. [Sidji et al., 2024] Matthew Sidji, Wally Smith, and Melissa J Rogerson. Human-ai collaboration in cooper- ative games: A study of playing codenames with an llm assistant. Proceedings of the ACM on Human-Computer Interaction, 8(CHI PLAY):1-25, 2024.
  35. [Silver et al., 2018] David Silver, Thomas Hubert, Julian Schrittwieser, Ioannis Antonoglou, Matthew Lai, Arthur Guez, Marc Lanctot, Laurent Sifre, Dharshan Kumaran, Thore Graepel, et al. A general reinforcement learning algorithm that masters chess, shogi, and go through self- play. Science, 362(6419):1140-1144, 2018.
  36. [Tambe, 2011] Milind Tambe. Security and game theory: al- gorithms, deployed systems, lessons learned. Cambridge university press, 2011.
  37. [Vinyals et al., 2019] Oriol Vinyals, Igor Babuschkin, Woj- ciech M Czarnecki, Michaël Mathieu, Andrew Dudzik, Junyoung Chung, David H Choi, Richard Powell, Timo Ewalds, Petko Georgiev, et al. Grandmaster level in star- craft ii using multi-agent reinforcement learning. nature, 575(7782):350-354, 2019.
  38. [Xia et al., 2024] Chunqiu Steven Xia, Yinlin Deng, Soren Dunn, and Lingming Zhang. Agentless: Demystifying llm-based software engineering agents. arXiv preprint arXiv:2407.01489, 2024.
  39. [Yang et al., 2024] John Yang, Carlos E Jimenez, Alexander Wettig, Kilian Lieret, Shunyu Yao, Karthik Narasimhan, and Ofir Press. Swe-agent: Agent-computer interfaces enable automated software engineering. arXiv preprint arXiv:2405.15793, 2024.
  40. [Zhang et al., 2021] Kaiqing Zhang, Zhuoran Yang, and Tamer Bas ¸ar. Multi-agent reinforcement learning: A se- lective overview of theories and algorithms. Handbook of reinforcement learning and control, pages 321-384, 2021.
  41. [Zhang et al., 2024a] Ruize Zhang, Zelai Xu, Chengdong Ma, Chao Yu, Wei-Wei Tu, Shiyu Huang, Deheng Ye, Wenbo Ding, Yaodong Yang, and Yu Wang. A survey on self-play methods in reinforcement learning. arXiv preprint arXiv:2408.01072, 2024.
  42. [Zhang et al., 2024b] Yadong Zhang, Shaoguang Mao, Tao Ge, Xun Wang, Adrian de Wynter, Yan Xia, Wenshan Wu, Ting Song, Man Lan, and Furu Wei. Llm as a mastermind: A survey of strategic reasoning with large language mod- els. arXiv preprint arXiv:2404.01230, 2024.

References were extracted automatically from the PDF and may contain errors.

Welcome Future Conferences AI Journal Division IJCAI Proceedings About IJCAI IJCAI Awards