Can Computers Learn to Be Funny?

Aeyrel Twone
6 min readAug 10, 2023
Photo by Tianyi Ma on Unsplash

Check out this machine-made joke: “Why did the chicken cross the road? To see the punchline.”

When people think about AI getting better, they often imagine the worst: like machines becoming super smart and trying to take over the world.

But what if all our machines wanted to do was crack some jokes?

As machines become a bigger part of our lives, I think they should have more personality. We all know how annoying it is when a phone call drops or a program crashes. Your computer doesn’t really understand or care about that. But adding a bit of humor could help us get along better with our tech.

So, how do you make a computer crack a joke? Humor is kinda hard for computers. Basically, there’s no surefire way to make something funny. You can follow instructions to bake a cake or build a chair, but making a really good joke doesn’t have a recipe. But if we want our machines to be funny, we gotta figure something out, ’cause computers always follow the rules. This is the big challenge of making computers funny.

To do this, you gotta break down why a joke is funny. Then you turn those ideas into rules and put them into computer code. But, you know, humor’s a bit like spotting something… well, you know it when you see it. Like this joke from a British comedian named Lee Dawson: “My mother-in-law fell down a wishing well the other day. I was surprised — I had no idea that they worked!” Figuring out why this joke is funny isn’t so simple (and some mothers-in-law might not find it funny at all). There’s this whole cultural context thing that comes into play. So, does this mean we’d have to teach a joke-telling computer all the knowledge and experiences of a whole society?

So, here’s the thing: some researchers are trying a different way. Like this guy Abhinav Moudgil, who’s studying at the International Institute for Information Technology in Hyderabad, India. He’s usually into computer vision stuff, but he’s been playing around with making computers crack jokes when he’s not busy. Moudgil’s been using this thing called a “recurrent neural network,” which is like a fancy computer brain. It’s different from the old-school way of making computer jokes, kinda like the difference between showing and telling a story.

You see, with the old way, the programmers had to do most of the heavy lifting. They had to work super hard to write out specific instructions for the computer. It was like giving it a script to follow. The computer’s creativity was a bit limited, and the jokes it made were kinda similar. The results are decent but closer to what kids — not adults — might find hilarious.

Here are two examples:

“What is the difference between a mute glove and a silent cat? One is a cute mitten and the other is a mute kitten.”

“What do you call a strange market? A bizarre bazaar.”

Okay, so when we’re talking about neural networks, it’s like this: instead of us telling the computer what to do, we give it a whole bunch of examples, like tons and tons of them. The computer looks at all these examples and figures out patterns on its own. (This is the same way computers “learn” how to recognize particular images.)

But here’s the thing: computers don’t see stuff the way we do. They see things as numbers and look for patterns in those numbers. How many times they look at the examples, called “iterations,” is super important. If they look too few times, they might not learn enough. But if they look too many times, they might learn some extra stuff that’s not useful.

For example, if you want the computer to know what a flamingo looks like, but you keep showing it flamingo pictures over and over again for too long, it might get really good at recognizing just those pictures and not really understand what flamingos look like in general.

So, here’s what Moudgil did: He gathered a bunch of really short jokes from all over the Internet, like a treasure hunt. Then, he gave these jokes to his computer, and the computer looked at each joke really closely, like looking at each letter one by one. But it didn’t look at how the words sounded together, like wordplay. Instead, it noticed how often certain letters came after other letters. And based on that, it came up with its own jokes that followed similar patterns.

For example, lots of jokes in the collection started with “What do you call…” or “Why did the…”. So, the computer learned that after the letter “w”, the letter “h” was usually next. And then, after “wh”, there was often a “y” or an “a”. And you can bet that after “wha”, the letter “t” usually came right after.

His computer came up with a bunch of jokes — some were really bad, like cringe-worthy, some were just awful, and a few were like, “Yeah, that’s kinda okay.” Check these out:

“I think hard work is the reason they hate me.”

“Why can’t Dracula be true? Because there are too many cheetahs.”

“Why did the cowboy buy the frog? Because he didn’t have any brains.”

“Why did the chicken cross the road? To see the punchline.”

Some of them sound more like those mind-bending Zen riddles than actual jokes. It’s because Moudgil trained his computer with all sorts of different humor. Now, don’t get me wrong, he’s not exactly scoring a job as a stand-up comedian, but he’s feeling optimistic about it. He’s planning to keep at it, and get this, he’s shared his collection of jokes so others can give it a shot too. He wants everyone in the machine learning gang to know that “hey, a neural net can do some pretty cool joke science.”

For his next trick, Moudgil’s gonna teach his computer some English grammar before hitting it with a bunch of jokes. The idea is that this way, the computer’s jokes won’t sound so wacky and nonsensical. So, maybe fewer head-scratching moments and more laughs.

Some folks out there are trying to copy a comedian’s vibe. Take He Ren and Quan Yang from Stanford University, for instance. They got a computer to learn how to crack jokes just like Conan O’Brien.

Their model generated these one-liners:

“Apple is teaming up with Playboy in the self-driving office.”

“New research finds that Osama Bin Laden was arrested for President on a Southwest Airlines flight.”

Yeah, the outcome kinda sounded more like Conan after a few drinks than the actual Conan. Ren and Yang figured that only about 12 percent of the jokes actually got a chuckle (according to human ratings), and some of those funny ones only got laughs because they were super crazy.

So, it’s pretty clear that there’s still a bunch of stuff to figure out before researchers can high-five each other and say they’ve cracked the humor code. “These efforts kind of sum up where we’re at with computational humor right now. It’s got potential down the road, but it’s a bit of a bummer in the meantime,” says Misra (a data scientist at Netflix and consultant to HBO’s Silicon Valley). But if we’re ever gonna make AI that thinks like humans, we’ll have to figure out how to teach it to be funny. And once we do that, who knows, maybe our worries about robots taking over will just turn into a good ol’ belly laugh.

--

--

Aeyrel Twone

Hi, I'm Aeyrel. I'm a writer and storyteller with a passion for exploring the world around me. I love to write about my experiences and turn them into stories.