DistilBERT IMDb Sentiment Classifier (V3)

Model Description

This model is a fine-tuned version of distilbert/distilbert-base-uncased for binary sentiment classification of English movie reviews.

It was developed as an independent Hugging Face learning project, covering dataset preparation, tokenization, fine-tuning, checkpoint selection, evaluation, and model publishing.

The model predicts two sentiment labels:

  • NEGATIVE (0)
  • POSITIVE (1)

Training Dataset

Dataset: IMDb Movie Reviews

The training and validation samples were drawn from the official IMDb training split.

Split Samples
Training 5,000
Validation 1,000
Independent test subset 200

The training and validation datasets were balanced across positive and negative classes.

The test subset was sampled from the official IMDb test split, with 100 examples per class.

Training Configuration

Parameter Value
Base model DistilBERT Base Uncased
Epochs 3
Training batch size 16
Evaluation batch size 16
Learning rate 2e-5
Weight decay 0.01
Maximum sequence length 128
Learning rate scheduler Linear
Warmup steps 94
Random seed 42
Model selection metric Validation Macro F1
Best checkpoint Step 939
Training device CPU

The model was trained using Hugging Face Transformers and PyTorch.

Evaluation Results

Validation Results

Metric Value
Accuracy 0.8500
Macro F1 0.84998
Loss 0.42117

IMDb Test Subset (200 Samples)

Metric Value
Accuracy 0.86
Macro F1 0.86
Negative Recall 0.84
Positive Recall 0.88

Confusion matrix:

[[84, 16],
 [12, 88]]

These results are based on a small, balanced subset of the official IMDb test split. They should not be interpreted as performance on the complete IMDb benchmark.

The same test subset was also used for comparison with earlier experimental versions, so these results are exploratory rather than a fully untouched final benchmark.

Usage

from transformers import pipeline

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

result = classifier(
    "This movie was absolutely fantastic!"
)

print(result)

Replace YOUR_USERNAME with the actual Hugging Face account name after publishing.

Limitations

  • Designed for English movie-review sentiment classification.
  • Supports only positive and negative labels.
  • Does not explicitly recognize neutral sentiment.
  • Input text is truncated to 128 tokens.
  • Performance may degrade on other domains.
  • Evaluation was conducted on a limited test subset.
  • Intended primarily for learning and demonstration.

License

Apache-2.0, following the base model's license.

Project Scope

This is an independent Hugging Face learning project and does not depend on an external GitHub repository.

Downloads last month
29
Safetensors
Model size
67M params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for YueranCao2001/distilbert-imdb-sentiment-v3

Quantized
(105)
this model

Dataset used to train YueranCao2001/distilbert-imdb-sentiment-v3

Space using YueranCao2001/distilbert-imdb-sentiment-v3 1