CoolFace
Modelpublic

Saana2005/distilbert-imdb-sentiment-classifier

sourceHugging Faceupdated 16d agoView on Hugging Face
0likes22downloads
Model Card

DistilBERT IMDb Sentiment Classifier

This model is a fine-tuned version of `distilbert-base-uncased` for binary sentiment classification of English IMDb movie reviews. It predicts either NEGATIVE or POSITIVE.

The uploaded checkpoint is the seed-42 model, selected because it achieved the highest validation accuracy among three independently trained seeds.

Model details

ItemValue
ArchitectureDistilBERT for sequence classification
Parameters66,955,010
LanguageEnglish
ClassesNEGATIVE, POSITIVE
Maximum input length256 tokens
FrameworkPyTorch / Transformers
Base modeldistilbert/distilbert-base-uncased

Intended use

The model is intended for educational experiments and binary sentiment classification of English movie reviews. It can be used through the Transformers pipeline:

python
from transformers import pipeline

classifier = pipeline(
    "text-classification",
    model="Saana2005/distilbert-imdb-sentiment-classifier",
)

result = classifier(
    "The movie was emotional, engaging, and beautifully acted.",
    truncation=True,
    max_length=256,
)
print(result)

Training data

The model was trained with the `stanfordnlp/imdb` dataset.

SplitExamplesPurpose
Training20,000Parameter updates
Validation5,000Best-checkpoint selection
Test25,000Final evaluation
Unsupervised50,000Not used

The official 25,000-example training split was divided with fixed split seed 2026. The official test split was kept separate from model training and checkpoint selection.

Training procedure

HyperparameterValue
Epochs2
Training batch size32
Evaluation batch size64
Learning rate2e-5
Weight decay0.01
Warmup10% of training steps
OptimizerAdamW
SchedulerLinear decay
PrecisionFP16
Random seed42
Selection metricValidation accuracy

Evaluation

The uploaded seed-42 checkpoint produced:

MetricResult
Best validation accuracy91.44%
Test accuracy91.14%
Test F191.15%

Three runs with seeds 7, 42, and 123 achieved mean test accuracy of 91.16% ± 0.02% and mean test F1 of 91.21% ± 0.07% (sample standard deviation).

Limitations

  • —The model handles only two sentiment classes and cannot represent neutral or mixed sentiment directly.
  • —It was trained on English movie reviews and is not a general-purpose emotion or opinion classifier.
  • —Inputs longer than 256 tokens are truncated, so important conclusions near the end of a long review may be omitted.
  • —Sarcasm, conflicting opinions, plot-heavy language, and annotation noise can cause errors.
  • —Confidence scores are model probability estimates, not guarantees that a prediction is correct.
  • —The model may inherit biases present in its pretrained model and IMDb data.

Source code

Training, evaluation, error-analysis, Slurm, command-line inference, and Gradio code are available in the `Sana1025/distilbert-imdb-sentiment-classifier` GitHub repository.