MarioGPT: Open-Ended Text2Level Generation through Large Language Models

Procedural Content Generation (PCG) is a technique to generate complex and diverse environments in an automated way. However, while generating content with PCG methods is often straightforward, generating meaningful content that reflects specific intentions and constraints remains challenging. Furthermore, many PCG algorithms lack the ability to generate content in an open-ended manner. Recently, Large Language Models (LLMs) have shown to be incredibly effective in many diverse domains. These trained LLMs can be fine-tuned, re-using information and accelerating training for new tasks. Here, we introduce MarioGPT, a fine-tuned GPT2 model trained to generate tile-based game levels, in our case Super Mario Bros levels. MarioGPT can not only generate diverse levels, but can be text-prompted for controllable level generation, addressing one of the key challenges of current PCG techniques. As far as we know, MarioGPT is the first text-to-level model and combined with novelty search it enables the generation of diverse levels with varying play-style dynamics (i.e. player paths) and the open-ended discovery of an increasingly diverse range of content. Code available at https://github.com/shyamsn97/mario-gpt.

Paper

References (52)

Scroll for more · 38 remaining

Similar papers

Peer review

Reviewer an9Y6/10 · confidence 4/52023-07-04

Summary

This paper proposes MarioGPT with novelty search, a method that can generate new Super Mario Bros levels. MarioGPT is finetuned from GPT-2 to generate levels. The novelty search is used to get novel levels by randomly selecting a generated level, mutating it, and then filtering it based on a novelty criterion: the mean distance between the mutated level and the K closest elements from the existing levels (K-means). Experimental results show that MarioGPT has a better level of reconstruction accuracy than LSTM, and 88.33% of the generated levels can be played by Robin Baumgarten’s A* agent.

Strengths

1. The idea of generating Super Mario Bros levels is interesting and might be helpful for both the reinforcement learning community and the game community. 2. The result shows that the finetuned GPT has the ability to generate decent Super Mario Bros levels, which is insightful.

Weaknesses

1. The evaluation criteria do not seem to be appropriate. For example, "playable by an A* agent" is not a convincing indicator that can measure the quality of generated levels. Actually, "playable by an A* agent" primarily measures the simplicity of the generated levels rather than the quality of the levels. Moreover, in section 4.4, "Guided Level Generation via Prompting", the "empirical evaluation" is not objective, and lacks baseline (like LSTM) comparisons. Since this paper claims that the generated levels are text-controllable, it would be better to provide a more explicit demonstration of controllability. 2. The baseline (LSTM) in section 4.1 is weak. Table 1 shows that the pre-trained GPT-2 is very important in the generation process. Then, how does a GPT-2 without finetune perform? How does GPT-3/3.5/4 perform? Also, I doubt the conclusion that LSTM is not promptable since it can be integrated with a text encoder. 3. Although the idea is interesting, the generated levels are simple. 88.33% of the generated levels can be played by an A* agent, and only horizontal movements are included (Mario cannot crawl into the pipes and there is no hidden brick, making the generated levels even simpler than traditional Super Mario Level 1-1). This greatly reduces the significance of this work, both in the fields of artificial intelligence and gaming industry.

Questions

1. How to control detailed level settings like the initial moving direction of the enemy? 2. Can MarioGPT be tuned on Super Mario Makers which consists of thousands of novel levels contributed by the gaming community? 3. Why do from-scratch-MarioGPT and adapter-MarioGPT perform worse than LSTM? 4. Mario GPT generates trajectories as well as game contexts. What about generating trajectories first, then selecting a trajectory and keeping it unchanged, and then generating, mutating, and filtering the game contexts? Will this improve the “playable rate” of the generated games?

Rating

6: Weak Accept: Technically solid, moderate-to-high impact paper, with no major concerns with respect to evaluation, resources, reproducibility, ethical considerations.

Confidence

4: You are confident in your assessment, but not absolutely certain. It is unlikely, but not impossible, that you did not understand some parts of the submission or that you are unfamiliar with some pieces of related work.

Soundness

3 good

Presentation

3 good

Contribution

2 fair

Limitations

See above questions.

Reviewer an9Y2023-08-18

Thanks for the rebuttal

Thanks for the rebuttal and response to my questions. Most of my concerns have been addressed, especially the comparison baselines. I will raise my score to 6.

Reviewer aEvk6/10 · confidence 4/52023-07-05

Summary

This paper proposes a novel idea of using LLMs to perform Procedural Content Generation. It addresses several challenges including the diversity of the generated environments, the existence of a feasible solution (playability) and generating with language guidance. It proposes two key algorithms. 1. MarioGPT - Fine-tuning on DistilGPT2 so that it can predict the next slice of the game. It also allows prompting - the text conditioning is done by using BART to encode text prompts then feeding the average hidden states into the cross attention. 2. Novelty search for open-endedness - Using MarioGPT as a mutation operator in the novelty search evolutionary loop, prompting the MarioGPT with random prompts and generate candidates, and retain the candidates that pass the novelty criteria to add to the archive. Then do masked token prediction (impainting) to ensure that the level generated has a feasible path solution. This paper conducts experiments that demonstrate (1) the high token prediction accuracy of MarioGPT, (2) good playability - i.e. most generated levels have feasible path solutions, (3) using a suitable temperature to control the trade-off between diversity and quality, (4) the accuracy in following the prompt and (5) the diversity of generated levels (in terms of the predicted path) achieved by novelty search.

Strengths

1. This paper proposes a novel framework for text-guided PCG: having a text-conditioning, generative model that predicts new levels, then having a novelty search algorithm reject the levels that are too similar to existing ones. 1. This paper is written clearly. The methods are well motivated. The experiments are well-designed with detailed analysis and discussion.

Weaknesses

1. Experiments are lacking in measuring “controllability”. The prompts are limited to a small set. The capability of following instructions on a more semantic level are not measured, such as the scene layout. and the spatial, functional, and semantic relationships between objects. (e.g. how tall the pipes are, “there is an enemy to the right of a pipe”). 2. The technique of first auto-regressively generating a scene, then using “inpainting” to ensure a feasible solution seems to be pretty tied to this specific type of games where the scene moves linearly in 1 dimension (i.e. the character can only move forward, not backward), and hard to generalize to other PGC scenarios. For example, in order to generalize to the cases where the character can move both forward and backward, non-trivial changes are needed.

Questions

1. In section 4.4 "Guided Level Generation via Prompting", under what sampling temperature are these results measured? I am curious how / whether this randomness affects how accurately the model follows the prompts as well. The authors mentioned that randomness helps with diversity - does this sacrifice accuracy of following prompts? 2. On a relevant note, in section 4.3 the authors mentioned that the temperature controls the tradeoff between diversity and quality. Could you elaborate what the definition of "quality" is? 3. In section 4.5, at what point does the “diversity” start to plateau? Are there baseline studies regarding the diversity of generated paths? 4. In section 4.2, are there quantitative baselines regarding the playability of generated environments? Could you share intuition regarding the trade-offs between playability versus diversity of the generated environments?

Rating

6: Weak Accept: Technically solid, moderate-to-high impact paper, with no major concerns with respect to evaluation, resources, reproducibility, ethical considerations.

Confidence

4: You are confident in your assessment, but not absolutely certain. It is unlikely, but not impossible, that you did not understand some parts of the submission or that you are unfamiliar with some pieces of related work.

Soundness

3 good

Presentation

4 excellent

Contribution

3 good

Limitations

As mentioned above, (1) the measurement of capability to understand the instructions semantically and (2) the generalizability of this approach beyond this type of games remains to be further studied.

Reviewer wPh97/10 · confidence 3/52023-07-07

Summary

In this work the authors fine tune a DistilGPT2 model to produce diverse, largely playable Mario levels. They incorporate a novelty search to favor diversity in levels, and also explore conditioning level generation on natural language user prompts. Their novelty search proceeds as follows: Given an initial set of levels, a level is sampled from the set and randomly mutated. The mutation involves deleting a random contiguous segment of the level and sampling a new one in its place from their model, then using a fine tuned BERT model to do inpainting on the border regions to smooth the transition between this and the rest of the level. The mutated level is accepted if it is sufficiently different from the other levels, using a distance metric comparing the player path through the level.

Strengths

- The use of LLMs for game level generation certainly makes sense, and I think it's valuable to publish work in this area for the NeurIPS community to see and build on. The technical approach taken here is original, to my knowledge. - The combination of genetic algorithms with LLMs is interesting and novel, and I found the use of BERT for inpainting to smooth out the transition between the mutated segment and the rest of the level to be a particular clever approach. - The paper also does a great job of visualizing the levels produced by the model which is very helpful in getting a feel for the sorts of outputs that their model produces. The playability and temperature analyses were quite interesting as well.

Weaknesses

- Section 4.5: It's hard to tell that the novelty search is actually helping, without a comparison to an ablated version that doesn't do the novelty search. In particular it's hard to tell if the darker points in Figure 9 seem to be filling in the space in between because of the novelty search, or if it's just that there are more sampled points so they happen to fill in some of the space in between the earlier points. Likewise with the rightmost graphs in figure 7 looking denser than the leftmost ones – taking more samples will always add some density, so in order to really conclude something you need a comparison to an ablation. Showing something like 300 levels from the novelty search plotted on the same tSNE as 300 levels from a version without novelty search (eg as a different color) would make it much clearer that there's actually an improvement in diversity (and likewise some analogous experiment for the other figure). * In a similar vein, in Table 3 it's hard to know how much the prompt is helping without seeing the scores without prompting (for an idea of what scores a fairly random approach would achieve); though I think is a less major issue. * After seeing the LSTM from prior work used in the Table 1 comparison, I was surprised that LSTM comparisons weren't given for any of the future evaluations, which would be helpful for understanding how much better this LLM setup is than prior work. For example, we learn that 88% of levels are solvable, but how does this compare to the LSTM approach? Likewise in the diversity analysis, a naive LSTM baseline would be interesting (but no need for all the novelty search machinery). This would just help me get a sense of where this work stands compared to prior work on these metrics that are being measured. That said, I wouldn't reject this paper on that basis – 88% playable is a great statistic regardless of what you compare it to, and I don't actually expect that the LSTM would make particularly good levels, but having the full comparison would strengthen the evaluation. - As a last, minor point, It's surprising (in a way that makes me feel that an explanation is needed) that such poor performance is obtained by from-scratch-MarioGPT on the tile prediction task given it was trained on 200,000 datapoints. The "tile accuracy" is presumably a measure of how well the system does next-tile prediction (analogous to next-token prediction in language modeling, and presumably this is the objective that all these models are trained on). I'd imagine something as simple as "always predict an air tile" since most levels look like they're more than half air, or "predict the same tile that you saw to the left" would do quite well, and the inability to pick up on even simple trends like this after 200,000 datapoints is surprising to me. Perhaps there is additional complexity I'm missing? Overall, this is an interesting paper that I end up borderline reject on because of the evaluation points mentioned above, but I don't have a huge amount of prior experience in this area or what typical evaluations are for PCG, so I am open to revising through discussion.

Questions

* Relating to the weakness point above, in Table 1 I'm a little surprised that everything except MarioGPT does so poorly (LSTM does okay at least though). It'd be helpful to have a little intuition for why this is so hard? - The concurrent work cited by this paper (Todd et al 2023) finds that pretraining (vs from-scratch) GPT2 has little to no impact on a range of metrics. That is of course a somewhat different task and setup, but I'm curious if you have thoughts on why you seem to find the opposite result in this domain? - What embedding is used for the tSNE? Is it something like the last layer of MarioGPT? - Do you guarantee that each tile is parsed as a separate token? Without this it seems like the network could potentially get confused about reasoning about lengths/distances, like if one token represented two blocks while another represented just one. Seems like it works either way, but I'm curious if this is something you're doing or might look at. - The language conditioning is cool! Of course, a natural extension of this would be moving towards level generation from more unstructured natural language. For example, flexibility with synonyms to "many" or more complex things like "a series of narrow pillars with an enemy on top of each one". That sounds like enough for a separate paper but I'm personally curious if you've done any preliminary work in that direction or what you think of it. To be clear, I don't think this is needed in this submission I just think that the work is cool and am curious!

Rating

7: Accept: Technically solid paper, with high impact on at least one sub-area, or moderate-to-high impact on more than one areas, with good-to-excellent evaluation, resources, reproducibility, and no unaddressed ethical considerations.

Confidence

3: You are fairly confident in your assessment. It is possible that you did not understand some parts of the submission or that you are unfamiliar with some pieces of related work. Math/other details were not carefully checked.

Soundness

3 good

Presentation

3 good

Contribution

3 good

Limitations

I think that this paper does an adequate job of presenting its limitations.

Reviewer 6gGD7/10 · confidence 3/52023-07-07

Summary

This submission proposes MarioGPT, which aims to generate diverse-and-playable Mario levels with LLM (GPT-2) through language prompts. The input and output of MarioGPT are level representations, not natural language. Human prompts are involved by incorporating the cross-attention layer into the LLM. A Novelty Search algorithm is further proposed to increase the diversity of generated levels.

Strengths

+ Leveraging LLM into Procedural Content Generation (PCG) is a natural idea. This submission successfully accomplishes this, and the proposed MarioGPT could be really usable. + This submission conducts a comprehensive study of various aspects of the proposed method, including the tile/path prediction accuracy, the playability of generated levels, whether MarioGPT is memorizing the training dataset, guidability by prompts. The overall experimental parts are convincing. The authors also analyze some current limitations and provide feasible solutions to them. + The proposed Novelty Search algorithm successfully improves the diversity of agent paths.

Weaknesses

- Overall, I think Procedural Content Generation (PCG) with LLM is 'quite' an obvious idea, making me doubt this submission's 'technical' contribution to the community. I did not see any other obvious weaknesses.

Questions

1. In the field of PCG, is there any game other than Super Mario? What is the generalization ability of the proposed method to other games (if there is any)?

Rating

7: Accept: Technically solid paper, with high impact on at least one sub-area, or moderate-to-high impact on more than one areas, with good-to-excellent evaluation, resources, reproducibility, and no unaddressed ethical considerations.

Confidence

3: You are fairly confident in your assessment. It is possible that you did not understand some parts of the submission or that you are unfamiliar with some pieces of related work. Math/other details were not carefully checked.

Soundness

3 good

Presentation

4 excellent

Contribution

3 good

Limitations

Same as in the Questions part.

Reviewer wPh92023-08-16

Changed Rating

Thank you for the extensive response and additional experiments/visualizations, I really appreciate this rebuttal. The addition of the first and third figures in the PDF that the authors attached make me much more convinced of the impact of the text conditioning and the novelty search. The additional baseline of LSTMs on the solvability objective is also helpful. My primary concerns in my initial review were around the soundness/thoroughness of the evaluation (baselines and ablations) and I feel the authors have dramatically improved that aspect of the paper, in addition to addressing my other thoughts. I believe that this would be a valuable paper for a NeurIPS audience, and have adjusted my rating to recommend Accept.

Authorsrebuttal2023-08-17

We hope we were able to address the concerns of Reviewer an9Y? We believe we addressed the main criticism of (1) using A* as an evaluation metric, and (2) evaluating against other baselines. If there are any other questions or issues, please let us know.

Reviewer 6gGD2023-08-20

Official Comments by Reviewer 6gGD

I appreciate the rebuttal, and the paper has addressed my questions and concerns. I will keep my rating 7 and hope the final version can contribute to the development of the field.

Reviewer aEvk2023-08-22

Change contribution from Fair to Good

Thank you for the rebuttal and detailed, helpful responses to my questions. I am keeping the rating, and raising the contribution from 2.Fair to 3.Good, because the added LSTM baseline highlighted your new models' capabilities of generating playable levels. I look forward to your future work on controlling the generated environment with more sophisticated prompts. Thank you again! :)

Program Chairsdecision2023-09-21

Decision

Accept (poster)

© 2026 NYSGPT2525 LLC