Can AI write an episode of Stargate? Google AI took on the challenge

We are excited to bring Transform 2022 back in-person July 19 and virtually July 20 – 28. Join AI and data leaders for insightful talks and exciting networking opportunities. Register today!

The process of writing a television show typically involves a writers room and a lot of time, as humans figure out the plot and the dialogue that makes a show work. 

For the cult classic Stargate science fiction franchise, which spanned three series (SG-1, Stargate Atlantis and Stargate Universe), character and plot development was helmed by Stargate co-creator Brad Wright. In 2021, Wright publicly posted a message on Twitter asking if it was possible for AI to write an episode of Stargate that would appear on SciFi insider site The Companion. 

None other than Laurence Moroney, AI lead at Google, responded by picking up the gauntlet to try and prove what AI could do.– though he wasn’t initially worried that AI would replace him or other writers.

“When the whole project started, I threw it out there to The Companion as an idea – I knew I had seen a couple of AI models for scripts,” Wright told VentureBeat. “In some ways, it’s fantastic. In other ways, it’s very unthreatening.”

The first iteration of the AI-generated script was completed by November 2021. The script was interesting, but there was also a lot of gibberish, Wright said. Now Moroney and Wright are collaborating again on a second version that aims to dial a new gate address for a more involved and engaging Stargate script.

“I told Laurence (Moroney) we should probably try to really step up the game if we’re going to do this again, and he accepted that challenge,” Wright said. “That’s what blew me away because it’s not just better – it’s like, whoa… better!”

How the Stargate AI script was generated

The process for producing the Stargate AI-generated script was much the same as the way any AI model is first built – by training it.

Moroney trained the AI model with every Stargate episode script ever written, providing the system with a corpus of every line of dialogue and plot. He used a variety of technologies, primarily Google’s TensorFlow machine learning framework.

He also used pre-trained natural language models, along with a technique known as transformers, Moroney said.

“Not to be confused with the Hasbro toys, the technique called transformers was primarily invented actually for language translation,” Moroney said. “If you think about the idea of language translation, you have an input sentence that you want to match to an output sentence and that almost sounds like the ideal thing for script generation.”

For example, an input sentence could be ‘Captain Samantha Carter says something to General Jack O’Neil.’ The output sentence is derived from the transformer training on how Jack has responded in the past to input sentences similar to the one that Samantha just uttered.

“So I could train a transformer to predict what Jack would say to anything,” Moroney said.

The other core technology approach used was something known as a universal sentence encoder, which provides a numeric value for the context of a sentence. With that approach, Moroney said it was possible to have semantics in the sentences be numerically encoded, in order to understand the connections between one sentence and the next, moving forward and backwards. Wright noted that, in his view, the second version of the Stargate API was better than the first because of the encoder – since the script never descended into nonsensical gibberish.

While there are various Google machine learning operations tools Moroney could have used for more automation, he emphasized that much of the process to build the Stargate script was manual. He provided a prompt to the trained TensorFlow model, which would then provide a response. Those responses were then inputted into the script, which Moroney manually assembled.

“The model wasn’t spitting out a screenplay with properly formatted text,” Moroney said. “It was a number of models generating the appropriate tags to go in at the appropriate time.

Bringing scriptwriting AI to the Google enterprise

The models and techniques used by Moroney to build out the Stargate script could be applicable to the enterprise. . However, he joked that it’s unlikely that his AI techniques will be used to write an event keynote script for Google and Alphabet CEO Sundar Pichai anytime soon.

“If I got every word that Sundar (Pichai) ever said, I could train a model on his vernacular,” he said. “If I wrote something that could help my pitch so that it’s more in his voice, than my voice, that kind of thing would be a very useful tool.”

Moroney said that for writers helping to produce the scripts used for keynotes at a corporate event, an AI model could help reduce the time needed to get the right tone for a particular speaker, but it won’t be able to do all the work.

“If you’re doing an announcement for something like Google I/O, you’re going to be talking about something new that nobody’s ever seen before,” he said. “Therefore by definition, you don’t have the data to be able to train models like that.”

Another potential way AI is now being exploited is for the production of deep fakes, which represents a non-trivial cybersecurity risk. An AI trained in the right vernacular could potentially be used to aid in the production of a deep fake, but Moroney said that he prefers to see positive uses of technology rather than negative ones.

“I personally worry a lot about deep fakes,” he said. “But I’m also optimistic that there are technologies out there that you can use to spot deep fakes and they actually are quite easy to spot with the right application of technologies.”

Stargate AI script is good, but it won’t replace humans

An often-heard concern about AI is that it will replace humans, but Moroney isn’t worried – for now. In his view, AI-assisted tools could potentially help generate the foundation for future scripts. While humans could use AI to help with parts of the process, the core storytelling and uniqueness comes from things that cannot be trained by machine learning.

Wright said emphatically that the AI-generated script is a unique idea that honors the Stargate show, but it honors the show as it was. That said, as a man that has spent his career writing about the future, there is always potential for something more.

“I think AI is going to be able to generate something eventually that will pass a test as to whether or not an audience believes it was written by humans,” Wright said. “It might not be better than the best humans, but you know, at the beginning, the best chess masters were beating the best computers and now AI beats chess masters. I’m sure that something similar could happen with this.”

The Stargate AI version 2 script, as read by the original actors from Stargate – including Richard Dean Anderson, Amanda Tapping and Michael Shanks –will premiere on The Companion on May 21.

Originally appeared on: TheSpuzz