Multi-model · XLM-RoBERTa Base (297.4 MB q8 · MIT) → Multilingual MiniLM-L12-v2 (118 MB q8 · Apache-2.0)

2-Stage Checker: Multilingual Cloze Quality & Semantic Preservation

Pair masked language modelling with cross-lingual semantic verification offline (415.4 MB combined): Stage 1 (FacebookAI/xlm-roberta-base via Xenova/xlm-roberta-base, 297.4 MB WASM q8, MIT) proposes top-K <mask> completions, and Stage 2 (Xenova/paraphrase-multilingual-MiniLM-L12-v2, 118 MB WASM q8, Apache-2.0, reusing ../opus-mt-en-romance/embed-worker.js) embeds the reference sentence and all completed candidates into a shared 384-d space to rerank by real cos(Reference, Candidate) fidelity.

Why Rerank Cloze Candidates Semantically: XLM-RoBERTa often assigns high prior probability to generic function words (like the or la). Embedding each completed candidate alongside a cross-lingual reference sentence in Stage 2 exposes semantic drift and promotes factually faithful completions.

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

Stage 1 · XLM-RoBERTa Base (297.4 MB WASM q8)

Xenova/xlm-roberta-base · fill-mask · MIT

Stage 2 · Multilingual MiniLM-L12-v2 (118 MB WASM q8)

Xenova/paraphrase-multilingual-MiniLM-L12-v2 · feature-extraction · Apache-2.0

2. Cross-Lingual Cloze × Semantic Preservation Workbench

Stage 1 generates top-K multilingual candidates; Stage 2 measures cross-lingual cosine fidelity against the reference meaning.

Initialize both stages above to run the 415.4 MB Cloze Quality & Semantic Preservation pipeline.

Stage 1 MLM #1–
Stage 2 Semantic #1–
Best cos(Ref, Cand)–
Stage 1 / Stage 2 ms–
Combined NaN check–
Stage 1 fill-mask candidates reranked by Stage 2 cross-lingual 384-d cosine similarity
S2 Rank S1 Rank Candidate S1 MLM Prob S2 cos(Ref, Cand) Quality Assessment Completed Sentence
Run Stage 1 → Stage 2 above to verify semantic preservation.

3. Inspect Reused Stage 2 Client & Reranking Logic

Show the code · xlmr-client.js — MultilingualEmbedClient (reusing ../opus-mt-en-romance/embed-worker.js)
Show the code · xlmr-core.mjs — rankClozeSemanticQuality()