Glossary¶
The terms this documentation uses, in the sense it uses them. Each entry links to the page that goes further.
Vectors and scores¶
Sparse vector. A vector with one dimension per entry of a dictionary, almost all of them zero. Two vectors are scored by their dot product. → What is learned sparse retrieval?
Dictionary. What the dimensions of a sparse vector stand for: the tokenizer's vocabulary, or the latents of an SAE.
Entry. One dimension of the dictionary: a word piece of the vocabulary, or a latent.
Expansion. Weight on an entry that does not occur in the text. It is what lets a sparse model match a document that uses other words than the query.
Non-zero entries (also active dimensions, L0). How many dimensions of a vector are not zero. Per document it sets the size of the index; per query, how many lists a search reads.
FLOPS. Two related things. As a regulariser (Paria et al.), a penalty on the square of each entry's mean weight over a batch, which costs frequent entries more than rare ones. As an evaluation figure, sum_j p_q(j) * p_d(j): the expected number of entries a query and a document share, where p(j) is the share of texts in which entry j is active. → Evaluate a retriever
Cap. A limit on the non-zero entries of a vector, applied by keeping the largest weights. Written 64/256 for 64 per query and 256 per document. A model can also be trained under several caps at once (MatryoshkaCaps).
Inverted index, posting list. The index of a search engine: for every entry, the list of documents that hold it, with their weights. That list is the entry's posting list.
Heads¶
Head. The module that turns the encoder's token states into the sparse vector. muscari has two: VocabularyPooling and SAEPooling.
Language-model head. The layers of a masked language model that score every vocabulary entry at every token. SPLADE and the vocabulary head read their weights off it.
Pooling. Reducing the scores of all tokens to one vector per text. Every method here takes the maximum over the tokens.
Saturation. log(1 + x) on the scores, which dampens large values. SlideOn leaves it out.
Shift. A constant subtracted from the logits of the language-model head before the ReLU, so that only the largest stay positive (SPARSEUP). --shift auto estimates it from your documents.
Limit per token (fan-out). How many logits each token may keep before pooling (SPARSEUP).
Folding. Merging vocabulary entries that differ only in case or in a word-boundary marker (SPARSEUP).
Noise tokens. Entries such as punctuation, symbols and special tokens, which a recipe can mask out of the vectors or penalise.
Content tokens. The tokens of the text itself: no padding, no special tokens and, by default, no prompt. SAEs are trained on them and the heads pool them.
Prompt. A fixed text an encoder expects in front of a query or a document, such as 検索クエリ: for ruri-v3.
Sparse autoencoders¶
Sparse autoencoder (SAE). A network trained to rewrite a hidden state of an encoder as a weighted sum of a few directions from a large set, and to reconstruct the state from them. → How it works
Latent. One of those directions. An SAE with 65,536 latents gives a dictionary of 65,536 entries.
Top-K, k. The rule that keeps the k largest latent activations of a token and zeroes the rest. With k = 16, every token has 16 active latents.
FVU. Fraction of variance unexplained: the SAE's reconstruction error over the variance of the states. Lower is better; it says nothing by itself about retrieval. → Evaluate and inspect an SAE
Dead latent. A latent that has not been active for a set number of training tokens. AuxK is the auxiliary loss that trains dead latents on what the live ones failed to reconstruct.
Loss recovered. How much of the encoder's own masked-language-model loss survives when the SAE's reconstruction replaces the hidden states.
Frozen, trainable. Whether retrieval training leaves the SAE's encoder as it is or updates it together with the transformer.
Masked latents. Latents removed from a head's output, usually because they are active in almost every text.
Probe. Ranking with an SAE before any retrieval training (muscari probe-sae), to see what the dictionary gives on its own.
Training¶
Contrastive loss, in-batch negatives. The loss that asks a query to score its own document above the documents of the other queries in the batch. Its scale multiplies the scores before the softmax; a temperature divides them.
Hard negative. A document that looks relevant to a query and is not, added to the batch on purpose.
Distillation, teacher. Training on the scores of a stronger model, usually a cross-encoder, instead of or next to the contrastive loss. KL, MarginMSE and soft labels are three ways to compare the model's scores with the teacher's. → Train a retriever
Regulariser. The penalty that keeps vectors sparse during training: FLOPS or L1, with a weight and usually a warm-up.
Collapse. A run that ends with empty or nearly empty vectors, or with dense ones. → Small runs of seven recipes
Recipe. A file of options for the training script that copies the published settings of one method and marks every value that is this project's own. → Recipes
Diagnostics. Measurements taken before training (--diagnose): how dense the vectors start, how large the loss is, how the teacher's scores are spread.
Evaluation¶
Reranking, retrieval. Reranking orders the candidates a benchmark supplies for each query; retrieval ranks a whole corpus.
nDCG@10, MRR@10. Ranking metrics over the top ten results; 1 is a perfect ranking.
Seed. The random seed of a training run. Differences smaller than the spread between seeds are not differences.