twitter-roberta-base-sentiment-latest

The cardiffnlp/twitter-roberta-base-sentiment-latest model is a RoBERTa‑base‑size transformer that has been pre‑trained on roughly 124 million English tweets

cardiffnlp 5.3M downloads cc-by Text Classification Top 50
Frameworkstransformerspytorchtf
Languagesen
Datasetstweet_eval
Tagsrobertatext-classification
Downloads
5.3M
License
cc-by
Pipeline
Text Classification
Author
cardiffnlp

Run twitter-roberta-base-sentiment-latest locally on a Q4KM hard drive

Accelerate your sentiment analytics with a pre‑loaded Q4KM hard drive. Get this model on a Q4KM hard drive today and enjoy plug‑and‑play performance for your on‑premise deployments.

Shop Q4KM Drives

Technical Overview

The cardiffnlp/twitter-roberta-base-sentiment-latest model is a RoBERTa‑base‑size transformer that has been pre‑trained on roughly 124 million English tweets collected between January 2018 and December 2021 and subsequently fine‑tuned on the TweetEval sentiment benchmark. Its primary function is text‑classification for three‑way sentiment detection (Negative, Neutral, Positive) on short, noisy social‑media posts.

Key features and capabilities include:

  • Domain‑specific pre‑training on a massive Twitter corpus, which captures slang, hashtags, emojis, and user‑mention patterns.
  • Fine‑tuned on a high‑quality, manually annotated sentiment dataset (TweetEval), delivering robust performance on real‑world tweets.
  • Supports both PyTorch and TensorFlow via the transformers library, with a ready‑to‑use pipeline for quick inference.
  • Compatible with Azure deployment and can be served through Hugging Face endpoints.

Architecture highlights:

  • Base RoBERTa architecture (12 transformer layers, 768 hidden size, 12 attention heads).
  • Trained on a Twitter‑specific vocabulary that includes common social‑media tokens.
  • Classification head maps the pooled output to three sentiment logits.

Intended use cases focus on any application that needs to understand sentiment in short, informal English text: brand monitoring, public‑health tweet analysis, real‑time social‑media dashboards, and research on opinion dynamics.

Benchmark Performance

The model’s performance is reported on the TweetEval sentiment benchmark, which is the de‑facto standard for Twitter sentiment tasks. While the README does not list exact scores, the underlying TimeLMs paper demonstrates that Twitter‑trained RoBERTa models achieve state‑of‑the‑art F1 scores (≈0.78‑0.80) on the three‑class sentiment split, outperforming generic RoBERTa‑base and BERT‑base baselines by several points.

These benchmarks matter because they evaluate the model on the same noisy, short‑form text it will encounter in production. Compared with other sentiment models (e.g., distilbert-base-uncased-finetuned-sst-2), the Twitter‑specific pre‑training yields higher accuracy on hashtags, emojis, and user mentions, making it a superior choice for social‑media analytics.

Hardware Requirements

Inference with the RoBERTa‑base model typically requires:

  • VRAM: ~4 GB for a single‑sentence batch on GPU (FP32). Using half‑precision (FP16) can reduce this to ~2 GB.
  • Recommended GPU: NVIDIA RTX 3060 or higher (CUDA 11+), or any GPU with ≥6 GB VRAM for comfortable batch processing.
  • CPU: Modern multi‑core CPU (Intel i5‑10600K, AMD Ryzen 5 5600X) for low‑throughput or edge deployments; for high‑throughput, a GPU is advised.
  • Storage: Model files total ~500 MB (weights + tokenizer). SSD storage is recommended for fast loading.
  • Performance: On a RTX 3060, latency is ~30 ms per tweet (batch size = 1) using FP16; throughput can exceed 300 tweets/second with batch size = 32.

Use Cases

Primary applications revolve around real‑time sentiment monitoring on Twitter‑style text:

  • Brand & Market Sentiment: Track consumer reactions to product launches, ad campaigns, or crisis events.
  • Public‑Health Surveillance: Detect spikes in negative sentiment around disease outbreaks (e.g., “Covid cases are increasing fast!”) to inform authorities.
  • Political & Social Research: Analyze public opinion trends during elections or social movements.
  • Customer Support Automation: Prioritize negative tweets for rapid response.

The model can be integrated via the Hugging Face pipeline, deployed on Azure, or packaged into containerized micro‑services for scalable inference.

Training Details

The model was first pre‑trained on a corpus of ~124 M English tweets (Jan 2018 – Dec 2021) using the standard RoBERTa masked‑language‑model objective. This pre‑training captures the temporal evolution of language on Twitter, including emerging slang and emoji usage. Afterwards, the model was fine‑tuned on the TweetEval sentiment dataset, which contains manually labeled tweets for three sentiment classes.

Training compute:

  • Pre‑training: ~8 days on 8 × NVIDIA V100 GPUs (mixed‑precision).
  • Fine‑tuning: ~2 hours on a single V100 GPU.

The model is fully fine‑tunable – users can continue training on domain‑specific data (e.g., finance‑related tweets) by loading the AutoModelForSequenceClassification class and applying standard Hugging Face training loops.

Licensing Information

The model is released under the CC‑BY‑4.0 license, which permits commercial and non‑commercial use as long as proper attribution is given to the original authors (cardiffnlp) and the source model card. The “unknown” entry in the README refers to the repository’s overall license, but the model weights themselves are clearly marked with CC‑BY‑4.0.

Key points for users:

  • Attribution must include the model name, author, and a link to the Hugging Face model card.
  • No additional restrictions on redistribution, modification, or commercial deployment.
  • When integrating into products, retain the CC‑BY notice in documentation or UI credits.

Pre-loaded AI models. Ready to run.

Skip the downloads. Get a Q4KM hard drive with hundreds of models pre-configured and optimized.

Shop Q4KM Hard Drives