Home/Data & Retrieval/FlagEmbedding
FlagEmbedding logo

FlagEmbedding

FlagOpen/FlagEmbedding

Retrieval and Retrieval-augmented LLMs

GraphCanon updated today · GitHub synced today

12k stars907 forksLast push 1w Python MIT

Decision brief

FlagEmbedding is a Python-based tool focused on developing components for embedding generation and enhancing retrieval systems for use in retrieval-augmented language models.

Good fit when

  • If you need to integrate semantic search capabilities within your application, particularly where sentence-level embeddings are critical for finding semantically similar text.
  • When working with large corpora of text data needing fine-grained similarity scores between sentences or phrases for advanced retrieval tasks.

Avoid when

  • Avoid using FlagEmbedding if you require real-time or extremely low-latency text matching, as the process may involve significant computational overhead and latency.
  • Do not adopt this tool if your application is already heavily invested in a different ecosystem where integration costs would outweigh benefits, unless specific retrieval-augmented capabilities are a亟

Observed Jul 11, 2026 · Source: enrich:decision_facts

Verify the decision

Maintenance and security

Full trust report
Maintenance
Active (7d since push)
As of today
Provenance
Not a fork · Organization account
As of today
Security (OSV)
No lockfile
As of 1mo

Public GitHub metadata and optional OSV scans. Signals, not a guarantee. Trust methodology.

Install

pip install FlagEmbedding
PyPI

Similar tools

Same-category neighbours. No typed graph edges are catalogued for this tool yet.

Evidence and technical details

Sourced facts, taxonomy, compatibility claims, README excerpt, and machine-readable endpoints.

Overview

The FlagEmbedding repository focuses on developing tools for embeddings, information retrieval, and retrieval-augmented generative models.

Capability facts

Languages
python

Source: github.language · Aug 22, 2026

Categories

Compatibility

Sourced claims from the README excerpt - not unsourced marketing copy.

Python runtimePython

Source: README excerpt (regex_v1, Aug 22, 2026)

pip install .
Source link

Tags

README

Install from sources:

Clone the repository and install

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 development in editable mode:


---

# If you do not need to finetune the models, you can install the package without the finetune dependency:
pip install -e .

---

## Quick Start
First, load one of the BGE embedding model:

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)

Then, feed some sentences to the model and get their embeddings:

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)

Once we get the embeddings, we can compute similarity by inner product:

similarity = embeddings_1 @ embeddings_2.T print(similarity)


For more details, you can refer to [embedder inference](./examples/inference/embedder), [reranker inference](./examples/inference/reranker), [embedder finetune](./examples/finetune/embedder), [reranker fintune](./examples/finetune/reranker), [evaluation](./examples/evaluation).

If you're unfamiliar with any of related concepts, please check out the [tutorial](./Tutorials/). If it's not there, let us know.

For more interesting topics related to BGE, take a look at [research](./research).

---

## License
FlagEmbedding is licensed under the [MIT License](https://github.com/FlagOpen/FlagEmbedding/blob/master/LICENSE). 

<p align="center">
  <sub>This work is supported by the National Science and Technology Major Project (No. 2022ZD0116300).</sub>
</p>

For agents

This page has a .md twin and JSON over the API.

Was this helpful?

Anonymous feedback helps us improve pages and translations.