Multi-model · DistilmBERT Cased (139.32 MB q8 · Apache-2.0) → mBERT 201-Lang ID (25.83 MB q8 · MIT)

2-Stage Multilingual Audit: Cloze Fill × 201-Language Shift

Chain two multilingual BERT-family models locally in your browser (165.15 MB combined WASM q8): Stage 1 (distilbert/distilbert-base-multilingual-cased via onnx-community/distilbert-base-multilingual-cased-ONNX, 139.32 MB, Apache-2.0) generates top-K [MASK] completions, then Stage 2 (onnx-community/language_detection-ONNX, 25.83 MB, MIT, reusing ../mbert-language-detection/worker.js) classifies every completed sentence across all 201 FLORES-200 languages to catch code-switching flips or cross-script leakage.

Why Pair Cloze Fill with 201-Language Identification? A shared 119,547-piece multilingual vocabulary can rank cross-script or second-language tokens at code-switch seams or high-entropy slots. Stage 2 scores each candidate's full 201-way FLORES-200 softmax distribution (eng_Latn, fra_Latn, spa_Latn, deu_Latn, arb_Arab, …) to reveal whether a candidate stays in-language or flips language identity.

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

Stage 1 · DistilmBERT Cased Fill-Mask (139.32 MB WASM q8)

onnx-community/distilbert-base-multilingual-cased-ONNX · fill-mask · Apache-2.0

Stage 2 · mBERT 201-Language ID (25.83 MB WASM q8)

onnx-community/language_detection-ONNX · text-classification · MIT

2. Top-K Candidate Language Identification Shift Workbench

Stage 1 proposes top-K cased WordPiece candidates; Stage 2 classifies each completed sentence across 201 FLORES-200 languages.

Initialize both stages above to run the 165.15 MB Cloze × 201-Lang ID Shift Audit.

Stage 1 MLM #1–
Anchor FLORES Lang–
Distinct Langs / Flips–
Conf Spread (201-way)–
Stage 1 / Stage 2 ms–
Combined NaN check–
Stage 1 DistilmBERT cloze candidates audited by Stage 2 mBERT 201-Language Detection
S1 Rank Candidate S1 MLM Prob Stage 2 Top FLORES-200 Runner-Up 201-Way Entropy Completed Sentence
Run Stage 1 → Stage 2 above to audit candidate language shifts.

3. Inspect Reused Stage 2 Client & Language Shift Logic

Show the code · distilbert-mbert-client.js — MbertLangDetectClient (reusing ../mbert-language-detection/worker.js)
Show the code · distilbert-mbert-core.mjs — analyzeLanguageShiftAudit()