fill-mask · text · WASM · ~280 MB
This is one model trained on 2.5 TB of text across 100 languages, sharing a
single 250,002-token vocabulary. Its job here is masked language modelling: hide a
word behind <mask> — in English, French, Hindi, Swahili, or Japanese — and the
same weights rank what belongs there. No language flag, no switch. Type a sentence with a
mask and see its guesses plus the exact logits. Everything runs on your device.
| Model | Xenova/xlm-roberta-base (ONNX build of FacebookAI/xlm-roberta-base) |
|---|---|
| Task / pipeline | fill-mask — masked language modelling, loaded via AutoModelForMaskedLM for raw logits |
| Languages | 100, in ONE shared model + subword vocabulary (CommonCrawl / CC-100) |
| Mask token | <mask> (RoBERTa-style — not [MASK]) |
| Output | A probability over the whole 250,002-token multilingual vocabulary at each <mask> |
| Architecture | XLM-RoBERTa base (12 layers, 270M params), SentencePiece unigram tokenizer |
| Quantization | q8 (8-bit) ONNX |
| Backend | WebAssembly (runs anywhere; no WebGPU needed) |
| Download | ~280 MB, cached after first load (larger than English BERT because of the 250k multilingual vocabulary) |
| License | MIT (FacebookAI/xlm-roberta-base) |
| Web APIs | WebAssembly, Web Workers — all Baseline widely available |
Write a sentence in any supported language containing <mask>
(use the button if you're not sure). XLM-RoBERTa predicts the missing word. You can use more than one mask.
A language model doesn't output words — it outputs a logit (a raw, unbounded
score) for every one of its 250,002 vocabulary tokens at the masked position, then we
softmax those into probabilities. What makes XLM-RoBERTa special is that this ONE vocabulary
is shared across every language: a French sentence and a Hindi sentence draw
candidates from the same 250k-token space, and the model has learned where each language's words
live in it. The bars above show the probability; the logit beside each is the actual
number the network produced. The – below is the entropy of the top-k — low means
it's sure, high means it's hedging (common when a slot is grammatical rather than factual).
top-k entropy: – bits · top-1 carries – of the shown mass
Most on-device NLP models are English-only. XLM-RoBERTa is a single set of weights that reads ~100 languages — so you ship one model and serve the whole world, offline, with no per-call API bill and nothing leaving the device. Because it scores every word in context, you can ask it what fits, how strongly, and compare alternatives — in any of those languages at once.
One mask, in the language of your choice, ranked predictions with probabilities and the raw logits.
Cross-lingual knowledge probe — ask the same fact in five languages and compare what it fills.
Cross-lingual analogy prompts — "man→woman, king→
Fill the mask, then auto-detect which language the completed sentence is in.
The one-liner uses the fill-mask pipeline — note the RoBERTa-style <mask> token:
import { pipeline } from "@huggingface/transformers";
const unmask = await pipeline("fill-mask", "Xenova/xlm-roberta-base");
const out = await unmask("Die Hauptstadt von Deutschland ist <mask>.");
// → [{ token_str: "Berlin", score: 0.22, sequence: "…" }, { token_str: "München", … }]
// the SAME call works for French, Spanish, Japanese… no language argument
For the "see inside" surface we go one level lower — AutoModelForMaskedLM — so we can
read the exact logits tensor ([1, sequence, 250002]), slice the row at the
<mask> position, and softmax it ourselves. XLM-RoBERTa uses a SentencePiece
tokenizer, so word-initial subwords carry a leading ▁ marker we clean up for display.
All of it runs in a Web Worker so the page never janks.