FlagEmbedding provides BGE-based retrieval tools for RAG with embeddings, rerankers, and evaluation. It includes installation options and a Quick Start using FlagAutoModel, with multiple releases and model variants.
Collecting history — the radar snapshots this repo daily. The trend line appears after 3 days of data (1 so far).
What it is
FlagEmbedding is a Python project focused on retrieval-augmented LLMs, offering embedding models (FlagEmbedding BGE series) and rerankers for retrieval tasks, along with evaluation and tutorials.
How it works
The project exposes an inference workflow via Embedder and Reranker components, and a Quick Start example shows loading a finetuned BGE model and computing embeddings for sentence pairs, then measuring similarity via inner product.
Getting started
Installation (no finetune):
pip install -U FlagEmbedding
Installation (with finetune):
pip install -U FlagEmbedding[finetune]
Install from sources:
git clone https://github.com/FlagOpen/FlagEmbedding.git
cd FlagEmbedding
# If you do not need to finetune the models, you can install the package without the finetune dependency:
pip install .
# If you want to finetune the models, install the package with the finetune dependency:
# pip install .[finetune]
For editable development:
pip install -e .
# pip install -e .[finetune]
Quick Start example imports and usage:
from FlagEmbedding import FlagAutoModel
model = FlagAutoModel.from_finetuned('BAAI/bge-base-en-v1.5',
query_instruction_for_retrieval="Represent this sentence for searching relevant passages:",
use_fp16=True)
sentences_1 = ["I love NLP", "I love machine learning"] sentences_2 = ["I love BGE", "I love text retrieval"] embeddings_1 = model.encode(sentences_1) embeddings_2 = model.encode(sentences_2)
similarity = embeddings_1 @ embeddings_2.T print(similarity)
## Recent releases
- v1.4.0 (2026-04-22): update reranker inference; add feature: support customized train_group_size
- v1.3.5 (2025-05-28): optimize evaluation in evaluator.py; fix "\n" issue
- v1.3.4 (2025-02-07): Inference docstring; delete useless parameters for embedder classes
- v1.3.2-BGE-Update (2024-10-31): updated BGE code including Inference Code with FlagAutoModel and FlagAutoReranker
## Traction
stars_7d present: 12015
## Behind the repo
Not applicable (no linked startup/company section in facts).
## Caveats
License: MIT
Created: 2023-08-02
Last push: 2026-04-22






