feature-extraction · text · WASM · ~118 MB
Most search matches words. This model matches meaning — across languages. multilingual-e5-small turns any text from 100 languages into a 384-number vector placed in a single shared space, so "Bonjour le monde" lands next to "Hello world" and a Hindi question can retrieve its Spanish answer. Type below and watch the real cosine similarities come back from a model running entirely on your device.
Honest note: this runs
Xenova/multilingual-e5-small,
the ONNX q8 export of intfloat/multilingual-e5-small (XLM-RoBERTa base, ~118M
params, MIT). E5 models expect a query: or passage: prefix on every
input — the demo adds them for you, exactly as the model card prescribes.
| Model | Xenova/multilingual-e5-small (ONNX q8 of intfloat/multilingual-e5-small) |
|---|---|
| Task / pipeline | feature-extraction (sentence embeddings) |
| Output | 384-dimensional vector per text, mean-pooled + L2-normalised → cosine similarity is a dot product |
| Architecture | XLM-RoBERTa base (12 layers, ~118M params) contrastively trained on ~1B multilingual text pairs |
| Languages | 100 (XLM-R vocabulary; evaluated on MIRACL, Mr. TyDi, multilingual MTEB) |
| Input convention | prefix every text with query: or passage: (applied automatically here) |
| Quantization | q8 (8-bit) ONNX |
| Backend | WebAssembly (runs anywhere; no WebGPU needed) |
| Download | ~118 MB, cached after first load |
| License | MIT |
| Web APIs | WebAssembly, Web Workers — all Baseline widely available |
Write a query in any supported language. It is matched, by meaning alone, against five passages in other languages. The bar is the real cosine similarity the model produced.
Each text becomes 384 real numbers. Below: the full cosine matrix between your query and every passage (and the passages against each other — near-duplicate meanings in different languages score high even with zero words in common), and a bar-strip of the query's raw embedding (blue = positive dimension, orange = negative).
A shared multilingual embedding space collapses "translate, then search" into one step — and it runs offline on the device, so private text never has to leave.
Embed two texts in any languages and read their real cosine similarity — plus a five-language meaning wall.
A working multilingual semantic search box over a mixed-language document set, ranked live.
Language-blind meaning clusters: throw ten sentences in six languages at the model and watch it group them by topic, not tongue.
Embeddings are one pipeline call — remember the E5 prefixes:
import { pipeline } from "@huggingface/transformers";
const embed = await pipeline("feature-extraction", "Xenova/multilingual-e5-small");
const out = await embed(
["query: Comment faire une omelette ?", "passage: How to cook an omelette"],
{ pooling: "mean", normalize: true },
);
// out.dims → [2, 384]; out[0].data → Float32Array(384), L2-normalised
// cosine similarity = dot(out[0].data, out[1].data) ≈ 0.9
pooling: "mean" averages token vectors into one sentence vector and
normalize: true unit-lengths it, so a plain dot product is the cosine
similarity. The query:/passage: prefixes come from the model card —
E5 was trained with them and scores measurably worse without. Everything runs in a Web Worker
so typing stays smooth.