multi-model Β· 372.4 MB dense retrieval β†’ 24-layer SQuAD 2.0 RAG Β· Apache-2.0 + CC-BY-4.0

MiniLM-L12 Retrieval β†’ BERT-Large WWM Open-Book QA

Chain two independent WebAssembly q8 models totaling ~372.4 MB with zero server calls: Stage 1 embeds your query and knowledge corpus with ../all-minilm-l12-v2/worker.js (Xenova/all-MiniLM-L12-v2, 34.73 MB, Apache-2.0) to shortlist Top-K passages, then Stage 2 reads each shortlisted passage with 24-layer onnx-community/bert-large-uncased-whole-word-masking-squad2-ONNX (337.67 MB, CC-BY-4.0) to extract a cited span β€” or abstain corpus-wide when no passage answers the query.

1 Β· Independent pipeline stages (~372.4 MB combined)

Stage 1 Β· all-MiniLM-L12-v2 Retriever (34.73 MB Β· Apache-2.0)

Stage 2 Β· BERT-Large WWM SQuAD 2.0 Reader (337.67 MB Β· CC-BY-4.0)

Initialise Stage 1 (all-MiniLM-L12-v2) and Stage 2 (BERT-Large WWM SQuAD 2.0) above to run local Open-Book RAG.

2 Β· Retrieve Top-K Passages (Stage 1) β†’ Extract Cited Answer (Stage 2)

Drop, paste, or upload a local .txt / .md / .csv / .json document to append to the live corpus.
Inspect corpus passages (6 passages)
Waiting for stages

β€”

Stage 1 ranks all corpus passages by 384-d cosine similarity; Stage 2 BERT-Large WWM extracts the best grounded span or abstains corpus-wide.

Winning Passageβ€”
Stage 1 Cosineβ€”
Stage 2 Span Scoreβ€”
[CLS] Null Probβ€”
Stage 1 / Stage 2 msβ€”
Combined Payload~372.4 MB q8

Winning Passage Citation (CSS.highlights)

Shortlisted Passages & Stage 2 Extraction Breakdown

3 Β· Show the code

Show the code β€” bert-large-wwm.js Stage 1 all-MiniLM-L12-v2 worker client (reusing ../all-minilm-l12-v2/worker.js)
Show the code β€” bert-large-wwm-core.mjs cosine shortlist & corpus-wide SQuAD 2.0 aggregation