Downloads · 30 days
460
67% of all-time downloads
iamahmadyasin/humor-distilbert
humor-distilbert is a text classification model from iamahmadyasin. Use it when you need a label for a piece of text. It is set up for transformers. The card lists the license as mit.
A DistilBERT 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: a predi…
Downloads · 30 days
460
67% of all-time downloads
All-time downloads
682
Public
Parameters
67M
268 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors268 MB · 100%
From the Hugging Face model README
A DistilBERT 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: a predicted humor score on a 0–11 scale (the dataset's log-compressed community rating). This is the lightweight rung of the model ladder (66M parameters), half the size of RoBERTa-base, yet within 0.007 Spearman of it.
Evaluated on a leakage-cleaned test set (see below).
| Model | Params | Test Spearman | Test Pearson | Test RMSE |
|---|---|---|---|---|
| TF-IDF + Ridge | — | 0.363 | — | — |
| DistilBERT-128 | 66M | 0.4118 | 0.4513 | 1.6426 |
| RoBERTa-base-128 | 125M | 0.4187 | 0.4510 | 1.7047 |
| BERT-large | 340M | 0.423 | 0.463 | 1.657 |
| RoBERTa-large-128 | 355M | 0.4323 | 0.4701 | 1.6298 |
Paper evaluates on a test set containing ~2.4% cross-split leakage. On a comparably leaked eval, DistilBERT scores Spearman 0.4210. Despite having half the parameters of RoBERTa-base, DistilBERT achieves nearly the same ranking performance (Spearman 0.4118 vs 0.4187) and actually produces better-calibrated magnitude predictions (RMSE 1.6426 vs 1.7047).
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:
| Model | Clean Spearman | Leaky Spearman | Inflation | Paper Spearman |
|---|---|---|---|---|
| DistilBERT (66M) | 0.412 | 0.421 | 0.009 | — |
| RoBERTa-base (125M) | 0.419 | 0.426 | 0.007 | — |
| BERT-large (340M) | 0.423 | 0.431 | 0.009 | 0.430 |
| RoBERTa-large (355M) | 0.432 | 0.440 | 0.008 | 0.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.
distilbert-base-uncased (66M parameters)num_labels=1, problem_type="regression")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)".
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
repo = "iamahmadyasin/humor-distilbert"
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}")
Dataset:
@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/",
}
Full project: github.com/iamahmadyasin/humor-intelligence