The first theatre play written by AI

30. 5. 2021 | News

The first theatre play written by AIKarel Čapek is a Czech writer known for his invention of the word ‘robot’. His famous play R.U.R. premiered in 1921 and now, a century later, comes a play written by the artificial intelligence. The project called AI: When a Robot Writes a Play was created as a unique experiment at the Faculty of Mathematics and Physics in cooperation with Švanda Theatre and DAMU.

“This project is fulfilment of my life aspiration because it connects several things I like: Karel Čapek, artificial intelligence, language research and theatre,” said dr. Rodolf Rosa who leads the project and works at the Institute of Formal and Applied Linguistics at Charles University. “In order to use artificial intelligence in future, we first have to understand it,” he comments.

Together with his colleagues from the Institute, he created a system for automatic generation of play scripts based on machine learning. He used the language model GPT-2 from OpenAI which processed 40 GB of text from eight million webpages. The play was written 90% by the AI and only 10% was adjusted by humans. The team gave the AI only an introductory scene and the rest was generated automatically.

The play consists of eight scenes narrating a robot’s journey in the human world and it’s a mixture of black comedy and existential drama. “I was surprised by what the play says about us humans. It shows that our most common topics are violence and sex,” said David Košťák, the dramaturgist. Daniel Hrbek, the director, adds: “I was astonished that the play also reflects the time when it was written—there’re motifs of isolation, fear, anxiety and uncertainty.”

The project was a huge success but dr. Rosa already sees things for future improvement: “We discovered that it’s relatively easy to generate a play script but the main challenge was to teach the AI that characters in a play are beings with their own goals and motivations. Also, the system isn’t trained for dialogues between more people but for general texts with only one speaker.”

The team’s work doesn’t end with the play’s premiere, though. The researchers want to keep improving the system and release another play in one year.