A robot walks into a bar. "What can I get you?" the bartender asks. "I need something to loosen up," the robot replies. So the bartender serves him a screwdriver.
Ba dum tss.
This joke is about as basic as humor can get, and would probably merit only the most tepid of chortles at a comedy club. And yet this simplistic style of joke-telling is the perfect jumping off point for one of the most exciting and ambitious efforts in the artificial intelligence research community: the quest to develop funny robots.
To clarify, I'm not talking about the the unintentionally funny kind of robot, though "robot fail" videos are undeniably hilarious. Rather, AI researchers are working to create robots and computers that are in on the joke, able to detect various shades of wit from their human companions, and to fire back in turn with their own wisecracks.
This compulsion to create funny robots goes back thousands of years, and has become a major trope in modern science fiction. We've seen depictions of percentage-scaled humor in the robot TARS from Interstellar, or humor as a form of therapy for Douglas Adams's Marvin the Paranoid Android. Jokes are learned through trial-and-error by the supercomputer Mike in Robert Heinlein's The Moon is a Harsh Mistress, and through wry observation by the humanoid Ava in Ex Machina. Then, there's Futurama's litany of hilarious robots, from Bender, to Hedonismbot, to Humorbot 5.0. Hell, even the Terminator has to learn a few basic punchlines from John Connor in Terminator 2.
Humor requires mastery of sophisticated functions like self-awareness, empathy, spontaneity, and linguistic subtlety
We have clearly been psyching ourselves up for joke-compatible computers for a long time, so it's no wonder that real AI researchers are on the case. Some specialists even see humor as the final frontier for artificial intelligence, because it requires mastery of sophisticated functions like self-awareness, empathy, spontaneity, and linguistic subtlety.
Of course, therein lies the challenge. "Anything that is inherently human is always very difficult to translate into a computer," Julia Taylor, a professor at Purdue Polytechnic and an expert on computational humor, told me over the phone.
"From the psychological point of view, we are not quite sure what it takes," she said. "What kind of sense of humor will people have? What is appropriate; what is not appropriate? Maybe today, you will appreciate joke X but two days from now, you won't appreciate it anymore. What are the characteristics of this appreciation? What is it that is going to make us find something funny or not?"
"All of those difficulties are there before you can actually get an AI type humor."
_Fallout 4 funny robot demonstration. Video: Kotaku/YouTube_
Indeed, these obstacles are compounded by the fact that we don't really understand our own comedic tastes and impulses, which makes it tricky to contextualize them for a computer. Despite our best efforts to explain the mysterious evolution and prominence of humor across every human culture, the core mechanisms behind it still remain elusive (as Bender would put it: "your best is an idiot").
So how can we teach a robot how to give and receive laughter, if we don't quite grasp the reasons we do so ourselves?
"When humans find something funny, we may not know why it is funny," Taylor said. "We are working on the theory of humor, on trying to define all of the subsets of it. We're not quite there. There are a lot of methodologies towards theories, but most people will agree that those theories are not fine-grained enough to be implemented by a computer. Not yet."
That means that for the time being, joke-telling computers are limited to very confined comedic parameters, like the formulaic "X walks into a bar" format that kicked off this piece. There are already plenty of artificial joke generators out there that can tackle these lower forms of wit, from the Double Entendre via Noun Transfer (DEviaNT) program, which tells "that's what she said" jokes, to LIBJOB, which generates light bulb jokes. Examples of computer-generated jokes include gems such as this one, written by a computer at Edinburgh University:
Q: What kind of line has sixteen balls?
A: A pool cue!
As you might note, computers lack some of the finesse it takes to pull off these jokes, because they don't understand why a certain linguistic pattern is funny in the first place.
"Most humor system jokes are simply verbal replication of something that is pre-programmed," Christopher Molineux, a professional comedian and humor researcher, told me over email. "This kind of thing can be impressive if the device is able to put the joke in good situational context, but that is more about the placement of the joke than the joke itself."
Similarly, programs designed to detect humor in humans, such as the sarcasm detector SASI, need clear instructions about what kind of linguistic patterns point to an attempt at humor. "If you want to program something that detects jokes dynamically, you have to insert some sort of an algorithm," Taylor explained. "You have to show a rule. Select text based on X, Y, X that you think is humorous."
In this way, artificial humor generators have gotten to the point where they can recognize and emulate the cadence and structure of formulaic jokes, but of course, they do not understand why those jokes are funny.
Indeed, in researching this piece, I noticed that the funniest thing about these robo-jokers is their their bizarre comedic framing, rather than the content of their one-liners. For example, take this fantastic joke from the System To Augment Non-speaker's Dialogue Using Puns (STANDUP) software.
Q: What do you get when you cross an optic with a mental object?
A: An eye-dea.
This joke is hilarious to me, because I can't imagine a human ever opening with such a weird setup question. This particular pun formula usually pairs questions like "what do you get when you cross a cow and a trampoline?" with answers like "a milkshake." But in STANDUP's joke, the setup is so intense and cerebral that it seems to emphasize the arbitrariness of that underlying formula.
Likewise, this standup performance of a Nao robot named Data, accompanied by roboticist Heather Knight, evokes an uncanny valley sense of humor (Data's set begins at the three minute mark).
_Heather Knight, "Silicon-based comedy" TED Talk. Video: TED/YouTube_
Again, I found the performance to be funny, but it was more due to Data's halting delivery and posture than the content of the jokes.
Robots are already pioneering their own comedic stylings
My point here is that computers and robots are already pioneering their own comedic stylings, as an accidental byproduct of learning the fundamentals of humor in humans. Computational humor may primarily be an effort on the part of the artificial intelligence community, but it also stands to enrich the comedy world with an unusual outsider perspective.
"Robots and all other modes of digital humor systems have the ability to create their own distinct styles of humor," Molineux said. "An interconnected digital humor system would be able to access vast, flexible databases of verbal and nonverbal comedy and have parameters to help them determine the who/what/when/where of being successfully amusing."
"They also have performance abilities that are beyond human expression, such as extreme changes of the pitch and speed of their voice, and they can make the sounds of a trumpet or a trout, or spit out famous quotes in the voice of that famous person," he added. "All good comedy fodder."
That said, robots will need to understand their own jokes before the biggest gains for both comedy fans and AI experts will be realized. It's one thing to generate puns based on an algorithm, and another to implicitly understand why people react to those jokes with groans, laughter, or pin-drop levels of icy silence.
"The overall discussion is more along the lines of what will it take for a computer to get those jokes," Taylor said. "Not just the low hanging fruit. The actual humor."
"People typically disagree on what it takes," she continued. "Some people think that if we have high enough computer power, we'll be able to track all the data that is available online, and come closer to an understanding of language for humor detection and generation. Some people think that there has to be a true semantic engine behind it. Some people think that psychological features of humans must be understood, and some people think, maybe not."
I asked Taylor what her own parameters would be for determining when artificial humor has finally arrived. "I'm not sure that we'll know when a computer achieves humor perfectly," she cautioned, "but probably when it's capable of generating responses to situational humor rather than getting information from familiar jokes. Not template-based—just on its own, getting the joke without seeing anything like that before."
The applications of this kind of artificial intelligence boggle the mind. Will our robot companions become more socially ingrained in our lives thanks to their witty repartee? Will phones be programmed to sarcastically mock us if we try to text an ex? When will we get our first robot late night talk show host?
For his part, Molineux thinks advances in AI joke-telling could revolutionize multiple entertainment platforms, especially the immersive worlds of video games.
"If gamers within a specific gaming circle were given the ability to make their own comic adaptations to situations and share them with others, their preferences could be monitored and you could achieve an evolving comic nature within the game," he explained. "Ultimately, this is what comedy is all about. Even the best lines you hear in a game get tired and unfunny after you hear them too many times. If new options of visual and verbal humor were continuously rolled out and used in combination with played controlled adaptations you could create something pretty amazing (and amusing)."
"It would take some time to implement systems like this but much of the technology is already there," he added. "It is our understanding of the finer mechanisms of humor and the creation of an adaptable taxonomy of humor that needs work."
It's hard to predict exactly how much work will be needed to endow robots with such sophisticated comedy chops, or what kind of timeframe we should expect before games can adapt to every player's unique sense of humor.
But given that many of us have already exchanged some solid banter with Siri, it seems likely that computational humor will continue to burst free from the rigid frameworks of puns, double entendres, and other formulaic joke formats over the coming years.
The robots are here to kill all right, but it look like they'll do so at comedy clubs, not battlefields.