SPLADE and Sparse Embeddings
The definition turns on the word majority. A vector does not need every value to be 0 to count as sparse, and it does not need every value to be non-zero to count as dense. What matters is which side holds more of the entries.
Testing a Common Shortcut
When you first meet the words sparse and dense in retrieval, it is tempting to form a quick rule: anything produced by a neural model is dense, and anything built from keywords is sparse. The rule feels reasonable. Embeddings are the famous output of neural models, and keyword matching is the famous older method. But the rule is a misconception, and this article is organized around testing it. You will see that the sparse versus dense question and the term-based versus embedding-based question are two different questions, and that SPLADE is a case where the answers do not line up with the shortcut.
Predicting What SPLADE Produces
Before reading the definitions closely, commit to an answer. SPLADE is described as an embedding-based retrieval algorithm, and embeddings are often assumed to be dense. Make your guess first, then read on.
What do you think happens?
SPLADE is described as an embedding-based retrieval algorithm. Are the vectors it produces dense or sparse?
Reveal answer
Sparse
SPLADE is an embedding-based algorithm that uses sparse embeddings. Its embeddings are pushed by regularization so that most values are 0. Being embedding-based does not force a method to be dense. The rest of this article explains how that works.
Sparse and Dense by the Share of Zeros
A sparse vector is one where the majority of the values are 0. A dense vector is one where the majority of the values are not 0.
The definition turns on the word majority. A vector does not need every value to be 0 to count as sparse, and it does not need every value to be non-zero to count as dense. What matters is which side holds more of the entries.
This means two vectors of the same length can land on opposite sides of the line depending only on how many of their entries are zero. Retrieval systems use this distinction in their naming. Sparse retrievers represent data using sparse vectors, and dense retrievers represent data using dense vectors. Each family is therefore described by the kind of vector it relies on.
Building a One-Hot Vector
The clearest sparse vector is the one-hot vector. It is defined as a vector that is 0 everywhere except for a single value of 1. Its length equals the size of the vocabulary, and the 1 sits at the index that matches the position of the term in the vocabulary. Term-based retrieval is considered sparse because each term can be represented this way.
One-Hot Vector for dog in a Four-Term Vocabulary
A small system knows four terms, indexed as cat at 0, dog at 1, fish at 2, and bird at 3. Write the one-hot vector for dog and decide whether it is sparse.
- 1Set the length
The vocabulary has four terms, so the vector has length 4.
- 2Find the index
dog is at index 1 in the vocabulary.
- 3Place the single 1
Put a 1 at index 1 and 0 everywhere else, giving [0, 1, 0, 0].
- 4Count the zeros
Three of the four values are 0, which is $\frac{3}{4}$ of the entries.
- 5Classify
Zeros form the majority, so the vector is sparse.
The one-hot vector for dog is [0, 1, 0, 0]. It is sparse because $\frac{3}{4}$ of its values are 0.
Notice what happens as the vocabulary grows. The vector length rises with the number of terms, but each one-hot vector still contains only one 1. Its share of zeros climbs toward everything, which is why one-hot vectors are a clean illustration of sparsity.
Why Sparse Is Not the Same Question as Term-Based
The contrast becomes clearer when the two kinds of vector sit next to each other. Sparse vectors have a majority of zero values, and the one-hot vector is a concrete case of that pattern. Dense vectors have a majority of non-zero values, and embedding-based retrieval is typically dense because embeddings are generally dense vectors.
There is a second axis, and it is separate from the first. Term-based versus embedding-based describes the family a method belongs to. Sparse versus dense describes the values inside the vectors that method produces. Keyword-based search is the most direct example of term-based retrieval. Given the query AI engineering, the system retrieves all documents that contain AI engineering. The source calls this lexical retrieval, and it belongs to the term-based side, which is why it is treated as a sparse method.
The two columns describe the typical pattern of each family, and the pattern has exceptions. That exception is the reason SPLADE needs its own discussion.
How SPLADE Ends Up Sparse
SPLADE, which stands for Sparse Lexical and Expansion, is a retrieval algorithm that works using sparse embeddings. It leverages embeddings generated by BERT, but it applies regularization that pushes most embedding values to 0. The sparsity that results makes embedding operations more efficient.
The starting point is an embedding, and embeddings are generally dense. The regularization step is what changes the outcome. Because it pushes most values to 0, the final vector falls on the sparse side of the majority definition. SPLADE is therefore a sparse embedding method even though embeddings are involved.
Mistakes Beginners Make
Common mistake Treating every neural output as dense
What it looks likeConcluding that SPLADE must produce dense vectors because it is an embedding-based method.
Why it failsSparse versus dense describes the values inside a vector, not the model family that produced it. SPLADE uses embeddings, but regularization pushes most of them to 0.
Do this insteadCheck the share of zero values in the vector itself before assigning the sparse or dense label.
Common mistake Assuming a vector must be entirely zeros to be sparse
What it looks likeRefusing to call [0, 1, 0, 0] sparse because it contains a 1.
Why it failsThe definition uses the word majority. Three of four values being 0 is enough.
Do this insteadCount the zeros and ask whether they make up the majority of the entries.
Common mistake Confusing the sparse-dense axis with the term-based-embedding axis
What it looks likeSaying keyword search is sparse, so every sparse method must be term-based.
Why it failsThe two axes are independent. SPLADE is sparse but embedding-based.
Do this insteadAnswer two separate questions: what family the method belongs to, and what kind of vector it produces.
Common mistake Forgetting that a one-hot vector's length equals the vocabulary size
Practice with a Five-Term Vocabulary
A system knows five terms indexed as apple at 0, banana at 1, carrot at 2, date at 3, and egg at 4. Write the one-hot vector for egg. Then state how many of its values are 0, and whether it is sparse or dense.
Hints
- The vector has length 5, one entry per term.
- egg is at index 4, so the single 1 goes in the last position.
- Four of the five values are 0, which is the majority.
Key Takeaways
- A sparse vector has a majority of values equal to 0, and a dense vector has a majority of values that are not 0.
- A one-hot vector is a sparse vector with a single 1 at the index of a term, and its length equals the vocabulary size.
- Sparse versus dense describes the values inside a vector, which is a different question from whether a method is term-based or embedding-based.
- SPLADE is an embedding-based algorithm that uses sparse embeddings, because regularization pushes most of its embedding values to 0.