distilbert/distilbert-base-uncased-finetuned-sst-2-english
Xenova/distilbert-base-uncased-finetuned-sst-2-english
text-classification
1. Live SST-2 Binary Polarity Desk
Pick a movie, product, support, or factual sentence preset, drop or upload a text file, paste (Ctrl/Cmd+V), or type any English text below:
.txt, .md, .csv, or .json file here, or press
Ctrl/Cmd+V anywhere outside editable fields. Inference runs locally in a Web Worker.
Binary SST-2 Probability Distribution & Raw Logits
Raw logits [NEGATIVE, POSITIVE]: ā
See Inside Ā· Uncased WordPiece Breakdown (30,522 vocab)
do_lower_case: true folds uppercase letters before greedy longest-match subword splitting.
2. Why DistilBERT SST-2 Matters ā and Its Binary Limits
Distilling BERT-base (110M params) into a 6-layer DistilBERT (67M params, 67.58 MB q8 ONNX)
cuts memory and latency roughly in half while keeping 91.3% SST-2 dev accuracy. Because SST-2 only has two
labels ({0: "NEGATIVE", 1: "POSITIVE"}), it excels at clear praise vs complaints ā yet forces
factual sentences onto one side unless checked with logit margins or a Stage 2 NLI verifier.
import { pipeline } from "https://cdn.jsdelivr.net/npm/@huggingface/transformers@3.7.5";
const classifier = await pipeline(
"text-classification",
"Xenova/distilbert-base-uncased-finetuned-sst-2-english",
{ device: "wasm", dtype: "q8" }
);
const scores = await classifier("I love transformers!", { top_k: 2 });
Show the code Ā· worker.js ā classify() (67.58 MB q8 WASM worker)
Show the code Ā· sst2-core.mjs ā normalizeScores()
3. Model Card, Biases & References
-
Upstream model card:
distilbert/distilbert-base-uncased-finetuned-sst-2-english
(Apache-2.0; notes country-name sentiment bias on neutral templates such as
"This film was filmed in COUNTRY"). - ONNX build for Transformers.js: Xenova/distilbert-base-uncased-finetuned-sst-2-english
- Base student architecture: distilbert/distilbert-base-uncased Ā· Paper: Sanh et al. (2019), DistilBERT.