feature-extraction · text · WASM q8 · 137.30 MB · Matryoshka 64–768 d · Apache-2.0

Nomic Embed Text v1.5 — one model, five vector sizes

A 137M-parameter long-context embedder trained with Matryoshka Representation Learning: the first 64, 128, 256, or 512 coordinates of its 768-d vector are themselves good embeddings. Slide the dimension below and watch storage shrink up to 12× while the ranking barely moves — all on your device, in a Web Worker.

At a glance

Model facts for nomic-embed-text-v1.5
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

The worker returns the raw mean-pooled vector once. Every dimension button re-applies the model card's exact recipe in your tab — no re-embedding — so you see the true cost/quality trade-off instantly.
Matryoshka dimension (re-scores instantly)
Bytes / vector (f32)–
1M docs index–
Compression vs 768-d–
Kendall τ vs 768-d–
Top-1 same as 768-d–
Recall@3 vs 768-d–

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:

    Exact model inputs including task prefixes
    RoleExact input textTokens
    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

    Use-case ladder

    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.

    Show the code — worker.js embed(): batched raw mean pooling with NaN telemetry
    Show the code — nomic-core.mjs matryoshkaEmbed(): layer_norm → slice → L2

    References