A writers room and a lot of time are usually involved in the process of writing a television program, as humans figure out the narrative and dialogue that makes a show work.


Character and narrative development for the cult classic Stargate science fiction franchise, which covered three series (SG-1, Stargate Atlantis, and Stargate Universe), was overseen by Stargate co-creator Brad Wright. In 2021, Wright asked on Twitter whether AI could compose a Stargate episode for publication on SciFi insider site The Companion.


Laurence Moroney, Google's AI lead, replied by taking up the challenge to show what AI might accomplish. – He was originally unconcerned about AI replacing him or other writers.


"I tossed it out there to The Companion as a concept when the whole project started — I knew I had seen a number of AI models for scripts," Wright told VentureBeat. "It's amazing in some ways." It's not threatening in any other manner."


By November 2021, the first iteration of the AI-generated screenplay had been finished. The writing was intriguing, but there was a lot of nonsense, according to Wright. Moroney and Wright are now working on a second version of the screenplay, which intends to dial a new gate address for a more complex and compelling Stargate narrative.


"I told Laurence (Moroney) that if we're going to do this again, we should definitely attempt to really step up the game, and he welcomed that challenge," Wright said. "That's what blew me away because it's like, whoa... better!"


How was the Stargate AI script created?

The Stargate AI-generated screenplay was created in much the same manner that any AI model is originally constructed — by training it.

Moroney fed every Stargate episode screenplay ever produced to the AI model, giving it a corpus of every word of speech and narrative. He employed a number of tools, the most notable of which being Google's TensorFlow machine learning framework.

Moroney claimed he also employed pre-trained natural language models and a method called transformers.

"Not to be confused with the Hasbro toys, the transformers approach was originally designed for language translation," Moroney explained. "When you think about language translation, you have an input sentence that you want to match to an output sentence, and it almost seems like the perfect scenario for script creation."

'Captain Samantha Carter speaks something to General Jack O'Neil,' for example, may be an input statement. The output sentence is based on how Jack has responded in the past to input sentences comparable to the one Samantha just spoke, as determined by the transformer training.

Moroney explained, "So I could teach a transformer to predict what Jack would reply to anything."

A universal sentence encoder, which offers a numeric value for the context of a phrase, was the second fundamental technology method utilised. Moroney claimed that with this method, meaning of phrases could be quantitatively encoded, allowing users to grasp the links between words as they moved ahead and backward. The encoder, according to Wright, made the second version of the Stargate API better than the first since the script never degraded into incomprehensible nonsense.

While Moroney could have utilized different Google machine learning operations tools for further automation, he stressed that most of the Stargate script development process was manual. He gave a command to the trained TensorFlow model, which responded with a response. These replies were then entered into the script, which Moroney built by hand.

"The model wasn't throwing out a properly structured script," Moroney explained. "It was a combination of models that generated the right tags at the right moment."