Meet MarioGPT, the artificial intelligence that generates infinite levels of Super Mario Bros

Researchers from the University of Copenhagen, in Denmark, have developed a method to generate infinite levels of Super Mario Bros., the classic Nintendo video game, using GPT-2, the system that makes use of artificial intelligence (AI) to generate texts : They have called it Mario GPT.

According to a report published on the website of beta genethe creators just told the AI ​​how to generate the infinite level with a method for it to understand some commands described in natural language.

Shyam Sudhakaran, lead author of Mario GPT, spoke about it with TechCrunch: “Honestly, we chose the smallest one to see if it would work. I think that with small data sets in general, GPT2 is more suitable than GPT3, as well as being much lighter and easier to train. However, in the future, with larger data sets and more complicated prompts, we may need to use a more sophisticated model like GPT3.”

What did the experts do to make it work?

While this is a complete language model, it cannot by itself generate Super Mario levels, so the team had to train it. They rendered a number of them to text, transforming the Super Mario level into something akin to copy-paste in ASCII, the character code based on the Latin alphabet.


After representing the level in alphanumeric characters, the language model easily interpreted it. Once the model understood the patterns, it was able to reproduce them to create the level.

Finally, the model symbolizes the path with an X, which confirms that the level is playable and can be completed. The study recorded that out of 250 levels generated, the system could complete the level 9 out of 10 times.

The training also allowed them to tell the AI ​​how many pipes, enemies, or blocks the developers wanted in the level.


For now, the system only has one representation for the keyword “enemy”, so it does not allow you to specify the type of rivals, whether they are Goombas, Koopas, among others. You also can’t spawn water levels, but these limitations will likely be fixed soon.