← All models

fill-mask Β· text Β· WASM Β· ~131 MB

Bio_ClinicalBERT β€” the missing word, with a medical education

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.

At a glance

Modelonnx-community/Bio_ClinicalBERT-ONNX (ONNX of emilyalsentzer/Bio_ClinicalBERT)
Task / pipelinefill-mask β€” masked language modelling, loaded via AutoModelForMaskedLM for raw logits
DomainClinical / biomedical β€” continued pretraining on ~2M MIMIC-III ICU clinical notes (initialised from BioBERT)
OutputA probability over the 28,996-token cased vocabulary at each [MASK]
ArchitectureBERT-base (12 layers, ~108M params), cased WordPiece tokenizer β€” same tokenizer as bert-base-cased, so a fair head-to-head
Quantizationq8 (8-bit) ONNX
BackendWebAssembly (runs anywhere; no WebGPU needed)
Download~131 MB, cached after first load
LicenseMIT
Web APIsWebAssembly, Web Workers β€” all Baseline widely available

Run it

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.

See inside β€” the domain gap, side by side

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.

Why it matters

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.

Use cases

Basics

One mask, ranked predictions with probabilities and the raw logits behind them.

Practical

Abbreviation & term expansion β€” score a fixed candidate set at the mask over clinical templates.

Wild

Head-to-head arena β€” clinical vs general BERT on any masked sentence, with the divergence scored.

Multi-model

Fill the clinical mask, then rank the candidates by meaning with MiniLM embeddings.

How the API works

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.

References