bert-base-multilingual-uncased-sentiment

nlptown/bert-base-multilingual-uncased-sentiment

nlptown 916K downloads mit Text Classification
Frameworkstransformerspytorchtfjaxsafetensors
Languagesennldefrites
Tagsberttext-classificationdoi:10.57967/hf/1515
Downloads
916K
License
mit
Pipeline
Text Classification
Author
nlptown

Run bert-base-multilingual-uncased-sentiment locally on a Q4KM hard drive

Accelerate your deployment with Q4KM hard‑drives pre‑loaded with bert-base-multilingual-uncased-sentiment . Get instant, zero‑latency access on‑premise—perfect for secure environments or edge...

Shop Q4KM Drives

Technical Overview

Model ID: nlptown/bert-base-multilingual-uncased-sentiment
Model Name: bert-base-multilingual-uncased-sentiment
Author: nlptown
Downloads: 916,079
License: MIT (as stated in the README)

This model is a multilingual BERT‑base (uncased) that has been fine‑tuned for **star‑rating sentiment analysis** on product reviews. It accepts raw text in any of six languages—English, Dutch, German, French, Italian, and Spanish—and returns a discrete sentiment label ranging from 1 to 5 stars. The output is a single integer, making it ideal for downstream pipelines that require a compact, human‑readable sentiment score.

Key Features & Capabilities

  • Multilingual out‑of‑the‑box support for six major European languages.
  • Predicts 5‑point star ratings (1‑5) directly, eliminating the need for post‑processing.
  • Built on the proven BERT‑base architecture (12 transformer layers, 768 hidden units, 110 M parameters).
  • Compatible with TensorFlow, PyTorch, JAX, and the safetensors format.
  • Ready for deployment on Azure (tagged deploy:azure) and other cloud platforms.

Architecture Highlights

  • Base model: bert-base-multilingual-uncased (12‑layer transformer, 12 attention heads).
  • Fine‑tuning head: a simple linear classifier on top of the [CLS] token that maps the 768‑dimensional representation to five logits (one per star rating).
  • Uncased tokenisation using WordPiece vocabulary covering 104 k tokens across the six target languages.

Intended Use Cases

  • E‑commerce platforms that need automated star‑rating extraction from multilingual product reviews.
  • Market‑research tools that aggregate sentiment across regions.
  • Customer‑support dashboards that prioritize tickets based on sentiment severity.
  • Any downstream NLP pipeline that benefits from a compact, language‑agnostic sentiment signal.

Benchmark Performance

Sentiment models for product reviews are typically evaluated on two metrics: Exact Match Accuracy (the predicted star rating exactly matches the human label) and Off‑by‑1 Accuracy (the prediction is within one star of the true rating). These metrics reflect both strict correctness and practical usefulness, because a one‑star deviation is often acceptable for business decisions.

Reported Results (5 000 held‑out reviews per language)

LanguageExact MatchOff‑by‑1
English67 %95 %
Dutch57 %93 %
German61 %94 %
French59 %94 %
Italian59 %95 %
Spanish58 %95 %

The Off‑by‑1 scores are consistently above 93 %, indicating that the model reliably captures the overall sentiment polarity even when the exact star count is missed. Compared with monolingual BERT‑based sentiment classifiers, this multilingual version trades a modest drop in exact‑match accuracy for the convenience of a single model covering six languages, making it competitive for cross‑regional deployments.

Hardware Requirements

VRAM for Inference – The base BERT‑large model occupies roughly 420 MB of GPU memory when loaded in FP16 (half‑precision). Adding the classification head raises the total to ≈ 450 MB. For batch sizes of 1–8, a GPU with at least 4 GB of VRAM is sufficient; larger batches benefit from 8 GB or more.

Recommended GPU – NVIDIA RTX 3060 (12 GB) or higher, AMD Radeon RX 6700 XT, or any cloud GPU offering ≥ 8 GB VRAM. The model runs efficiently on both CUDA and ROCm back‑ends.

CPU Requirements – On CPU‑only inference, a modern 8‑core processor (e.g., Intel i7‑10700K or AMD Ryzen 7 3700X) can achieve ~30 ms latency per review in FP32. For production workloads, a GPU is strongly recommended.

Storage – The model files (weights, tokenizer, config) total about 440 MB. Using the safetensors format reduces load time and memory fragmentation.

Performance Characteristics – With batch size = 16 on an RTX 3070, throughput exceeds 150 reviews per second (FP16). Latency remains under 10 ms per review for batch = 1, making the model suitable for real‑time API services.

Use Cases

The model is purpose‑built for **product‑review sentiment scoring** across six European languages. Typical deployments include:

  • E‑commerce review aggregation: Auto‑generate star ratings for new reviews, enabling quick sorting and filtering.
  • Brand monitoring: Track sentiment trends across multilingual social‑media channels and forums.
  • Customer‑support prioritisation: Flag low‑star reviews for immediate human follow‑up.
  • Market‑research analytics: Combine star scores with sales data to assess product performance per region.

Because the model outputs a single integer, integration is straightforward: a REST endpoint can return JSON { "stars": 4 }, and downstream services can map the value to UI widgets, dashboards, or alerting systems.

Training Details

Methodology – The base bert-base-multilingual-uncased model was fine‑tuned using a standard classification head on top of the [CLS] token. Training employed cross‑entropy loss over five classes (1‑5 stars) with AdamW optimisation and a learning‑rate schedule (linear warm‑up followed by cosine decay).

Datasets – Product reviews were collected in six languages:

  • English – 150 k reviews
  • Dutch – 80 k reviews
  • German – 137 k reviews
  • French – 140 k reviews
  • Italian – 72 k reviews
  • Spanish – 50 k reviews

The reviews were pre‑processed (HTML stripping, lower‑casing, tokenisation) and split into 80 % training, 10 % validation, and 10 % test sets per language.

Compute – Fine‑tuning was performed on a single NVIDIA V100 GPU (16 GB VRAM) for approximately 12 hours, using a batch size of 32 and mixed‑precision (FP16) to accelerate convergence.

Fine‑tuning Capability – Because the model follows the standard Hugging Face Trainer API, users can further fine‑tune it on domain‑specific sentiment data (e.g., hotel reviews, movie ratings) with only a few hundred labeled examples.

Licensing Information

The README lists the license as MIT. The MIT license is a permissive open‑source licence that permits:

  • Commercial and non‑commercial use.
  • Modification, redistribution, and incorporation into proprietary software.
  • No requirement to disclose source code of derivative works.

Attribution – The only obligation is to retain the original copyright notice and license text in any distribution. A typical attribution statement could be:

“This work uses the model nlptown/bert-base-multilingual-uncased-sentiment (MIT License) by NLP Town.”

Restrictions – The MIT licence imposes no patent or trademark restrictions, but users should verify that any downstream data (e.g., product reviews) complies with local privacy regulations. The “unknown” tag in the Hugging Face metadata likely reflects a missing field; the explicit MIT statement in the README overrides it.

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