Skip to content

BGE

A toolkit of open embedding and reranking models for search and retrieval-augmented generation (RAG).FlagOpen/FlagEmbedding

Stars
12.3k
Forks
945
Licence
MIT
Language
Python
Last update
10 days ago
Type
Library

What it is

FlagEmbedding (the BGE project) provides text embedding models that turn words and passages into numeric vectors, so software can find text with similar meaning. It also includes reranker models that re-order search results, and tools for fine-tuning these models. People use it to build semantic search and to supply relevant documents to large language models in RAG systems.

  • Encode a document collection into vectors and search it by meaning
  • Re-rank the top results from a first-stage search with a reranker model
  • Feed retrieved passages into an LLM to answer questions over private text
  • Fine-tune an embedding model on your own query and passage pairs

Great for

  • Developers building semantic search over their own documents
  • Teams adding retrieval-augmented generation (RAG) to an LLM app
  • Researchers comparing or fine-tuning embedding and reranker models
  • Multilingual projects that need one embedding model for many languages

Not ideal for

  • People who want a finished search app without writing code, since this is a toolkit of models and scripts
  • Projects that cannot run machine-learning models locally or pay for hosted inference, since the models need compute
  • Anyone who needs guaranteed stable APIs, as the README lists many research projects and frequent new releases
Step-by-step guide: how to use BGEInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Install with a package manager

    You'll need: Python

    Clone the repository

    git clone https://github.com/FlagOpen/FlagEmbedding
  2. 2

    Run it

    • Install the package as described in the README's installation section
    • Load a BGE embedding model from Hugging Face
    • Encode a small set of sentences and compare their similarity
    • Optionally add a reranker to order the top search results
  3. 3

    Get the most out of it

    • Use a reranker on top of embedding results to improve ranking quality
    • Follow the tutorials folder for worked examples
    • Check the BGE documentation site linked from the README for model details
    • Use the Hugging Face model collection to pick a model for your language or task

Downloads

Strengths

  • MIT licensed, so the code can be used commercially according to the README
  • Broad set of models, including multilingual and multimodal (BGE-VL) variants
  • Documentation and tutorials are maintained alongside the code

Trade-offs

  • Many components are research projects with varying levels of documentation
  • Larger models need substantial GPU or memory resources
  • The README is long and spread across many sub-projects, which takes time to navigate

How it compares

ProjectStarsTypeLevelUpdatedBest for
FlagEmbedding (this)12.3kLibraryintermediate10 days agoDevelopers building semantic search over their own documents
llama_index52.8kLibraryintermediate11 days agoPython developers building retrieval-augmented generation (RAG) apps over private documents
PageIndex40kLibraryintermediate8 days agoDevelopers building question-answering over long PDFs such as annual reports or manuals
LightRAG40.5kLibraryintermediate8 days agoDevelopers building question-answering over their own document collections
RAG-Anything24.4kLibraryintermediate4 days agoDevelopers building question-answering systems over PDFs or Office documents with figures and tables
turbovec17.5kLibraryintermediate30 days agoPython or Rust developers building semantic search over a few million or fewer embeddings on a single machine

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.