text-classification · 168.59 MB WASM q8 (171.16 MB total) · 167M Params · 12-Layer mBERT · MIT

Multilingual BERT Sentiment — 5-Star Product Review Classifier

nlptown/bert-base-multilingual-uncased-sentiment (served via Xenova/bert-base-multilingual-uncased-sentiment , MIT) is a 12-layer, 167M-parameter uncased multilingual BERT model fine-tuned on 629k product reviews across six languages (EN, NL, DE, FR, IT, ES). It predicts an ordinal 1 star to 5 stars distribution offline in 168.59 MB (160.78 MiB weights; 171.16 MB / 163.23 MiB with tokenizer) q8 WASM.

Upstream Model nlptown/bert-base-multilingual-uncased-sentiment
ONNX Artifact Xenova/bert-base-multilingual-uncased-sentiment
Pipeline Task text-classification
Size & Quant 168.59 MB (171.16 MB total) · WASM q8
Params & Classes 167M · 5 classes (1 star .. 5 stars)
License & Web APIs MIT · WASM + Workers (Baseline Widely Available)

1. Live 5-Star Multilingual Review Desk

Pick a product review preset in English, German, French, Dutch, Spanish, or Italian, drop or upload a text file, paste (Ctrl/Cmd+V), or type any review below:

Drop a .txt, .md, .csv, or .json file here, or press Ctrl/Cmd+V anywhere outside editable fields. Inference runs locally in a Web Worker.
Expected Rating E[S]–
Spread σ / Entropy–
Logit Margin (top1−top2)–
WordPiece Tokens–
NaN Score Check–
Latency · BackendWASM · q8

5-Star Probability Distribution & Raw Logits

Awaiting inference
Initialize the model above to compute live 1★–5★ probabilities.

Raw logits [1★ .. 5★]: –

See Inside · 105,879-Vocab Uncased mBERT WordPiece

do_lower_case: true and tokenize_chinese_chars: true share one subword table across languages.

Run inference to inspect WordPiece tokens and vocabulary IDs.

2. Why 5-Star Ordinal Sentiment Matters

Binary sentiment models collapse lukewarm praise, mixed reviews, and furious defects into two buckets. nlptown/bert-base-multilingual-uncased-sentiment preserves a 5-point ordinal head ({"0":"1 star","1":"2 stars","2":"3 stars","3":"4 stars","4":"5 stars"}), letting apps compute both the top star class and the continuous expected rating E[S] = Σ k·P(k) across six languages with zero server round-trips.

Model-card fine-tuning counts and held-out 5,000-review accuracy per language
Language FLORES-200 Fine-Tune Reviews Exact Star Acc Off-by-1 Acc
import { pipeline } from "https://cdn.jsdelivr.net/npm/@huggingface/transformers@3.7.5";

const classifier = await pipeline(
  "text-classification",
  "Xenova/bert-base-multilingual-uncased-sentiment",
  { device: "wasm", dtype: "q8" }
);
const scores = await classifier("Great espresso grinder, quiet and solid!", { top_k: 5 });
Show the code · worker.js — classify() (171.16 MB total WASM q8 worker)
Show the code · nlptown-core.mjs — normalizeStarScores()

3. Model Card, Biases & References