Can AI Write a Joke?

Last updated on December 28th, 2022

With the rapid rise of artificial intelligence writing assistants and tools, let’s experiment with the current generation of language models, specifically GPT-3, and see where the limits might be for them.

A sense of humor is often said to be one of the most difficult things for AI to master, so let’s see if we can get a machine to tell us a joke.

Why is it Difficult for AI to Understand Humor?

Humor is often context- and situation-dependent, so it can be difficult for a pre-trained, static neural network to identify the appropriate context and setting so that a generated punch line can hit the mark.

Jokes are commonly based on cultural references that machines may not be able to understand. Humor also often relies on understanding the audience’s experience, emotions, and background, which is something that won’t be available here.

Read the room, robot.

Topical comedy also emerges from the news or current events. The training lag of current language models means that context and information simply won’t be there. The cutoff date for GPT-3’s training data, for example, was October 2019. So don’t expect any lockdown or Wordle jokes.

Update — Nov. 28th, 2022

OpenAI has just released their latest GPT-3 model (text-davinci-003) that is now trained up to Jun 2021. So once AI writing tools upgrade to use that model maybe we will be able to write more recent jokes. Now, what was funny in 2021… hmm.

What Types of Jokes Can an AI-based Writer Generate?

Let’s run through a few common scenarios that might benefit from a little levity and see what the algorithm creates.

Wedding Speech

Yes, these are always bad, so we’re giving the AI a break by starting with a really low bar.

Prompt:

Write a humorous opening joke for a wedding speech

Results:

The output ranged from the pedestrian…

I would like to thank everyone for coming today, and to the bride and groom for finally tying the knot. It’s been a long time coming, and I’m sure it’s a relief for all of us that they’ve finally made it official.

A special thank you to those of you who traveled from far away. I know some of you had to take time off work, and others had to miss your favorite shows on TV. So, on behalf of the bride and groom, I’d like to apologize for the inconvenience.

…to a couple that got a chuckle out of me, and might actually be usable depending on the audience:

I’m not going to lie, I was really hoping this wedding would be canceled.

My husband and I were happy for twenty years. Then we met.

Business Presentation Opener

This type of humor should almost always play it safe and stay well away from offensive or spicy topics. Let’s see how the algorithm does.

Prompt:

Write a funny ice-breaker opening for a business presentation

Results:

I’m sorry I’m late, I had to drop my kids off at school and then my dog ate my homework.

Are you all ready to get this show on the road? I know I am! But before we get started, let’s all take a moment to break the ice. I’ll start. Hi, I’m Sarah and I’m really bad at keeping plants alive.

I like Sarah already.

How many of you have ever had a bad day at work? You know, one of those days where nothing goes right and you just want to crawl under a rock and hide? Well, today is NOT one of those days!

I’m sorry, I thought this was the line for the new iPhone.

Safe and inoffensive… check. Funny… maybe?

Open Mic Night Stand-Up

I’m anxious and my mouth is dry just thinking about this one. Let’s see if our AI assistant can help us out here.

Prompt:

Write a joke for an open mic night amateur stand-up routine

Results:

Many of the responses I got back were exactly the same:

Why did the chicken cross the road? To get to the other side!

Playing with some model settings I was able to get only a few others:

I was so poor when I was growing up, my parents would only give me one dollar a week. So I had to spend it wisely.

I’m not saying that I don’t like my job, but if I didn’t have to work, I would definitely not be here right now.

Why did the banana cross the road? Because he was sick of being mashed!

Why don’t scientists trust atoms? Because they make up everything.

Sure, we’ve all been to open mic nights like this, but please, I’d encourage you to bring better material than these.

Knock-Knock Joke for Kids

Prompt:

Write a knock-knock joke for kids

Results:

Knock knock

Who’s there?

Orange

Orange who?

Orange you going to answer the door or what?”

This is the only response I could get, even after many settings changes and trying different prompts. I mean, it is a classic though!

Does More Context Help AI Joke Writing?

I was curious if adding context to the prompt could help, so I fleshed out the scene for the wedding speech a bit more:

Prompt:

I’m the father of the bride and I need to give a speech at an afternoon wedding ceremony which is being held at a historic park by the seaside. Write a humorous, self-deprecating opening joke for my wedding speech to the 50 attendees which include family, friends, and coworkers

Results:

I’m not usually one for public speaking, but I’m glad to be here today to give my daughter away. I’m sure she’ll be much better off without me.

#dadjokes

I’m not used to being the center of attention, so bear with me while I try to get through this speech without embarrassing myself. Or my daughter. Or my soon-to-be son-in-law. Wish me luck!

Will require some good timing… but sweet.

I’m not going to lie, when my daughter first told me she was getting married, I was a little disappointed. I was hoping she’d choose a more traditional path, like becoming a doctor or a lawyer. But I guess you can’t choose your children’s life partners for them. Anyway, I’m just kidding. I’m actually very happy for my daughter and her new husband. I’m sure they’ll be very happy together.

You can almost hear the groans and eye rolls. “Not ok, dad!”

I’m not sure what I’m doing here. The last time I was at an altar, I was the one getting married. Though, I suppose it’s fitting that I’m giving away my daughter on a beach. If you think about it, it’s really just another form of tide pooling.

Um, what? Ok, now I’m wondering if one of Dad’s meds has a drug interaction with Prosecco.

With the additional context to draw on, the responses are more situationally relevant for sure; recognizing a “father of the bride” could have a daughter, and a “seaside” has a beach. But are they funnier? Maybe cringier, but I guess that’s typical of family gatherings and wedding days. Nailed it!

So, is it Funny?

Yes, AI can write a joke, but whether or not it’s genuinely funny is another question. Without context or any insight into a specific audience, there isn’t much to work with and the AI-based jokes lose nuance and average down into a form of generalized humor. Then again, I can’t remember the last time I wrote a good joke either.

Another observation from my brief experiments is that I didn’t notice any wordplay or puns in responses. Even when specifically asking for puns on various topics, the results missed the mark and at times were nonsensical. I expect that type of humor would take a fairly deep level of language understanding.

With GPT-4 on the horizon in a couple months, we’ll give this experiment another shot and see if the new model and data science advancements can do any better. Only time will tell if AI will be able to write jokes that make us actually LOL!