Repolode
FlagOpen

FlagOpen/FlagEmbedding

A retrieval toolkit from BAAI providing BGE embedding and reranker models plus training, evaluation and tutorials for search and RAG.

Stars
12,259
Forks
1,105
Open issues
924
Last commit
2 months ago

What is it?

FlagEmbedding (BGE, BAAI General Embedding) is a toolkit for text retrieval and retrieval-augmented LLM applications. It provides a family of embedding models that convert text into vectors for semantic search, along with cross-encoder reranker models that reorder the top results returned by an embedder.

The project covers the full workflow: inference with the Python package (installable via pip), fine-tuning scripts for embedders and rerankers, evaluation tools, and a dataset collection. Models are published on Hugging Face and include English, Chinese and multilingual variants, with the BGE-M3 model supporting dense, sparse and multi-vector retrieval over inputs up to 8192 tokens.

Beyond the core models, the repository hosts research projects such as LLM-Embedder for retrieval augmentation, Activation-Beacon for extending LLM context length, and C-MTEB, a Chinese embedding benchmark.

Key features

  • 01Pip-installable Python package for running BGE embedding and reranker models.
  • 02Multilingual BGE-M3 model supporting dense, sparse and multi-vector retrieval.
  • 03Fine-tuning scripts for embedder and reranker models.
  • 04Evaluation tools and a dataset collection for retrieval benchmarks.
  • 05Models on Hugging Face covering English, Chinese and multilingual use.

Use cases

  • Building semantic search over document collections.
  • Adding a retrieval step to a RAG pipeline with a reranker over top-k results.
  • Fine-tuning an embedding model on domain-specific query and passage pairs.
  • Benchmarking Chinese or multilingual retrieval quality.

Quick start

  1. 1

    Install the package with pip

    pip install -U FlagEmbedding
  2. 2

    Load a BGE embedding model in Python

  3. 3

    Encode sentences and compute similarity

Things to know

  • Fine-tuning requires installing the extra finetune dependencies separately.

Topics

FAQ

What is FlagEmbedding?
A retrieval toolkit from BAAI providing BGE embedding and reranker models plus training, evaluation and tutorials for search and RAG. FlagEmbedding (BGE, BAAI General Embedding) is a toolkit for text retrieval and retrieval-augmented LLM applications. It provides a family of embedding models that convert text into vectors for semantic search, along with cross-encoder reranker models that reorder the top results returned by an embedder.
Is FlagEmbedding free to use? What license does it have?
FlagEmbedding is open source under the MIT license. Check the license terms before using it in commercial products.
Is FlagEmbedding still maintained?
Updated within 6 months. The last commit to FlagEmbedding was on Aug 24, 2026.
What can I use FlagEmbedding for?
Building semantic search over document collections. Adding a retrieval step to a RAG pipeline with a reranker over top-k results. Fine-tuning an embedding model on domain-specific query and passage pairs. Benchmarking Chinese or multilingual retrieval quality.
How do I install FlagEmbedding?
Install the package with pip: pip install -U FlagEmbedding Load a BGE embedding model in Python Encode sentences and compute similarity
Where can I get FlagEmbedding?
The source code and installation instructions are on GitHub: https://github.com/FlagOpen/FlagEmbedding

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects