RAG & Retrieval·Question 32 of 100Intermediate

What is learned sparse retrieval, SPLADE-style, and when would you pick it over BM25 or a dense retriever?

Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.

Model answer: the part to lead with

Learned sparse retrieval produces a sparse vector over the vocabulary, like BM25, but the weights are learned by a transformer rather than counted. SPLADE runs text through a masked-language-model head, gets a weight for every vocabulary term at every position (a log-saturated ReLU of the logits), max-pools across positions, and trains with a sparsity regularizer so most entries go to zero. What survives is a bag of weighted terms that includes words never in the original text.

Full worked answer

Learned sparse retrieval produces a sparse vector over the vocabulary, like BM25, but the weights are learned by a transformer rather than counted. SPLADE runs text through a masked-language-model head, gets a weight for every vocabulary term at every position (a log-saturated ReLU of the logits), max-pools across positions, and trains with a sparsity regularizer so most entries go to zero. What survives is a bag of weighted terms that includes words never in the original text.

That expansion is the whole point. A document about 'myocardial infarction' picks up nonzero weight on 'heart attack'. So you get semantic matching, but the output is still sparse, which means you serve it from an ordinary inverted index with the same query machinery you already run for BM25.

The appeal versus the alternatives:

  • Versus BM25: solves vocabulary mismatch. BM25 cannot match a query and document that share no terms; SPLADE can, because expansion put the terms there at index time.
  • Versus dense: it is interpretable. You can look at the vector and see which terms fired and with what weight, which makes debugging a bad result tractable in a way a 1024-dim dense vector never is. It also keeps exact-term precision, and there is no separate vector index to operate.

The costs are real. Indexing needs a transformer forward pass per document, so it is as expensive as embedding. Expansion lengthens postings lists, so query latency rises versus BM25, sometimes substantially, and the sparsity regularizer is the knob trading effectiveness against that. Effectiveness is also weaker on genuinely abstract or paraphrase-heavy queries where dense wins.

When I would reach for it: you already run Elasticsearch or OpenSearch, you need better-than-BM25 semantics, and you would rather not stand up and operate a vector database. In a hybrid stack it is a legitimate third leg, or a stronger replacement for the lexical leg, fused with dense by RRF.

What a good answer covers

  • What survives is a bag of weighted terms that includes words never in the original text
  • A document about 'myocardial infarction' picks up nonzero weight on 'heart attack'
  • So you get semantic matching, but the output is still sparse, which means you serve it from an ordinary…
  • Versus dense: it is interpretable
  • Indexing needs a transformer forward pass per document, so it is as expensive as embedding

Key terms: Versus BM25 · Versus dense

Interviewer follow-ups to expect

  1. SPLADE's expansion lengthens postings lists. What would you actually tune to keep query latency acceptable?

  2. Would you fuse SPLADE with dense retrieval, or does the expansion make dense redundant?

Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep