question-answering · text · WASM · ~65 MB
This is extractive question answering: give it a passage and a question, and instead of writing a new sentence it points at the exact span of the passage that answers you — and tells you how confident it is. Type a question below and watch it highlight the answer, then look inside to see the real start/end token probabilities it used to pick that span. Nothing leaves your device.
| Model | Xenova/distilbert-base-cased-distilled-squad |
|---|---|
| Task / pipeline | question-answering (extractive span prediction) |
| How it works | predicts two distributions over the passage tokens — where the answer starts and where it ends |
| Architecture | DistilBERT (6-layer, cased) fine-tuned on SQuAD 1.1 |
| Quantization | q8 (8-bit) ONNX |
| Backend | WebAssembly (runs anywhere; no WebGPU needed) |
| Download | ~65 MB, cached after first load |
| License | Apache-2.0 |
| Web APIs | WebAssembly, Web Workers — all Baseline widely available |
Paste any passage, ask a question about it, and the model highlights the answer span in the passage. The candidate list shows its next-best guesses with their probabilities.
Answer
–
The model never "reads" an answer out — it outputs two numbers per passage token: how likely that token is the first word of the answer, and how likely it is the last. The answer is just the span from the best start to the best end. Below is the real (softmaxed) distribution over the passage tokens for your last question — the outlined tokens are the chosen start and end.
Extractive QA is the quiet engine behind "answer from my documents". Because it returns a span of the source rather than inventing text, the answer is always grounded — it literally can't hallucinate a fact that isn't in the passage. And at 65 MB it runs in a tab, so you can query private documents, contracts, or logs without any of it leaving the device.
Ask a question about a short passage and watch the exact answer span light up.
Paste your own document and query it — a tiny FAQ bot over text you control.
Trick it: adversarial and unanswerable questions, and spotting when it's guessing.
MiniLM retrieves the right paragraph, then this model pulls the exact answer from it.
The pipeline takes a question and a context and returns the best span with a score:
import { pipeline } from "@huggingface/transformers";
const qa = await pipeline(
"question-answering",
"Xenova/distilbert-base-cased-distilled-squad",
); // downloads + caches ~65 MB once
const out = await qa(
"How tall is the Eiffel Tower?",
"The tower is 330 metres tall …",
{ topk: 5 },
);
// → [{ answer: "330 metres", score: 0.97, start: 12, end: 22 }, …]
"See inside" reuses that same loaded model instance (qa.model + qa.tokenizer)
to read the raw start_logits / end_logits, softmax them over the passage
tokens, and draw the distribution. All of it runs in a Web Worker so the UI never janks.