欢迎访问《图学学报》

图学学报 ›› 2026, Vol. 47 ›› Issue (3): 511-523.DOI: 10.11996/JG.j.2095-302X.2026030511

• 图像处理与计算机视觉 • 上一篇    下一篇

LlaMario:基于大语言模型的可控马里奥关卡生成

耿钰轩1, 卢奕南1, 伍铁如2, 李文辉1,3, 马锐2()   

  1. 1 吉林大学计算机科学与技术学院吉林 长春 130012
    2 吉林大学人工智能学院吉林 长春 130012
    3 吉林动画学院吉林 长春 130013
  • 收稿日期:2025-08-15 接受日期:2026-01-21 出版日期:2026-06-30 发布日期:2026-06-30
  • 通讯作者:马锐,E-mail:ruim@jlu.edu.cn
  • 基金资助:
    国家自然科学基金(62202199)

LlaMario: controllable Mario level generation based on large language models

GENG Yuxuan1, LU Yinan1, WU Tieru2, LI Wenhui1,3, MA Rui2()   

  1. 1 College of Computer Science and Technology, Jilin University, Changchun Jilin 130012, China
    2 School of Artificial Intelligence, Jilin University, Changchun Jilin 130012, China
    3 Jilin Animation Institute, Changchun Jilin 130013, China
  • Received:2025-08-15 Accepted:2026-01-21 Published:2026-06-30 Online:2026-06-30
  • Contact: MA Rui,E-mail:ruim@jlu.edu.cn
  • Supported by:
    National Natural Science Foundation of China(62202199)

摘要:

在游戏开发过程中,程序内容生成(PCG)能够有效降低游戏开发成本,提高关卡设计的多样性。近年来,程序内容生成与机器学习的结合在游戏关卡生成方面取得了显著进展。针对现有方法在生成控制性和适应复杂设计意图方面仍存在局限性的问题,提出了LlaMario模型。通过将马里奥游戏关卡转换成字符矩阵并交由大语言模型(LLMs)训练,最终将生成的关卡字符再转换成可玩的马里奥游戏关卡。具体而言,采用LLMs Llama 3.1-8B-instruct,并结合高效语言模型微调框架Unsloth,使模型实现了更强的关卡理解与生成能力。通过构建4万条基于LLMs Gemini理解关卡数据的指令集,并采用数据高效的指令微调策略Alpaca进行关卡数据集的构建,使得经过训练后的LlaMario能够基于自然语言描述生成高可玩性的马里奥关卡。实验结果表明,在关卡逻辑合理性、可玩性、复杂性和生成质量方面表现优异,能够生成用户期望的马里奥游戏关卡。该方法框架具有通用性,可扩展至其他基于瓷砖地图的关卡生成任务。

关键词: 程序内容生成, 大语言模型, 游戏关卡生成, 指令微调, 可控关卡生成

Abstract:

In game development, Procedural Content Generation (PCG) effectively reduces development costs and enhances the diversity of level design. Recent advances in integrating PCG with machine learning have demonstrated significant progress in game level generation. However, existing methods still exhibit limitations in generation controllability and adaptability to complex design intentions. To address these limitations, the LlaMario model was proposed to convert Mario game levels into character matrices for training with Large Language Models (LLMs), and then transformed the generated symbolic sequences into playable Mario levels. Specifically, we adopted the Llama 3.1-8B-instruct model combined with the efficient language model to fine-tune the Unsloth framework, empowering the model with enhanced level comprehension and generation capabilities. An instruction set of 40 000 entries derived from the Gemini model’s comprehension of level data was constructed and employed together with the data-efficient Alpaca instruction-tuning strategy for dataset construction; the resulting LlaMario trained on this dataset generated highly playable Mario levels from natural language descriptions. Experimental results validated that the proposed model achieved exceptional performance in level logical coherence, playability, complexity, and generation quality, successfully producing user-intended Mario game levels. Furthermore, the proposed framework demonstrated generality and was extended to other tile-based level generation tasks.

Key words: procedural content generation, large language models, game level generation, instruction fine-tuning, controllable level generation

中图分类号: