Model or dataset
FlagOpen/FlagEmbedding avatar
FlagOpen/FlagEmbedding

FlagEmbedding: BGE Models and Tooling for Search and RAG Pipelines

Retrieval and Retrieval-augmented LLMs

12,318 stars950 forksPythonMIT

At a glance

What is it?
FlagEmbedding is the Python toolkit behind BAAI's BGE embedding and reranker models, covering dense, lexical, and multi-vector retrieval. This review looks at what it offers, how it runs, and where its breadth creates friction.
Who is it for?
Adopt FlagEmbedding if you need BGE models for dense, lexical, or multi-vector retrieval, especially in multilingual or multimodal settings, and if you can tolerate a repository that mixes stable code with research experiments. Do not adopt it if you want a single, polished API for a narrow task like English-only sentence embeddings, where a smaller library may suffice.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 17 days ago.
What is it written in?
Mainly Python, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 13, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • FlagOpen/FlagEmbedding12,318 ★ · +166
Star history
Repository2026-09-102026-11-13
FlagOpen/FlagEmbedding12.2k12.3k

166 Stars in the last 64 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

What FlagEmbedding Actually Covers

FlagEmbedding is the Python package that accompanies BAAI's BGE series of models. The README describes it as a one-stop retrieval toolkit for search and RAG. That is a fair description in scope, not in polish. The repository contains not only the embedding models but also rerankers, a multimodal model called BGE-VL, and a collection of research projects under a research directory. The BGE-VL models are released under the MIT license, and the library itself is MIT licensed as well. The target user is an engineer building retrieval-augmented generation or semantic search who wants the BGE family rather than a single model. The scope is broad: dense retrieval, lexical retrieval, multi-vector ColBERT-style retrieval, and reranking all appear. That breadth is both the strength and the source of complexity.

The Mechanism: Dense, Lexical, and Multi-Vector in One Model

The core technical claim is embodied in BGE-M3, which the README introduces as supporting three retrieval methods in a single model. M3 stands for multilingual, multi-granularity, and multi-functionality. It handles 100-plus languages, input lengths up to 8192 tokens, and unifies dense, lexical, and multi-vector retrieval. That is a concrete architectural achievement: most embedding models force you to pick one representation. BGE-M3 produces all three, so you can switch retrieval strategies without changing the encoder. The README also mentions bge-en-icl, which incorporates in-context learning by encoding query-response examples, and bge-reranker-v2.5-gemma2-lightweight, a reranker that supports token compression and layerwise lightweight operations. These are separate models with different inference paths. In practice, FlagEmbedding is not a single pipeline but a collection of entry points, each tied to a specific model family.

Getting It Running: Installation and Quick Start

The package is named FlagEmbedding in setup.py, so pip install FlagEmbedding is the install step. setup.py requires torch, transformers, datasets, accelerate, sentence_transformers, peft, ir-datasets, sentencepiece and protobuf, and a finetune extra adds deepspeed and flash-attn. The repository has top-level examples/ folders for evaluation, finetune and inference, while some model code lives under research/, for example research/BGE_M3 for BGE-M3 and research/llm_reranker for the rerankers. The documentation site at bge-model.com is described as the centralized source for BGE information and materials, so that is the place to look for concrete commands. If you want to test the models, the Hugging Face collection linked in the README is the practical starting point, since each model page typically includes a usage snippet.

A Genuine Limitation: The Research Code Is Not a Stable API

FlagEmbedding's biggest weakness is the split between the core library and the research directory. The README lists many models and projects, but several of them, such as Visualized-BGE and the long-context LLM work, are presented as research outputs rather than polished library features. That means the API can change between releases, and a feature you rely on may live in a subdirectory with its own dependencies. The recent release history shows rapid iteration: v1.4.2, v1.4.1, and v1.4.0 all came within about four months, with v1.4.2 pushed the day after v1.4.1. That pace is fine for a research group but risky for a production deployment. You cannot assume that a script from the research folder will work unchanged after an upgrade. The README also points to external repositories like MemoRAG and OmniGen, which are not part of FlagEmbedding itself, so you have to track multiple projects to use the full ecosystem.

Alternatives: How They Differ in Approach

The main alternative to FlagEmbedding is the sentence-transformers library, which also provides access to embedding models including some BGE variants. The difference is in packaging and philosophy. sentence-transformers gives you a uniform API for loading any model and computing embeddings, with a focus on ease of use and fine-tuning. FlagEmbedding is more tightly coupled to the BGE research line and includes retrieval-specific features like rerankers and multi-vector support (sentence_transformers is itself a dependency in setup.py). Another alternative is using the Hugging Face transformers library directly, which lets you load BGE models without FlagEmbedding at all. That approach gives you full control but requires you to implement the pooling and similarity logic yourself. For a team that only needs dense embeddings for English text, sentence-transformers is simpler. For teams that need multilingual, multi-granularity, or reranking, FlagEmbedding's model-specific code is closer to the research.

Maintenance and License Considerations

The repository is actively maintained, with the last push on 2026-10-27 and the latest release, v1.4.2, on 2026-08-24. The library is MIT licensed, as are the BGE-VL models the README names, which is permissive for commercial use. That removes a common barrier to adoption. However, active maintenance does not mean stable APIs. The presence of a research directory and the rapid release cadence suggest that breaking changes are likely. The README also mentions a WeChat group for community support, for BGE news and questions. Before adopting, you should check the specific model's documentation on Hugging Face for input length limits, language support, and any known issues. The BGE documentation site is the stated central resource.

Editorial conclusion

Adopt FlagEmbedding if you need BGE models for dense, lexical, or multi-vector retrieval, especially in multilingual or multimodal settings, and if you can tolerate a repository that mixes stable code with research experiments. Do not adopt it if you want a single, polished API for a narrow task like English-only sentence embeddings, where a smaller library may suffice. Before adoption, verify which model version you need, check the model card on Hugging Face for input length limits and language coverage, and review the research directory to see if the feature you rely on is still experimental. Make that check against the specific release you pin, since the project moves quickly.

Frequently asked questions

how to install flagembedding

The repository setup.py names the distribution FlagEmbedding at version 1.4.2 and requires transformers>=4.44.2,<6.0.0, torch>=1.6.0, datasets>=2.19.0, and accelerate>=0.20.1, plus sentence_transformers, peft, ir-datasets, sentencepiece, and protobuf. deepspeed and flash-attn come only with the 'finetune' extra. A separate documentation site at www.bge-model.com collects the BGE guides and model materials.

what is flagembedding

It is the Python package for the BGE models, a retrieval and retrieval-augmented LLM toolkit from FlagOpen. The tree holds a FlagEmbedding/ package plus docs/, examples/, scripts/, tests/, dataset/, Tutorials/, and a research/ directory of per model implementations, and the models themselves are distributed through Hugging Face.

Can I use LLM as an embedding model?

Within this project, yes, in specific releases. LLaRA is a LLaMA-7B based dense retriever released 12/24/2023 that reports state of the art results on MS MARCO and BEIR, the March 2024 rerankers are built on M3 and LLM backbones including GEMMA and MiniCPM, and bge-multilingual-gemma2 is based on gemma-2-9b.

Which model to use for embeddings?

For multilingual hybrid retrieval, BGE-M3 covers dense, lexical, and multi-vector matching with 100+ languages and input up to 8192 tokens. For queries carrying in-context examples, bge-en-icl encodes task-relevant query-response pairs. For multilingual ranking, bge-multilingual-gemma2 targets MIRACL, MTEB-fr, and MTEB-pl, and bge-reranker-v2.5-gemma2-lightweight trims rerank cost through token compression.

flag embedding vs sentence transformers

At the dependency level they are not rivals here, because sentence_transformers is a required install in setup.py alongside torch, transformers, datasets, accelerate, peft, and ir-datasets. The difference is scope: FlagEmbedding adds the BGE checkpoint family, the finetune extra for deepspeed and flash-attn, evaluation examples, and the per model research implementations.

Official sources

  1. FlagOpen/FlagEmbedding on GitHub
  2. License: MIT
  3. Project website
  4. README
  5. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/flagopen-flagembedding.svg)](https://hysenlabs.com/projects/flagopen-flagembedding)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/flagopen-flagembedding.svg)](https://hysenlabs.com/projects/flagopen-flagembedding)

Was this useful?