Engineer Trains Artificial Intelligence to Write the Next ‘Game of Thrones’ Book

Zack Thoutt used artificial intelligence to write 'The Winds of Winter' since George R.R. Martin hasn't yet.

Can artificial intelligence predict Cersei Lannister’s next move? Helen Sloan/HBO

The seventh season finale of HBO’s Game of Thrones broke ratings records over the weekend, attracting almost 17 million viewers. But once the credits rolled, fans were left with the realization that the final season won’t premiere until 2019, and there’s no set release date for George R.R. Martin’s sixth book in the series, The Winds of Winter.

Sign Up For Our Daily Newsletter

By clicking submit, you agree to our <a rel="nofollow noreferer" href="http://observermedia.com/terms">terms of service</a> and acknowledge we may use your information to send you emails, product samples, and promotions on this website and other properties. You can opt out anytime.

See all of our newsletters

So one diehard Thrones fan took matters into his own hands, using artificial intelligence to continue the story.

Software engineer Zack Thoutt has trained a recurrent neural network (RNN) to predict the events of The Winds of Winter. This machine-learning algorithm is modeled after the human brain—it can quickly analyze text and remember thousands of plot points.

In theory, an RNN is trained not to repeat events, so that the generated text can be a continuation of the story, rather than a new version of an old book.

Thoutt uploaded the first five Game of Thrones books to the RNN so it could write its own version of The Winds of Winter. And while in some cases the network wrote about characters who had already died, overall it kept the thread of the story intact.

The RNN has produced five chapters thus far, which are available to read on GitHub.

Thoutt told Motherboard that he started each chapter by giving the RNN a character name like Tyrion or Jaime and then providing a word count. He did this to retain the format of the books, in which each chapter is focused on a specific character.

“There is no editing other than supplying the network that first prime word,” Thoutt said. That lack of editing shows at times—the RNN uses nonexistent phrases like “onion concubine” and “winesink.” It also ignores grammar rules, with phrasings like “I miss for it” appearing frequently.

The network also created an entirely new character named Greenbeard, a “big blind bearded pimple.”

But the RNN also confirmed some theories which have been floated by Game of Thrones fans. For example, the network predicted that Jaime Lannister would kill Cersei, that Jon Snow would ride a dragon and that Daenerys would be poisoned.

Thoutt said the RNN’s task was complicated by the many fantastical location, character and place names in the books—there about 32,000 of these unique words throughout the series. While RNNs are trained to work with large data sets, most of them can only retain the vocabulary of a children’s book.

This isn’t the only AI Game of Thrones project. The website Inverse has partnered with San Francisco technology firm Unanimous AI on a “hive mind” project to predict what will happen in the show’s final season.

Can AI and the hive mind predict George R.R. Martin’s next move? Only time will tell.

Engineer Trains Artificial Intelligence to Write the Next ‘Game of Thrones’ Book