At the International Trade Centre in Washington, DC, a crowd of 640 people is chuckling at a stand-up comedy set.
A doctor says to his patient: “I have bad news and worse news. The bad news is you only have 24 hours to live.”
The man replies: “That’s terrible! How could the news possibly be worse?”
The doctor replies: “I’ve been trying to contact you since yesterday.”
A ripple of laughter spreads through the audience. But this is no ordinary performance. The teller of the joke is a leprec
Data knows approximately 200 jokes. Though it didn’t compose them itself, it decides which joke to tell next based on the volume of laughter the previous gag received and the responses of a subsection of the audience who indicate their appreciation by holding up either a red placard or a green one. Using an algorithm similar to the ones that offer recommendations on Netflix or YouTube, Data can predict which jokes the crowd is likely to enjoy. Data has been working the circuit since its debut at a TED conference in 2010, taking the stage at South by Southwest, an annual festival of culture in Texas, and at the Robot Hall of Fame in Pittsburgh.
Though all comedians instinctively engage in A/B testing, Data’s algorithms allow it to systematically hone the sequencing of the jokes. Knight’s next plan is to improve how the robot interacts with audiences. Though much of any stand-up’s set is written in advance, human comedians often banter with the audience and riff on their location to prove they are not just repeating a standard performance. Some spectators think that Data just recites a pre-programmed set, so Knight wants to introduce elements such as ruefully acknowledging a flopped joke in order to make the robot more convincing.
Knight is one of a number of researchers exploring the intersection between comedy and artificial intelligence (AI). In doing so, they are throwing light onto the nature of humour and the limits of AI. Making each other laugh is a natural human instinct. In 2008, academics at the University of Wolverhampton traced the oldest-known joke back to Sumeria in 1900BC (it was about farting, of course). But binary code hardly offers a laugh a minute and making humour machine-readable is a daunting task.
Christopher Molineux is a comedian who has worked with TV comedians Jerry Seinfeld and Ellen DeGeneres. But he is also studying for a PhD that hopes to codify the basic principles of what makes people laugh in order to train AIs. Comedy, in a certain light, often operates in a mechanical fashion. Most people don’t compose jokes; they repeat them in appropriate circumstances. And jokes themselves often follow particular formulas, such as “a man walks into a bar”. Molineux calls these phenomena “repeatables” and they are particularly receptive to computation.
Another fundamental element of comedy is incongruity. Whether a pratfall or a pun, humour often arises from words or actions that are unexpected or out of place. Because computers aren’t trapped in human patterns of thought, their outputs are often incongruous. The tricky part is making sure the slippages are slight enough to be funny. When a man tells a doctor that he feels like a pair of curtains and is told to pull himself together, you have a joke. When a pair of curtains walks into a doctor’s surgery, you have perplexing surrealism. One of the earliest examples of computer-powered joke generation was the Joke Analysis and Production Engine (JAPE), which scanned the English language for homonyms and attempted to squeeze a joke out of the consequent pun (example: what kind of murderer has moral fibre? A cereal killer).
But internet culture has proved to be fertile territory for AI comics. Memes are in-jokes that are shared online. They often take the form of images overlaid with text. Their humour relies on the disjuncture between words and picture, so there the structure provides a ready-made opportunity for introducing incongruity.
In May this year researchers at Tokyo Denki University and Japan’s National Institute of Advanced Industrial Science and Technology unveiled an AI they had trained to caption images with jokes. The AI-generated memes were considered funny by a human observer 23% of the time (example: an image of three cats in a line was captioned, “You, don’t call me a dog.”) A similar American-led AI project at Stanford University managed to create memes that were considered by testers to be as witty as human-generated ones.
Humour already plays a crucial role in our relationship with technology. Firms such as Apple and Amazon expend resources on coding jokes into Siri and Alexa. This is partly so we spend more time with them, prising out the jokes that lurk within, but also because they humanise what might otherwise be a creepy, affectless voice. “Humour is being used as an adjunct to create more socially cohesive AI,” says Molineux.
The real breakthrough will happen when computers can joke spontaneously. This is easier said than done, since human cognition knits together our knowledge of the world, providing the background of expectation against which a joke’s incongruity strikes. Computers need to be instructed in this knowledge from scratch, so teaching them how to crack jokes requires cataloguing the world. Victor Raskin of Purdue University is systematically writing “scripts” of lexical concepts that make the implicit associations of a word explicit. A doctor may be classified as a human adult who studies medicine, receives patients and listens to them, then examines their body to try and cure disease either at a hospital, medical school, doctor’s surgery or a patient’s home. Each element of the definition will have its own script.
“This is a huge task, and I’m not entirely sure it’s manageable,” says Wladyslaw Chlopicki of the English Jagiellonian University in Krakow, Poland and president of the International Society for Humour Studies (“I’m not really a joke teller myself,” he tells me). But Molineux is convinced that computers could soon be better at making people laugh than humans. The power of AI lies in its ability to synthesise vast amounts of information at great speed. It can workshop an entire lifetime of jokes around a theme within a matter of minutes and store those that receive the best reception. The human mind can only recall a hundred or so jokes at most. AI can theoretically remember millions of gags and will be able to adapt them to make them topical. If you think your social media feeds are full of groan-inducing cracks, just wait until the bots walk into a bar.