At a glance
| Model | nomic-ai/nomic-embed-text-v1.5 (official repo ships the browser ONNX) |
|---|---|
| Task / pipeline | feature-extraction with pooling: "mean" |
| Architecture | NomicBertModel · 137M params · 12 layers · 12 heads · SwiGLU · rotary (base 1000) · 768-d · 30,528 WordPiece vocab |
| Context | 8,192 tokens (trained at 2,048 with rotary scaling) |
| Matryoshka dims | 64 · 128 · 256 · 512 · 768 — recipe: layer_norm → slice [:d] → L2 normalize |
| Task prefixes | search_query: · search_document: · clustering: · classification: (required) |
| Quantization & size | q8 · onnx/model_quantized.onnx · 137.30 MB + 0.71 MB tokenizer, cached after first download |
| Backend | WASM (CPU) via Transformers.js 3.7.5 — no WebGPU required |
| License | Apache-2.0 |
Matryoshka Search & Prefix Lab
Ranked corpus
Query vs corpus constellation
2D PCA of the query (red crosshair) and documents at the selected dimension; colour + shape = top-3 vs rest.
See inside: what the prefixes and the slice do
Nomic trained one encoder for four jobs and tells it which job via a plain-text prefix. The exact strings sent to the model on the last run:
| Role | Exact input text | Tokens |
|---|---|---|
| Run the lab to see the prefixed inputs. | ||
Matryoshka training put the most important information in the leading coordinates. Layer-norm first re-centres the raw 768-d mean vector; slicing keeps the first d values; L2 re-normalization makes cosine a plain dot product again.
Why it matters
- Cheaper vector stores — index at 256-d (3× smaller) or 64-d (12×) and keep 768-d only for re-scoring.
- Offline, private RAG — embed notes, tickets, or docs locally with zero API calls.
- One model, many tasks — the same weights serve search, clustering, and classifier features via prefixes.
- Long inputs — 8,192-token context means fewer, larger chunks.
Use-case ladder
Basics · Retention curve & prefix test
Benchmark all five dims at once (Kendall τ, top-1 retention vs 12× compression) and measure the effect of wrong or missing prefixes.
Practical · Document search & clustering
Drop .txt/.md/.json/.csv files, search or cluster them at a chosen storage budget, export formula-safe CSV/JSON.
Wild · Constellation morph
Watch a 2D PCA map of topics morph as dims grow 64→768, plus 1-bit binary Hamming vs float32 cosine.
Multi-model · 3-tier funnel
64-d fast filter → 768-d re-score → ms-marco MiniLM cross-encoder rerank, with a rank-shift bump chart.
How the API works
The worker calls the feature-extraction pipeline with pooling: "mean" and
normalize: false, then the page applies the Matryoshka recipe for whichever dimension you pick.