YAML Metadata Warning:empty or missing yaml metadata in repo card

Check out the documentation for more information.

sentiment-bert-small

Overview

sentiment-bert-small is a compact BERT-based sequence classification model fine-tuned for binary sentiment analysis (POSITIVE / NEGATIVE) on a diverse multi-domain corpus (product reviews, social posts, and short articles). The model is optimized for fast inference while maintaining strong accuracy for downstream classification tasks.

Model Architecture

  • Base architecture: BERT (12-layer, 768-hidden, 12-heads)
  • Task head: Linear classifier on [CLS] pooled output (single-label classification)
  • Tokenizer: WordPiece (uncased)
  • Fine-tuning objective: Cross-entropy loss for binary classification

Intended Use

This model is intended for:

  • Classifying short-to-medium length English text into positive or negative sentiment.
  • Backend sentiment features in analytics dashboards.
  • Research or prototyping where a balance of speed and accuracy is required.

Not intended for:

  • Multi-label emotion detection, aspect-based sentiment without further fine-tuning.
  • High-stakes applications where biased or incorrect outputs may cause harm without human oversight.

Limitations

  • Binary labels only (POSITIVE / NEGATIVE) โ€” not suitable for neutral or multi-class emotion taxonomy without re-training.
  • Potential domain shift: performance may degrade on highly specialized text (legal, medical) not represented in fine-tuning data.
  • May reflect biases present in training data (demographic, cultural, topical). Use fairness evaluation before production deployment.

Example Code

from transformers import AutoTokenizer, AutoModelForSequenceClassification, pipeline

model_id = "your-username/sentiment-bert-small"

# Load tokenizer and model
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForSequenceClassification.from_pretrained(model_id)

# Create a pipeline
sentiment = pipeline("text-classification", model=model, tokenizer=tokenizer, return_all_scores=False)

examples = [
    "I absolutely loved the product โ€” exceeded my expectations.",
    "The update made things worse; I'm very disappointed."
]

for text in examples:
    result = sentiment(text)[0]
    print(f"Text: {text}\nLabel: {result['label']}, Score: {result['score']:.4f}\n")
Downloads last month
9
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support