Rankify
π₯ Rankify: A Comprehensive Python Toolkit for Retrieval, Re-Ranking, and Retrieval-Augmented Generation π₯. Our toolkit integrates 40 pre-retrieved benchmark datasets and supports 7+ retrieval techniques, 24+ state-of-the-art Reranking models, and multiple RAG methods.
Install / Use
/learn @DataScienceUIBK/RankifyREADME
π₯ Rankify: A Comprehensive Python Toolkit for Retrieval, Re-Ranking, and Retrieval-Augmented Generation π₯
<!-- First row of badges --> <div style="display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin-bottom: 8px;"> <a href="https://arxiv.org/abs/2502.02464"> <img src="https://img.shields.io/badge/arXiv-b5212f.svg?logo=arxiv" style="height: 24px;"> </a> <a href="https://huggingface.co/datasets/abdoelsayed/reranking-datasets"> <img src="https://img.shields.io/badge/%F0%9F%A4%97%20HuggingFace%20Datasets-27b3b4.svg" style="height: 24px;"> </a> <a href="https://huggingface.co/datasets/abdoelsayed/reranking-datasets-light"> <img src="https://img.shields.io/badge/%F0%9F%A4%97%20HuggingFace%20Datasets%20light-orange.svg" style="height: 24px;"> </a> <a href="#"> <img src="https://img.shields.io/badge/Python-3.10_3.11-blue" style="height: 24px;"> </a> <a href="https://opensource.org/license/apache-2-0"> <img src="https://img.shields.io/static/v1?label=License&message=Apache-2.0&color=red" style="height: 24px;"> </a> </div> <!-- Second row of badges --> <div style="display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin-bottom: 8px;"> <a href="https://pepy.tech/projects/rankify"> <img src="https://static.pepy.tech/badge/rankify" style="height: 24px;"> </a> <a href="https://github.com/DataScienceUIBK/rankify/releases"> <img src="https://img.shields.io/github/release/DataScienceUIBK/rankify.svg?label=Version&color=orange" style="height: 24px;"> </a> <a href="#"> <img src="https://api.visitorbadge.io/api/visitors?path=https://github.com/DataScienceUIBK/Rankify" style="height: 24px;"> </a> <a href="https://gitcode.com/abdoelsayed2016/Rankify"> <img src="https://gitcode.com/abdoelsayed2016/Rankify/star/badge.svg" > </a> <a href="https://colab.research.google.com/drive/1QukxP1WZHkPfD4321UcLXD24sKCpuUuP?usp=sharing"><img style="height: 24px;" src="https://img.shields.io/static/v1?label=Colab&message=Install_Rankify&logo=Google%20Colab&color=f9ab00"></a> </div> <!-- Product Hunt badge --> <!--<div style="margin-top: 10px;"> <a href="https://www.producthunt.com/products/github-113?embed=true&utm_source=badge-featured&utm_medium=badge&utm_source=badge-github-73d2dbbf-d84f-495d-86d8-af4dd72fc31f"> <img src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=980097&theme=light&t=1750416463103" style="height: 40px;"> </a> </div>--> </div>If you like our Framework, don't hesitate to β star this repository β. This helps us to make the Framework more better and scalable to different models and methods π€.
<!-- <img src="./images/output.gif" height=50 alt="Star the repo " />-->A modular and efficient retrieval, reranking and RAG framework designed to work with state-of-the-art models for retrieval, ranking and rag tasks.
<!--_Rankify is a Python toolkit designed for unified retrieval, re-ranking, and retrieval-augmented generation (RAG) research. Our toolkit integrates 40 pre-retrieved benchmark datasets and supports 7 retrieval techniques, 24 state-of-the-art re-ranking models, and multiple RAG methods. With a flexible generator architecture supporting multiple endpoints, Rankify provides a modular and extensible framework, enabling seamless experimentation and benchmarking across retrieval pipelines. Comprehensive documentation, open-source implementation, and pre-built evaluation tools make Rankify a powerful resource for researchers and practitioners in the field._--> <!-- <p align="center"> <img src="images/overview.png" width="500" height="700" > </p> -->π Demo
To run the demo locally:
# Make sure Rankify is installed
pip install streamlit
# Then run the demo
streamlit run demo.py
https://github.com/user-attachments/assets/13184943-55db-4f0c-b509-fde920b809bc
:link: Navigation
- Features
- Roadmap
- Installation
- Quick Start
- Indexing
- Retrievers
- Re-Rankers
- Generators
- Evaluation
- Documentation
- Community Contributing
- Contributing
- License
- Acknowledgments
- Citation
πNews
-
[2026-02-16] Huge thanks to @JamieHoldcroft for integrating 15+ new dense retrievers, including SOTA LLM-based bi-encoders (SFR, E5, GritLM) and reasoning-augmented models (RaDeR, ReasonIR, ReasonEmbed, BGE-Reasoner).
-
[2025-10-14] Updated installation with optional extras:
retriever,reranking,rag, andall. -
[2025-10-14] New CLI (
rankify-index) syntax & examples for BM25, DPR, ANCE, Contriever, ColBERT, BGE. -
[2025-06-11] Many thanks to @tobias124 for implementing Indexing for Custom Dataset.
-
[2025-06-01] Many thanks to @aherzinger for implementing and refactoring the Generator and RAG models.
-
[2025-05-30] Huge thanks to @baraayusry for implementing the Online Retriever using CrawAI and ReACT.
-
[2025-02-10] Released reranking-datasets and reranking-datasets-light on Hugging Face.
-
[2025-02-04] Our paper is released on arXiv.
π§ Installation
Set up the virtual environment
First, create and activate a conda environment with Python 3.10:
conda create -n rankify python=3.10
conda activate rankify
Install PyTorch 2.5.1
we recommend installing Rankify with PyTorch 2.5.1 for Rankify. Refer to the PyTorch installation page for platform-specific installation commands.
If you have access to GPUs, it's recommended to install the CUDA version 12.4 or 12.6 of PyTorch, as many of the evaluation metrics are optimized for GPU use.
To install Pytorch 2.5.1 you can install it from the following cmd
pip install torch==2.5.1 torchvision==0.20.1 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cu124
Basic Installation
To install Rankify, simply use pip (requires Python 3.10+):
pip install rankify
Recommended Installation
For full functionality, we recommend installing Rankify with all dependencies:
pip install "rankify[all]"
This ensures you have all necessary modules, including retrieval, re-ranking, and RAG support.
Optional Dependencies
If you prefer to install only specific components, choose from the following:
# Retrieval stack (BM25, dense retrievers, web tools)
pip install "rankify[retriever]"
# Install base re-ranking with vLLM support for `FirstModelReranker`, `LiT5ScoreReranker`, `LiT5DistillReranker`, `VicunaReranker`, and `ZephyrReranker'.
pip install "rankify[reranking]"
# RAG endpoints (OpenAI, LiteLLM, vLLM clients)
pip install "rankify[rag]"
Or, to install from GitHub for the latest development version:
git clone https://github.com/DataScienceUIBK/rankify.git
cd rankify
pip install -e .
# For full functionality we recommend installing Rankify with all dependencies:
pip install -e ".[all]"
# Install dependencies for retrieval only (BM25, DPR, ANCE, etc.)
pip install -e ".[retriever]"
# Install base re-ranking with vLLM support for `FirstModelReranker`, `LiT5ScoreReranker`, `LiT5DistillReranker`, `VicunaReranker`, and `ZephyrReranker'.
pip install -e ".[reranking]"
# RAG endpoints (OpenAI, LiteLLM, vLLM clients)
pip install -e ".[rag]"
Using ColBERT Retriever
If you want to use ColBERT Retriever, follow these additional setup steps:
# Install GCC and required libraries
conda install -c conda-forge gcc=9.4.0 gxx=9.4.0
conda install -c conda-forge libstdcxx-ng
# Export necessary environment variables
export LD_LIBRARY_PATH=$CONDA_PREFIX/lib:$LD_LIBRARY_PATH
export CC=gcc
export CXX=g++
export PATH=$CONDA_PREFIX/bin:$PATH
# Clear cached torch extensions
rm -rf ~/.cache/torch_extensions/*
:rocket: Quick Start
π One-Line Pipeline API (Recommended)
The simplest way to use Rankify - HuggingFace-style one-line interface:
from rankify import pipeline
# Create a RAG pipeline with intelligent defaults
rag = pipeline("rag")
answers = rag("What is machine learning?", documents)
# Or customize your configuration
rag = pipeline(
"rag",
retriever="bge", # State-of-the-art dense retriever
reranker="flashrank", # Ultra-fast reranker
generator="basic-rag"
)
Available Pipeline Types:
pipeline("search")- Document retrieval onlypipeline("rerank")- Retrieve + rerankpipeline("rag")- Full RAG pipeline (retrieve + rerank + generate)
π Pipeline API Documentation
π€ RankifyAgent - AI-Powered Model Selection
Let AI help you choose the best models for your use case:
from
