learned sparse retrieval · text · WASM · ~532 MB
The built embedding models turn text into a dense vector of opaque numbers. SPLADE does something different: it produces a sparse vector — a weight per word in the vocabulary, mostly zero — and it expands the text with related terms it never contained ("pasta" also lights up "noodles", "italy", "food"). That's how neural lexical search matches meaning while staying an interpretable, invertible index. Encode a sentence, then match a second one. Runs on your device.
| Model | Splade_PP_en_v1 — a SPLADE++ sparse encoder (BERT MLM head) |
|---|---|
| Task | learned sparse retrieval (feature-extraction) — run via raw ONNX Runtime Web (see note below) |
| Runtime | onnxruntime-web 1.21 (transformers.js has no SPLADE task) + a transformers.js tokenizer |
| Input | text → input_ids / attention_mask / token_type_ids |
| Output | MLM logits → SPLADE pool maxi log(1 + relu(logits)) → a sparse weight per vocabulary term |
| Quantization | fp32 ONNX — runs on the plain WASM backend, no WebGPU needed |
| Download | ~532 MB, cached after first load (auto-inits on return) |
| License | Apache-2.0 (Splade_PP_en_v1) — the weights stay Apache-2.0 wherever exported |
| Web APIs | WebAssembly, Web Workers — all Baseline widely available |
SPLADE relevance = the sparse dot-product of the two weighted-term vectors.
transformers.js has no SPLADE task, so we run the masked-LM ONNX directly with onnxruntime-web and
tokenize with a transformers.js tokenizer. SPLADE reads the model's word-prediction logits at every
position and keeps, for each vocabulary word, its strongest log(1 + relu) score — a
sparse vector where a handful of words carry weight, including words the text implies but
never wrote. Two texts are relevant when their sparse vectors overlap. Everything runs on
your device.