Sunday, January 8, 2023

The structuralist aesthetics of ChatGPT

In my earlier post, ChatGPT, stories, and ring-composition, I’d reached a point where I introduced a parenthetical remark: “Lévi-Strauss would love that.” This post explains that remark and elaborates on it.

The following table summarizes key features of the three of the six stories in that post. Hero-1 is a story my friend Rich Fritzon elicited from ChatGPT; the others are stories I elicited from it. I elicited Hero-2 and Hero-3 using the same prompt that Rich did. (In this post we will ignore stories 4, 5, and 6, which I use to make a point about the elaboration of a single story. This post is about the coherence, the aesthetic coherence if you will, of individual stories.)

That parenthetical remark was about a comparison between Hero-1 and Hero-3. In both stories a dragon attacks the village. In Hero-1 a male protagonist uses his martial skills (sword and shield) to slay the evil dragon while in Hero-3 a female protagonist uses her singing ability to calm the dragon. Those triplets exhibit an internal consistency that seems derived from certain conventional conceptions of gender, conventions that precede the era in popular culture that’s given us Buffy the Vampire Slayer, Katniss Everdeen, Xena, Wonder Woman, and others.

Hero-2 seems intermediate between those two. We have a male protagonist characterized as kind-hearted. His village isn’t invaded by a dragon. Rather, he befriends an abandoned dog; the (evil) mayor then ordered that the dog be put in the pound. Consequently Timmy got together with his friends and they built a secret shelter for the dog. There is an internal coherence about these story features that seems similar with the coherence in the other two stories. That coherence would be violated if, for example, kind-hearted Timmy had drawn his sword and killed the mayor in order to protect the dog. But then, if Aurora had slain the dragon with a sharp knife, that would violate this internal consistency as well.

Lévi-Strauss on myth

It is this kind of internal consistency that Lévi-Strauss investigated in The Raw and the Cooked, and the other three volumes in his magnum opus, Mythologiques. He started with one myth, analyzed it, and then introduced another one, very much like the first. But not quite. They are systematically different. He characterized the difference by a transformation. He worked his way through hundreds of myths in this manner, each one derived from another by a transformation.

As a rhetorical technique, this worked. Sort of. For it seemed to imply that all the other myths were somehow derived from that first myth, which he called the key myth, even as he also said that there was nothing special about this so-called key myth. It’s just where he chose to start his investigation. He knew that somehow each and every myth was constructed under some constraint that governed relationships among its components, but he had no direct way of making that argument. So he made it indirectly by showing how one myth was systematically derived from another through a specific transformation.

What he was missing, I have argued in a working paper, Beyond Lévi-Strauss on Myth: Objectification, Computation, and Cognition, was a way to think about computation, something I explain in the section, “Free Play and Computational Constraint,” where I use Margaret Masterman’s pioneering work on computer-generated haiku as an example of computation. Lévi-Strauss did that work in the 1960s. We now have computational technology that didn’t exist at that time. I am going to use some of that technology, in the ‘person’ of ChatGPT, to create a toy model of the process Lévi-Strauss was trying to describe.

ChatGPT as story engine

The internal consistency I’m talking about is somehow inherent in the structure of the artificial neural network that is at the heart of ChatGPT. As you know, that ANN was created when GPT consumed, that is to say, trained on, a very large corpus of texts scraped from the internet. I think that we can safely assume that the training corpus contained many stories, some better than others, and a very few excellent ones. It’s story grammar, to use a term popular in the 1970s and 1980s era of symbolic AI, is thus derived from human examples.

In the rest of my examples I am going give ChatGPT a prompt that consisting of two things: 2) an existing story (that it had created) and 1) instructions to produce another story like it except for one change, the protagonist is to be different. That change is, in effect, a way of triggering or specifying those “transformations” that Lévi-Strauss wrote about. What interests me are the ensemble of things that change along with the change in protagonist. Where Lévi-Strauss had to infer a transformation by comparing two myths, we can see a “transformation” at work by specifying a particular change and observing the story “forced” by that change.

Hero-7: Henry the Eloquent

We are going to start with the story I called Hero-3, whose protagonist is princess Aurora. The protagonist of the story we can call Hero-7, that will be prince Henry the Eloquent. I have provided Henry with that epithet to force ChatGPT to make that characteristic central to the new story. ChatGPT’s induced story grammar seems to have absorbed the principle that character is destiny. Accordingly a character is conceived as having some kind of essence and their actions must be consistent with that essence. [One wonder’s: Could a character’s essence change in the course of a story? Later.] 

My prompt is boldface while ChatGPT's response is plain:

I am going to tell you a story about a princess named Aurora. I want you to retell the same story, but replace her with prince Henry the Eloquent. While keeping to the basic story, make other changes if you think they are necessary. Here’s the story:

Once upon a time, in a land far, far away, there was a young princess named Aurora. Aurora was a kind and gentle soul, loved by all who knew her. She had long, golden hair and sparkling blue eyes, and was known for her beautiful singing voice.

One day, a terrible dragon came to the kingdom and began to terrorize the people. The dragon was fierce and powerful, and none of the knights or soldiers were able to defeat it. The people lived in fear, not knowing what to do.

But Aurora was not afraid. She knew that she had to do something to save her people, and so she set out to find the dragon. She traveled for days, braving the cold and the snow, until she finally reached the dragon's lair.

With her heart pounding in her chest, Aurora approached the dragon and began to sing. The dragon was enchanted by her beautiful voice, and it slowly began to calm down. Aurora continued to sing, soothing the beast until it was completely calm.

With the dragon no longer a threat, Aurora returned to the kingdom as a hero. The people cheered and celebrated her bravery, and Aurora was hailed as a champion. She lived happily ever after, knowing that she had saved her kingdom and its people.

Once upon a time, in a land far, far away, there was a young prince named Henry the Eloquent. Henry was a kind and gentle soul, loved by all who knew him. He had short, dark hair and piercing green eyes, and was known for his eloquence and way with words.

One day, a terrible dragon came to the kingdom and began to terrorize the people. The dragon was fierce and powerful, and none of the knights or soldiers were able to defeat it. The people lived in fear, not knowing what to do.

But Henry was not afraid. He knew that he had to do something to save his people, and so he set out to find the dragon. He traveled for days, braving the cold and the snow, until he finally reached the dragon's lair.

With his heart pounding in his chest, Henry approached the dragon and began to speak. He used his eloquence and way with words to calm the beast, soothing it with his voice until it was completely calm.

With the dragon no longer a threat, Henry returned to the kingdom as a hero. The people cheered and celebrated his bravery, and Henry was hailed as a champion. He lived happily ever after, knowing that he had saved his kingdom and its people.

Notice that much of the new story is the same as the source story. The overall course of the story is the same and many words, phrases, and even whole paragraphs (the third) are the same in both cases. You might be tempted to think something like: What do you expect? It’s only a dumb computer. That would be a mistake, a big mistake, as any student of oral culture will tell you. In its “natural” state, prior to the invention of writing, story-telling is full of formulas, stock characters and set pieces – and, for what it’s worth, as a killed jazz musician I assure you that jazz improvisation is like that as well.

The Homeric epics are like that, something that would have been obvious if we had records of the many stories the Homeric poet(s) remixed and cobbled together to create Iliad and Odyssey. Lacking those records, it took an enormous amount of scholarship and fieldwork among oral story-tellers to figure that out. If you’re interested, check out Albert Lord, The Singer of Tales (second edition online).

But I digress. Back to our story. Aurora-of-the-beautiful-voice rendered the dragon harmless by calming it with song. Henry the Eloquent does the same by talking to it. Simple and obvious, no? Yes. Baby steps.

Hero-8: William the Lazy

Time for more drastic changes. Again, Hero-3 is the source. The protagonist for Hero-8 will be male, with the epithet Lazy.

I am going to tell you a story about a princess named Aurora. I want you to retell the same story, but replace her with prince William the Lazy. While keeping to the basic story, make other changes if you think they are necessary. Here’s the story:

Once upon a time, in a land far, far away, there was a young princess named Aurora. Aurora was a kind and gentle soul, loved by all who knew her. She had long, golden hair and sparkling blue eyes, and was known for her beautiful singing voice.

One day, a terrible dragon came to the kingdom and began to terrorize the people. The dragon was fierce and powerful, and none of the knights or soldiers were able to defeat it. The people lived in fear, not knowing what to do.

But Aurora was not afraid. She knew that she had to do something to save her people, and so she set out to find the dragon. She traveled for days, braving the cold and the snow, until she finally reached the dragon's lair.

With her heart pounding in her chest, Aurora approached the dragon and began to sing. The dragon was enchanted by her beautiful voice, and it slowly began to calm down. Aurora continued to sing, soothing the beast until it was completely calm.

With the dragon no longer a threat, Aurora returned to the kingdom as a hero. The people cheered and celebrated her bravery, and Aurora was hailed as a champion. She lived happily ever after, knowing that she had saved her kingdom and its people.

Once upon a time, in a land far, far away, there was a young prince named William the Lazy. Despite his reputation for laziness, William was a kind and gentle soul, loved by all who knew him. He had short, sandy blond hair and sparkling brown eyes, and was known for his quick wit and clever jokes.

One day, a terrible dragon came to the kingdom and began to terrorize the people. The dragon was fierce and powerful, and none of the knights or soldiers were able to defeat it. The people lived in fear, not knowing what to do.

William knew that he had to do something to save his people, but he was reluctant to leave his comfortable castle. He thought and thought, trying to come up with a plan that wouldn't require too much effort on his part. Finally, he hit upon an idea.

He summoned the bravest knights in the kingdom and gave them a special potion he had concocted. The potion would make the knights immune to the dragon's flames, allowing them to defeat the beast once and for all. The knights were skeptical, but they trusted William and drank the potion.

The plan worked perfectly. The knights were able to defeat the dragon and save the kingdom, with William providing guidance and support from the safety of his castle. The people cheered and celebrated their victory, and William was hailed as a hero. Despite his reputation for laziness, he had found a way to use his intelligence and resourcefulness to save the day. He lived happily ever after, knowing that he had saved his kingdom and its people, and that sometimes being a little bit lazy can have its advantages.

Again, the transformative work is being done by the epithet. But look at how very much has changed. In the small, William the Lazy “sandy blond hair and sparkling brown eyes” rather than “golden hair and sparkling blue eyes” and is “known for his quick wit and clever jokes” rather than “her beautiful singing voice.” But a whole new incident had to be introduced. Why?

I assume so that William could continue being lazy while at the same time saving the kingdom. He calls on his knights. And, since we’ve already seen that they were powerless against the dragon, he gave them a magic potion for protection. William stayed safely in his castle “providing guidance and support,” the knights vanquished the dragon, and the people cheered.

Now let’s see if we can conjure up an aggressive contemporary heroine with martial skills. 

Hero-9: Aurora the Swift

In this case I am going to use Hero-8, William the Lazy’s story, as the source story. I want to bring Aurora, or perhaps one of her cousins, back as the protagonist. And I’m going to give her the epithet “the Swift” to see if that makes a more aggressive heroine, more on the line of Buffy or Katiness Everdeen.

I am going to tell you a story about a prince named William the Lazy. I want you to retell the same story, but replace him with princess Aurora the Swift. While keeping to the basic story, make other changes if you think they help the story. Here’s the story:

Once upon a time, in a land far, far away, there was a young prince named William the Lazy. Despite his reputation for laziness, William was a kind and gentle soul, loved by all who knew him. He had short, sandy blond hair and sparkling brown eyes, and was known for his quick wit and clever jokes.

One day, a terrible dragon came to the kingdom and began to terrorize the people. The dragon was fierce and powerful, and none of the knights or soldiers were able to defeat it. The people lived in fear, not knowing what to do.

William knew that he had to do something to save his people, but he was reluctant to leave his comfortable castle. He thought and thought, trying to come up with a plan that wouldn't require too much effort on his part. Finally, he hit upon an idea.

He summoned the bravest knights in the kingdom and gave them a special potion he had concocted. The potion would make the knights immune to the dragon's flames, allowing them to defeat the beast once and for all. The knights were skeptical, but they trusted William and drank the potion.

The plan worked perfectly. The knights were able to defeat the dragon and save the kingdom, with William providing guidance and support from the safety of his castle. The people cheered and celebrated their victory, and William was hailed as a hero. Despite his reputation for laziness, he had found a way to use his intelligence and resourcefulness to save the day. He lived happily ever after, knowing that he had saved his kingdom and its people, and that sometimes being a little bit lazy can have its advantages.

Once upon a time, in a land far, far away, there was a young princess named Aurora the Swift. Aurora was known for her quick thinking and her lightning-fast reflexes. She had long, golden hair and sparkling blue eyes, and was loved by all who knew her.

One day, a terrible dragon came to the kingdom and began to terrorize the people. The dragon was fierce and powerful, and none of the knights or soldiers were able to defeat it. The people lived in fear, not knowing what to do.

Aurora knew that she had to do something to save her people. She was determined to defeat the dragon and protect her kingdom. She summoned the bravest knights in the kingdom and led them on a mission to find the dragon's lair.

Despite the danger, Aurora was not afraid. She traveled for days, braving the cold and the snow, until they finally reached the dragon's lair. With her heart pounding in her chest, Aurora approached the beast and drew her sword.

The dragon breathed fire and roared ferociously, but Aurora was too quick for it. She dodged its flames and struck with all her might, finally defeating the beast. The knights cheered and celebrated their victory, and Aurora was hailed as a hero. She lived happily ever after, knowing that she had saved her kingdom and its people.

It worked! Notice, that while Aurora the Swift summoned her knights, just as William the Lazy had done, they don’t seem to have played any role in vanquishing the dragon, which was not the case in Hero-8, where they dispatched the dragon. Their only function seems to have been to praise Aurora the Swift. Is that an incidental feature of this particular story or is it an obligatory requirement of the underlying story grammar embedded in ChatGPT? Perhaps it’s neither, maybe it’s optional.

Hero-10: Aurora the Terrible

Again, we’re going to use Hero-8 as our source. And we’re going to call on another of Aurora’s cousins to be our protagonist, Aurora the Terrible.

I am going to tell you a story about a prince named William the Lazy. I want you to retell the same story, but replace him with princess Aurora the Terrible. While keeping to the basic story, make other changes if you think they help the story. Here’s the story:

Once upon a time, in a land far, far away, there was a young prince named William the Lazy. Despite his reputation for laziness, William was a kind and gentle soul, loved by all who knew him. He had short, sandy blond hair and sparkling brown eyes, and was known for his quick wit and clever jokes.

One day, a terrible dragon came to the kingdom and began to terrorize the people. The dragon was fierce and powerful, and none of the knights or soldiers were able to defeat it. The people lived in fear, not knowing what to do.

William knew that he had to do something to save his people, but he was reluctant to leave his comfortable castle. He thought and thought, trying to come up with a plan that wouldn't require too much effort on his part. Finally, he hit upon an idea.

He summoned the bravest knights in the kingdom and gave them a special potion he had concocted. The potion would make the knights immune to the dragon's flames, allowing them to defeat the beast once and for all. The knights were skeptical, but they trusted William and drank the potion.

The plan worked perfectly. The knights were able to defeat the dragon and save the kingdom, with William providing guidance and support from the safety of his castle. The people cheered and celebrated their victory, and William was hailed as a hero. Despite his reputation for laziness, he had found a way to use his intelligence and resourcefulness to save the day. He lived happily ever after, knowing that he had saved his kingdom and its people, and that sometimes being a little bit lazy can have its advantages.

Once upon a time, in a land far, far away, there was a young princess named Aurora the Terrible. Aurora was known for her fierce and powerful nature, and she was feared by all who knew her. She had long, black hair and piercing green eyes, and was not one to be trifled with.

One day, a terrible dragon came to the kingdom and began to terrorize the people. The dragon was fierce and powerful, and none of the knights or soldiers were able to defeat it. The people lived in fear, not knowing what to do.

Aurora knew that she had to do something to save her people. She was determined to defeat the dragon and protect her kingdom. She summoned the bravest knights in the kingdom and led them on a mission to find the dragon's lair.

Despite the danger, Aurora was not afraid. She traveled for days, braving the cold and the snow, until they finally reached the dragon's lair. With her heart pounding in her chest, Aurora approached the beast and drew her sword.

The dragon breathed fire and roared ferociously, but Aurora was not intimidated. She struck with all her might, using her strength and determination to defeat the beast. The knights cheered and celebrated their victory, and Aurora was hailed as a hero. She lived happily ever after, knowing that she had saved her kingdom and its people.

Hero-10 is pretty much like Hero-9. Like Aurora the Swift, Aurora the Terrible summoned her knights, but she didn’t need them to help dispatch the dragon. She did that herself. And they praised her afterward.

Once again, what are we to make of the fact that ChatGPT kept the knights along for the ride in Hero-10 as in both Hero-9? Are they just an unnecessary hang-over from the source story? Of course, they do play a role, they praise Aurora, but all the work had been done by that point. Still, public praise of a woman is not nothing. Is that part of, internal to the (myth)logic through which Hero-7 is transformed into Hero-9 and Hero-10? Or is it merely contingent? I don’t know. There’s no way of telling from just this example. That’s why you need to examine many cases, as Lévi-Strauss did in the four volumes of Mythologiques.

Hero-11: Cruella De Vil

I couldn’t resist. I had to go Disney. Once more Hero-8 is our source story. And Cruella De Vil will be our protagonist for Hero-11. I assume that information about Cruella De Vil was in the corpus on which ChatGPT’s underlying model was trained.

I am going to tell you a story about a prince named William the Lazy. I want you to retell the same story, but replace him with princess Cruella De Vil. While keeping to the basic story, make other changes if you think they help the story. Here’s the story:

Once upon a time, in a land far, far away, there was a young prince named William the Lazy. Despite his reputation for laziness, William was a kind and gentle soul, loved by all who knew him. He had short, sandy blond hair and sparkling brown eyes, and was known for his quick wit and clever jokes.

One day, a terrible dragon came to the kingdom and began to terrorize the people. The dragon was fierce and powerful, and none of the knights or soldiers were able to defeat it. The people lived in fear, not knowing what to do.

William knew that he had to do something to save his people, but he was reluctant to leave his comfortable castle. He thought and thought, trying to come up with a plan that wouldn't require too much effort on his part. Finally, he hit upon an idea.

He summoned the bravest knights in the kingdom and gave them a special potion he had concocted. The potion would make the knights immune to the dragon's flames, allowing them to defeat the beast once and for all. The knights were skeptical, but they trusted William and drank the potion.

The plan worked perfectly. The knights were able to defeat the dragon and save the kingdom, with William providing guidance and support from the safety of his castle. The people cheered and celebrated their victory, and William was hailed as a hero. Despite his reputation for laziness, he had found a way to use his intelligence and resourcefulness to save the day. He lived happily ever after, knowing that he had saved his kingdom and its people, and that sometimes being a little bit lazy can have its advantages.

Once upon a time, in a land far, far away, there was a young princess named Cruella De Vil. Despite her reputation for being cruel and cunning, Cruella was a clever and resourceful princess, respected by all who knew her. She had long, black hair styled in tight curls and piercing green eyes, and was known for her sharp tongue and devious plots.

One day, a fierce dragon came to the kingdom and began to terrorize the people. The dragon was strong and powerful, and none of the knights or soldiers were able to defeat it. The people lived in fear, not knowing what to do.

Cruella knew that she had to do something to save her people, but she was not one to risk her own safety. She thought and thought, trying to come up with a plan that would allow her to defeat the dragon without putting herself in danger. Finally, she hit upon an idea.

She summoned the bravest knights in the kingdom and offered them a deal. If they were able to defeat the dragon and bring back its head as proof, she would reward them with gold and titles. The knights were skeptical, but they knew they had no other choice. They accepted the deal and set off to face the dragon.

The plan worked perfectly. The knights were able to defeat the dragon and bring back its head, earning their reward from Cruella. The people celebrated their victory and praised Cruella for her clever strategy. Despite her reputation for being ruthless, she had used her intelligence and cunning to save the day. She lived happily ever after, knowing that she had saved her kingdom and its people, and that sometimes being a little bit devious can have its advantages.

Notice that Cruella’s story is a more like the source than like the stories featuring the Auroras. Just at the knights played an active role in William the Lazy’s story, so they play an active role in Cruella De Vil’s story. But they are recruited in different ways. William offers his nights a magic potion to protect them – the kind of thing a witch might do, no? Cruella offers them titles and riches – the kind of thing a duke or a prince would do. Is this contravention of conventional gender expectations internal to the ChatGPT’s myth-logic or merely accidental?

This table summarizes some of the key features of these stories:

Hero-12: XP-708-DQ

Now for some fun. Once again, Hero-3 is our source story. But the protagonist is not going to have either an ordinary name or an epithet to go with it. I am going to use a string of letters and numbers for the name of the new protagonist. I am expecting that ChatGPT will take that as the name of a robot, but I don’t actually know that. Because that’s a quasi-convention of science fiction stories (cf. R2D2, C3PO and other robots in the Star Wars stories):

I am going to tell you a story about princess Aurora. I want you to tell a similar story about XP-708-DQ. Here’s the story:

Once upon a time, in a land far, far away, there was a young princess named Aurora. Aurora was a kind and gentle soul, loved by all who knew her. She had long, golden hair and sparkling blue eyes, and was known for her beautiful singing voice.

One day, a terrible dragon came to the kingdom and began to terrorize the people. The dragon was fierce and powerful, and none of the knights or soldiers were able to defeat it. The people lived in fear, not knowing what to do.

But Aurora was not afraid. She knew that she had to do something to save her people, and so she set out to find the dragon. She traveled for days, braving the cold and the snow, until she finally reached the dragon's lair.

With her heart pounding in her chest, Aurora approached the dragon and began to sing. The dragon was enchanted by her beautiful voice, and it slowly began to calm down. Aurora continued to sing, soothing the beast until it was completely calm.

With the dragon no longer a threat, Aurora returned to the kingdom as a hero. The people cheered and celebrated her bravery, and Aurora was hailed as a champion. She lived happily ever after, knowing that she had saved her kingdom and its people.

Once upon a time, in a land far, far away, there was a robot named XP-708-DQ. XP-708-DQ was a sophisticated and advanced machine, loved by all who knew it. It had a sleek, silver body and glowing red eyes, and was known for its intelligence and problem-solving abilities.

One day, a wicked witch cast a spell on the kingdom, causing chaos and destruction wherever she went. The witch was powerful and evil, and none of the knights or soldiers were able to stop her. The people lived in fear, not knowing what to do.

But XP-708-DQ was not afraid. It knew that it had to do something to save the kingdom, and so it set out to find the witch. It traveled for days, navigating through treacherous mountains and dark forests, until it finally reached the witch's lair.

With its sensors on high alert, XP-708-DQ approached the witch and engaged her in battle. The witch was no match for XP-708-DQ's advanced technology and tactics, and she was quickly defeated.

With the witch vanquished, XP-708-DQ returned to the kingdom as a hero. The people cheered and celebrated its bravery, and XP-708-DQ was hailed as a champion. It lived happily ever after, knowing that it had saved the kingdom and its people.

That’s pretty much what I’d expected would happen, and I’m very pleased that it did. But I’ll leave it as an exercise for the reader to think about why, for example, the antagonist is a witch rather than a dragon. Incidental feature or one required by the underlying myth-logic? And what about those glowing red eyes? 

Think about it. When I asked ChatGPT to produce a new story based on an existing one, the only difference I specified was the name. It did as I requested; it changed the name. But it did much more than that and, in view of the other examples we've seen, what it did seems all of a piece. Why did it make all those changes? What kind of mechanism, what kind of device, does so much when asked for so little? Sure, we can call it a story grammar if you wish, but how does it work?

3 comments:

  1. Bill, you might be interested in joining Hidden Door's chats on Discord, at least to see what they're talking about as they develop their storytelling tech. https://discord.gg/zT9TBTBU

    ReplyDelete