Xenova Brings BGE-base-en-v1.5 to Browsers Without a Server
Xenova's ONNX build of BAAI's BGE-base-en-v1.5 lets developers run 768-dimensional text embeddings entirely client-side through Transformers.js, no backend required.
ProTakeaways
- Xenova ships an ONNX build of BAAI's BGE-base-en-v1.5 for Transformers.js.
- Runs 768-dim embeddings client-side in browser, Node, Bun, or Deno without an API.
- 110M-parameter BERT encoder, strong MTEB scores, English-only, instruction-tuned for retrieval.
- Install with
npm i @huggingface/transformersand call the feature-extraction pipeline. - Transformers.js v3 added WebGPU, later versions delivered ~4x speedup for BERT embedders.
- Ideal for privacy-preserving semantic search, offline RAG, and Chrome extensions with local data.
Running semantic search in a web app usually means paying for an embeddings API or standing up a Python service with a GPU. Xenova's ONNX port of BAAI's BGE-base-en-v1.5 removes that requirement. It packages the popular 110M-parameter BERT-based embedding model into a format that runs directly inside Transformers.js, so you can generate 768-dimensional vectors in the browser, in Node, or in Bun and Deno without a server call.
What the port actually is
The Xenova/bge-base-en-v1.5 repo mirrors BAAI's original weights converted to ONNX so the JavaScript runtime can execute them. The upstream model is well-known in retrieval: a 110M-parameter BERT-based encoder with instruction-tuned embeddings that posts strong numbers on MTEB. BAAI trained it by pre-training with RetroMAE and then fine-tuning on large-scale pairs data using contrastive learning. The bge-large variants ranked first on MTEB and C-MTEB at release.
Xenova's contribution here is plumbing rather than modeling. The card is explicit that these are BAAI's weights re-exported to ONNX for compatibility with Transformers.js. It exists as a separate repo because, as the maintainer notes, the companion ONNX repo is a temporary bridge until web-native ML tooling matures.
How you use it
Installation is a single npm command, and the pipeline API mirrors the Python transformers library. Once loaded, the model streams from the Hugging Face CDN and caches locally for subsequent runs.
import { pipeline } from '@huggingface/transformers';
const extractor = await pipeline('feature-extraction', 'Xenova/bge-base-en-v1.5');
const texts = ['Hello world.', 'Example sentence.'];
const embeddings = await extractor(texts, { pooling: 'mean', normalize: true });
// Tensor { dims: [2, 768], type: 'float32', ... }For retrieval you prepend a query instruction, which is standard BGE practice. The model card walks through a full example computing cosine similarity between a query like "Represent this sentence for searching relevant passages: What is a panda?" against a small corpus and returning ranked hits.
Why this matters for browser apps
The Transformers.js team has been pushing hard on making models genuinely fast in the browser. Their v4 release rewrote the ONNX export path around specialized operators, and adopting the com.microsoft.MultiHeadAttention operator delivered a roughly 4x speedup for BERT-based embedding models like this one. WebGPU acceleration now works across Node, Bun, and Deno, so the same code path scales from a browser tab to a serverless function.
Practical implications for anyone building retrieval features:
- No embeddings API bill. Every vector is computed on the user's device.
- Privacy by default. Document text never leaves the client, which matters for personal notes apps, medical tools, or enterprise data.
- Offline capable. After the initial model download the pipeline works without a network.
- Same model as your server. If your backend already uses BGE-base-en-v1.5, the vectors are compatible with existing indexes.
Strengths and sharp edges
BGE-base sits in a sweet spot for general English retrieval. It produces 768-dim embeddings from a 110M-parameter encoder, small enough to ship over the wire and still competitive on MTEB. gte-large, bge-base-en-v1.5, bge-large-en-v1.5, and multilingual-e5-large-instruct all show that BERT-based encoders can hold their own at modest parameter counts and embedding dimensions. For English semantic search, RAG over documents, deduplication, and clustering, it is a reasonable default.
The limits are real. The model is English-only, so multilingual apps should look at BGE-M3 or EmbeddingGemma. It requires the query-side instruction prefix to hit its best retrieval numbers, and forgetting that prefix is a common source of quietly worse results. Most teams should start with OpenAI text-embedding-3-small or BGE-large-en-v1.5, measure retrieval quality on a domain-specific eval set, and only invest in fine-tuning when the gap is measurable and the business case justifies the overhead. The base variant trades some accuracy for a smaller download, which is the right call in a browser context.
Where it fits in the stack
The obvious use cases are the ones that have been awkward until now: an in-browser vector store for a notes app, semantic search inside a Chrome extension, RAG over a user's local files in an Electron app, or a Vercel edge function that needs to embed short strings without a round-trip to OpenAI. It also pairs cleanly with the PGlite semantic search demo in the Transformers.js examples repo, which runs Postgres with pgvector fully in WebAssembly. Combining a client-side embedder with a client-side vector database was the missing piece for genuinely local retrieval, and this port is one of the more battle-tested ways to get it.