Papers › RankLLM: A Python Package for Reranking with LLMs

RankLLM: A Python Package for Reranking with LLMs

25 May 2025arXiv:2505.19284archive 2025-07-28

Sahel Sharifymoghaddam, Ronak Pradeep, Andre Slavescu, Ryan Nguyen, Andrew Xu, Zijian Chen, Yilin Zhang, Yidi Chen, Jasper Xian, Jimmy Lin

The adoption of large language models (LLMs) as rerankers in multi-stage retrieval systems has gained significant traction in academia and industry. These models refine a candidate list of retrieved documents, often through carefully designed prompts, and are typically used in applications built on retrieval-augmented generation (RAG). This paper introduces RankLLM, an open-source Python package for reranking that is modular, highly configurable, and supports both proprietary and open-source LLMs in customized reranking workflows. To improve usability, RankLLM features optional integration with Pyserini for retrieval and provides integrated evaluation for multi-stage pipelines. Additionally, RankLLM includes a module for detailed analysis of input prompts and LLM responses, addressing reliability concerns with LLM APIs and non-deterministic behavior in Mixture-of-Experts (MoE) models. This paper presents the architecture of RankLLM, along with a detailed step-by-step guide and sample code. We reproduce results from RankGPT, LRL, RankVicuna, RankZephyr, and other recent models. RankLLM integrates with common inference frameworks and a wide range of LLMs. This compatibility allows for quick reproduction of reported results, helping to speed up both research and real-world applications. The complete repository is available at rankllm.ai, and the package can be installed via PyPI.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2505.19284")

Code

Syntology Ran 0 of 13 code samples harvested from 1 repository linked to this paper; 13 have no recorded run.

By repository: community (archive-listed): 13 samples from 1 repository, 0 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

castorini/rank_llm mentioned on GitHubpytorchApache-2.0 report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

13 samples harvested; 0 ran; 0 honoured the contract we drafted; 13 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

13unverified

Licence: 0 of the 13 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from castorini/rank_llm. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

find_best_gpus castorini/rank_llm/src/rank_llm/utils.py community (archive-listed) unverified Apache-2.0 (permissive) · 025a3a828a8fde1f · report
find_msmarco_table_topic_set_key_v1 castorini/rank_llm/src/rank_llm/2cr/msmarco.py community (archive-listed) unverified Apache-2.0 (permissive) · 22d9daa798fdaf0c · report
find_msmarco_table_topic_set_key_v2 castorini/rank_llm/src/rank_llm/2cr/msmarco.py community (archive-listed) unverified Apache-2.0 (permissive) · 306db46ecd7c0698 · report
format_eval_command castorini/rank_llm/src/rank_llm/2cr/msmarco.py community (archive-listed) unverified Apache-2.0 (permissive) · 25f50ee80e849639 · report
has_partial_success_metrics castorini/rank_llm/src/rank_llm/cli/error_utils.py community (archive-listed) unverified Apache-2.0 (permissive) · 7585553d01360423 · report
install_hint castorini/rank_llm/src/rank_llm/_optional.py community (archive-listed) unverified Apache-2.0 (permissive) · 6c0055b38466010d · report
make_data_artifact castorini/rank_llm/src/rank_llm/cli/adapters.py community (archive-listed) unverified Apache-2.0 (permissive) · 0a2eef71fe5bf316 · report
make_file_artifact castorini/rank_llm/src/rank_llm/cli/adapters.py community (archive-listed) unverified Apache-2.0 (permissive) · bc32f991851f8092 · report
missing_extra_error castorini/rank_llm/src/rank_llm/_optional.py community (archive-listed) unverified Apache-2.0 (permissive) · be47efc39e24a8ad · report
run_command castorini/rank_llm/src/rank_llm/2cr/_base.py community (archive-listed) unverified Apache-2.0 (permissive) · e0e20cb592f4dd2c · report
run_dpr_retrieval_eval_and_return_metric castorini/rank_llm/src/rank_llm/2cr/_base.py community (archive-listed) unverified Apache-2.0 (permissive) · c67e097aa1cffcc0 · report
run_eval_and_return_metric castorini/rank_llm/src/rank_llm/2cr/_base.py community (archive-listed) unverified Apache-2.0 (permissive) · ee37eba5176e2e8d · report
serialize_data castorini/rank_llm/src/rank_llm/cli/adapters.py community (archive-listed) unverified Apache-2.0 (permissive) · 90bece501432321f · report

Tasks

Mixture-of-ExpertsRAGRerankingRetrievalRetrieval-augmented Generation

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

SPEED

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections