← All models

feature-extraction · text (100+ languages) · WASM · ~570 MB

BGE-M3 — one meaning space for 100+ languages and whole documents

BGE-M3 is BAAI's flagship multi-functionality embedder. This page runs its dense-retrieval head: the 1024-number vector you drop into a vector database. Two things set it apart from the smaller embedders on this site — it covers 100+ languages in one shared space, and it reads up to 8192 tokens, so it embeds whole paragraphs and documents, not just sentences. Paste passages in any mix of languages, build a cross-language cosine matrix, and search long documents by meaning. Nothing leaves your device.

At a glance

ModelXenova/bge-m3 (ONNX of BAAI/bge-m3)
Task / pipelinefeature-extraction (dense head)
ArchitectureXLM-RoBERTa-large backbone (~568M params) → 1024-dimensional dense embedding
Languages100+ — one shared multilingual retrieval space
Contextup to 8192 tokens — embeds long passages / documents, not just sentences
Pooling[CLS] pooling, then L2-normalize — no instruction prefix; embed query and document the same way, in any language
Multi-functionalityM3 = dense + sparse (lexical) + multi-vector (ColBERT). This demo runs the dense head.
Quantizationq8 (8-bit) ONNX
BackendWebAssembly (runs anywhere; no WebGPU needed)
Download~570 MB, cached after first load — the largest embedder here; see the honest note below
LicenseMIT (BAAI/bge-m3)
Web APIsWebAssembly, Web Workers — all Baseline widely available

Honest about the size. At ~570 MB (q8) this is far heavier than the 118 MB multilingual MiniLM or the ~30–90 MB English embedders — a real download and a real memory footprint, especially on phones. You buy 100+ languages, an 8192-token window, and top-tier retrieval quality; if you don't need those, a smaller embedder is the right call. It caches after the first load and clears with the button below.

Run it

Put one passage per line — mix languages freely, and make some lines long (BGE-M3 reads up to 8192 tokens). The matrix shows the cosine similarity between every pair (1.00 = identical direction). The 2D map is a PCA projection coloured by language — if the model works, points cluster by meaning, not by colour.

Cross-language cosine matrix

2D map (PCA), coloured by language

Green badge = a hit in a different language from your query. An English query surfaces its French or Japanese answer above an unrelated English line.

See inside — the 1024-d vector and the 8192-token window

BGE-M3 takes the [CLS] token's 1024-number hidden state as the document vector, then L2-normalizes it so every passage becomes a unit-length arrow and cosine similarity is a plain dot product. Pick a passage to see its real vector, its pre-normalization magnitude, and how much of the 8192-token context window it actually used.

Embed some passages above to inspect a vector.

Why it matters

BGE-M3 collapses the "one index per language" and "chunk everything to a sentence" problems at once. You embed questions, documents, tickets and reviews — long or short, in any of 100+ languages — into one 1024-d space, and nearest-neighbour search just works across the whole corpus. It's the dense head that powers a lot of production multilingual RAG, and it runs here with no server and no data leaving the tab.

Use cases

Basics

Do two passages mean the same thing across languages, or across a paraphrase? One cosine number.

Practical

Long-document, cross-language semantic search and dedup over a mixed-language knowledge base.

Wild

Cluster a mixed-language pile of text by meaning — watch the groups ignore language entirely.

Multi-model

Retrieve cross-lingually with BGE-M3, then translate the winning passage to English with M2M100.

Contrast with the lighter multilingual MiniLM (384-d, ~50 languages, 118 MB) and the English-only GTE-small: BGE-M3 trades size for language breadth, an 8192-token window, and 1024-d retrieval quality.

How the API works

Same feature-extraction recipe as any sentence embedder — with CLS pooling for BGE-M3's dense head:

import { pipeline } from "@huggingface/transformers";

const extract = await pipeline(
  "feature-extraction",
  "Xenova/bge-m3",
); // downloads + caches ~570 MB once

// CLS pooling, no instruction prefix — embed a query and a document IN ANY LANGUAGE the same way:
const out = await extract(["How long does the battery last?", "このバッテリーは一日中もちます"], {
  pooling: "cls",
  normalize: true,
});
const [q, d] = out.tolist();

// unit-length vectors → cosine similarity is just the dot product:
const sim = q.reduce((s, x, i) => s + x * d[i], 0); // high — same meaning, different languages

This page asks the worker for the un-normalized CLS vectors so "See inside" can show the real pre-normalization magnitude, then normalizes them in JS. Inference runs in a Web Worker so the matrix, projection and search never jank the page.

References