↑↓ move Enter open ⌘K find from any page 256 of 256 tabs
Loading the recording…

Learned weights for a sparse index

SPLADE keeps BM25's machinery, a sparse vector over the vocabulary and an inverted index, but learns the weights with a language model. Each text becomes one weight per vocabulary term, most of them exactly zero. The model can also give weight to terms the text never uses, its expansion terms, so a paragraph about Mongolians can match a question that says Mongolia. That closes part of the vocabulary gap that makes BM25 miss paraphrases, while search still walks posting lists instead of comparing dense vectors.

This tab records opensearch-neural-sparse-encoding-v2-distill, a 6-layer DistilBERT of 67 M parameters released by OpenSearch under Apache-2.0. It has SPLADE's architecture and pooling; NAVER's own SPLADE checkpoints are licensed CC BY-NC-SA. Questions and paragraphs go through the same model, on the same 2,067 SQuAD paragraphs and 300 questions as every Retrieval tab.

A score for every term at every token

The encoder ends in BERT's masked-language-model head, kept from pretraining: a dense layer, GELU and LayerNorm, then a projection onto all 30,522 WordPiece terms that reuses the token embedding matrix. At token it gives a logit for every term , the same scores a masked language model uses to guess a hidden word. SPLADE turns them into term weights with a log saturation and keeps each term's largest value over the text:

The ReLU sets every negative logit to exactly 0, which is where the sparsity comes from; the logarithm keeps a few large weights from dominating. The A weight for every term, at every token panel shades the question's or the paragraph's tokens by one term's saturated score, and lists the terms one token writes most strongly. Its maximum over the tokens is the term's weight in the vector. The special tokens' terms are set to 0, as the model card's code does.

Two sparse vectors

The Two sparse vectors panel lists the non-zero terms of the question and of its relevant paragraph, largest first. Dashed chips are expansion terms. A paragraph here averages 245 non-zero terms out of 30,522, of which 194 are not among its own tokens; they carry 57% of its total weight. A question averages 135 non-zero terms from 15 tokens, and 78% of its weight sits on terms it does not contain. The model also drops words: of a paragraph's 95 distinct tokens on average, only 51 keep any weight, and stopwords and punctuation end at exactly 0.

For the first featured question, about Genghis Khan, the strongest terms are its own mongolian, ##agger and khan, then mongolia (1.74), which the question never says, and further expansions such as exaggerated, mongol and fake.

The dot product

Query and paragraph are scored by the dot product of their vectors,

and only terms both vectors hold add anything, so an inverted index computes it by walking the question's terms' posting lists, as for BM25. The dot product, term by term bars split the best paragraphs' scores by shared term. The first question shares 51 terms with its relevant paragraph, for a score of 31.8, and mongolia, an expansion term in the question, is the fourth largest contribution.

Over all 300 questions SPLADE puts the relevant paragraph first for 0.770 of them, against 0.733 for BM25 and 0.673 for bge-small-en-v1.5, and its nDCG@10 is 0.872 against 0.838 and 0.810. The model card lists SQuAD's training pairs among its training data; the validation articles recorded here are not in that split, but the questions are of the same kind.

Sparsity and what it costs

Sparsity decides the cost of search. SPLADE's FLOPS is the expected number of terms a question and a paragraph share, with the share of questions or paragraphs whose vector holds term ; here it is 4.96. Training adds a FLOPS regularizer that pushes this number down. The index holds 505,866 postings, nearly four times BM25's 130,829, because every paragraph also lists its expansion terms.

The strip's chart cuts every paragraph to its largest terms. With 128 terms per paragraph nDCG@10 is 0.875, as good as the full vectors; with 32 it falls to 0.787 and with 8 to 0.592. The bars beside it remove the expansion terms: without any, nDCG@10 drops from 0.872 to 0.820; without the question's alone to 0.854. Replacing every weight by 1, so that only which terms are present counts, gives 0.694: the learned weights matter as much as the terms.

Where it came from

Learned sparse retrieval started by fixing what BM25 indexes: doc2query appended predicted questions to each document, and DeepCT learned a weight for each term a document already contains. SparTerm then predicted a weight for every vocabulary term from the MLM head. SPLADE (Formal, Piwowarski and Clinchant, 2021) added the log saturation, max pooling (in SPLADE v2) and the FLOPS regularizer of Paria and colleagues; SPLADE++ trained it with distillation from cross-encoders and hard negatives. OpenSearch's v2 models are distilled SPLADE-style encoders, and their follow-up work removed the model from the query side altogether. The BM25 tab shows the hand-designed weights this replaces, and the Hybrid tab another way to combine exact and semantic matching.

Papers

  1. SPLADE: Sparse Lexical and Expansion Model for First Stage Ranking Thibault Formal, Benjamin Piwowarski, Stéphane Clinchant · SIGIR 2021 Introduces SPLADE: the MLM head's log-saturated weights over the whole vocabulary, trained with a FLOPS regularizer.
  2. SPLADE v2: Sparse Lexical and Expansion Model for Information Retrieval Thibault Formal, Carlos Lassance, Benjamin Piwowarski, Stéphane Clinchant · arXiv 2021 Replaces sum pooling with the max pooling this tab draws, and adds distillation.
  3. From Distillation to Hard Negative Sampling: Making Sparse Neural IR Models More Effective Thibault Formal, Carlos Lassance, Benjamin Piwowarski, Stéphane Clinchant · SIGIR 2022 SPLADE++: trains with cross-encoder distillation and hard negatives.
  4. Towards Competitive Search Relevance For Inference-Free Learned Sparse Retrievers Zhichao Geng et al. · arXiv 2024 OpenSearch's learned sparse retrievers, the family of the model this tab records.
  5. Minimizing FLOPs to Learn Efficient Sparse Representations Biswajit Paria, Chih-Kuan Yeh, Ian E.H. Yen, Ning Xu, Pradeep Ravikumar, Barnabás Póczos · ICLR 2020 The FLOPS regularizer and measure: the expected number of shared non-zero terms per query and document.
  6. Document Expansion by Query Prediction Rodrigo Nogueira, Wei Yang, Jimmy Lin, Kyunghyun Cho · arXiv 2019 doc2query: expanding documents with predicted questions before indexing them with BM25.
  7. Context-Aware Sentence/Passage Term Importance Estimation For First Stage Retrieval Zhuyun Dai, Jamie Callan · arXiv 2019 DeepCT: BERT predicts the weight of each term a passage contains, a learned replacement for term frequency.
  8. DistilBERT, a distilled version of BERT: smaller, faster, cheaper and lighter Victor Sanh, Lysandre Debut, Julien Chaumond, Thomas Wolf · arXiv 2019 The 6-layer encoder under the recorded model.

See also