Rankify: A Comprehensive Python Toolkit for Retrieval, Re-Ranking, and Retrieval-Augmented Generation

Abdelrahman Abdallah, Jamshid Mozafari, Bhawna Piryani, Mohammed Eunus Ali, Adam Jatowt · DOI

Abstract

Retrieval, re-ranking, and retrieval-augmented generation (RAG) are critical components of modern applications in information retrieval, question answering, or knowledge-based text generation. However, existing solutions are often fragmented, lacking a unified framework that easily integrates these essential processes. The absence of a standardized implementation, coupled with the complexity of retrieval and re-ranking workflows, makes it challenging for researchers to compare and evaluate different approaches in a consistent environment. While existing toolkits such as Rerankers and RankLLM provide general-purpose reranking pipelines, they often lack the flexibility required for fine-grained experimentation and benchmarking. In response to these challenges, we introduce Rankify, a powerful and modular open-source toolkit designed to unify retrieval, re-ranking, and RAG within a cohesive framework. Rankify supports a wide range of retrieval techniques, including dense and sparse retrievers, while incorporating state-of-the-art re-ranking models to enhance retrieval quality. Additionally, Rankify includes a collection of pre-retrieved datasets to facilitate benchmarking. As a unified and lightweight framework, Rankify allows researchers and practitioners to advance retrieval and re-ranking methodologies while ensuring consistency, scalability, and ease of use.

Introduction

In the rapidly evolving landscape of Information Retrieval (IR) and Retrieval-Augmented Generation (RAG), the "two-stage" pipeline—retrieving a broad set of candidates and then re-ranking them for precision—has become the industry standard. However, implementing these pipelines is often hindered by a fragmented ecosystem. Researchers frequently juggle disparate libraries for BM25, dense embeddings, and LLM-based re-ranking, making fair, end-to-end benchmarking difficult.

Furthermore, the entry cost for IR research is high; setting up large-scale indices like Wikipedia or MS MARCO requires significant compute and time. Rankify addresses these challenges by providing a modular, "plug-and-play" ecosystem with pre-built indices and standardized data schemas, effectively democratizing high-end IR research.

System Architecture and Methods

Rankify is built on a modular architecture designed to unify the entire pipeline—from initial document retrieval to sophisticated re-ranking and final answer generation—into a single, cohesive framework. The toolkit’s unified API allows researchers to swap components, such as changing a BM25 retriever for a ColBERT model, with minimal code changes.

The Rankify pipeline unifies retrieval, re-ranking, and generation into a single workflow.

The architecture consists of four core pillars:

  1. Data: Standardized access to 40 popular IR and QA datasets and major corpora like Wikipedia and MS MARCO.
  2. Retrievers: Support for sparse methods (e.g., BM25) and dense methods (e.g., DPR, ANCE, BGE, Contriever, and ColBERT).
  3. Re-Rankers: A library of 24 primary models covering pointwise, pairwise, and listwise strategies (e.g., RankGPT).
  4. RAG (Generator): Integration with LLMs (LLaMA, GPT, T5) using techniques like Fusion-in-Decoder (FiD) or In-Context RALM.
Rankify's modular architecture covers data, retrievers, rerankers, and RAG methods.

Datasets and Benchmarking

To facilitate rapid experimentation, Rankify includes a curated repository of 40 datasets, including Natural Questions (NQ), TriviaQA, and HotpotQA. A key feature is the provision of pre-retrieved benchmarks, which include the top 1,000 documents retrieved by various models. This allows users to bypass the computationally expensive retrieval phase and jump directly to re-ranking experiments. The toolkit also provides ready-to-use indices for the entirety of English Wikipedia and MS MARCO.

Key Insights and Results

The modularity of Rankify supports over 20,160 possible configurations, enabling unprecedented ablation studies. Benchmarks conducted by the authors validate the toolkit's performance:

  • Retrieval Consistency: Rankify matches the performance of gold-standard libraries like Pyserini.
  • Re-ranking Gains: On the NQ dataset, models like RankT5-3B and LiT5-Distill-xl achieved Top-1 accuracy of ~47-48%, a significant boost over the initial BM25 retrieval (~23%).
  • RAG Performance: In full RAG testing, DPR paired with LLaMA V3 8B achieved the best Exact Match (EM) score on NQ (28.08%), while BM25 proved surprisingly strong for TriviaQA (57.55% EM) when paired with Gemma 2 9B.

Conclusion and Future Work

Rankify provides a comprehensive, open-source solution for IR and RAG research. While the current version is robust, future work will focus on optimizing execution speed for larger scales, expanding the suite of traditional IR metrics (like MAP and NDCG), and incorporating broader benchmarks such as the BEIR suite. Rankify is available as a PyPI package, with source code and documentation accessible via GitHub and ReadTheDocs.

Summary updated

BibTeX
@misc{abdallah2025rankify,
  author = {Abdelrahman Abdallah and Jamshid Mozafari and Bhawna Piryani and Mohammed Eunus Ali and Adam Jatowt},
  title = {{Rankify: A Comprehensive Python Toolkit for Retrieval, Re-Ranking, and Retrieval-Augmented Generation}},
  year = {2025},
  eprint = {2502.02464},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2502.02464},
}
Figure