bge-m3

BAAI/bge-m3 |

BAAI 14.8M downloads mit Sentence Similarity Top 50
Frameworkssentence-transformerspytorchonnx
Tagsxlm-robertafeature-extractionsentence-similaritytext-embeddings-inference
Downloads
14.8M
License
mit
Pipeline
Sentence Similarity
Author
BAAI

Run bge-m3 locally on a Q4KM hard drive

Boost your retrieval pipelines with a Q4KM hard drive pre‑loaded with BGE‑M3 . Get instant, plug‑and‑play performance on your on‑premise servers. Shop now → ```

Shop Q4KM Drives

Technical Overview

Model ID: BAAI/bge-m3 | Name: bge-m3 | Author: BAAI (Beijing Academy of Artificial Intelligence)

BGE‑M3 is a multilingual, unified‑embedding model designed for dense, multi‑vector, and sparse retrieval in a single forward pass. It extends the XLM‑RoBERTa‑large backbone to a maximum sequence length of 8 192 tokens, enabling it to encode short sentences as well as long documents without truncation. The model is trained with a “unified fine‑tuning” strategy that jointly optimises three retrieval modalities: dense vectors (bi‑encoder), multi‑vector (ColBERT‑style) representations, and token‑level sparse weights (BM25‑like).

Key Features & Capabilities

  • Multi‑Functionality: Simultaneously produces dense embeddings, sparse token weights, and multi‑vector outputs, eliminating the need for separate models.
  • Multi‑Linguality: Supports > 100 languages out‑of‑the‑box, making it a true “one‑model‑fits‑all” solution for global retrieval tasks.
  • Multi‑Granularity: Handles inputs from a few words up to 8 192 tokens, suitable for sentence‑level similarity, paragraph search, and full‑document retrieval.
  • Hybrid Retrieval Ready: Provides token‑level importance scores that can be combined with traditional BM25 or other lexical methods for hybrid pipelines (e.g., RAG).
  • End‑to‑End Compatibility: Works with popular vector stores (Milvus, Vespa, FAISS) and can be exported to ONNX for low‑latency serving.

Architecture Highlights

  • Base encoder: XLM‑RoBERTa‑large (24 layers, 1024‑dim hidden state) extended to 8 192 token context.
  • Unified fine‑tuning head that jointly learns three loss functions: contrastive dense loss, ColBERT‑style multi‑vector loss, and sparse token‑weight loss derived from RetroMAE pre‑training.
  • Parameter count: ~ 355 M (≈ 1.4 GB when stored in FP16).

Intended Use Cases

  • Hybrid retrieval pipelines for Retrieval‑Augmented Generation (RAG).
  • Cross‑language semantic search and document clustering.
  • Large‑scale knowledge‑base indexing where both dense similarity and lexical matching are required.
  • Any scenario that benefits from a single model handling multiple granularities—from short queries to multi‑kilobyte documents.

Benchmark Performance

BGE‑M3 is evaluated on a suite of multilingual and long‑document retrieval benchmarks. The most notable results are from the MIRACL benchmark (over 100 languages) where the model achieved top‑ranked nDCG@10 scores, surpassing both OpenAI embeddings and other open‑source multilingual models. Additional evaluations on MLDR (13‑language long‑document dataset) and classic English benchmarks (e.g., MS‑MARCO) confirm its strong dense‑retrieval performance while also delivering competitive sparse scores.

Why these benchmarks matter:

  • MIRACL: Tests cross‑lingual semantic similarity across a wide language spectrum, essential for global search applications.
  • MLDR: Emphasises long‑document retrieval, validating the 8 192‑token context window.
  • MS‑MARCO & BEIR: Standard dense‑retrieval suites that allow direct comparison with existing bi‑encoder models.

In head‑to‑head comparisons, BGE‑M3 consistently outperforms earlier BGE‑M2 and E5‑large models on multilingual nDCG and Recall metrics, while offering the added advantage of sparse token weights at no extra cost. This makes it a compelling choice for hybrid pipelines where both semantic and lexical relevance are required.

Hardware Requirements

VRAM & Inference

  • FP16 (half‑precision) inference on a single GPU typically requires 8‑10 GB VRAM for a batch size of 1 (8 192 token input).
  • FP32 inference pushes the requirement to ~ 12 GB VRAM.
  • For batch processing (e.g., 8 × 512‑token queries), a 24 GB GPU (NVIDIA RTX 3090/ A6000) is recommended.

Recommended GPU

  • Any NVIDIA GPU with ≥ 8 GB VRAM supporting CUDA 11+ (RTX 3080, A5000, etc.).
  • For production‑grade latency, consider GPUs with Tensor Cores (e.g., A100, H100) and enable TensorRT or ONNX Runtime optimisations.

CPU & Storage

  • CPU inference is possible but will be ~ 5‑10× slower; a modern 8‑core Xeon or AMD EPYC is advisable.
  • Model files (FP16) total ~ 1.4 GB; the full repository (including tokenizer, config, and example scripts) is ~ 2 GB.
  • SSD storage is recommended for fast loading of the tokenizer and ONNX exports.

Use Cases

BGE‑M3 shines in scenarios that demand both semantic depth and lexical precision across many languages and document lengths.

  • Hybrid Retrieval for RAG: Combine dense similarity with token‑level sparse scores to retrieve the most relevant passages before feeding them to a LLM.
  • Multilingual Enterprise Search: Index corporate knowledge bases in dozens of languages with a single model, reducing operational overhead.
  • Long‑Document Retrieval: Academic literature search, legal case law retrieval, or patent discovery where documents exceed 4 K tokens.
  • Cross‑Language Recommendation: Match user queries in one language to content in another, leveraging the shared multilingual embedding space.
  • Edge‑Optimised Retrieval: Export to ONNX for low‑latency inference on edge devices or in cloud functions.

Training Details

Methodology

  • Three‑stage training pipeline:
    1. RetroMAE pre‑training on massive multilingual corpora (≈ 10 B tokens) to learn token‑level reconstruction.
    2. Unsupervised contrastive learning using the bge-m3-unsupervised checkpoint, where positive pairs are generated via data augmentation (e.g., back‑translation, random cropping).
    3. Unified fine‑tuning on a mixture of dense (MS‑MARCO), multi‑vector (ColBERT‑style), and sparse (BM25‑style) objectives, jointly optimising a weighted sum of contrastive, ColBERT, and sparse token‑weight losses.
  • Training data spans 100+ languages, sourced from Wikipedia, Common Crawl, and the bge‑m3‑data collection.
  • Compute: 8 × NVIDIA A100 40 GB GPUs, ~ 2 weeks of mixed‑precision (FP16) training.
  • Fine‑tuning: Users can further adapt the model on domain‑specific data via the provided unified_finetune scripts, which maintain the three‑head structure.

Licensing Information

The model card lists the license as MIT, although the top‑level metadata on Hugging Face shows “unknown”. The MIT license is permissive: it allows free use, modification, distribution, and commercial exploitation provided that the original copyright notice and license text are retained.

Commercial Use

  • Yes – you may integrate BGE‑M3 into SaaS products, internal search engines, or any commercial offering.
  • No royalty or attribution fee is required beyond the standard MIT notice.

Restrictions & Requirements

  • Do not remove the original copyright notice from the source code or model card.
  • If you redistribute the model (e.g., on a private model hub), you must include the MIT license file.
  • There are no patent claims or export‑control restrictions in the MIT text, but you should verify any downstream dependencies (e.g., XLM‑RoBERTa) for their own licenses.

Pre-loaded AI models. Ready to run.

Skip the downloads. Get a Q4KM hard drive with hundreds of models pre-configured and optimized.

Shop Q4KM Hard Drives