Algorithm Search⌘K

Techniqueadvanced

Static index pruning

Also called Carmel static pruning.

Removes low-impact postings from an inverted index at build time, so the index is smaller and faster with a small, measured loss in ranking quality.

Static index pruning removes postings from an inverted index once, at build time, when they are not likely to matter for the top results of any query. The pruned index is smaller, so it fits in faster memory and its posting lists are shorter to read. This is unlike the dynamic pruning of WAND or MaxScore, which skips work at query time and can be safe. Static pruning is lossy: a removed posting is gone for every query, so scores change and some rankings change. Its quality is measured, not proved in general. The usual test runs the queries of a test collection on the full and the pruned index, and compares measures such as precision at k or mean average precision, together with the size of the index. Carmel and others (2001) gave the classic term-centric rule: for each term, keep the postings whose score is at least a fraction ε\varepsilon of the kk-th best score in the list of that term.

In plain words

Most entries of a search index are weak: a word that appears once in a long document adds very little to its score. If you throw such entries away before any query comes, the index gets smaller and searches get faster. The price is that some answers change. A document that was good because it had many weak matches can drop down or vanish. Nothing can promise that the answers stay the same for all queries, so you check by experiment: run many test queries on both indexes and see how much the quality drops for the space you save.

When it applies

It applies when the full index is too large for the memory or the time budget, and a small drop in ranking quality is acceptable. It needs a ranking function whose score is a sum of the weights of the query terms, such as BM25 or tf-idf, so that the contribution of each posting can be judged on its own. It suits short queries best: a query with few terms depends mostly on the strong postings of those terms. It does not apply when the results must be exactly those of the full index; then use a safe method such as WAND, MaxScore, or the safe rule of a tiered index.

The template

  1. Score each posting. Compute the weight w(t,x)w(t, x) of each posting with the ranking function of the system.
  2. Choose a rule. The term-centric rule of Carmel and others, top-kk pruning: for each term tt, let ztz_t be the kk-th largest weight in the list of tt, or the smallest one if the list is shorter, and keep the postings with w(t,x)≥εztw(t, x) \ge \varepsilon z_t, for a factor 0<ε≤10 < \varepsilon \le 1. Uniform pruning: keep the postings with w(t,x)≥τw(t, x) \ge \tau for one global τ\tau. A document-centric rule: for each document, keep its strongest terms.
  3. Remove the postings. Write the pruned lists. Keep the original weights; do not compute the weights again from the pruned index, or the scores of all documents change.
  4. Measure. Run a set of test queries on both indexes. Report the fraction of postings removed, the size and query time, and the quality: the overlap of the top kk and measures such as precision at kk, MAP or nDCG, each compared with the full index.
  5. Tune. Choose kk and ε\varepsilon, or τ\tau, by the measured trade-off between size and quality.

The rule of Carmel and others comes with a guarantee for their scoring model: for queries with few terms, the top answers of the pruned index stay close to those of the full index, by a closeness that depends on ε\varepsilon. The guarantee is about the similarity of the top answers under their model, not about equal results, and it is stated in the paper.

Classic examples

Top-kk pruning on the toy collection. Take the toy collection with BM25 weights (k1=1.2k_1 = 1.2, b=0.75b = 0.75, the Lucene IDF with the natural log), which has 74 postings. With k=1k = 1 and ε=0.8\varepsilon = 0.8, each term keeps the postings with weight at least 0.8 times its largest weight. Six postings are removed: a in d3 and d7, sorted in d1, d4 and d8, and list in d3. For example, sorted has the largest weight 0.9497, so it keeps only weights of at least 0.7598, which leaves d2.

query full index pruned index
q1 "sorted array search" d1 3.0283, d2 1.8893, d8 1.6292, d7 1.2743, d4 0.6896 d1 2.3091, d2 1.8893, d7 1.2743, d8 0.9396
q2 "posting list merge" d4 2.6946, d3 2.2139, d5 2.2139, d2 1.2743 d4 2.6946, d5 2.2139, d2 1.2743, d3 0.9396

The top document of each query stays the same, as the rule aims for k=1k = 1. Below it the ranking changes: for q1, d8 drops below d7 and d4 is gone; for q2, d3, which tied with d5 and won by docid, drops to fourth. With k=2k = 2 and ε=1.0\varepsilon = 1.0, four postings are removed (a in d3 and d7, sorted in d4 and d8); the top 2 of q1 stays the same, but the third place changes. With k=2k = 2 and ε=0.9\varepsilon = 0.9 only the two postings of a are removed.

Carmel and others (2001). They tested top-kk pruning and uniform pruning with the Juru search engine on TREC data. Their measurements showed that a large part of the index could be removed with a small change in the top results and in precision for short queries. These results are measurements on their collections and queries.

Document-centric pruning. Buettcher and Clarke (2006) keep, for each document, the terms that contribute most to it, and they measured that for some sizes this keeps quality better than term-centric pruning. A document then always keeps its most typical terms, even when they are common in the collection.

Variations

  • Uniform pruning. One global threshold for all terms. It is simple, but it can empty the lists of terms whose weights are all small.
  • Term-centric with a share. Keep a fixed share of each list in place of a factor of the kk-th score.
  • Pruning with tiers. Keep the removed postings in a second, slower index, as the last tier of a tiered index, and read it only when the first tier does not give good enough results. This keeps the space saving on the fast index and lets a safe stop rule fall back.
  • Pruning by document. Remove whole documents that are not likely to be retrieved, for example by a static quality score.
  • Combination with dynamic pruning. A pruned index can still be queried with WAND or MaxScore; these methods are then safe for the pruned index, not for the full one.

Pitfalls

  • Calling it safe. Static pruning changes scores and rankings. A guarantee for short queries under one scoring model is not a guarantee for all queries.
  • Recomputing statistics. If the document frequencies or lengths are computed again from the pruned index, every weight changes, and the effect is not the one that was measured.
  • Measuring only the top 1. A rule tuned for the top kk can change the ranks below kk a lot, as the toy example shows. Measure at the depth that the users see.
  • Lost terms. A rare term with only weak postings can lose its whole list under uniform pruning, and then queries with that term find nothing for it.
  • Ties. A removed posting can break a tie, as with d3 and d5 in q2. Tests that compare rankings must use the same tie rule on both indexes.

Exercises

  1. On the toy collection, compute the postings that top-kk pruning removes with k=1k = 1 and ε=0.9\varepsilon = 0.9, and the new top 3 of q1.
  2. Give an index and a query of two terms for which top-kk pruning with k=1k = 1 and ε=1\varepsilon = 1 changes the top 1 of the query.
  3. Show that uniform pruning with threshold τ\tau keeps the top kk of a one-term query unchanged whenever the kk-th weight of its list is at least τ\tau.
  4. A pruned index is queried with WAND. Explain why the results are exactly the top kk of the pruned index but can differ from the top kk of the full index.

References

  1. David Carmel, Doron Cohen, Ronald Fagin, Eitan Farchi, Michael Herscovici, Yoelle S. Maarek and Aya Soffer, Static index pruning for information retrieval systems, SIGIR 2001, the top-k pruning rule with the factor epsilon for each term, the uniform pruning rule with one global threshold, the guarantee on the top answers of short queries, and the experiments with the Juru search engine on TREC data
  2. Stefan Buettcher and Charles L. A. Clarke, A document-centric approach to static index pruning in text retrieval systems, CIKM 2006, the pruning rule that keeps, for each document, the terms that contribute most to it, and its comparison with term-centric pruning
  3. Nicola Tonellotto, Craig Macdonald and Iadh Ounis, Efficient query processing for scalable web search, Foundations and Trends in Information Retrieval 12(4-5), 2018, 319-500, the part on static pruning of the index, as opposed to the dynamic pruning of WAND and MaxScore

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW2 basic
  • three classic examples