Skip to main content
QUICK REVIEW

[Paper Review] Pyserini: An Easy-to-Use Python Toolkit to Support Replicable IR Research with Sparse and Dense Representations

Jimmy Lin, Xueguang Ma|arXiv (Cornell University)|Feb 19, 2021
Explainable Artificial Intelligence (XAI)Computer Science29 references31 citations
TL;DR

Pyserini provides a self-contained Python toolkit for first-stage retrieval across sparse, dense, and hybrid methods, with built-in test collections, pre-built indexes, and replication workflows to support replicable IR research.

ABSTRACT

Pyserini is an easy-to-use Python toolkit that supports replicable IR research by providing effective first-stage retrieval in a multi-stage ranking architecture. Our toolkit is self-contained as a standard Python package and comes with queries, relevance judgments, pre-built indexes, and evaluation scripts for many commonly used IR test collections. We aim to support, out of the box, the entire research lifecycle of efforts aimed at improving ranking with modern neural approaches. In particular, Pyserini supports sparse retrieval (e.g., BM25 scoring using bag-of-words representations), dense retrieval (e.g., nearest-neighbor search on transformer-encoded representations), as well as hybrid retrieval that integrates both approaches. This paper provides an overview of toolkit features and presents empirical results that illustrate its effectiveness on two popular ranking tasks. We also describe how our group has built a culture of replicability through shared norms and tools that enable rigorous automated testing.

Motivation & Objective

  • Provide an easy-to-use Python interface for first-stage IR retrieval in a multi-stage ranking setup.
  • Support sparse (BM25), dense (neural) and hybrid retrieval with pre-built indexes and out-of-the-box evaluations.
  • Foster replicability through automated testing, replication guides, and open-source workflows.
  • Enable end-to-end research workflow from data loading to evaluation on standard IR test collections.

Proposed method

  • Integrates Lucene-based sparse retrieval via Anserini in a Python package to expose postings, document vectors, and term statistics.
  • Integrates FAISS/HNSW for dense retrieval and combines it with sparse retrieval in a weighted hybrid retriever.
  • Packages standard IR test collections (queries, qrels, pre-built indexes) and provides Python interfaces to load topics and qrels and run batch retrievals.
  • Provides interactive retrieval examples using SimpleSearcher (BM25) and SimpleDenseSearcher (dense vectors) to illustrate sparse, dense, and hybrid workflows.
  • Includes an end-to-end batch retrieval and evaluation workflow that replicates MS MARCO baselines and supports doc2query expansions and multi-stage pipelines.

Experimental results

Research questions

  • RQ1How can Pyserini provide a Python interface that supports replicable first-stage retrieval across sparse, dense, and hybrid representations?
  • RQ2What are the empirical gains of sparse, dense, and hybrid retrieval on popular ranking tasks (e.g., MS MARCO passage and document ranking)?
  • RQ3How effectively can Pyserini enable end-to-end research workflows from indexing to evaluation on standard IR test collections?
  • RQ4What practices and infrastructure support replicability in IR research?
  • RQ5To what extent can Pyserini serve as a foundation for neural reranking and multi-stage ranking experiments?

Key findings

  • Pyserini provides competitive baselines for MS MARCO passage retrieval across sparse (BM25), dense (TCT-ColBERT), and hybrid setups, with document expansion further improving sparse results.
  • Dense retrieval with TCT-ColBERT significantly outperforms sparse BM25 under the reported configurations, and hybrid sparse–dense approaches yield the best results in several settings.
  • The toolkit enables replication of official leaderboard baselines and supports end-to-end batch retrieval and evaluation with minimal user setup.
  • Replicability is reinforced through social and technical practices, including replication guides, regression testing, and open-source workflows that ensure code and results can be reproduced.
  • Pyserini demonstrates that first-stage retrieval is a solid foundation for modern neural ranking experiments, including multi-stage and reranking pipelines.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.