Welcome to Nvidia's AI podcast. And I think this is the first time we've been able to say this, but there might be spoilers ahead on this segment of the podcast.
Because joining us, we have Zach Tout, who is a data scientist and a developer from Boulder, Colorado.
Zach, welcome. Hi, thanks for having me.
Zach has done something that we've all wanted to have done which is He's working on finishing Game of Thrones, the books, by setting an AI system on it.
Zach, I'm sure you're a fan of the show.
Do you watch it? Do you read it? Do you do all those things?
I do everything, yeah. read Reddit. I talk about it.
I think it's like probably 50% of what my wife and I talk about are just Game of Thrones theories.
George R.R. Martin has been saying that he was going to finish the next book in the series, which is what?
The Winds of Winter or is that? Yep, I think The Winds of Winter.
But we don't have that book, and it's been years.
And the show, as we know, has kind of surpassed the book's kind of... at least in the chronology of what's happening in the books.
And so you took it upon yourself to do what?
I used a type of neural network to look at patterns and basically learn sequences of text from the Game of Thrones or from the Song of Fire and Ice books.
And so and these patterns were, for example, like what what kind of patterns emerged?
So that's kind of the tricky thing about neural networks is they're not as interpretable as other types of machine learning.
You basically just feed it the text and you tell it, hey, go look for patterns.
I mean, it learns how to more or less write in English, use words.
Fairly grammatically correct sentences and then also learn the characters right in the context of Game of Thrones and the tone.
Right. Just by looking at the books. How did you even get to the point where you were able to do it?
I mean, I think feeding in some sense, you're trying to train a deep learning You know, a neural net to become George R.R.
Martin or at least get in his head. Did you know about neural nets?
Did you was that your expertise? And how did you get to it?
My degree in college was applied math. kind of like a mixture of math and engineering and computer science.
So I learned some stuff there in statistics.
And then at my first job, I did some machine learning stuff as a data scientist.
I never got into deep learning, though, until I started doing some Kaggle competitions and you know, just kind of getting into the community there.
And I heard about Udacity. They came out with a deep learning nano degree and I actually ended up taking that the start of June.
And so that's how I got into deep learning.
And that's kind of where the project came from, too.
I see. So June, right around the time when Game of Thrones was coming back on the air.
And these two things were not coincidental.
Maybe Game of Thrones was in the air and so was deep learning for you.
I mean, how did you put the two together?
I guess I'm just a really big fan, and I've wanted the last book to come out for a while.
And I think everyone, when the show first started, thought that the books would stay ahead of the show.
And I had done a project for my nano degree that was pretty similar to this. the Game of Thrones project that I ended up doing, and that one wrote scripts for The Simpsons, the TV show.
And did that work pretty well? Did the Simpsons teach you, okay, we can take Bart and then translate that to Tyrion or something like that?
How did that work? It's a little different.
I think when you train these types of, or the type of network that I train, so it's a recurrent neural network, which works well on sequences of data, When you feed it the text, you actually have to go through and create a number ID for each word that shows up in the text.
And so you're really just feeding it sequences of numbers.
The way that I did it for Game of Thrones is that I made each word a unique ID.
But in the Simpsons project, We did each character.
So to spell out Bart, the neural network would have to make four predictions instead of just one.
So how many words is that? Do you know? I'm sure you do know.
Or how many unique IDs for Game of Thrones were there?
Yeah, I think there's around 32,000. in all the books, which is pretty big.
Wow. And so you get these unique IDs, you set the to kind of consuming the text.
And then what happens? I used a type of network called a long short-term memory cell.
Those are types of recurrent networks. neural networks that are really good at remembering things long-term, you'd want it to remember stuff from more than just like 10 words ago or 20 words ago and obviously the the network still doesn't do a great job of remembering like plot points and stuff but well apparently This is what I've read, at least.
George R.R. Martin had a hard time remembering plot points himself. he would ask the community, be like, hey, was that guy's horse white or brown?
And was he left-handed? So... It remembers these plot points, or it tries to, and then it generates patterns.
Explain to us what a pattern might be. Right, so there's basically just a whole bunch of weights that make up the neural network.
When you pass in the ID, so when you want to start making predictions, which in this case is writing text, writing new text, you feed it a prime word.
So I used words for the characters of the book, because in the books, the chapters are... named after a character like Tyrion or Jaime or whatever I would feed it Tyrion and then it would predict the next word in the sequence with a little bit of randomness added in.
And then you would take that two-word sequence and you'd feed that in and you'd do that recursively to create the text.
Well, and what I would love for you to do is read us some of that text.
So read us, if you can, the first... paragraph of the first chapter?
So the first chapter I did was Tyrion. It's not totally grammatically correct.
Tyrion could hear Lord Aemon's coughing.
I miss for it. Why did you proper? I feared Master Sansa, sir, Sir Jaime reminded her.
Shibarathian is one of the crossing, the second sons of your onion concubine.
So just to be clear about this and to set some expectations. we're not talking like finished novel winds of winter.
Hey, who needs it from George? Cause we got, you know, Zach's version.
Um, How would you describe the text itself and kind of what people can expect when they read it?
So I think this text is interesting, especially if you're interested in learning about what currently is possible with AI, especially in the realm of writing and artistic creation and stuff like that.
But it's not obviously grammatically correct.
It can't carry a plot long term. I think it's more amusing than something that you could sit down and read for an hour at night before you go to bed.
How did you feel when those sort of first sentences started coming out?
I was actually pretty surprised at how funny they were. how creative the text was, but I was a little disappointed in how grammatically correct it was.
Right. So, yes. So I think that's something I'd like to improve on in the future.
Well, so what funny things did you discover or what what was generated by the AI system?
So there's some funny stuff with John that kept coming out, which I thought was interesting.
It actually showed up in several of the chapters that I generated.
I don't really know why, but here's one of the slightly weird and perverted sentences that it generated for John. once she thought it was wrong climbing through the cloudless terrible light noise that was no last snow John did not need to share a cup or part of it, but maybe this, a fat little blind girl.
Well, okay. Pardon the interruption, but we have a favor to ask.
Leave us a review on iTunes, Google Play Music or whatever your favorite podcast platform of choice is.
It helps more people find us. As always, thanks for listening.
Now, back to the good stuff. Okay, now here's the point in the conversation where we get to say spoilers follow.
You've been warned, spoilers follow. So what happens?
That's what we all want to know. Does Cersei get killed by Jaime or Tyrion, or does it lead us in a direction where you think –
The actual text and the show, for that matter, next season may go.
Yeah, I don't know. Some interesting things came out, but you never know what's going to happen in Game of Thrones.
This is true. And I think... George R.R.
Martin's been known to kill off characters that people say, please don't kill this character.
So maybe this becoming popular will make this stuff less likely to happen.
So what happened in your version or what's happened in the chapters that your system put out?
It kind of jumps around quite a bit. Some of my favorites were that Sansa is actually a Baratheon, as we just read.
And part of something called the second sons of the onion cocky pine.
Right. Hodor is back and he can say something other than Hodor.
Hodor's back. Oh, that's good news. Yeah.
Yeah. Maybe it's like a flashback or something of Bran.
I don't know. I'm not quite sure. Ned is alive and apparently dead.
John is actually a Lannister so he must be like a Lannister Targaryen or something according to my book That is some double, triple agent work right there.
If Jon is a Targaryen who's actually a Lannister and Ned was never dead.
And yeah, then we get into some of the more popular fan fiction stuff, like Jon riding a dragon, Jaime killing Cersei.
Sir Jorah walking around. Sir Jorah makes it out, or you're telling me that Sir Jorah survives?
Yeah, according to this book. In theory, I guess you could just keep cranking out chapters forever like Game of Thrones could never end.
And I'm sure some some fans would like that.
How does it end or how does it keep going?
Yeah, so you tell it how many words to write, basically, and it writes that many words based on Just starting from the prime word that you give it.
But yeah, theoretically, you could tell it to write a million new words of a book.
Honestly, I bet you some Game of Thrones fans would like that, where there's just an endless series of books.
An endless series of words. Has George R.R.
Martin gotten in touch with you? Has he asked for some help?
No. That'd be pretty cool. I'd like to talk to him and meet him, but no, he hasn't.
I haven't heard from anyone like that or from the Game of Thrones team.
Well, when you step back and you think about what you've done, so you're talking about teaching a system to write a text in a specific text, right? and tell a specific story in some ways, and also predict the plot lines.
Is there other applications? We've seen deep learning systems kind of be applied to art where it does a really good job of painting in the style of Van Gogh or the style of…
Name your favorite painter. Or we had a podcast segment with a musician who taught a system to compose music.
Where do you think that this kind of approach takes you and then takes us more broadly?
I think in the future, it would be really cool Typically, computers have a hard time doing creative things, but I think maybe they could assist artists and writers with doing their creative work.
So maybe an application would be a model that's trained to check for plot holes and plot consistencies or something that just generates new plot ideas.
Maybe the writer actually goes through and writes it.
But you use something like this to come up with ideas.
Obviously, it's a long ways off, but that's kind of where I think AI in the context of helping writers might go.
And from your experience, what's the gap between somebody like George are Martin and, you know, the system that you developed?
And do you have a name for your system for that matter?
Well, I didn't name it, but I did an interview with Vice and they named the system George AI Martin.
That was pretty good. So I'll go with that.
George A.I. Martin. So but what's the gap between your George and the other George?
I think the hardest thing for a network like this is understanding context.
So it's good at remembering sequences of text.
But for instance, when someone dies, it doesn't always say like, John died.
It describes it, and then it's kind of implied in different ways by the way that the text describes it.
And so I think that's one of the big reasons why text generation like this has difficulties creating something that you know it makes sense over the course of a whole book and have a consistent plot and remember that characters are dead and Right, right.
Ned doesn't just rise up and grab his axe because actually Ned doesn't have a head.
It wouldn't be too difficult to get better grammar, but I think for it to... hold on to a plot long term and actually come up with things that are consistent I think that as far as I know that's still not really possible.
What's the plan? Are you going to just keep at it until you've cranked out any number of chapters or just keep at it until the next season starts in 2019 or whatever it is.
I'm going to try to do some updates. I'm going to try to, again, get better grammar.
So I'll probably try to add some other text that doesn't change the context of it too much.
I've been asking people online for other suggestions, and then we'll see where it goes from there.
If people still like it, I can keep generating chapters as long as people enjoy reading them.
It's such an interesting combination of what you've done, like kind of taking this thing from the most pop of pop culture and kind of the moment. and combining it with another thing of the moment, which is AI, in a new and interesting way.
And I just wonder... If you have not advice, but kind of what you learned about going after something and doing it.
And if other people are thinking about, you know, hey, maybe I could try... x plus y um how you would go about it or what you would suggest Yeah, I think deep learning, especially for someone with a background in programming, is very approachable, especially with something.
I really liked the Udacity course that I took.
And I thought it did a really good job of condensing it into a pretty short timeframe. where you can finish it in a few months.
I think you have up to six months to finish the course. it's a lot quicker than going back and getting like a master's degree or something.
And only a few universities might offer something like that.
So I think taking a course on Coursera. Udacity, that's a really good way to get started.
And if you know how to program and you can write in Python, then And it's mostly just kind of learning the algorithms behind it and understanding the theory so that you can apply the different types of models to different situations later on.
Was computer science and this kind of what you're doing now, is it something that you've always been interested in and something that you were always doing?
Were you coding Python at age eight or something?
Or what? No, I wish I was. For the most part in college, I really only programmed in like R and MATLAB.
So I didn't have... any experience programming in anything like Python or web development until my senior year in college when I was working for a tech company in town as a data scientist. just like as an intern.
So yeah, so I've only learned in the last two and a half years or so was when I started programming.
So it's doable. I mean, if you have the kind of the creativity and the focus and the interest, it's doable, it sounds like.
Yeah, definitely. Everything's out there on Google, so you just have to take the time and have the patience to sit through stuff when you don't understand it.
Because, you know, that's the hard part is not walking away when there's so much stuff out there to learn that it's almost impossible to ever learn it.
But if you just chip away at it for a while, then I think even if you have no programming experience... you could easily learn how to do the type of AI that I used in this project or any type of machine learning. final question, who sits on the iron throne in the end?
Is it John? Although he's now a secret Lannister, is it Daenerys?
I didn't hear any mention of Daenerys. Um, What do you think is going to happen?
Or what does your AI think is going to happen?
I don't think that the AI ever predicted anything about anyone sitting on the Iron Throne that hasn't already.
I like the idea of John, but I think it might be a little too obvious. on Reddit the other day, someone had a fan theory that Jaime is actually Azor Ahai and that he'll sit on the Iron Throne.
I kind of like that idea now that he has left King's Landing.
Well, he's got a long way to redemption in the Iron Throne, but I guess, you know, with your eye on the job, maybe...
We'll get there sooner rather than later.
Zach Tout, thank you so much. Yeah, thanks for having me.
It was nice talking to you guys.