Tuesday, March 21, 2023

Interactive story-telling with ChatGPT [What does ChatGPT know, and when?]

I’ve asked ChatGPT to tell many stories. Most of the time I’ve given it a simple prompt – often as simple as “Tell me a story” – but I’ve also asked it to produce a new story by revising an old one. This time I decided to try something different. What would happen if I gave it the first paragraph and asked it continue from there?

It's an obvious and simple idea, but I didn’t arrive at it in an obvious and simple way. Ever since I finished my working paper, ChatGPT tells stories, and a note about reverse engineering, I’ve been thinking about just how ChatGPT evolves a story. It’s clear that, unless otherwise specified, ChatGPT will tell a story with a happy ending. How is that encoded in those weights? Does ChatGPT “know” that the ending will be happy when it begins to tell the story?

Now, if I ask it to tell a sad story, it will do so. For example:

Tell me a sad story.

Once upon a time, there was a young boy named Jack who lived in a small village at the base of a mountain. Jack had always been fascinated by the mountain, and would often spend his days exploring its rocky slopes and lush forests. One day, while on one of his adventures, Jack met a wise old man who lived in a cabin at the top of the mountain. The old man told Jack that the mountain was sacred, and that it held a great power that could only be unlocked by someone pure of heart.

Jack was determined to unlock the mountain's secrets, and so he spent many months training his body and mind, becoming stronger and more focused with each passing day. Finally, he felt ready to attempt the climb to the summit. The journey was long and difficult, but Jack never gave up. He battled through fierce storms, climbed sheer cliffs, and crossed treacherous ice fields, all the while driven by his desire to unlock the mountain's secrets.

At last, Jack reached the summit, and there he found a beautiful cave. Inside the cave, he saw a glowing crystal that radiated an otherworldly light. As he reached out to touch the crystal, he felt a powerful energy flowing through his body, and he knew that he had unlocked the mountain's secrets.

But as he emerged from the cave, he saw that his village was on fire. His family and friends were gone, killed by raiders who had attacked while he was away. Jack's heart was filled with sadness and regret, for he realized that his quest for the mountain's secrets had cost him everything he held dear. He died alone, on top of the mountain, with nothing but the memories of his loved ones and the knowledge that he had unlocked the mountain's secrets, but at too high a cost.

Notice that that story doesn’t become sad until the fourth and final paragraph. Was it only then that it “knew” it would give the story a sad ending? How was that knowledge encoded?

If you know Shakespeare, you know that at some point all of the comedies almost collapse into disaster. And Romeo and Juliet reads like a comedy much of the way through. It doesn’t take much to tip a story one way or the other – you might want to look at my comparison between The Winter’s Tale and the story on which Shakespeare based it, Robert Greene’s Pandosto.

In a lot of the stories I’ve been working with the protagonist will be introduced in the first paragraph and the antagonist in the second paragraph. Does ChatGPT “know” the antagonist from the beginning or does it only “choose” one after it has specified the protagonist? If the later, how does the choice of a protagonist influence the choice of an antagonist? On that last question, I know from one experiment that if the protagonist is a giant chocolate milkshake, the antagonist will be chosen from the same universe.

So those are the sorts of questions I had on my mind when I decided fully specify an opening paragraph and see how ChatGPT would respond. Here’s my first attempt:

I am going to give you an opening paragraph. You continue the story from there.

If was a cold day in the middle of winter. Snow blanketed the ground. John had left his house at 5:30 in the morning and began to hike through the woods to his brother’s compound. He got there at just as the sun was rising. The front door had been ripped off its hinges and a wisp of smoke came out of the door.

John's heart raced as he cautiously stepped inside, his hand instinctively reaching for the hunting knife at his belt. The sight before him made his blood run cold. Furniture was overturned, glass shattered on the ground, and there was a trail of blood leading to the kitchen. He followed the trail, gripping his knife tighter, and found his brother lying on the floor, bleeding profusely from a wound on his leg. "What happened?" John asked, as he quickly tore off a piece of his own shirt to use as a makeshift bandage. His brother looked up at him with fear in his eyes and whispered, "They came...they took her."

And? It did what I asked, it continued the story. But it didn’t finish it. So...

Could you finish it.

John's mind raced as he tried to make sense of his brother's words. Who had taken who? And why? He knew he needed to act fast if he was going to save his brother and whoever had been taken. "Who took her? Who did this to you?" John asked urgently, helping his brother to sit up. "They were wearing masks, I couldn't see their faces," his brother replied weakly. "But they said something about a ransom and demanded money." John's heart sank as he realized what was happening. His brother had been targeted for his wealth, and now someone had taken his loved one hostage. Without wasting any more time, John grabbed his backpack and set off on a mission to rescue his brother's beloved and bring the criminals to justice.

Continue.

John quickly made his way out of the compound and back into the woods. He had to find any clues that could lead him to the kidnappers. The snow on the ground made it easier to track them, but the trail was already getting faint. He followed it as fast as he could, using all his wilderness skills to keep himself hidden and avoid detection. As he went deeper into the woods, he heard voices up ahead. He moved closer, being careful not to make a sound, and saw a group of men huddled around a small cabin. One of them was holding a woman, who was tied up and blindfolded.

John's heart raced as he realized he had found them. He knew he had to act fast before they could harm the woman or escape. He assessed the situation and formulated a plan. He moved around to the back of the cabin, where he saw a window that was slightly open. He quietly slipped inside and found himself in a small room. There was a table with a few chairs, and a door that led to another room. He heard footsteps coming from the other side of the door, so he quickly hid under the table, waiting for his moment to strike.

As the footsteps got closer, John held his breath, his heart pounding in his chest. The door opened, and two of the kidnappers walked in, talking to each other in hushed tones. John could see their shadows moving across the floor. He waited for the right moment, then sprang into action, grabbing the legs of the first kidnapper and knocking him to the ground. The second kidnapper tried to reach for his gun, but John was too quick for him. He disarmed him and knocked him out with a swift blow to the head.

John quickly untied the woman and removed her blindfold. She was shaken, but unharmed. "Are you okay?" he asked urgently. She nodded, tears streaming down her face. "Thank you," she whispered.

But John knew they weren't out of danger yet. They had to get out of there before the other kidnappers came looking for their missing comrades. He grabbed the woman's hand and led her outside, where they quickly made their way back to his brother's compound. Once they arrived, John contacted the authorities and gave them all the information he had about the kidnappers. With John's help, they were able to track down and arrest the criminals, bringing them to justice for their heinous crime.

In the end, John's bravery and quick thinking saved his brother's beloved and brought the kidnappers to justice. He knew that the dangers of the wilderness could be treacherous, but he also knew that he had the skills to face any challenge that came his way.

It took a bit of work, but ChatGPT managed to finish the story. And it’s somewhat more interesting than the fairy tales it had been giving me.

I decided to try it again. Here’s the resulting interaction, without comment:

I am going to give you an opening paragraph. You continue the story from there.

If was a cold day in the middle of winter. Jane could hear the traffic down on the street below as she awoke. She got out of bed, took a shower and got dressed. She put on her best suit because she would be meeting a new client at the office. She smiled at the doorman as she left her apartment building and went to the coffee shop around the corner where she had a cup of coffee and a bagel. When she got to the office, she learned that the new client was waiting for her. “Hello, Mr. Belknap, how are you this morning?” “I’m fine, he said. Let’s discuss the merger with Smith and Baskins.

Jane shook Mr. Belknap's hand and led him to her office. As they walked, she couldn't help but feel a sense of unease. There was something about Mr. Belknap that made her feel uneasy, but she couldn't quite put her finger on it. Once they were in her office, they sat down and Jane began discussing the details of the merger. But every time she looked up at Mr. Belknap, he seemed to be staring at her in a strange way. She tried to ignore it and focus on the meeting, but she couldn't shake the feeling that something was off. Finally, she couldn't take it anymore. "Mr. Belknap, is everything okay? You seem to be staring at me." Mr. Belknap's expression changed suddenly, and he leaned forward in his chair. "Jane, I'm sorry, but I have to tell you something. You're in danger."

That's good. Continue.

Jane's eyes widened in surprise. "What do you mean, I'm in danger?" she asked, her voice barely above a whisper. Mr. Belknap looked around the room, as if checking to make sure they were alone. "I can't say too much here," he said, his voice low. "But I have reason to believe that someone is trying to harm you. And it's not just you, it's your entire company. They're after your secrets." Jane's mind raced as she tried to make sense of what Mr. Belknap was saying. She had heard of corporate espionage before, but she never thought it could happen to her. "Who is 'they'?" she asked. "And how do you know all of this?" Mr. Belknap leaned back in his chair and took a deep breath. "I'm with the FBI," he said. "And we've been tracking a group of hackers who have been targeting companies like yours for months. We believe they're getting close to infiltrating your system."

Very good. Tell me more about the hackers.

Jane felt her heart rate increase as she processed what Mr. Belknap had just told her. Hackers? Infiltrating her company's system? This was a nightmare scenario that she never thought would happen to her. "What can we do?" she asked, her voice shaky. Mr. Belknap reached into his briefcase and pulled out a folder. "We have reason to believe that the hackers are using a new form of malware that is almost impossible to detect," he said, opening the folder and sliding a piece of paper across the desk. "But we've also developed a countermeasure that we believe will work." Jane picked up the paper and studied it. It was a list of instructions for a security protocol that she had never heard of before. "I don't understand," she said, looking up at Mr. Belknap. "What do we need to do?" Mr. Belknap leaned forward again. "You need to follow these instructions to the letter," he said. "And you need to do it quickly. We believe the hackers are planning to strike soon." Jane took a deep breath and nodded. "Okay," she said. "We'll do whatever it takes to protect our company." And with that, she got to work.

Continue.

Over the next few hours, Jane worked tirelessly with her IT team to implement the security protocol that Mr. Belknap had given her. It was a complex process, but they followed the instructions to the letter. When they were done, they tested the system to make sure it was working properly. As she watched her team work, Jane felt a sense of relief wash over her. They had done everything they could to protect their company. But then her phone rang. It was Mr. Belknap. "Jane, we have a problem," he said, his voice urgent. "We just received intel that the hackers have breached your system. They're inside your network right now." Jane's heart sank. All of their hard work, all of their efforts to protect the company, had been for nothing. "What do we do now?" she asked, her voice trembling. "We need to act fast," Mr. Belknap said. "I'm sending a team over right now to help you contain the breach. But you need to do everything you can to make sure they can't get their hands on your data." Jane took a deep breath and nodded. "We'll do everything we can," she said. "Thank you for your help." And with that, she hung up the phone and got to work.

I can’t wait to see what happens next. Tell me more.

Jane's heart was pounding in her chest as she ran to the IT department. She found her team working frantically, trying to isolate the breach and prevent the hackers from accessing any critical data. "What's the situation?" she asked, trying to stay calm. "We've managed to isolate the breach to a single server," one of her team members replied. "But they're moving quickly. We need to act fast." Jane nodded and took a deep breath. "Okay, let's do it. Cut them off from the rest of the network and lock down that server. And let's make sure our backups are secure." Her team got to work, moving with speed and precision. They managed to isolate the server and prevent the hackers from accessing any other parts of the network. But the hackers were determined, and they kept trying to break through the defenses. Jane watched nervously as her team worked, her mind racing with thoughts of what could happen if they failed. Finally, after what felt like hours, the attacks stopped. "We did it," one of her team members said, his voice filled with relief. "We managed to fend them off." Jane let out a long breath and slumped into a nearby chair. "Thank God," she said. "Thank you all for your hard work." She knew they had a long road ahead of them, cleaning up the mess left by the hackers. But for now, she was just grateful that they had managed to prevent a disaster.

Very good. I want to work on the story myself. Do you have any advice? Possible plot points? Perhaps an ending?

Of course! Here are a few ideas to consider:

  • Consider exploring the aftermath of the breach. How does the company recover from the attack? What measures do they put in place to prevent future breaches? Are there any lasting consequences for Jane or her team?

  • You could also introduce a twist by revealing that the hack was an inside job. Maybe someone within the company was working with the hackers, or maybe there was a disgruntled employee who wanted to cause trouble.

  • Another possibility is to have the hackers come back for a second round. Maybe they weren't able to get everything they wanted the first time, and they're determined to try again. This could add a sense of tension and urgency to the story.

  • As for an ending, you could have Jane and her team ultimately succeed in defeating the hackers and preventing any further breaches. Or you could leave things more ambiguous, with the implication that the company is still vulnerable to future attacks.

Whatever direction you choose to take the story, remember to keep the stakes high and the tension mounting. Good luck!

I’m not sure just what, if anything, I should conclude. Nor, for that matter, do I know just what I’ll do next. There are so many possibilities, no?

No comments:

Post a Comment