Skip to content

Latest commit

 

History

History
93 lines (61 loc) · 4.2 KB

experiments-spladev2.md

File metadata and controls

93 lines (61 loc) · 4.2 KB

Pyserini: SPLADEv2 for MS MARCO Passage Ranking

This page describes how to reproduce with Pyserini the DistilSPLADE-max experiments in the following paper:

Thibault Formal, Carlos Lassance, Benjamin Piwowarski, Stéphane Clinchant. SPLADE v2: Sparse Lexical and Expansion Model for Information Retrieval. arXiv:2109.10086.

Here, we start with a version of the MS MARCO passage corpus that has already been processed with SPLADE, i.e., gone through document expansion and term reweighting. Thus, no neural inference is involved. As SPLADE weights are given in fp16, they have been converted to integer by taking the round of weight*100.

Data Prep

We're going to use the repository's root directory as the working directory. First, we need to download and extract the MS MARCO passage dataset with SPLADE processing:

wget https://rgw.cs.uwaterloo.ca/JIMMYLIN-bucket0/data/msmarco-passage-distill-splade-max.tar -P collections/

# Alternate mirror
wget https://vault.cs.uwaterloo.ca/s/poCLbJDMm7JxwPk/download -O collections/msmarco-passage-distill-splade-max.tar

tar xvf collections/msmarco-passage-distill-splade-max.tar -C collections/

To confirm, msmarco-passage-distill-splade-max.tar should have MD5 checksum of 95b89a7dfd88f3685edcc2d1ffb120d1.

Indexing

We can now index these documents:

python -m pyserini.index -collection JsonVectorCollection \
 -input collections/msmarco-passage-distill-splade-max \
 -index indexes/lucene-index.msmarco-passage-distill-splade-max \
 -generator DefaultLuceneDocumentGenerator -impact -pretokenized \
 -threads 18

The important indexing options to note here are -impact -pretokenized: the first tells Anserini not to encode BM25 doc lengths into Lucene's norms (which is the default) and the second option says not to apply any additional tokenization on the SPLADE tokens.

Upon completion, we should have an index with 8,841,823 documents. The indexing speed may vary; on a modern desktop with an SSD (using 18 threads, per above), indexing takes around thirty minutes.

Retrieval

To ensure that the tokenization in the index aligns exactly with the queries, we use pre-tokenized queries. First, fetch the MS MARCO passage ranking dev set queries:

wget https://rgw.cs.uwaterloo.ca/JIMMYLIN-bucket0/data/topics.msmarco-passage.dev-subset.distill-splade-max.tsv.gz -P collections/

# Alternate mirror
wget https://vault.cs.uwaterloo.ca/s/DrL4HLqgmT6orJL/download -O collections/topics.msmarco-passage.dev-subset.distill-splade-max.tsv.gz

The MD5 checksum of the topics file is 621a58df9adfbba8d1a23e96d8b21cb7.

We can now run retrieval:

python -m pyserini.search --topics collections/topics.msmarco-passage.dev-subset.distill-splade-max.tsv.gz \
                          --index indexes/lucene-index.msmarco-passage-distill-splade-max \
                          --output runs/run.msmarco-passage-distill-splade-max.tsv \
                          --impact \
                          --hits 1000 --batch 36 --threads 12 \
                          --output-format msmarco

Query evaluation is much slower than with bag-of-words BM25; a complete run can take around half an hour. Note that the important option here is -impact, where we specify impact scoring.

Note from authors: We are still investigating why it takes so long using Pyserini, while the same model (including distilbert query encoder forward pass in CPU) takes only 10 minutes on similar hardware using a numba implementation for the inverted index and using sequential processing (only 1-query at a time).

The output is in MS MARCO output format, so we can directly evaluate:

python -m pyserini.eval.msmarco_passage_eval msmarco-passage-dev-subset runs/run.msmarco-passage-distill-splade-max.tsv

The results should be as follows:

#####################
MRR @10: 0.36852691363078205
QueriesRanked: 6980
#####################

The final evaluation metric is very close to the one reported in the paper (0.368).

Reproduction Log*