question-answering · SQuAD v2 abstention · text · WASM q8 · 26.90 MB · MIT

MobileBERT-SQuAD2

A 25M-parameter bottleneck inverted-residual MobileBERT fine-tuned on SQuAD v2.0 (csarron/mobilebert-uncased-squad-v2 via onnx-community/mobilebert-uncased-squad-v2-ONNX) running 100% locally in WebAssembly at ~60 ms per query — roughly 3× smaller than TinyRoBERTa (82.14 MB) and ~5× smaller than RoBERTa-base. Routes unanswerable questions to the [CLS] null sink so your app can honestly abstain instead of fabricating citations.

csarron/mobilebert-uncased-squad-v2 onnx-community/mobilebert-uncased-squad-v2-ONNX question-answering Transformers.js 3.7.5 · WASM q8 · 26.90 MB MIT

At a glance

Task & architecture
question-answering · 24-layer bottleneck MobileBERT (25M params, 512-token window)
Runtime & backend
Transformers.js 3.7.5 · WebAssembly (WASM)
Quantisation & size
q8 · 26.90 MB (26,903,231 B onnx/model_quantized.onnx)
License & SQuAD v2
MIT · 75.2 EM / 78.8 F1 (~60 ms WASM)

1 · Initialise MobileBERT-SQuAD2 locally

License notice: Model weights are distributed under the MIT license (upstream csarron/mobilebert-uncased-squad-v2, ONNX export onnx-community/mobilebert-uncased-squad-v2-ONNX). Inference runs off the main thread in a FIFO Web Worker calling pipeline("question-answering", "onnx-community/mobilebert-uncased-squad-v2-ONNX", { device: "wasm", dtype: "q8" }).

2 · Pick a domain preset or upload your own passage

Drop a local .txt or .md document here (stays 100% on-device, max 512 KB).

Initialise MobileBERT-SQuAD2 above to extract grounded answer spans or detect unanswerable questions.

Waiting for model

—

Ask a question once ready to compare top span probability against MobileBERT's SQuAD v2 null probability P([CLS]).

Top Span Score—
Null P([CLS])—
Char Offsets—
Latency (WASM)—
Tokens / Window—
Finite Check—

Highlighted Source Passage

Exact character offsets highlighted via semantic <mark> nodes (or left clean when abstained).

Top-K Candidate Spans vs [CLS] Null

Click any candidate span to highlight its exact UTF-16 location in the source passage.

Use-case ladder

Show the code

Inspect the live vanilla ES modules powering this route — zero bundler, zero hidden server calls.

Show the code — worker.js pipeline & SQuAD v2 logit pass
Show the code — qa-core.mjs SQuAD v2 abstention threshold logic