BGE-M3
Multilingual Embedding Model for Multilingual Search
2 min readupdated
The BGE-M3 model is designed to simultaneously support three retrieval methods: dense, sparse, and multi-vector. It handles over 100 languages and supports a context length of up to 8192 tokens, allowing you to work with both short phrases and long documents. Unlike classical models, it extracts token weights without extra overhead during dense embedding generation. The model is useful for developers of search engines, RAG pipelines, and text data analysis systems.
Key features
- Support for over 100 working languages for global projects.
- Processing long texts up to 8192 tokens in size.
- Combining dense, sparse, and multi-vector (ColBERT) retrieval.
- High performance and integration with popular search engines such as Milvus and Vespa.
What you can do
- Build a hybrid search system using sparse and dense search.
- Set up efficient search over long documents and knowledge bases.
- Integrate the model into RAG pipelines to improve LLM response accuracy.
Example
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"]
embeddings_1 = model.encode(sentences_1, max_length=8192)['dense_vecs']
embeddings_2 = model.encode(sentences_2)['dense_vecs']
similarity = embeddings_1 @ embeddings_2.T
print(similarity)Read more
DetailsEmbedding dimensionality: 1024
Maximum sequence length: 8192 tokens
Supports optimization via use_fp16 to speed up computations
Includes dense, sparse, and colbert retrieval methods










Comments