fill-mask ยท text ยท WASM ยท ~110 MB
This is the original BERT, the model that taught machines to read in both directions at once. Its
one job here is masked language modelling: hide a word behind
[MASK] and it ranks what belongs there. Type a sentence with a mask and see its guesses
โ plus the exact logits it computed. Everything runs on your device.
| Model | Xenova/bert-base-uncased (ONNX build of google-bert/bert-base-uncased) |
|---|---|
| Task / pipeline | fill-mask โ masked language modelling, loaded via AutoModelForMaskedLM for raw logits |
| Output | A probability over the whole 30,522-token vocabulary at each [MASK] |
| Architecture | BERT-base (12 layers, 110M params), uncased WordPiece tokenizer |
| Quantization | q8 (8-bit) ONNX |
| Backend | WebAssembly (runs anywhere; no WebGPU needed) |
| Download | ~110 MB, cached after first load |
| License | Apache-2.0 |
| Web APIs | WebAssembly, Web Workers โ all Baseline widely available |
Write a sentence containing [MASK] (use the button if you're not sure).
BERT 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 30,522 vocabulary tokens at the masked position. We
softmax those into probabilities. The bars above show the probability; the
logit beside each is the actual number the network produced. Watch how a confident
prediction ("paris") sits far above the pack in logit space, while an ambiguous slot spreads the
mass out. The โ below is the entropy of the top-k โ low means BERT is sure,
high means it's hedging.
top-k entropy: โ bits ยท top-1 carries โ of the shown mass
Masked language modelling is how BERT learned language in the first place โ and the same trick is a surprisingly useful tool on its own. Because it scores every word in context, you can ask it what fits, how strongly, and compare alternatives โ all locally, with no prompt engineering and no API bill.
One mask, ranked predictions with probabilities and the raw logits behind them.
Word-by-word autocomplete and factual knowledge probing over ready-made templates.
Bias probe โ run the same sentence with one word swapped and compare what BERT expects.
Fill the mask, then rank the candidates by meaning with MiniLM embeddings.
The one-liner uses the fill-mask pipeline:
import { pipeline } from "@huggingface/transformers";
const unmask = await pipeline("fill-mask", "Xenova/bert-base-uncased");
const out = await unmask("The capital of France is [MASK].");
// โ [{ token_str: "paris", score: 0.325, sequence: "โฆ" }, { token_str: "lille", โฆ }]
For the "see inside" surface we go one level lower โ AutoModelForMaskedLM โ so we can
read the exact logits tensor ([1, sequence, 30522]), slice the row at the
[MASK] position, and softmax it ourselves. That's the only way to show the real logit
values, not just the pipeline's rounded scores. All of it runs in a Web Worker so the page never janks.