Narrative and Text Generation AI

Addison Eldin
University of Pittsburgh

This activity engages students in a conversation about text generation AI, namely ChatGPT, in order to prompt a deeper conversation about narrative. As an assignment, students engage with a storytelling engine based on ChatGPT, AI Dungeon. Then, in class, the instructor guides a conversation about the stories students experienced, the nature of the technology AI Dungeon relies on, and the ramifications such technology might have on what we consider to be narrative. 


Learning Goals

  • Understand how concepts from narrative theory or game studies might be applied, or change in response to, narratives that rely on generative technology.
  • Understand, in broad strokes, how generative text AI such as ChatGPT produces text in response to user input and seemingly “retains” information via transformer architecture.
  • Use understanding of generative text AI to further theorize the relationship between narrative, games, and AI.

Original Assignment Context: Narrative and Technology, a literature class that fulfills a writing general education requirement

Materials Needed: Student and instructor accounts and access to AI Dungeon via a web browser (https://beta.aidungeon.com/). Ideally, instructors would be able to project their screen and show students how to interact with AI Dungeon the class prior to this lesson, but it’s not required.

Time Frame: One class session, with out-of-class work by students leading up to the session

Overview

This activity was designed for a course called Narrative and Technology, which focuses on the impact of technology on narrative and the theory/study thereof. Throughout the term, students read narrative theory scholarship and interact with narratives from a variety of media, including print, film, television, interactive electronic literature, and video games. (That said, this activity as written here minimizes the connections to narrative theory so that it can be reworked into a wider variety of contexts.)

AI is a common part of game design, e.g. as a set of rules dictating the behavior of an enemy or ally in an action or adventure game. In these cases, the AI is embedded in a broader narrative structure. But what happens when the story itself is constructed via AI, in particular AI that operates stochastically and thus has no ground truth or explicitly designed sense of narrative structure? Students begin this conversation by interacting with AI Dungeon, a ChatGPT-driven storytelling system which users interact with similarly to the more familiar ChatGPT chatbot design.

The in-class session that this activity centers on explores students’ reactions to AI Dungeon through discussion, then shifts to a brief lecture about the underlying technology, i.e. a generative pre-trained transformer model used for text generation. After this lecture, the instructor leverages the established understanding of ChatGPT to further discuss the nature of narrative, games, and technology.

I have run this activity once, this most recent semester, and found the conversation productive for students. They were interested in AI Dungeon, not just in terms of sharing their own stories, but also describing how they poked at the edges of the technology, seeing how they could understand it or break it through play. Their ability to “play” with the technology and its storytelling enabled a deeper conversation about not just the underlying technology, but the ramifications of that technology on how we understand narrative and storytelling more broadly.


Assignment

Prior to Class

Assigned Work

[Estimate: 1 hour]

Students should create an account with AI Dungeon and "play" it for roughly one hour prior to class. This involves selecting a genre and character role, then exchanging messages back and forth with the ChatGPT-backed storytelling engine, much like one would interact with ChatGPT directly through the standard OpenAI interface.

In Class

AI Dungeon Generalities

[Estimate: 20 minutes]

Below are the questions I use to guide the initial student conversation about their interactions with AI Dungeon. I do not follow this structure strictly. Some questions might be addressed out of order based on student responses, or some might be omitted or added as appropriate. I do, however, recommend giving students plenty of time to describe their stories. Alternatively, you might break students into groups based on their chosen genres to guide conversations about how AI Dungeon represents genres, and identify similarities and differences between players' experiences.

I encourage instructors to adapt the questions to their own style of guiding in-class conversation.

  • What genre and role did you choose? How did AI Dungeon represent that genre?
  • How interesting did you find the initial premise AI Dungeon presented you with? Did you alter the text in the initial premise at all?
  • How effective was AI Dungeon at interpreting your inputs?
  • How effective was AI Dungeon at keeping track of the events, places, and characters in your story?
  • What was *your* story? What happened, and did it feel truly interactive?
  • By the time you finished playing, how cohesive did your story feel?
  • Were there any places where the cohesion of the narrative broke down? What happened?

GPT Explainer

[Estimate: 10 minutes]

This section of class is a short lecture, paired with some prompting questions for students about their knowledge of or experience with generative text AI. There are many approaches to explaining how ChatGPT works, and many explainers of the technology that you might reference (e.g. Stephen Wolfram's “What Is ChatGPT Doing ... and Why Does It Work?”). I have included below my approach to explaining the subject, which involves breaking down the G, P, and T parts of ChatGPT, after an initial question to prompt students to explain the technology in their own terms.

  • What is your understanding of how ChatGPT works?
  • Does anyone know what GPT stands for?

I choose to write each of the three terms on a whiteboard or chalkboard, so that students can follow each separate explanation. The descriptions below are purposefully simple, and I recommend giving time for students to ask questions after each part of the explanation.

Generative

Generative refers to the fact that GPT-based technology generates an output in response to user input, in this case text. Students might be familiar with other kinds of generative AI, such as Craiyon's Dall-E Mini or Midjourney. In any case, the point is that something is generated.

Pre-Trained

GPT-based technologies are pre-trained, i.e. they are trained on a dataset prior to their deployment and use. In the case of ChatGPT, it is trained on billions of web pages, including digitally available books, Wikipedia, and pages linked to from Reddit. The output, then, is based on probabilities of what words tend to follow the prior words in this dataset, meaning biases in the dataset can be replicated in the generated outputs. For ChatGPT in particular, there are stages of human intervention where outputs determined to be undesired or offensive are manually altered or prevented.

Transformer

It is worth noting that technologies such as ChatGPT do not only look at the previous word when determining the next word. This is due to the use of transformer architecture. This architecture enables the GPT model to retain the context and importance of certain words or phrases, weighting some words or phrases more than others and thus maintaining their relevance throughout the output. This explains how AI Dungeon is able to keep track of, say, characters, character roles, and places. They were not necessarily understood to be characters in a story with something like a character arc, but they were weighted as important terms to maintain in the continued production of outputs based on user inputs.

Emphasize that while GPT-based technology uses the transformer architecture to retain context and importance of certain words and phrases, it is still fundamentally a stochastic model. That is, the next word generated by the technology is still based on the probability of what words would likely follow, with those probabilities coming from relations and connections identified in the pre-training phase.

AI Dungeon, GPTs, and Narrative

[Estimate: 20 minutes]

Below are the questions I use to guide the remaining conversation about the nature of narrative, technology, and generative text AI. Again, if your course engages with the study of narrative or narrative theory, you might appeal to concepts such as story and narrative discourse, fabula and syuzhet, events and entities, etc.

  • Does anyone have any questions about how ChatGPT works in terms of the brief overview given here?
  • How does interacting with ChatGPT via AI Dungeon compare to other forms of interaction in video games?
  • How does interacting with ChatGPT via AI Dungeon compare to other video games where you make decisions about what your character does or says?
  • For anyone who has experience playing tabletop roleplaying games—such as Dungeons and Dragons where a "game master" or "dungeon master" mediates between the narrative and player decisions—how does AI Dungeon compare to that experience?
  • Does a narrative have to be pre-determined?
  • Is a game where player choices in some way dictate what happens in the story still a narrative?
  • Can a set of characters, places, and events semi-randomly strung together be a narrative?
  • If AI Dungeon has no internal sense of the meaning of what is happening, i.e. no understanding of the "story" being told, then is the result of your interaction with ChatGPT in AI Dungeon a narrative?
  • Is the dynamism of AI Dungeon exciting because it, in a sense, can produce infinite story variations? Is it similar to the possibilities presented by art generation AI?
  • Is there something lost when we remove the human element from the role of storyteller, or is this an exciting new possibility?

Acknowledgements

I first wrote about this assignment, in broad strokes, for Exploring with AI: A Community Collection of Teaching Reflections, which is hosted on Humanities Commons and was sourced by the MLA-CCCC Joint Task Force on AI and Writing. You can find that reflection here:

https://exploringaipedagogy.hcommons.org/2023/11/13/narrative-and-text-generation-ai/