alt.freeweights.embed / bge-m3-unsupervised
From: BAAI <huggingface.co/BAAI>Newsgroups: alt.freeweights.embedSubject:

bge-m3-unsupervised

Date: 2026-11-14Commit: 46f03bcSigned: 2DC28CC7B26A283B ✓

Sentence similarity model with 568M parameters. Safetensors weights, 4.57 GB in all. Published by BAAI under MIT.

568M params4.57GBbge-m3-unsupervisedsafetensorspermissive
FactsParams568MSize4.57 GBFormatssafetensorsTasksentence similarityLicenseMITFrom sourcepermissive
$ fw get BAAI/bge-m3-unsupervised
# manifest sha256 14ea00542787… · 4.57 GB · 17 files
$ fw verify ./bge-m3-unsupervised BAAI/bge-m3-unsupervised
From sourceHosted (signed)BAAI/bge-m3-unsupervisedLast check: 2026-11-14 21:08 UTC

Get help: custom fine-tune or private deploy. We review your setup before we quote.

Works with

Evaluate with

Overview

Size
4.57 GB
Weights
2.27 GB (safetensors)
Parameters
568M
Formats
safetensors
Task
sentence similarity
License
MIT (permissive)
Files
17, each with a sha256
Publisher
BAAI
Added
2026-11-14
Section
alt.freeweights.embed
Lineage

Original release from the publisher.

Where these bytes come from
Publisher at the pinned commit→You

Sources are tried in order. A file counts only when its size and sha256 match the manifest. Sources are checked when you ask for them, not on a timer.

Sources
BadgeHostLast checkResult
From sourcehuggingface.co2026-11-14 21:08 UTCpassed

Model card

From the publisher at commit 46f03bc. Shown as plain text with links; images open at the publisher.

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 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.

  • As cross-encoder models, re-ranker demonstrates higher accuracy than bi-encoder embedding model.

Utilizing the re-ranking model (e.g., bge-reranker, cohere-reranker) after retrieval can further filter the selected text.

News:#

  • 2/6/2024: We release the MLDR (a long document retrieval dataset covering 13 languages) and evaluation pipeline.
  • 2/1/2024: Thanks for the excellent tool from Vespa. You can easily use multiple modes of BGE-M3 following this notebook

Specs#

  • Model
Model NameDimensionSequence LengthIntroduction
BAAI/bge-m310248192multilingual; unified fine-tuning (dense, sparse, and colbert) from bge-m3-unsupervised
BAAI/bge-m3-unsupervised10248192multilingual; contrastive learning from bge-m3-retromae
BAAI/bge-m3-retromae--8192multilingual; extend the max_length of xlm-roberta to 8192 and further pretrained via retromae
BAAI/bge-large-en-v1.51024512English model
BAAI/bge-base-en-v1.5768512English model
BAAI/bge-small-en-v1.5384512English model
  • Data
DatasetIntroduction
MLDRDocuemtn Retrieval Dataset, covering 13 languages

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. Comparison with BGE-v1.5 and other monolingual models

BGE-M3 is a multilingual model, and its ability in monolingual embedding retrieval may not surpass models specifically designed for single languages. However, we still recommend trying BGE-M3 because of its versatility (support for multiple languages and long texts). Moreover, it can simultaneously generate multiple representations, and using them together can enhance accuracy and generalization, unlike most existing models that can only perform dense retrieval.

In the open-source community, there are many excellent models (e.g., jina-embedding, colbert, e5, etc), and users can choose a model that suits their specific needs based on practical considerations, such as whether to require multilingual or cross-language support, and whether to process long texts.

3. 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 sparse retrieval methods, most open-source libraries currently do not support direct utilization of the BGE-M3 model. Contributions from the community are welcome.

In our experiments, we use Pyserini and Faiss to do hybrid retrieval. Now you can ou can try the hybrid mode of BGE-M3 in Vespa. Thanks @jobergum.

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

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

Our code and data for unified fine-tuning (dense, sparse, and multi-vectors) will be released.

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#

  • Multilingual (Miracl dataset)

Image: avatar

  • Cross-lingual (MKQA dataset)

Image: avatar

  • Long Document Retrieval
    • MLDR: Image: avatar 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: Image: avatar

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.

The fine-tuning codes and datasets will be open-sourced in the near future.

Acknowledgement#

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

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}
}

Files

17 files · 4.57 GBWeights 2.27 GB (safetensors). Sizes and sha256 from the signed manifest.
Hide all 17 files with their sha256
FileSizesha256
.gitattributes1.57 KB34448b82c17d60fec9b65b1f093c115ddbaadc04beb1b0140b6bfed2e012a930
1_Pooling/config.json191 Be54c164a07274f2eb45bb724f54a79d1efcc90c41573887cd9a29aeee0597352
README.md13.5 KB6d4cb6c6f4730ff36941485fb47f10b2e2787064f0b82573cfe290cf1080bba6
config.json687 B26159e7ad065073448460117eb24b7a4572f6f4e78eadff65dc0a11c052449fa
config_sentence_transformers.json123 B1eef72430e7194a1e59680e635aed81ffa083f05668dbc5bb1c56c04c0999c38
imgs/long.jpg127 KB4ba03433ef54575eeef5a291abd81661eb53c432677934dc4050565893e7a8a9
imgs/miracl.jpg201 KBe02048688a4e97f2ca44f4f598405c2d7d0f521fdc8b35dd0372de4bd56a6080
imgs/mkqa.jpg326 KBec5da089cc0f9633571af26e6ac42b209f7cfe98a464de0100b8536176c5e1b4
imgs/nqa.jpg97.4 KBe835018505ca1f5cabe92daeaedcdf0a4d2fdb23db2e1b3f441f8f9c89d42700
model.safetensors2.27 GBf66c8875cbd1c039d0d85ea1ea6627535ed9e92974629aeb1ebce0a8ff53f8a5
modules.json349 B84e40c8e006c9b1d6c122e02cba9b02458120b5fb0c87b746c41e0207cf642cf
pytorch_model.bin2.27 GB206f59b77411b290d8a5a317863fbcf1de979e4ed5a8181de9c50fa21fea87ef
sentence_bert_config.json54 Beb9b44b13c0f52a3b3685c3b1cbdea1ba8b04bea123b98f61610048940776eb1
sentencepiece.bpe.model5.07 MBcfc8146abe2a0488e9e2a0c56de7952f7c11ab059eca145a0a727afce0db2865
special_tokens_map.json964 B8c785abebea9ae3257b61681b4e6fd8365ceafde980c21970d001e834cf10835
tokenizer.json17.1 MB21106b6d7dab2952c1d496fb21d5dc9db75c28ed361a05f5020bbba27810dd08
tokenizer_config.json1.31 KB4c532e44f339fd1142ff026025b6a7910bef6e32aa4b5d7baa73e39a9db9fe88
VersionsEach time the pinned upstream commit or file list changed in this repo. Newest first.
Upstream commitDateContents
46f03bc863 pinned now manifest updated, same commit2026-11-14 21:08 UTC17 files · 4.57 GB
46f03bc8632026-11-14 21:08 UTC17 files · 4.57 GB

Use it

$ fw get BAAI/bge-m3-unsupervised
# manifest sha256 14ea00542787… · 4.57 GB · 17 files
$ fw verify ./bge-m3-unsupervised BAAI/bge-m3-unsupervised
fw.pyChecks the signature and every sha256, tries each source in order, resumes.
$ python3 fw.py get https://freeweights.allternit.com/manifests/BAAI/bge-m3-unsupervised.json --dir ./bge-m3-unsupervised $ python3 fw.py verify ./bge-m3-unsupervised ./BAAI__bge-m3-unsupervised.json
hfThe Hugging Face CLI with one setting. Same repo id.
$ HF_ENDPOINT=https://freeweights.allternit.com hf download BAAI/bge-m3-unsupervised --revision 46f03bc86361cf88102b0b517b36c8259f2946b1 --local-dir ./bge-m3-unsupervised
transformersLoad the weights in Python.
import os os.environ["HF_ENDPOINT"] = "https://freeweights.allternit.com" from transformers import AutoModel, AutoTokenizer tok = AutoTokenizer.from_pretrained("BAAI/bge-m3-unsupervised", revision="46f03bc86361cf88102b0b517b36c8259f2946b1") model = AutoModel.from_pretrained("BAAI/bge-m3-unsupervised", revision="46f03bc86361cf88102b0b517b36c8259f2946b1", device_map="auto")
sentence-transformersEmbed text with sentence-transformers.
import os os.environ["HF_ENDPOINT"] = "https://freeweights.allternit.com" from sentence_transformers import SentenceTransformer model = SentenceTransformer("BAAI/bge-m3-unsupervised", revision="46f03bc86361cf88102b0b517b36c8259f2946b1") vectors = model.encode(["Hello"])

License

Name
MIT License
Id
MIT
Class
Permissive
Redistribution
yes
Listing
Hosted (signed)
Decided
License as declared by the publisher. No person read it. 2026-11-14
Text in
README.md
Text sha256
6d4cb6c6f4730ff36941485fb47f10b2e2787064f0b82573cfe290cf1080bba6
Terms gate
No extra terms beyond the license.

Read the license text

Licenses are checked against the license table. A custom license passes only after a person reads it.

Provenance

From: BAAI <huggingface.co/BAAI>Newsgroups: alt.freeweights.embedSubject: bge-m3-unsupervisedDate: 2026-11-14Commit: 46f03bcSigned: 2DC28CC7B26A283B ✓
Upstream
BAAI/bge-m3-unsupervised
Pinned commit
46f03bc86361cf88102b0b517b36c8259f2946b1
Manifest
bge-m3-unsupervised.json · .minisig
Manifest sha256
14ea005427877a8bb3b9acb4a3116616c9e0d2cdc90548793257eeed5cf0db68
Signature
minisign, Ed25519, key 2DC28CC7B26A283B
Created
2026-11-14 21:08 UTC
Generator
freeweights-manifest/0.1.0
Takedowns
None.

How to verify

$ curl -O https://freeweights.allternit.com/manifests/BAAI/bge-m3-unsupervised.json $ curl -O https://freeweights.allternit.com/manifests/BAAI/bge-m3-unsupervised.json.minisig $ minisign -Vm bge-m3-unsupervised.json -P RWQ7KGqyx4zCLXtUFOqvfv8L3g+8fpKJ1FsuxPyOYMF+4KufbUxKq1Oq $ shasum -a 256 <file> # compare with the Files tab

A manifest whose signature fails must be rejected. A file whose size or sha256 does not match must be discarded. Verify a download

Model tree

No related models in this catalog.Nothing here lists this model as its parent, and it names no parent.
Get it
Download
$ HF_ENDPOINT=https://freeweights.allternit.com hf download BAAI/bge-m3-unsupervised
Open in Freeweights Studio

Pull, verify and run it in the Allternit app on Desktop, web or phone.

Signed manifest
minisign, key 2DC28CC7B26A283B. bge-m3-unsupervised.json. Provenance. Takedown history: none.
From: sentence-transformers <huggingface.co/sentence-transformers>Subject: all-MiniLM-L6-v1
From: unsloth <huggingface.co/unsloth>Subject: all-MiniLM-L6-v2
From: mlx-community <huggingface.co/mlx-community>Subject: all-MiniLM-L6-v2-4bit
From: sentence-transformers <huggingface.co/sentence-transformers>Subject: all-mpnet-base-v1
From: sentence-transformers <huggingface.co/sentence-transformers>Subject: allenai-specter
From: sentence-transformers <huggingface.co/sentence-transformers>Subject: bert-base-nli-max-tokens