fill-mask Β· text Β· WASM Β· ~110 MB
CamemBERT is a RoBERTa trained on 138 GB of French text and nothing else. Its
one job here is masked language modelling: hide a word behind
<mask> and it ranks what belongs there β with a French-native vocabulary, French
idioms and French grammar baked in. Type a sentence with a mask and see its guesses, plus the exact
logits it computed. Everything runs on your device.
| Model | Xenova/camembert-base (ONNX build of almanach/camembert-base) |
|---|---|
| Task / pipeline | fill-mask β masked language modelling, loaded via AutoModelForMaskedLM for raw logits |
| Output | A probability over the whole 32,005-token French vocabulary at each <mask> |
| Architecture | CamemBERT / RoBERTa-base (12 layers, ~110M params), SentencePiece tokenizer trained on French |
| Language | French only β mask token is <mask> (RoBERTa style), not [MASK] |
| Quantization | q8 (8-bit) ONNX |
| Backend | WebAssembly (runs anywhere; no WebGPU needed) |
| Download | ~110 MB, cached after first load |
| License | MIT |
| Web APIs | WebAssembly, Web Workers β all Baseline widely available |
Write a French sentence containing <mask> (use a sample if you're not
sure). CamemBERT predicts the missing word. You can use more than one mask.
CamemBERT spent its whole 32k-token budget on French. XLM-RoBERTa spread a 250k-token vocabulary
across ~100 languages. Load the multilingual model (an extra ~280 MB, on demand) and compare what
each one predicts for the same French <mask> β the specialist usually
offers cleaner, more idiomatic French words, and you can see it in the logits.
The comparison uses whatever sentence is in the box above. Both runs are real, off-thread forward passes β nothing is cached or faked.
A language model doesn't output words β it outputs a logit (a raw, unbounded
score) for every one of its 32,005 French 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 ("capitale") 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 CamemBERT is sure,
high means it's hedging.
top-k entropy: β bits Β· top-1 carries β of the shown mass
A model trained only on French reads French the way a multilingual model can't afford to β every
token in its vocabulary is a French subword, so accents, elisions (l',
d'), gender agreement and idioms come out cleaner. 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 French mask, ranked predictions with probabilities and the raw logits behind them.
A French writing aid β word-by-word completion and register comparison over ready-made templates.
French idioms and elisions β does CamemBERT know "ce n'est pas la mer Γ β¦" ?
Fill the mask, then tag every word's part of speech with a French CamemBERT POS model.
The one-liner uses the fill-mask pipeline:
import { pipeline } from "@huggingface/transformers";
const unmask = await pipeline("fill-mask", "Xenova/camembert-base");
const out = await unmask("Paris est la <mask> de la France.");
// β [{ token_str: "capitale", score: 0.71, sequence: "β¦" }, { token_str: "ville", β¦ }]
For the "see inside" surface we go one level lower β AutoModelForMaskedLM β so we can
read the exact logits tensor ([1, sequence, 32005]), 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.