skillfed

FlagEmbedding

FlagEmbedding

flagembedding v1.4.0 632.8K downloads/30d#5,649 on PyPI12,050
License unclear Active released

What it is and what it does

FlagEmbedding is a toolkit for building semantic search and RAG systems using pre-trained embedding and reranking models. It wraps transformer-based models that convert text into dense vector representations, enabling similarity-based retrieval. The package integrates with torch, transformers, and sentence_transformers to handle model loading, inference, and fine-tuning workflows.

The toolkit supports multilingual queries, variable input lengths, and multiple retrieval strategies (dense, lexical, and multi-vector). It is commonly used to rank and retrieve relevant documents for LLM prompts, implement semantic search over document collections, and fine-tune embedding models on domain-specific data.

Use it for:

  • Build a semantic search engine over a document corpus by encoding documents and queries into embeddings and finding nearest neighbors.
  • Implement retrieval-augmented generation (RAG) by retrieving relevant documents to augment LLM context before generation.
  • Re-rank top-k search results using reranker models to improve relevance of retrieved documents.
  • Fine-tune embedding models on custom datasets to optimize for domain-specific or task-specific retrieval.
  • Support multilingual search applications where queries and documents span multiple languages.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

FlagEmbedding provides embedding and reranking models for semantic search and retrieval-augmented generation (RAG), supporting dense retrieval, multilingual queries, and document ranking.

Yes, with conditions. FlagEmbedding is actively maintained with no known vulnerabilities. Install if you need semantic search or RAG capabilities and can accommodate the heavy ML dependencies (torch, transformers). Verify the license terms in the repository first, as the package metadata does not declare a clear license. Not suitable if you need a lightweight embedding solution or cannot install PyTorch.

Install

flagembedding on PyPI

pip

pip install flagembedding

uv

uv add flagembedding

poetry

poetry add flagembedding

Installing FlagEmbedding

Before you install

Low friction installation with a pure Python wheel. Active maintenance with recent commits and a large repository (12050 stars). Depends on heavy ML libraries (torch, transformers, sentence_transformers) that may require significant disk and memory.

License in practice

License status is unclear—no SPDX identifier or raw license text is available in the package metadata. Verify the actual license terms in the repository before use in proprietary or commercial projects.

Quickstart

pip install flagembedding
from flagembedding import FlagModel
model = FlagModel('BAAI/bge-small-en-v1.5')
embeddings = model.encode(['hello world'])

Requires torch and transformers; model downloads are large and may require significant disk space and network bandwidth on first use.

Verify before relying

  • Exact Python version compatibility (requires_python not specified in metadata)
  • Whether all 9 runtime dependencies are always required or only for specific use cases
  • Performance characteristics and typical latency for embedding generation

Package facts

License not declared (unclear)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies 9 — torch, transformers, datasets, accelerate, sentence_transformers, peft, ir-datasets, sentencepiece, protobuf
Maintenance actively maintained — 114 days since the last release
Last repo commit
First released
Downloads 632,761/month — #5,649 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: flagembedding-1.4.0-py3-none-any.whl

Tags

semantic search embeddingsretrieval augmented generation RAGmultilingual embeddingsdocument rerankingdense retrieval modelstext embedding modelscross-lingual search
embeddingsretrieval-augmented-generationsemantic-search

More Artificial Intelligence packages

Further reading