text-classification Ā· 67.58 MB WASM q8 (68.29 MB total) Ā· 67M Params Ā· Uncased DistilBERT Ā· Apache-2.0

DistilBERT SST-2 English — Binary Sentiment Classifier

distilbert/distilbert-base-uncased-finetuned-sst-2-english (served via Xenova/distilbert-base-uncased-finetuned-sst-2-english , Apache-2.0) is a 6-layer, 67M-parameter uncased DistilBERT fine-tuned on Stanford Sentiment Treebank v2 (SST-2, 91.3% dev accuracy). It classifies English text as NEGATIVE or POSITIVE completely offline in 67.58 MB (64.45 MiB; 68.29 MB with tokenizer) q8 WASM.

Upstream Model distilbert/distilbert-base-uncased-finetuned-sst-2-english
ONNX Artifact Xenova/distilbert-base-uncased-finetuned-sst-2-english
Pipeline Task text-classification
Size & Quant 67.58 MB (68.29 MB total) Ā· WASM q8
Params & Classes 67M Ā· 0: NEGATIVE Ā· 1: POSITIVE
License Apache-2.0

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:

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.
Inference latency–
Logit margin |zā‚āˆ’zā‚€|–
Binary entropy–
WordPiece tokens–
NaN score check–
Backend / dtypeWASM Ā· q8

Binary SST-2 Probability Distribution & Raw Logits

Awaiting inference
Initialize the model above to compute live binary probabilities.

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.

Run inference to inspect WordPiece tokens and vocabulary IDs.

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