CoolFace
Modelpublic

iamahmadyasin/humor-roberta-base

sourceHugging Facemitupdated 2mo agoView on Hugging Face
0likes10downloads
Model Card

Humor Intelligence — RoBERTa-base

A RoBERTa-base model fine-tuned to predict how funny a joke is, trained on 340k cleaned Reddit jokes from the rJokes dataset (Weller & Seppi, LREC 2020). Given a joke as input, the model outputs a single scalar which is a predicted humor score on a 0–11 scale (the dataset's log-compressed community rating).

Results

Evaluated on a leakage-cleaned test set.

ModelParamsTest SpearmanTest PearsonTest RMSE
TF-IDF + Ridge—0.363——
DistilBERT-12866M0.41180.45131.6426
RoBERTa-base-128125M0.41870.45101.7047
BERT-large340M0.4230.4631.657
RoBERTa-large-128355M0.43230.47011.6298

Paper evaluates on a test set containing ~2.4% cross-split leakage. On a comparably leaked eval, this model scores Spearman 0.4260, narrowing the gap from 0.016 to 0.009.

Leakage-cleaned evaluation

The original rJokes splits contain ~2.4% of test jokes that are exact copies of training jokes (Reddit reposts). Prior work evaluated on these leaked splits. I remove the overlap and report on the clean test set (41,957 examples). I quantified the impact:

ModelClean SpearmanLeaky SpearmanInflationPaper Spearman
DistilBERT (66M)0.4120.4210.009—
RoBERTa-base (125M)0.4190.4260.007—
BERT-large (340M)0.4230.4310.0090.430
RoBERTa-large (355M)0.4320.4400.0080.435

The average inflation is 0.008 ± 0.001 Spearman, consistent across four architectures of different sizes, confirming it is a dataset property and not a model-specific artifact.

Training details

  • —Base model: roberta-base (125M parameters)
  • —Task: Single-value regression (num_labels=1, problem_type="regression")
  • —Dataset: rJokes, cleaned (339,499 train / 41,941 dev / 41,957 test)
  • —Cleaning: removed 5,707 exact duplicates, ultra-short fragments (<5 words), and ~2.4% cross-split leakage from dev/test
  • —Max sequence length: 128 tokens
  • —Epochs: 5
  • —Effective batch size: 32
  • —Learning rate: 2e-5 with 6% linear warmup
  • —Weight decay: 0.01
  • —Precision: fp16
  • —Optimizer: AdamW (Hugging Face default)
  • —Seed: 42
  • —Hardware: Kaggle T4 ×2, ~7.5 hours

Label note

The rJokes score column is already log-scaled: round(ln(raw_upvotes + 1)), giving integers 0–11. It is used directly as the regression target. Do not log-transform again. This follows the paper's Section 3.1, which reduces the raw scale (0–136,353) down to integers 0–11 (the paper reports 0–10; labels of 11 are rare but present in the data).

Usage

python
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch

repo = "iamahmadyasin/humor-roberta-base"
tokenizer = AutoTokenizer.from_pretrained(repo)
model = AutoModelForSequenceClassification.from_pretrained(repo)
model.eval()

joke = "I told my wife she was drawing her eyebrows too high. She looked surprised."
inputs = tokenizer(joke, return_tensors="pt", truncation=True, max_length=128)
with torch.no_grad():
    score = model(**inputs).logits.item()
print(f"Predicted humor score: {score:.2f}")

Limitations

  • —Humor is subjective; the labels reflect one Reddit community's preferences, shaped by timing and virality as much as joke quality.
  • —The model regresses to the mean and is unreliable at the extremes of the score range (rarely predicts 0 or 6+).
  • —Trained on English-language Reddit jokes only.
  • —This is a humor ranker, not a judge of objective funniness.

Citation

Dataset:

bibtex
@inproceedings{weller-seppi-2020-rjokes,
    title     = "The rJokes Dataset: a Large Scale Humor Collection",
    author    = "Weller, Orion and Seppi, Kevin",
    booktitle = "Proceedings of the 12th Language Resources and Evaluation Conference (LREC)",
    year      = "2020",
    pages     = "6136--6141",
    url       = "https://aclanthology.org/2020.lrec-1.753/",
}

Project

Full project: github.com/iamahmadyasin/humor-intelligence