AI Dungeon Welcome Screen

Using GPT-2 as a continuous writing prompt generator via AI Dungeon

OpenAI has released an API for accessing GPT-3, an AI text generator that’s capable of generating much longer responses than GPT-2. The API is currently in closed beta, and while I’ve requested access, I haven’t gotten it (yet?) But, I learned from Mario Dian’s blog about AI Dungeon, a text-based dungeon game powered by GPT-2 and/or GPT-3. Imagine a text-based adventure game, like Zork–that’s the feel of AI Dungeon, but instead of being programmed behind the scenes by something like ChoiceScript, it’s using GPT-2 (free version) or GPT-3 (paid version) to generate text.

I’m interested in exploring GPT-2 and GPT-3 for fiction generation, so I gave the free version of AI Dungeon a try as I was working on a short piece of flash fiction. I didn’t want AI Dungeon to write a story for me, or even to write parts of a story. I wanted to use it as a tool to spur my own creativity.

Getting Started

In AI Dungeon’s single-player mode, you have a choice of settings such as fantasy, mystery, zombies, etc; choosing “other” lets you prime the AI with a setting of your own. I wanted to work on a retelling of the Black Airts folktale, which is set in an eeevil school of eeevil magic, so I chose “other”.

I started by saving a few details in the “What should the AI remember” section. Then I primed AI Dungeon with this text:

You are a student in the school under the mountain. You haven’t seen the sun since the day seven years ago you passed through the school’s doors. You’ve long since washed away the blood you shed to open those doors: not washed clean, but washed away by the blood of a hundred other rites, each worse than the last.

The AI came back with several lines I didn’t like. I kept pressing “try again” until it generated this line:

The Devil has always been with you. He is your teacher and your master. The only thing that separates you from him is time… and death.

I really liked this! I hadn’t planned to put the Devil in the teacher’s role, but this idea worked so well that I went with it. This turned out to be the only line the AI generated that I would accept “as is” for the draft. (I should mention that while I kept the idea of the Devil as a teacher/master, the actual line didn’t make it into the final version of the story. There’s no AI-generated text in the final story; it is 100% human-written.)

I sent this to the engine next:

Each day begins with a sumptuous feast, if you can conjure it from the worms and scorpions that appear on your plate. The youngest students often go hungry. The weakest become your sacrifices.

After hitting reload a few times, AI Dungeon came out with:

Your days pass in a cycle of sacrifice, ritual, and ecstasy.

Not bad. I took the idea as a starting point and drafted this:

Your days pass in a cycle of ritual and sacrifice. You learn, and you fight to be the one that wields the Black Arts, not the one they are wielded against. Always the enchanter, never the sacrifice.

But this morning, your plate is empty.

A quick glance around you shows that your fellow seniors’ plates are bare as well. There are only seven of you who have made it this far. Seven enchanters. You don’t wish to count the sacrifices.

This was a good example of the AI acting as a spur for my own creativity. “Ecstasy” didn’t fit the story, but I liked the emphasis on ritual–which the AI came up with by itself, based on a setting that included “sacrifice” and “rite” but not “ritual”.

The next few texts the AI generated were less on-point. I wound up combining two different generated texts to make the next section. This was the rule for the rest of the story. For example, AI Dungeon suggested these two texts:

There is a mad scramble for the door. The last student desperate to be the first to reach the open air.


You lunge for the exit. Your friends scramble after you, but it is too late. The Devil swivels around, and his fingers close around the last student’s throat.

and I used these suggestions to draft this paragraph:

There is a mad scramble for the door. Each new enchanter is desperate to be the first to reach the world above. You lunge for the exit with the rest, but too slowly. The Devil swivels around, and his fingers close on your shoulder.

The ending of the story required a change in tense, and AI Dungeon can only really handle second-person present, so I had to abandon AI Dungeon to draft the ending I wanted.

Conclusion: AI Dungeon as continuous writing prompt generator

I essentially used AI Dungeon’s free mode to help the words come. The generated text was mostly a little off from where I wanted to go with the story, but that worked well for me. Reading something that’s not quite right focused me on what would be right, and helped the words flow.

It felt very much like using a fiction prompt generator, where you keep pressing “refresh” until you find a prompt that sparks something–except in this case, the prompts were useful at the paragraph level, not just the story level, and were more-or-less informed by the earlier part of the story.

As a result, I wrote a 600-word draft in about half the time it would usually take me, with much less frustration.

Important Note: A story draft is very different from a story! The final story, which is 50% longer, is 100% human-written, incorporates suggestions from my fellow human writers, and is overall a different story from the draft I first wrote using AI Dungeon as a prompt generator.

I’m pretty pleased with how the story draft came out. AI Dungeon’s free, GPT-2 engine (“Griffin”) was a good writing tool for me in this specific situation. Some of the specifics that made this work:

  • I knew the story I wanted to tell.
  • I picked a setting from folkloric tradition, and AI Dungeon was able to pick up on elements that go with that setting without being told, like “ritual”.
  • I wanted to tell a very short, one-scene story, with few characters.
  • I wanted to tell it in 2nd person present (as AI Dungeon suggests, it works best in this mode).

Next up: Dragons?

I’d like to try GPT-3 for text generation. I’m on the waitlist for the GPT-3 beta, but failing that I could try AI Dungeon’s paid mode, which uses GPT-3 (their “Dragon” model).

Afterthoughts: Who owns the draft that I wrote with AI Dungeon’s help?

I only wound up using a few sentences generated by the software in my draft; I used the AI-generated text as starting points, prompts that I riffed off and rewrote.

To be clear, there is no AI-generated text in the finished story, which is 100% my writing. But what if I’d let AI Dungeon write an entire story for me, after giving it an intial paragraph? Who would own the rights to that story? I’m utterly unqualified to answer this question, but as best as I can tell, it depends on your country.

Katharine Stephens, a partner at the UK firm of <a href=”>Bird & Bird, says, “In most countries, if no human author can be identified for the work, no copyright will subsist in it and therefore it will fall into the public domain,” but in the UK, computer-generated works for which there is no human author are considered to have been written by the person “by whom the arrangements necessary for the creation of the work are undertaken.” The answer seems much less clear-cut for the US and Canada.

2024 Update

Coming back to this blog post in 2024, it still seems like nobody owns the copyright to AI-generated stuff, but there are other important copyright issues I wasn’t aware of when I wrote this post in 2020: we now know that Open AI used copyrighted texts without permission to train its GPT-3 and above models, and we’ve learned that those texts are stored in the models and can occasionally be regurgitated. A tool whose 2020 iteration was a fun writing prompt generator has been developed into a wholesale plagiarism machine. I have a lot of problems with that. I enjoyed experimenting with the early version, but other than the 2020 experiment detailed in this post, I don’t use GPT in my writing.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.