rerankers  by AnswerDotAI

Unified API for reranking models, simplifying retrieval architectures

created 1 year ago
1,505 stars

Top 28.0% on sourcepulse

GitHubView on GitHub
Project Summary

This library provides a unified, lightweight API for various reranking models, simplifying integration into retrieval pipelines. It targets developers and researchers working with semantic search and information retrieval systems, offering a consistent interface to diverse reranking architectures, including cross-encoders, LLM-based methods, and API providers.

How It Works

The core of the library is a single Reranker class that abstracts away the complexities of different reranking models. It supports a wide array of architectures, from standard Hugging Face cross-encoders and T5 models to API-based services like Cohere and Pinecone, and specialized implementations like FlashRank and RankLLM. The library aims for minimal dependencies by default, allowing users to install only the necessary components for the models they intend to use.

Quick Start & Requirements

  • Install core package: pip install rerankers
  • Install model-specific dependencies: pip install "rerankers[transformers]", pip install "rerankers[gpt]", pip install "rerankers[api]", pip install "rerankers[flashrank]", pip install "rerankers[rankllm]", pip install "rerankers[monovlm]", pip install "rerankers[llmlayerwise]", or pip install "rerankers[all]".
  • RankLLM requires Python 3.10+.
  • MonoVLM models require flash-attention, peft, accelerate, and recent transformers.
  • Official docs: https://github.com/AnswerDotAI/rerankers

Highlighted Details

  • Unified API for cross-encoders, T5, LLM-based, API-based (Cohere, Jina, Voyage, MixedBread, Pinecone), FlashRank, ColBERT, and RankLLM models.
  • Supports multi-modal reranking with MonoVLMRanker (e.g., MonoQwen2-VL).
  • Dependency-free core package, with optional installs for specific model types.
  • Includes async support and metadata handling for documents.

Maintenance & Community

Developed by Benjamin Clavié as part of Answer.ai. Recent updates include support for MXBai V2, removal of Pydantic/tqdm dependencies, Pinecone API rerankers, and multi-modal support.

Licensing & Compatibility

The project is available under the MIT License, permitting commercial use and integration with closed-source projects.

Limitations & Caveats

Training functionality is not directly provided by the library, though it aims to interface with libraries that support training. RankZephyr/RankVicuna support via RankLLM is untested. Reproducibility for RankGPT can be challenging.

Health Check
Last commit

2 months ago

Responsiveness

1 week

Pull Requests (30d)
0
Issues (30d)
0
Star History
108 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.