Multi-model ยท ModernBERT-Base (154.68 MB q8 ยท Apache-2.0) โ†’ DeBERTa-v3 NLI (87.3 MB q8 ยท MIT)

Cloze Candidate Generator โ†’ NLI Semantic Re-Ranker (~242 MB Total)

Masked language models predict what is probable in context, not necessarily what matches your intent. Stage 1 (onnx-community/ModernBERT-base-ONNX) proposes top-K cloze words; Stage 2 (Xenova/nli-deberta-v3-xsmall via ../zero-shot-text/worker.js) scores each completed sentence for entailment against your target claim and re-ranks them locally.

1. Two independent on-device models (~242 MB total)

Stage 1 ยท ModernBERT-Base Fill-Mask (154.68 MB)

Uses ../worker.js โ€” WASM q8 22-layer RoPE masked LM proposing top-K candidates for [MASK].

Stage 2 ยท DeBERTa-v3 Zero-Shot NLI (87.3 MB)

Reuses ../../zero-shot-text/worker.js โ€” WASM q8 cross-encoder scoring entailment vs contradiction per completion.

2. Masked prompt โ†’ Stage 1 proposals โ†’ Stage 2 NLI verification

Initialise both stages above to run the 2-stage cloze + NLI semantic re-ranker.

Stage 1 top fillโ€“
Stage 2 top pickโ€“
Rank shift (ฮ”)โ€“
Stage 1 / Stage 2 msโ€“
NaN count (S1 / S2)โ€“
Stage 1 ModernBERT cloze candidates re-ranked by Stage 2 DeBERTa-v3 NLI target entailment score
Stage 2 Rank Candidate (S1 โ†’ S2 ฮ”) Stage 1 Fill Prob Target NLI Score Entailment / Contra Completed Sentence
Run the 2-stage pipeline above to rank completions by meaning.

Inspect Stage 2 client & semantic re-ranker

Show the code ยท modernbert-base.js โ€” ZeroShotNliClient (reusing ../../zero-shot-text/worker.js)
Show the code ยท modernbert-core.mjs โ€” rankCandidatesWithNli()

References