← All models

feature-extraction · text · WASM · ~337 MB

mxbai-embed-large-v1 — a large, high-quality retriever

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.

At a glance

Modelmixedbread-ai/mxbai-embed-large-v1
Task / pipelinefeature-extraction
ArchitectureBERT-large encoder (~335M params) → 1024-dimensional sentence embedding
Poolingmask-aware mean pooling, then L2-normalize
Retrieval promptqueries only: “Represent this sentence for searching relevant passages: ”
Trained withAnglE loss · supports Matryoshka truncation (1024→512→256…) and binary quantization
Quantizationq8 (8-bit) ONNX
BackendWebAssembly (runs anywhere; no WebGPU needed)
Download~337 MB, cached after first load
LicenseApache-2.0 (Mixedbread AI)
Web APIsWebAssembly, Web Workers — all Baseline widely available

Run it

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.

Cosine similarity matrix

2D map (PCA)

See inside — the 1024-d vector, the prompt A/B, and Matryoshka

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.

Embed some sentences above to inspect a vector.

A/B — does the retrieval prompt help?

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.


Matryoshka — quality vs size

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.

Why it matters

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.

Use cases

Basics

Two lines, one cosine number — and the retrieval prompt's effect, felt directly.

Practical

Prompted semantic search plus near-duplicate detection over your own text.

Wild

A Matryoshka explorer: slide the dimension and watch quality vs size trade off live.

Multi-model

mxbai retrieves a shortlist by meaning, then a cross-encoder reranker re-scores the top hits.

How the API works

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.

References