mlsanityData to 7 Oct 2026

Laughing Heads: Can Transformers Detect What Makes a Sentence Funny?

arXiv 2105.09142 ↗First posted 19 May 2021cs.CL cs.AI cs.LGcited by 9

Not on the map. Why?

Abstract (arXiv)

The automatic detection of humor poses a grand challenge for natural language processing. Transformer-based systems have recently achieved remarkable results on this task, but they usually (1)~were evaluated in setups where serious vs humorous texts came from entirely different sources, and (2)~focused on benchmarking performance without providing insights into how the models work. We make progress in both respects by training and analyzing transformer-based humor recognition models on a recently introduced dataset consisting of minimal pairs of aligned sentences, one serious, the other humorous. We find that, although our aligned dataset is much harder than previous datasets, transformer-based models recognize the humorous sentence in an aligned pair with high accuracy (78%). In a careful error analysis, we characterize easy vs hard instances. Finally, by analyzing attention weights, we obtain important insights into the mechanisms by which transformers recognize humor. Most remarkably, we find clear evidence that one single attention head learns to recognize the words that make a test sentence humorous, even without access to this information at training time.

Key facts. Cited by 9 papers in the map (data through 7 Oct 2026). Builds on 12 of its 47 references that are in the map. First posted on arXiv 19 May 2021.

Builds on

12 of 47 references.

References · 12

  1. 2017Attention Is All You Needcited by 59,932
  2. 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,204
  3. 2019Sentence-BERT: Sentence Embeddings using Siamese BERT-Networkscited by 9,049
  4. 2019What Does BERT Look At? An Analysis of BERT's Attentioncited by 994
  5. 2019Attention is not Explanationcited by 916
  6. 2019Attention is not not Explanationcited by 629
  7. 2019Revealing the Dark Secrets of BERTcited by 300
  8. 2018Learning Word Vectors for 157 Languagescited by 279
  9. 2019Humor Detection: A Transformer Gets the Last Laughcited by 46
  10. 2019"President Vows to Cut <Taxes> Hair": Dataset and Analysis of Creative Text Editing for Humorous Headlinescited by 27
  11. 2019Reverse-Engineering Satire, or "Paper on Computational Humor Accepted Despite Making Serious Advances"cited by 15
  12. 2020Stimulating Creativity with FunLines: A Case Study of Humor Generation in Headlinescited by 10

Built on by

Cited by year

Citing papers per year: 2022: 3; 2023: 2; 2024: 2; 2025: 2.

9 papers.