Friday, July 19, 2019

In Which An AI Attempts to Do My Job

You're the only one who can write your story. That's an oft-repeated encouragement among writers; depending where you're coming from, it promises that your work matters, that your work is unique, that you have some weird form of job security in that you cannot really be replaced by another person or, heaven forbid, a robot. It's also not entirely accurate; other people can take your story and make it their own (as evidenced by, say, series that are taken over by another author after the first author dies, or even the existence of fanfiction). And, as it turns out, there are AI that are at least semi-competent at writing.

So, does that mean that an AI can write your story? I decided to figure out the answer using Talk to Transformer, a neural network created by Adam King and based on OpenAI's GPT-2 learning model. I feed the AI the first few lines of one of my novels, and it generates the next few paragraphs based on what it knows from downloading a large chunk of the internet. From that, we'll see if an AI really could write my story.

 Can An AI Do My Job?

First Test: Blood in the Snow

We begin, obviously, with Blood in the Snow. If you're not familiar with it: it's an Asian-inspired retelling of Snow White crossed with The Goose Girl, a story of betrayal, friendship, magic, and finding one's voice. It's also available to buy on Amazon or add on Goodreads, if you're so inclined! What will the AI do with it? Let's find out! The original prompt is the portion in bold; the AI created what follows.
The cherry blossoms fell slowly the morning Princess Zhu Baili of the Kingdom of Seven Rivers left her home forever.
Baili tucked her hands deeper into the wide sleeves of her red silk robe, watching as the petals sprinkled the surface of the Taìyáng River and swirled around the royal barge.
She heard the noise of the wind through her bedroom window. It was silent and beautiful, like birds flying. In her room, she tucked herself deeper into her white robe and closed her eyes, waiting for her mother's footsteps to come slowly down the steps of the palace, like a boat sliding into the waves.
After about forty-five minutes had passed, a small door was opened. As the door closed, the rain began to fall, soaking the windows, and the breeze blew through her room.
With little noise, Princess Zhu Baili fell asleep for only nine hours.
On Friday morning, June 6th, she awoke at six. She looked at the clock, and heard her mother's footsteps enter the room, which was now empty, as usual. Looking in all directions, she saw her little sister Yúxi in her bed, still wearing her long gown.
As you see, the AI manages a surprisingly pleasing tone (especially given how little of the original it had to work with). It does have a bit of trouble keeping track of small details, though, and it seems inclined to take the story in a rather different direction than intended. It's also invented a younger sister for Baili . . . which, honestly, is pretty feasible. Baili has more than a few siblings who don't feature in Blood in the Snow.

Now, let's move on to the second test: my upcoming novel, Mechanical Heart!

Second Test: Mechanical Heart

Mechanical Heartin case you somehow missed it, is a steampunk retelling of Rapunzel centering on a girl trapped in a clock tower and a prince fighting his relative lack of power. It comes out in just three weeks (ahhhhh!), and I'm super excited. Because we have two POV characters, I'm going to give the AI the opening lines from each of their first chapters and see what happens.

First up: Breen's POV! I ended up running this one multiple times (trying to give the AI a fair chance) and ended up with a couple good options. My favorite result actually bears very little resemblence to the original, but it sounds like an interesting story.
Her heart beat on, as it always did.
Breen waited, eyes shut, trying to ignore the pain of her bones knitting back together. The crystal in her chest burned with an almost unbearable heat as it fed magical energy into her body. Yet the clockwork of her heart pumped on, unperturbed.

"I was planning to see you again."
Breen spoke, not to Akenes or her fellow workers. No, she spoke to Breen's friends, her closest circle around whom she was able to talk for the first time this day as the ship began its turn at Port Jarnarth. Breen spoke as Akenes stood on a deck and waited anxiously for the ship to approach her, a small ship that she knew could never reach Akenes, ever.
The crew of Jundlande stared at her, and the look on her face was one of confusion and terror. The people of Jundlande couldn't comprehend what Breen had done. She had done it, surely. They would never understand what she had done to their world. No. They would see what she had done. She had done it for them.
Again, a bit muddled on who and where characters are, but an interesting concept. What did this alternate universe Breen do? Will people understand what it is and why she did it? Who is Akenes? All the questions; none of the answers.

Moving on, let's see what the AI makes of Josiah's introduction . . .
“Powerless!” Josiah waved his hand in the air, pacing up and down the rich red carpet of the royal library. “That’s what we are. What we’ve become. Powerless!”
His eyes widened and he took a step back, the sound of glass shattering behind him. “Powerless!?” It was the cry of a frightened man, a scream that echoed around the building. “Oh God!” His sister's scream seemed to wake him up from what he'd been doing; it had broken his trance and, now that he was awake, he'd found it hard to concentrate in front of the door.
He stumbled down the steps onto the carpet, staring out toward the ceiling as a faint pink glow made him look back up at the room.
He pulled himself up by his sword before he could cry out again; instead he turned on a dime, and when the first girl was gone he turned to the girls in a look of incredulity, not knowing whether to laugh or cry. He saw her face grow even larger, her cheeks starting to get red.
So, the AI seems to have decided that Josiah is either in a horror novel or the survivor of some horrible event. Possibly both. Poor Josiah. Though, you have to admit, the AI's decision is pretty characteristic of certain schools of authors . . .

That's two tests, but any student of fairy tales knows that it's best to do things in threes. So, the AI's last chance:

Third Test: Once Upon a Dream

For those of you who don't know, Once Upon a Dream is a steampunk Sleeping Beauty retelling featuring dreamworlds, chemistry nerds, and the power of science motivated by love! I wrote it for the Five Magic Spindles contest and intend to publish it at some point, but it needs a bit of work first. Can an AI do that work for me? Let's find out. As before, the lines from the original work are in bold; the rest is the AI's creation.
Our story begins as do most tales: with a dream.
The ground rippled beneath Alexander’s feet, sending him stumbling sideways into the nearest tree. He pushed himself upright, brushing lichen and tree sap from his jacket. Another ripple unsteadied him, but he was ready for it this time and stayed upright.
His eyes were open. He took in the sights. A distant hilltop, a dark and distant lake, a dark and distant tree. He turned toward the lake, hoping with his eyes that it would give way without warning.
It did, and the ground beneath him cracked and rolled back, letting him out of the tree and into the lake—and his head, which lay atop of a tree branch. All that remained was a rock with something staining it, something bright and dark shining, and the world seemed filled with nothing except the image of him perched and waiting.
While he sat, staring at the landscape, the other characters of the tale moved away. They were gone, they said of themselves. In their place were strange men, who called themselves the Order, and had come down to see how the world went (or didn't go).
The AI's tendency to get a little mixed up about the details actually works somewhat in its favor here; the weirdness adds to the feel that this is a dream world that works by dream logic. One also has to appreciate the AI's decision to go a bit meta at the end, and this Order (looking to see how the world does or doesn't go) and the strange stone sound quite fascinating. All that said, it's certainly not the story originally intended.

So, in conclusion: our jobs as writers are probably pretty safe from the AI, at least for now. But if we're ever stuck for story ideas, dropping a few lines in this particular neural network might be a good way to get the mind working.

Now, it's your turn! Add your speculations about any of these AI snippets in the comments, or put in a few lines of your own work and share what the AI comes up with! I'd love to see what you get out of it!
Thanks for reading!
-Sarah (Leilani Sunblade)

6 comments:

  1. Ah, Breen, a mysterious...pirate, I guess? I can see this as a possible AU, if, say, she figures out how to recharge her heart herself, and manages to keep it secret until this Akenes fellow came along.

    Oh my goodness, poor Josiah. XD

    Once Upon A Dream sounds like an interesting story! Are you planning any other steampunk retellings (if it’s as good as MH, I get the feeling this might end up being a niche of yours)?

    I put in the first few lines from the reworked opening of Renewal of Spirit. The first few results were, ah...unpublishable, as they were gory and contained a bit of cursing, but this one turned out okay:
    Staccato drumbeats laced through the darkness. They cut through the groan of settling earth, called forth the beasts that slumbered beneath the surface.
    In the midst of the music, Corinna ran.
    Her fingers wrapped around the handle of the blade, and it felt as if it was a blade that could hurt her. She couldn't help but smile. It would never hurt her.
    When the final few drums and snarls settled around her, Corinna was about ready to go, and as she walked out of the cave, she stopped.
    "What—"
    There was a silence and then one of them said,
    "Well what do we know of Corinna? If it is her, she could have been hiding up all along in the hole. I'm not sure what kind of creature she made the lair, but a dragon or an insect. The beast's jaws were large enough to tear through steel, even steel with a lot of flesh around it."
    And Corinna stopped in her tracks. She looked around the cave, watching her fellow survivors take their own breaths, then turned back to the sound.
    "I'd say we heard quite a lot of things this morning."
    The others looked back as quickly as they had walked. Corinna stood still, her sword still in her hand, wondering what their leader had in mind.

    ReplyDelete
    Replies
    1. Something like that. Though, if I were going to expand that story, I'd actually fast-forward the setting a couple decades so it would be closer to our WWII era. I don't know why; I just feel like I can see Breen working on a battleship or a submarine more easily than I can see her on a pirate ship.

      Yeeeeaaaah . . . he's very glad that's not his actual story.

      Thanks! Obviously, I have that one planned, and possibly a Cinderella one that would be a sequel to Once Upon a Dream, and I have vague ideas for a Mechanical Heart sequel but I don't know what fairy tale it would be yet. So, we'll see.

      Huh. Honestly, it reads like something a tired NaNoer might write if they pulled an all-nighter and maybe had a glass of wine . . . which is to say, it has potential. The bit about her sword is particularly interesting. (Also, the actual lines of your story sound cool.) Thanks for sharing!

      Delete
  2. What an interesting concept! I haven't heard of writing through AI before (though I have heard of AI editors).

    I'll check out your writing; I love fairytale retellings!

    ReplyDelete
    Replies
    1. Heh. Based on this, I don't think it would actually work . . . but it's a fun experiment.

      Thanks! Hope you enjoy what you find!

      Delete
  3. Is it weird that I find this unbelievably hilarious?
    I fed the Transformer the first few lines from Guardian of Our Beauty (my Sleeping Beauty retelling from 5 Magic Spindles) and got this:
    [mine] And it happened in the days of the great heroes, in the years of the warrior-shepherds, that the king of Gubla had no son. (He even begged a wife from the King of the Four Quarters, the master of the Black-Headed People; but the Great King did not send him a wife. The Great King did not even receive the king of Gubla’s messenger.)
    [Transformer] As they went out on their journeys, the warriors came to the island of Mafra. A battle commenced, fought on the waters of the Red Sea. With these warriors came men of the kingdom of Gubla, and their king was slain. The army that the queen of the south laid waste with its great wealth, which it had taken away from her enemies and which her enemies themselves took away by force became the enemy and the foe of the kingdom that lay under her. The king's son was captured, killed, and sold as slaves. A few days later there were captured warriors again, to be killed, to be burned, and as the queen of the south returned by boat to them; this time she returned with the king's child. (And again the king of Gubla was slain, and his son was sold again as slaves.)
    Wow. I'm impressed that the AI was able to figure out where in the world my story was set, and to do something with it that makes historical sense... though it ended up with a Daniel 8-9 kind of feel.

    ReplyDelete
    Replies
    1. I mean, I also find it hilarious, so . . .
      Wow. That's seriously impressive. Probably one of the best ones I've read. And yeah, I was thinking that it sounded like something out of one of the OT books, though I was thinking the Kings or the Chronicles, not Daniel.
      Thanks for sharing!

      Delete

I'd love to hear your thoughts! But remember: it pays to be polite to dragons.