At a glance
| Upstream & ONNX | intfloat/multilingual-e5-large → Xenova/multilingual-e5-large |
|---|---|
| Task / pipeline | feature-extraction (HF tag: sentence-similarity · pooling: "mean", normalize: true) |
| Architecture | XLMRobertaModel · 24 layers · 16 heads · hidden_size: 1024 · 4,096 FFN · 514 max_position_embeddings (512 usable tokens) · 250,002 SentencePiece Unigram vocab |
| E5 prefix protocol | Every input starts with "query: " (queries / symmetric STS) or "passage: " (documents to retrieve) |
| Quantization & size | q8 WASM ONNX (onnx/model_quantized.onnx = 561,768,762 B / 561.77 MB + tokenizer.json 17.08 MB + configs 1,210 B = 578.85 MB) |
| Backend | CPU WebAssembly (wasm) via shared ../../lib/webai.js (@huggingface/transformers@3.7.5 — no WebGPU required) |
| License & browser APIs | MIT · Web Workers, WebAssembly, Cache Storage, Canvas 2D (Baseline Widely Available) |
xlm-roberta-large
and contrastively trained on ~1B multilingual pairs plus supervised retrieval datasets,
multilingual-e5-large averages non-padding token states (pooling: "mean")
and L2-normalizes to 1,024 unit floats. Toggle the E5 "query: " / "passage: "
prefixes below to inspect how asymmetric framing shifts cosine separation across scripts.
1. Cross-Lingual 1024-d Retrieval Workbench
2. See inside: 2D PCA Constellation, 1024-d Vector & Cosine Matrix
2D PCA Semantic Constellation
Run inference above to project passages and query into 2D PCA space.
Active Query 1024-d Mean Vector & Histogram
Pairwise Cosine Similarity Matrix (Query + Passages)
Run inference above to inspect the live N×N pairwise cosine matrix.
3. Why it matters & what you can build
- One 100-language retrieval index: Embed English, French, Spanish, German, Japanese, Chinese, Arabic, Hindi, and Russian passages into a single 1,024-d vector space — a query in any supported language finds meaning matches across every other script.
- Private client-side RAG: Keep medical FAQs, compliance policies, and personal notes inside the browser sandbox while computing deterministic 1,024-d embeddings with zero cloud API egress.
- Two-stage multilingual precision: Retrieve a fast dense shortlist with
multilingual-e5-largein Stage 1, then rerank the Top-K hits with a cross-encoder likebge-reranker-baseon Multi-model.
4. How the API works & Show the code
All inference executes inside a dedicated module Web Worker via shared ../../lib/webai.js
on @huggingface/transformers@3.7.5 (CPU WASM q8) with strict FIFO queueing and
epoch-safe disposal.