fill-mask Β· text Β· WASM Β· ~131 MB
Same architecture as BERT, a very different reader. Bio_ClinicalBERT is BERT continued-pretrained
on roughly two million MIMIC-III clinical notes, so its
masked language modelling is steeped in medicine: hide a word behind
[MASK] in a clinical or biomedical sentence and it ranks what a clinician β not the
open web β would expect. Type a masked sentence, see its guesses and the exact logits,
then race it against general BERT to watch the domain gap appear. All on your device.
| Model | onnx-community/Bio_ClinicalBERT-ONNX (ONNX of emilyalsentzer/Bio_ClinicalBERT) |
|---|---|
| Task / pipeline | fill-mask β masked language modelling, loaded via AutoModelForMaskedLM for raw logits |
| Domain | Clinical / biomedical β continued pretraining on ~2M MIMIC-III ICU clinical notes (initialised from BioBERT) |
| Output | A probability over the 28,996-token cased vocabulary at each [MASK] |
| Architecture | BERT-base (12 layers, ~108M params), cased WordPiece tokenizer β same tokenizer as bert-base-cased, so a fair head-to-head |
| Quantization | q8 (8-bit) ONNX |
| Backend | WebAssembly (runs anywhere; no WebGPU needed) |
| Download | ~131 MB, cached after first load |
| License | MIT |
| Web APIs | WebAssembly, Web Workers β all Baseline widely available |
Write a clinical or biomedical sentence containing [MASK] (use a chip if
you're not sure). Bio_ClinicalBERT predicts the missing word. You can use more than one mask.
A masked LM outputs a logit (a raw, unbounded score) for every vocabulary token
at the masked position; we softmax those into probabilities. The bars above show the
probability and the exact logit. The real story is which tokens rise and
how sharply. Run the same masked sentence through general bert-base-cased and clinical
Bio_ClinicalBERT β identical tokenizer and vocabulary, so the only variable is what each
model read during training. Watch the clinical model concentrate mass on the medically-correct
word while general BERT spreads its bets.
clinical top-k entropy: β bits Β· top-1 carries β of the shown mass
A general model averages the whole internet; a domain model has read the notes. On clinical and biomedical text that difference is the difference between a plausible guess and the right one β and it comes for free, in the same 110M-parameter, browser-runnable package, with no prompt engineering and no API bill.
One mask, ranked predictions with probabilities and the raw logits behind them.
Abbreviation & term expansion β score a fixed candidate set at the mask over clinical templates.
Head-to-head arena β clinical vs general BERT on any masked sentence, with the divergence scored.
Fill the clinical mask, then rank the candidates by meaning with MiniLM embeddings.
The one-liner uses the fill-mask pipeline β only the model id is domain-specific:
import { pipeline } from "@huggingface/transformers";
const unmask = await pipeline("fill-mask", "onnx-community/Bio_ClinicalBERT-ONNX", { dtype: "q8" });
const out = await unmask("The patient was admitted with acute [MASK] failure.");
// β [{ token_str: "respiratory", score: 0.95, sequence: "β¦" }, { token_str: "heart", β¦ }]
For the "see inside" surface we go one level lower β AutoModelForMaskedLM β so we can
read the exact logits tensor ([1, sequence, 28996]), slice the row at the
[MASK] position, and softmax it ourselves. The comparison loads general
bert-base-cased the same way, in the same Web Worker, so both are exercised
identically and the page never janks.