WHY THIS MATTERS IN BRIEF
- Learning how to write novels is difficult enough for a human, but now some AI’s are trying tackle the task
Alas for all of those among you who love fire breathing Dragons, that aren’t the Mother-in-Law kind, and weird zombie ice creatures, the seventh season of Game of Thrones has finished and the next instalment which is scheduled to start later this week will see us all race through the next chapter with the exuberance of a crowd of five year olds in a very large candy store. And once it’s finished we know that the eighth season won’t be far behind. Hallelujah.
However, after the next instalment there’s a problem on the horizon, and it’s causing die hard Games of Thrones fans to freak out and it’s to do with the hero himself – George RR Martin, the saga’s legendary author.
You see, George was supposed to finish writing Winter Winds, the sixth book in the saga this year but recently he announced he wants to take it easy and no there’s no release date in sight, and that’s too long for some fans. It also looks like it’s taking its toll on the HBO execs who are scattering to the five corners of the Earth to wail from the cliff tops.
Poor, poor executives.
Now it’s probably fair to say that George has earned a rest, after all he’s human and he’s been working very hard. However, in an age where human frailties, such as the need to eat, rest, go to the toilet and sleep, are mere cannon fodder for today’s ultra-efficient, 247 AI’s and now an individual named Zack Thoutt, who’s an avid Games of Thrones fan and AI newbie has taken it upon himself to take up the great man’s mantle and write the book for him. What a hero.
Well, actually, that would be if he could be arsed, but frankly being human he has better things to do like eat donuts and watch whale movies in VR, so instead he’s made a Recurrent Neural Network (RNN) to do the work for him, and in true AI fashion it’s been busy digesting and analysing everything it can about the Game of Thrones universe and it’s already written five chapters.
“I’m a huge fan of Game of Thrones, the books and the show,” said Thoutt, who had just completed a Udacity course on artificial intelligence and deep learning and used what he learned to do the project, “I had worked with Recurrent Neural Networks a bit in that class and thought I’d give working with the books a shot.”
Neural networks are a class of machine learning algorithms modelled after the human brain and RNN’s are a subclass that work well with sequences of data, like text.
“With a vanilla neural network you take a set of input data, pass it through the network, and get a set of outputs,” said Thoutt, “in order to train these models you need to know what the model should ideally output, which is often called your labels or target variables. The neural network compares the data it outputs with the targets and updates the network learns to better mimic the targets.”
Thoutt is working with a “long short-term memory” RNN which has better memory, the key to training a network to remember plot points from thousands of words ago. In theory, this type of memory should prevent the network from repeating events that have already happened, allowing the generated book to be a continuation of the plot rather than an alternative version of an already-published work.
In this sense, the network is attempting to write true sequels, though it obviously stumbles from time to time. For instance, it has in some cases written about characters who have already died.
“It is trying to write a new book. A perfect model would take everything that has happened in the books into account and not write about characters being alive when they died two books ago,” Thoutt said, “the reality, though, is that the model isn’t good enough to do that. If the model were that good authors might be in trouble. The model is striving to be a new book and to take everything into account, but it makes a lot of mistakes because the technology to train a perfect text generator that can remember complex plots over millions of words doesn’t exist yet.”
After adding the 5,376 pages of the first five books in the series to the network, Thoutt has produced five predicted chapters and published them on the GitHub page for the project.
“I start each chapter by giving it a prime word, which I always used as a character name, and tell it how many words after that to generate,” Thoutt said, “I wanted to do chapters for specific characters like in the books, so I always used one of the character names as the prime word … there is no editing other than supplying the network that first prime word.”
George R.R. Martin isn’t going to be calling for writing tips anytime soon, but Thoutt’s network is able to write mostly readable sentences and is packed with some serious twists.
“It’s obviously not perfect. It isn’t building a long-term story and the grammar isn’t perfect. But the network is able to learn the basics of the English language and structure of George R.R. Martin’s style on its own,” said Thoutt.
So what do the latest chapters hold in store for us? Well, Hodor returns from the grave and learns to say more words, Ned is still alive, Jon Snow is actually a Lannister and rides a Dragon, and Sansa is a Baratheon. And it gets better. The AI’s also created a new character called Barbaverde and yes, you’ll also be happy to know it’s also figured out new and exciting ways to kill people, er, characters, as it calmly gets Jaime to kill Cersei and gets Varys to poison Daenerys.
Now the only question we have to ask is which version will we see? Maybe HBO will turn George’s “going easy time” into an “extended vacation,” and it wouldn’t be the first time that an AI has taken over the creative process of writing and producing a movie after that honour went to Eclipse, who debuted its short movie at Cannes last year.