feature-extraction · text · WASM · ~337 MB
Mixedbread's flagship embedder turns a sentence into 1024 numbers — a big, expressive point in meaning space — and was trained with the AnglE objective to rank near the top of the MTEB retrieval benchmark. It brings two conventions worth knowing: a retrieval prompt you prepend to queries, and Matryoshka vectors you can safely truncate to trade quality for size. Type a few lines, search by meaning, and watch both levers move the results. Nothing leaves your device.
| Model | mixedbread-ai/mxbai-embed-large-v1 |
|---|---|
| Task / pipeline | feature-extraction |
| Architecture | BERT-large encoder (~335M params) → 1024-dimensional sentence embedding |
| Pooling | mask-aware mean pooling, then L2-normalize |
| Retrieval prompt | queries only: “Represent this sentence for searching relevant passages: ” |
| Trained with | AnglE loss · supports Matryoshka truncation (1024→512→256…) and binary quantization |
| Quantization | q8 (8-bit) ONNX |
| Backend | WebAssembly (runs anywhere; no WebGPU needed) |
| Download | ~337 MB, cached after first load |
| License | Apache-2.0 (Mixedbread AI) |
| Web APIs | WebAssembly, Web Workers — all Baseline widely available |
One sentence per line, then embed. The matrix is the cosine similarity between every pair (1.00 = identical direction); the map is a 2D PCA of the 1024-d vectors. Then query below to rank the lines by meaning — with the retrieval prompt on the query, the way mxbai is meant to be used.
The encoder emits one 1024-number vector per token; mean pooling (mask-aware) collapses them to one per sentence, then L2-normalize makes it a unit arrow so cosine is a dot product. Pick a sentence to see its real vector and pre-normalization magnitude.
First 128 of 1024 dimensions (blue = positive, orange = negative, brighter = larger magnitude):
Embed the query below both ways — plain, and with the “Represent this sentence for searching relevant passages: ” prefix — and rank the sentences above with each. The prefix usually pushes the truly relevant lines up and the irrelevant ones down, widening the gap that makes retrieval work.
mxbai's vector is trained so a leading slice is still a good embedding. Truncate 1024 → 512 → 256 → 128 → 64 (re-normalized) and see how much of the full-precision ranking survives at a fraction of the storage. This is how you cut a vector database's footprint without re-embedding.
Embeddings power search, recommendations, dedup, clustering and RAG. mxbai's pitch is quality: a large, MTEB-strong retriever you can still run in a tab, with two production levers baked in — the retrieval prompt that sharpens query/document matching, and Matryoshka truncation that shrinks your index on demand. And because it runs locally, the corpus and the queries never leave the device.
Two lines, one cosine number — and the retrieval prompt's effect, felt directly.
Prompted semantic search plus near-duplicate detection over your own text.
A Matryoshka explorer: slide the dimension and watch quality vs size trade off live.
mxbai retrieves a shortlist by meaning, then a cross-encoder reranker re-scores the top hits.
Feature-extraction with mean pooling — and the one thing to remember is the query prompt:
import { pipeline } from "@huggingface/transformers";
const extract = await pipeline(
"feature-extraction",
"mixedbread-ai/mxbai-embed-large-v1",
); // downloads + caches ~337 MB once
const PROMPT = "Represent this sentence for searching relevant passages: ";
// Prompt the QUERY; embed documents plain:
const q = await extract([PROMPT + "how do I sign in?"], { pooling: "mean", normalize: true });
const d = await extract(["the login page rejects my password"], { pooling: "mean", normalize: true });
const sim = q.tolist()[0].reduce((s, x, i) => s + x * d.tolist()[0][i], 0); // cosine
// Matryoshka: keep the first N dims, then re-normalize.
function truncate(vec, n) { const v = vec.slice(0, n); const m = Math.hypot(...v); return v.map(x => x / m); }
This page asks the worker for the un-normalized pooled vectors so “See inside” can show the true magnitude and do Matryoshka truncation in JS. Inference runs in a Web Worker, so the matrix, projection, A/B and size sweep never jank the page.