arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2510.04542cs.AI
收藏

面向通用博弈的代码世界模型

Code World Models for General Game Playing

Google DeepMind(谷歌DeepMind)
Wolfgang Lehrach, Daniel Hennes, Miguel Lazaro-Gredilla, Xinghua Lou, Carter Wendelken, Zun Li, Antoine Dedieu, Jordi Grau-Moya, Marc Lanctot, Atil Iscen, John … 展开作者

Wolfgang Lehrach, Daniel Hennes, Miguel Lazaro-Gredilla, Xinghua Lou, Carter Wendelken, Zun Li, Antoine Dedieu, Jordi Grau-Moya, Marc Lanctot, Atil Iscen, John Schultz, Marcus Chiam, Ian Gemp, Piotr Zielinski, Satinder Singh, Kevin P. Murphy

AI总结:

针对大语言模型直接生成游戏走法存在非法走法多、策略浅的问题,研究提出将游戏规则转为Python代码形式的可执行世界模型,结合MCTS等规划算法,在10款游戏中9款的表现优于或持平Gemini 2.5 Pro。

摘要:

大语言模型(LLMs)的推理能力正越来越多地应用于经典棋类和卡牌游戏,但主流方法——即通过提示工程直接生成走法——存在显著缺陷。该方法依赖模型隐含且脆弱的模式匹配能力,导致频繁出现非法走法,且策略层面的博弈深度较浅。本文提出一种替代方案:我们利用LLM将自然语言形式的游戏规则和对局轨迹转换为以Python代码表示的形式化、可执行的世界模型。该生成模型包含状态转移函数、合法走法枚举函数和终止检查函数,可作为蒙特卡洛树搜索(MCTS)等高性能规划算法的可验证仿真引擎。此外,我们通过提示工程让LLM生成启发式价值函数(以提升MCTS的效率),以及推理函数(用于估计不完全信息博弈中的隐藏状态)。与直接将LLM用作策略的方法相比,我们的方法具有三大显著优势:(1)可验证性:生成的代码世界模型(CWM)可作为游戏规则的形式化规范,只要合成的模型正确,规划器就能通过算法枚举所有合法动作,避免非法走法;(2)策略深度:我们将LLM的语义理解能力与经典规划器的深度搜索能力相结合;(3)泛化性:我们引导LLM聚焦于“数据转代码”这一元任务,使其能更轻松地适配新游戏。我们在10款不同的游戏上评估了我们的智能体,其中4款是为本文全新创建的。10款游戏中有5款是完全可观测的(完美信息),5款是部分可观测的(不完全信息)。实验结果表明,在涉及的10款游戏中,我们的方法在9款游戏上的表现优于或持平于Gemini 2.5 Pro。

英文摘要:

Large Language Models (LLMs) reasoning abilities are increasingly being applied to classical board and card games, but the dominant approach -- involving prompting for direct move generation -- has significant drawbacks. It relies on the model's implicit fragile pattern-matching capabilities, leading to frequent illegal moves and strategically shallow play. Here we introduce an alternative approach: We use the LLM to translate natural language rules and game trajectories into a formal, executable world model represented as Python code. This generated model -- comprising functions for state transition, legal move enumeration, and termination checks -- serves as a verifiable simulation engine for high-performance planning algorithms like Monte Carlo tree search (MCTS). In addition, we prompt the LLM to generate heuristic value functions (to make MCTS more efficient), and inference functions (to estimate hidden states in imperfect information games). Our method offers three distinct advantages compared to directly using the LLM as a policy: (1) Verifiability: The generated CWM serves as a formal specification of the game's rules, allowing planners to algorithmically enumerate valid actions and avoid illegal moves, contingent on the correctness of the synthesized model; (2) Strategic Depth: We combine LLM semantic understanding with the deep search power of classical planners; and (3) Generalization: We direct the LLM to focus on the meta-task of data-to-code translation, enabling it to adapt to new games more easily. We evaluate our agent on 10 different games, of which 4 are novel and created for this paper. 5 of the games are fully observed (perfect information), and 5 are partially observed (imperfect information). We find that our method outperforms or matches Gemini 2.5 Pro in 9 out of the 10 considered games.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑