Multi-model · DistilBERT Cased (67.20 MB q8 · Apache-2.0) → DistilBERT SST-2 Sentiment (68.29 MB q8 · Apache-2.0)

2-Stage DistilBERT Audit: Cased Cloze Fill × SST-2 Sentiment Polarity

Chain two 6-layer DistilBERT models locally off-main-thread (135.49 MB combined WASM q8): Stage 1 (distilbert/distilbert-base-cased via Xenova/distilbert-base-cased, 67.20 MB, Apache-2.0) generates top-K [MASK] substitutions, then Stage 2 (distilbert/distilbert-base-uncased-finetuned-sst-2-english via Xenova/distilbert-base-uncased-finetuned-sst-2-english, 68.29 MB total / 67.58 MB ONNX, Apache-2.0, reusing ../distilbert-base-uncased-finetuned-sst-2-english/worker.js) classifies every substituted sentence to expose polarity flips and raw logit margins.

Why Pair Cased Fill-Mask with SST-2 Sentiment? An ambiguous [MASK] slot in a review or earnings note can rank both positive and negative candidates in its top-K fills. Stage 2 runs off-main-thread SST-2 scoring across every substituted sentence so you can measure exactly which candidate flips polarity and how wide its logit margin |z_pos - z_neg| is.

1. Two Independent On-Device Models (135.49 MB Combined)

Stage 1 · DistilBERT Base Cased Fill-Mask (67.20 MB WASM q8)

Xenova/distilbert-base-cased · fill-mask · Apache-2.0

Stage 2 · DistilBERT SST-2 Binary Sentiment (68.29 MB WASM q8)

Xenova/distilbert-base-uncased-finetuned-sst-2-english · text-classification · Apache-2.0

2. Top-K Candidate Substitution × Live SST-2 Polarity Audit

Stage 1 proposes top-K cased WordPiece candidates; Stage 2 scores every substituted sentence with SST-2 POSITIVE / NEGATIVE polarity and raw logit margin.

Initialize both stages above to run the 135.49 MB Cloze × SST-2 Sentiment Audit pipeline.

Stage 1 MLM #1–
Anchor SST-2 Polarity–
Polarity Flips / Split–
Polarity Spread / Margin–
Stage 1 / Stage 2 ms–
Combined NaN check–
Stage 1 distilbert-base-cased cloze candidates audited by Stage 2 DistilBERT SST-2 sentiment
S1 Rank Candidate S1 MLM Prob Stage 2 Polarity SST-2 Conf / Margin Entropy (0–1 b) Completed Sentence
Run Stage 1 → Stage 2 above to audit candidate sentiment flips.

3. Inspect Reused Stage 2 Client & Sentiment Shift Audit

Show the code · distilbert-cased-client.js — DistilBertSst2Client (reusing ../distilbert-base-uncased-finetuned-sst-2-english/worker.js)
Show the code · distilbert-cased-core.mjs — analyzeSentimentShiftAudit()