AI SeedbankHelp preserve open and free AI for humanity's future

← All models

BAAI_bge-m3

BAAI · View on Hugging Face ↗

Get this model

Download TorrentMagnet Link

Seeders: 2 · Leechers: 0

Observed 2026-09-05T20:48:33Z across trackers.

Model card

The complete upstream card, rendered from this payload's README.md — the same hash-verified bytes the torrent distributes. Images and off-site links are removed; the original card on Hugging Face carries them.


pipeline_tag: sentence-similarity tags:

  • sentence-transformers
  • feature-extraction
  • sentence-similarity license: mit

For more details please refer to our github repo: https://github.com/FlagOpen/FlagEmbedding

BGE-M3 (paper, code)

In this project, we introduce BGE-M3, which is distinguished for its versatility in Multi-Functionality, Multi-Linguality, and Multi-Granularity.

  • Multi-Functionality: It can simultaneously perform the three common retrieval functionalities of embedding model: dense retrieval, multi-vector retrieval, and sparse retrieval.
  • Multi-Linguality: It can support more than 100 working languages.
  • Multi-Granularity: It is able to process inputs of different granularities, spanning from short sentences to long documents of up to 8192 tokens.

Some suggestions for retrieval pipeline in RAG

We recommend to use the following pipeline: hybrid retrieval + re-ranking.

  • Hybrid retrieval leverages the strengths of various methods, offering higher accuracy and stronger generalization capabilities. A classic example: using both embedding retrieval and the BM25 algorithm. Now, you can try to use BGE-M3, which supports both embedding and sparse retrieval. This allows you to obtain token weights (similar to the BM25) without any additional cost when generate dense embeddings. To use hybrid retrieval, you can refer to Vespa and Milvus.

  • As cross-encoder models, re-ranker demonstrates higher accuracy than bi-encoder embedding model. Utilizing the re-ranking model (e.g., bge-reranker, bge-reranker-v2) after retrieval can further filter the selected text.

News:

  • 2024/7/1: We update the MIRACL evaluation results of BGE-M3. To reproduce the new results, you can refer to: bge-m3_miracl_2cr. We have also updated our paper on arXiv.

    Details

    The previous test results were lower because we mistakenly removed the passages that have the same id as the query from the search results. After correcting this mistake, the overall performance of BGE-M3 on MIRACL is higher than the previous results, but the experimental conclusion remains unchanged. The other results are not affected by this mistake. To reproduce the previous lower results, you need to add the --remove-query parameter when using pyserini.search.faiss or pyserini.search.lucene to search the passages.

  • 2024/3/20: Thanks Milvus team! Now you can use hybrid retrieval of bge-m3 in Milvus: pymilvus/examples /hello_hybrid_sparse_dense.py.

  • 2024/3/8: Thanks for the experimental results from @Yannael. In this benchmark, BGE-M3 achieves top performance in both English and other languages, surpassing models such as OpenAI.

  • 2024/3/2: Release unified fine-tuning example and data

  • 2024/2/6: We release the MLDR (a long document retrieval dataset covering 13 languages) and evaluation pipeline.

  • 2024/2/1: Thanks for the excellent tool from Vespa. You can easily use multiple modes of BGE-M3 following this notebook

Specs

  • Model
Model Name Dimension Sequence Length Introduction
BAAI/bge-m3 1024 8192 multilingual; unified fine-tuning (dense, sparse, and colbert) from bge-m3-unsupervised
BAAI/bge-m3-unsupervised 1024 8192 multilingual; contrastive learning from bge-m3-retromae
BAAI/bge-m3-retromae -- 8192 multilingual; extend the max_length of xlm-roberta to 8192 and further pretrained via retromae
BAAI/bge-large-en-v1.5 1024 512 English model
BAAI/bge-base-en-v1.5 768 512 English model
BAAI/bge-small-en-v1.5 384 512 English model
  • Data
Dataset Introduction
MLDR Docuemtn Retrieval Dataset, covering 13 languages
bge-m3-data Fine-tuning data used by bge-m3

FAQ

1. Introduction for different retrieval methods

  • Dense retrieval: map the text into a single embedding, e.g., DPR, BGE-v1.5
  • Sparse retrieval (lexical matching): a vector of size equal to the vocabulary, with the majority of positions set to zero, calculating a weight only for tokens present in the text. e.g., BM25, unicoil, and splade
  • Multi-vector retrieval: use multiple vectors to represent a text, e.g., ColBERT.

2. How to use BGE-M3 in other projects?

For embedding retrieval, you can employ the BGE-M3 model using the same approach as BGE. The only difference is that the BGE-M3 model no longer requires adding instructions to the queries.

For hybrid retrieval, you can use Vespa and Milvus.

3. How to fine-tune bge-M3 model?

You can follow the common in this example to fine-tune the dense embedding.

If you want to fine-tune all embedding function of m3 (dense, sparse and colbert), you can refer to the unified_fine-tuning example

Usage

Install:

git clone https://github.com/FlagOpen/FlagEmbedding.git
cd FlagEmbedding
pip install -e .

or:

pip install -U FlagEmbedding

Generate Embedding for text

  • Dense Embedding
from FlagEmbedding import BGEM3FlagModel

model = BGEM3FlagModel('BAAI/bge-m3',  
                       use_fp16=True) # Setting use_fp16 to True speeds up computation with a slight performance degradation

sentences_1 = ["What is BGE M3?", "Defination of BM25"]
sentences_2 = ["BGE M3 is an embedding model supporting dense retrieval, lexical matching and multi-vector interaction.", 
               "BM25 is a bag-of-words retrieval function that ranks a set of documents based on the query terms appearing in each document"]

embeddings_1 = model.encode(sentences_1, 
                            batch_size=12, 
                            max_length=8192, # If you don't need such a long length, you can set a smaller value to speed up the encoding process.
                            )['dense_vecs']
embeddings_2 = model.encode(sentences_2)['dense_vecs']
similarity = embeddings_1 @ embeddings_2.T
print(similarity)
# [[0.6265, 0.3477], [0.3499, 0.678 ]]

You also can use sentence-transformers and huggingface transformers to generate dense embeddings. Refer to baai_general_embedding for details.

  • Sparse Embedding (Lexical Weight)
from FlagEmbedding import BGEM3FlagModel

model = BGEM3FlagModel('BAAI/bge-m3',  use_fp16=True) # Setting use_fp16 to True speeds up computation with a slight performance degradation

sentences_1 = ["What is BGE M3?", "Defination of BM25"]
sentences_2 = ["BGE M3 is an embedding model supporting dense retrieval, lexical matching and multi-vector interaction.", 
               "BM25 is a bag-of-words retrieval function that ranks a set of documents based on the query terms appearing in each document"]

output_1 = model.encode(sentences_1, return_dense=True, return_sparse=True, return_colbert_vecs=False)
output_2 = model.encode(sentences_2, return_dense=True, return_sparse=True, return_colbert_vecs=False)

# you can see the weight for each token:
print(model.convert_id_to_token(output_1['lexical_weights']))
# [{'What': 0.08356, 'is': 0.0814, 'B': 0.1296, 'GE': 0.252, 'M': 0.1702, '3': 0.2695, '?': 0.04092}, 
#  {'De': 0.05005, 'fin': 0.1368, 'ation': 0.04498, 'of': 0.0633, 'BM': 0.2515, '25': 0.3335}]


# compute the scores via lexical mathcing
lexical_scores = model.compute_lexical_matching_score(output_1['lexical_weights'][0], output_2['lexical_weights'][0])
print(lexical_scores)
# 0.19554901123046875

print(model.compute_lexical_matching_score(output_1['lexical_weights'][0], output_1['lexical_weights'][1]))
# 0.0
  • Multi-Vector (ColBERT)
from FlagEmbedding import BGEM3FlagModel

model = BGEM3FlagModel('BAAI/bge-m3',  use_fp16=True) 

sentences_1 = ["What is BGE M3?", "Defination of BM25"]
sentences_2 = ["BGE M3 is an embedding model supporting dense retrieval, lexical matching and multi-vector interaction.", 
               "BM25 is a bag-of-words retrieval function that ranks a set of documents based on the query terms appearing in each document"]

output_1 = model.encode(sentences_1, return_dense=True, return_sparse=True, return_colbert_vecs=True)
output_2 = model.encode(sentences_2, return_dense=True, return_sparse=True, return_colbert_vecs=True)

print(model.colbert_score(output_1['colbert_vecs'][0], output_2['colbert_vecs'][0]))
print(model.colbert_score(output_1['colbert_vecs'][0], output_2['colbert_vecs'][1]))
# 0.7797
# 0.4620

Compute score for text pairs

Input a list of text pairs, you can get the scores computed by different methods.

from FlagEmbedding import BGEM3FlagModel

model = BGEM3FlagModel('BAAI/bge-m3',  use_fp16=True) 

sentences_1 = ["What is BGE M3?", "Defination of BM25"]
sentences_2 = ["BGE M3 is an embedding model supporting dense retrieval, lexical matching and multi-vector interaction.", 
               "BM25 is a bag-of-words retrieval function that ranks a set of documents based on the query terms appearing in each document"]

sentence_pairs = [[i,j] for i in sentences_1 for j in sentences_2]

print(model.compute_score(sentence_pairs, 
                          max_passage_length=128, # a smaller max length leads to a lower latency
                          weights_for_different_modes=[0.4, 0.2, 0.4])) # weights_for_different_modes(w) is used to do weighted sum: w[0]*dense_score + w[1]*sparse_score + w[2]*colbert_score

# {
#   'colbert': [0.7796499729156494, 0.4621465802192688, 0.4523794651031494, 0.7898575067520142], 
#   'sparse': [0.195556640625, 0.00879669189453125, 0.0, 0.1802978515625], 
#   'dense': [0.6259765625, 0.347412109375, 0.349853515625, 0.67822265625], 
#   'sparse+dense': [0.482503205537796, 0.23454029858112335, 0.2332356721162796, 0.5122477412223816], 
#   'colbert+sparse+dense': [0.6013619303703308, 0.3255828022956848, 0.32089319825172424, 0.6232916116714478]
# }

Evaluation

We provide the evaluation script for MKQA and MLDR

Benchmarks from the open-source community

The BGE-M3 model emerged as the top performer on this benchmark (OAI is short for OpenAI). For more details, please refer to the article and Github Repo

Our results

  • Multilingual (Miracl dataset)

  • Cross-lingual (MKQA dataset)

  • Long Document Retrieval

    • MLDR:
      Please note that MLDR is a document retrieval dataset we constructed via LLM, covering 13 languages, including test set, validation set, and training set. We utilized the training set from MLDR to enhance the model's long document retrieval capabilities. Therefore, comparing baselines with Dense w.o.long(fine-tuning without long document dataset) is more equitable. Additionally, this long document retrieval dataset will be open-sourced to address the current lack of open-source multilingual long text retrieval datasets. We believe that this data will be helpful for the open-source community in training document retrieval models.

    • NarritiveQA:

  • Comparison with BM25

We utilized Pyserini to implement BM25, and the test results can be reproduced by this script. We tested BM25 using two different tokenizers: one using Lucene Analyzer and the other using the same tokenizer as M3 (i.e., the tokenizer of xlm-roberta). The results indicate that BM25 remains a competitive baseline, especially in long document retrieval.

Training

  • Self-knowledge Distillation: combining multiple outputs from different retrieval modes as reward signal to enhance the performance of single mode(especially for sparse retrieval and multi-vec(colbert) retrival)
  • Efficient Batching: Improve the efficiency when fine-tuning on long text. The small-batch strategy is simple but effective, which also can used to fine-tune large embedding model.
  • MCLS: A simple method to improve the performance on long text without fine-tuning. If you have no enough resource to fine-tuning model with long text, the method is useful.

Refer to our report for more details.

Acknowledgement

Thanks to the authors of open-sourced datasets, including Miracl, MKQA, NarritiveQA, etc. Thanks to the open-sourced libraries like Tevatron, Pyserini.

Citation

If you find this repository useful, please consider giving a star :star: and citation

@misc{bge-m3,
      title={BGE M3-Embedding: Multi-Lingual, Multi-Functionality, Multi-Granularity Text Embeddings Through Self-Knowledge Distillation}, 
      author={Jianlv Chen and Shitao Xiao and Peitian Zhang and Kun Luo and Defu Lian and Zheng Liu},
      year={2024},
      eprint={2402.03216},
      archivePrefix={arXiv},
      primaryClass={cs.CL}
}

Magnet link

Opens the swarm directly in your torrent client — no file download needed. Copy-paste works too:

magnet:?xt=urn:btih:8fc8762d5369ea709eb0464f1508004a64f6ca05&dn=BAAI_bge-m3

Open magnet in torrent client · infohash 8fc8762d5369ea709eb0464f1508004a64f6ca05

Files & hashes

PathSizesha1sha256
1_Pooling/config.json191 B (191 B)9bd85925f325e25246d94c4918dc02ab98f2a1b7e54c164a07274f2eb45bb724f54a79d1efcc90c41573887cd9a29aeee0597352
README.md15.5 KB (15,822 B)e5a320176edd6ee1cfb256e68ee5ac0004de94470b81ccf9134e5874d620a86e6905062ea999e779c34eb1a7e65eaeb7fe00e450
colbert_linear.pt2.0 MB (2,100,674 B)feedf5ca9a284b5a5dbb0fb006aa538090962fa019bfbae397c2b7524158c919d0e9b19393c5639d098f0a66932c91ed8f5f9abb
config.json687 B (687 B)e6eda1c72da8f9dc30fdd9b69c73d35af3b7a7ad26159e7ad065073448460117eb24b7a4572f6f4e78eadff65dc0a11c052449fa
config_sentence_transformers.json123 B (123 B)1fba91c78a6c8e17227058ab6d4d3acb5d8630a91eef72430e7194a1e59680e635aed81ffa083f05668dbc5bb1c56c04c0999c38
imgs/bm25.jpg128.8 KB (131,849 B)030c9395c29d2ae71fdc8a8fe38b01de178178214d88d1c224dc6dae62b76547e1e79ed12e1085b94dc1fe0c50440a948277d89a
imgs/long.jpg474.1 KB (485,432 B)5121bd05ddd5b58e69f1dd62ae82117a40144ab5d2a44539154d2cee75abd032fe773d5514f1129b741c4641cde12554762709a6
imgs/miracl.jpg563.0 KB (576,482 B)878d67d4931a00e30c5a56a2f5adedaf220da7f1a48c10a1be83aa7a92a25d85dbc6d2c0194b59503a2599a9e89bd7e063c32a66
imgs/mkqa.jpg593.8 KB (608,027 B)6607ac85da86583bd4fe91d3b9ec58a76feb220eae331fb64bdceeaafecc2f8cd89a2d55a3e41c429dcc5ba906cb9a7bdb73cf2b
imgs/nqa.jpg154.6 KB (158,358 B)bf983404739ed8b859d15e5586bdcdf731d3caa05385ca9d6af4124932281039e1366d704d10ed81e905526f795f5732352394bb
imgs/others.webp20.5 KB (20,984 B)58e7f9981380794db1df4334707539f180b0035e9222ef69ba79cbd3aa8c659bd3cbbf9d90b3dbb040526f56298ed9ceb05ec9df
long.jpg123.9 KB (126,894 B)3435de26618499e8381cd414025410991c3a97bd4ba03433ef54575eeef5a291abd81661eb53c432677934dc4050565893e7a8a9
modules.json349 B (349 B)952a9b81c0bfd99800fabf352f69c7ccd46c5e4384e40c8e006c9b1d6c122e02cba9b02458120b5fb0c87b746c41e0207cf642cf
onnx/Constant_7_attr__value64.0 KB (65,552 B)3cdc05e5f550d8bd136f28efcea0ad5e6b4169c8cdf16f72c5d07b36484056e601ed9687f78477e5d85cee85a34f2406b7fb5906
onnx/config.json698 B (698 B)aadef53b97586be7cafa2c06837a0bd53f1f1dedf24afd5de914fba8c668426c43d208a1a54022500c63b2c160be20891686fce8
onnx/model.onnx_data2.11 GB (2,266,820,608 B)dd24ba994ba3a3b1f2ce13c1739e852937d361fc1eebfb28493f67bba03ce0ef64bfdc7fc5a3bd9d7493f818bb1d78cd798416b4
onnx/sentencepiece.bpe.model4.8 MB (5,069,051 B)7e88c49faff6c6c136fdf4a3402d0cb534c6ab10cfc8146abe2a0488e9e2a0c56de7952f7c11ab059eca145a0a727afce0db2865
onnx/special_tokens_map.json964 B (964 B)b1879d702821e753ffe4245048eee415d54a93858c785abebea9ae3257b61681b4e6fd8365ceafde980c21970d001e834cf10835
onnx/tokenizer.json16.3 MB (17,082,821 B)11f41581bba28a313ac97149cc031fd668fcc07d6710678b12670bc442b99edc952c4d996ae309a7020c1fa0096dd245c2faf790
onnx/tokenizer_config.json1.1 KB (1,173 B)328a00a9a560aadcf2a3064f917517359eb3cc267e4c1cc848840aeccdd763458c18dd525eb0f795c992e00ebe9c28554e7db2d4
pytorch_model.bin2.12 GB (2,271,145,830 B)fc6baf9ba577b19e732a017be4cf3573dd08178db5e0ce3470abf5ef3831aa1bd5553b486803e83251590ab7ff35a117cf6aad38
sentence_bert_config.json54 B (54 B)0140ba1eac83a3c9b857d64baba91969d988624beb9b44b13c0f52a3b3685c3b1cbdea1ba8b04bea123b98f61610048940776eb1
sentencepiece.bpe.model4.8 MB (5,069,051 B)7e88c49faff6c6c136fdf4a3402d0cb534c6ab10cfc8146abe2a0488e9e2a0c56de7952f7c11ab059eca145a0a727afce0db2865
sparse_linear.pt3.4 KB (3,516 B)180631d4a633fa1bc63ec9203825b10b206ef13e45c93804d2142b8f6d7ec6914ae23a1eee9c6a1d27d83d908a20d2afb3595ad9
special_tokens_map.json964 B (964 B)b1879d702821e753ffe4245048eee415d54a93858c785abebea9ae3257b61681b4e6fd8365ceafde980c21970d001e834cf10835
tokenizer.json16.3 MB (17,098,108 B)4484b9077438b46533f7112a8ff23760e1d80e1021106b6d7dab2952c1d496fb21d5dc9db75c28ed361a05f5020bbba27810dd08
tokenizer_config.json444 B (444 B)dc69ac559dcba2694012009aaa108c614541789aa62b2b6784f990259fddef5f16388693a8043be4f69179e6a5257eeb3f9abac4

Cite this release

Canonical URL
https://aiseedbank.org/models/BAAI_bge-m3/
Slug
BAAI_bge-m3
Infohash
8fc8762d5369ea709eb0464f1508004a64f6ca05
License
mit
Signing key fingerprint
85a3b32c3712427b

Every file carries a locally computed sha256 — verify a download against the signed sums: BAAI_bge-m3.SHA256SUMS (+ minisign signature).

Provenance

Upstream repositoryBAAI/bge-m3
Revision (pinned)5617a9f61b028005a4858fdac845db406aefb181
Fetched at2026-08-24T05:37:30Z
License at fetchmit
Snapshot toolhuggingface · seedbank 0.1.0

Trackers

✓ verified · rehash-vs-hf-metadata at 2026-08-24T05:40:04Z

mit4.27 GB (4,586,584,706 bytes)sentence-transformerspytorchonnxxlm-robertafeature-extractionsentence-similarityeval-resultstext-embeddings-inferenceendpoints_compatiblepaper: 2402.03216paper: 2004.04906paper: 2106.14807paper: 2107.05720paper: 2004.12832