Skip to main content
QUICK REVIEW

[Paper Review] Applying a Pre-trained Language Model to Spanish Twitter Humor Prediction

Bobak Farzin, Piotr Czapla|arXiv (Cornell University)|Jul 6, 2019
Humor Studies and ApplicationsPsychology11 references5 citations
TL;DR

This paper proposes a fine-tuned, pre-trained language model for Spanish Twitter humor detection and regression, leveraging a large self-collected Spanish Twitter corpus (475K tweets) and label smoothing to improve generalization. The approach achieves 3rd place in humor detection (F1: 0.8099) and 2nd in regression, outperforming a strong NBSVM baseline by using transfer learning with Fast.ai and random seed optimization for model initialization.

ABSTRACT

Our entry into the HAHA 2019 Challenge placed $3^{rd}$ in the classification task and $2^{nd}$ in the regression task. We describe our system and innovations, as well as comparing our results to a Naive Bayes baseline. A large Twitter based corpus allowed us to train a language model from scratch focused on Spanish and transfer that knowledge to our competition model. To overcome the inherent errors in some labels we reduce our class confidence with label smoothing in the loss function. All the code for our project is included in a GitHub repository for easy reference and to enable replication by others.

Motivation & Objective

  • To improve humor detection and funniness scoring in Spanish Twitter using transfer learning with a pre-trained language model.
  • To overcome label noise and overconfidence in predictions through label smoothing in the loss function.
  • To enhance model generalization by treating random seed as a hyperparameter and selecting the best initialization across 20 trials.
  • To build a robust, reproducible system using a large, domain-specific Spanish Twitter corpus for language model pre-training.
  • To outperform the standard NBSVM baseline in both humor classification and regression tasks.

Proposed method

  • Pre-trained a language model on a 475,143-tweet Spanish Twitter corpus collected via tweepy, excluding retweets to reduce redundancy.
  • Applied a sequence of text cleanup functions, including handling repeated characters, ALL CAPS words, punctuation spacing, and newline normalization.
  • Used sentencepiece with byte-pair encoding (BPE) to tokenize text into subword units with a 30,000-vocabulary size.
  • Fine-tuned the language model using ULMFiT-style transfer learning, replacing the final layer with a softmax (classification) or linear (regression) head.
  • Employed label smoothing in the loss function to regularize predictions and avoid overconfidence, enabling full training without gradual unfreezing.
  • Optimized model performance by selecting the best random seed from 20 initializations and using 5-fold cross-validation on validation data.

Experimental results

Research questions

  • RQ1Can a self-collected, large-scale Spanish Twitter corpus improve humor detection performance compared to standard pre-trained models?
  • RQ2Does label smoothing in the loss function lead to better generalization and faster convergence than gradual unfreezing in transfer learning?
  • RQ3How does random seed initialization affect model performance in low-resource NLP tasks like Spanish humor classification?
  • RQ4To what extent can transfer learning with a domain-specific language model outperform a strong NBSVM baseline in Spanish humor prediction?
  • RQ5Can end-to-end training with a pre-trained language model achieve state-of-the-art results in Spanish humor detection and regression without hand-crafted features?

Key findings

  • The model achieved 3rd place in the humor detection task with an F1 score of 0.8099 on the test set, surpassing the NBSVM baseline (F1: 0.7548).
  • The best-performing model achieved a five-fold cross-validated F1 of 0.8254 on the validation set, indicating strong generalization.
  • Label smoothing enabled full training without gradual unfreezing, reducing training complexity while maintaining performance.
  • The best random seed from 20 trials improved the F1 score by 0.0016 over the first seed, highlighting the importance of initialization in model selection.
  • The system outperformed the NBSVM baseline in both F1 (0.8099 vs. 0.7548) and RMSE in the regression task, securing 2nd place.
  • The use of a 16x larger, domain-specific Spanish Twitter corpus significantly enhanced the language model’s ability to capture slang, abbreviations, and emoticons relevant to humor.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.