Learn · The Art of Not Looking
budding
The Arithmetic of Skipping
A pruning test is a tax on every query and a refund only when its bound excludes enough work.
“We focus on safe techniques for disjunctive queries, which return the same result as an exhaustive evaluation.”
— Shuai Ding and Torsten Suel, “Faster Top-k Document Retrieval Using Block-Max Indexes”
This is the eleventh chapter in a book about search from first principles. Chapter 9 supplied the monotone-bound theorem, and Chapter 10 used term-level bounds to raise a top-k threshold. Here you will refine one ceiling into block ceilings, prove that the refinement inherits safety, derive a tax-and-refund cost model, explain why single-term queries cannot benefit from competitive pruning, and distinguish an expensive check from a vacuous bound. You will also design measurements that say why an optimization did or did not pay. The next chapter turns from avoiding arithmetic to avoiding stored bits.
A checkpoint in every block
Suppose the posting list for term is divided into consecutive blocks. The global term ceiling
is valid everywhere, but it may be set by one exceptional document. For block , record
Then every posting in that block satisfies
When the current iterators identify a candidate region, sum the ceilings of the blocks that could contribute. If the sum cannot beat threshold , advance past the region without decoding and scoring its postings.
Block-max index — an inverted index augmented with a maximum possible score for each compressed posting block, enabling a shallow bound check before deep decoding. Learn more.
Safety is inherited
Let a candidate document lie in block for each matching term . Define the block bound
and the coarser term bound
For an additive nonnegative scorer,
Bound-refinement inheritance. If a refined bound satisfies and is a valid upper bound, then every skip proved by is safe under the same top-k theorem as .
Proof. , so cannot displace a retained result at or above . The inequality is not needed for correctness; it establishes that the new bound is never looser than the old one.
This separation is valuable. Correctness asks whether the bound dominates the score. Performance asks how often it is strictly tighter by enough to cross the threshold.
The tax and the refund
Let
- be the cost of reading and combining a global term bound;
- be the additional cost of locating and combining block bounds;
- be the cost of decoding one block;
- be the cost of scoring its surviving postings;
- be the fraction of visited blocks safely skipped;
- be the number of block-bound decisions.
A first-order comparison is
Block refinement pays when
The equation is intentionally local. Cache misses, branch prediction, prefetching, compression state, iterator synchronization, and threshold growth make the measured costs depend on workload and machine. But it tells us which quantities to instrument instead of staring at elapsed time alone.
A bound check is purchased on every visited region. Its refund arrives only when the check proves enough decoding and scoring unnecessary.
Why one term cannot compete with itself
Consider a query with one term and a positive local score. Every document in its posting list is a candidate, and the top-k winners are simply the largest contributions. In document order, the term's block ceiling can say a block lies below the current threshold after the heap is full. That can skip some blocks if score maxima vary.
But ordinary WAND-style competitive pivoting has no second term whose bound can combine with or exclude the first. If the evaluator must traverse the single list to establish its winners, per-term pivot machinery supplies no competitive pruning. A specialized impact-ordered list or block-max traversal may help, but that is a different access order with its own index cost.
The honest lesson is narrower than the slogan “single-term queries can never prune”:
- multi-list WAND machinery cannot earn its coordination tax with one list;
- a document-ordered block-max list can skip only after a threshold exists and only when local maxima fall below it;
- an impact-ordered representation can retrieve high contributions early but pays in construction, storage, and other query shapes.
The machine should therefore report the actual mechanism, not credit every saved posting to “WAND.”
A refinement can be valid and vacuous
Suppose every block in one posting list contains at least one occurrence with the list-wide maximum contribution. Then
for every block. The hierarchy remains valid, but the middle ceiling has added no information.
This is likely when the bounded quantity has little within-list variation, or when blocks are large enough that nearly every one contains an extreme value. It can also happen when a coarse scoring quantization produces many equal maxima.
Measure the refinement gap
or ratio , alongside the empirical distribution of local scores. If most gaps are zero, no threshold tuning will make the metadata informative. Smaller blocks may expose variance, but they add more maxima, headers, lookups, and cache pressure.
Block size is a three-way trade
Smaller blocks usually tighten maxima because fewer values compete to set each ceiling. They also increase:
- metadata entries and bytes;
- boundary searches and shallow pointer movements;
- branch and cache pressure;
- construction and update work.
Larger blocks reduce those taxes but approach the global maximum and decode more postings after a failed check. There is no corpus-independent optimum.
For block length and postings, the uncompressed maximum table holds approximately
entries. That is only the space term. Query time depends on how changes the refinement-gap distribution and the number of blocks actually visited.
The top-k problem being solved
This chapter's top-k is a cardinality-constrained selection over independent, already eligible document scores with a deterministic tie order. Under that structure, keeping the best scalar items is exact.
Do not silently transfer the pruning proof to a different feasible family. A result set with diversity quotas, coverage requirements, per-item costs, or sequence-dependent value is not ordinary scalar top-k. It may be a matroid, knapsack, submodular, or harder selection problem, and its threshold needs a corresponding theorem. Authority and mandatory coverage remain hard constraints, never score bonuses.
This classification prevents a common error: adding a diversity penalty to the heap and assuming a per-document ceiling still proves the best set.
Instrument the survivor funnel
Elapsed time says whether a run was fast. The survivor funnel says why:
| Stage | Counter |
|---|---|
| global term test | candidate regions considered |
| block refinement | block bounds evaluated |
| shallow skip | blocks skipped without decoding |
| deep movement | blocks decoded |
| candidate verification | documents scored |
| selection | heap insertions and threshold updates |
Pair those counters with query strata:
- one term, two terms, and many terms;
- rare-only, common-only, and mixed-frequency terms;
- small and large ;
- high and low within-list score variance;
- cold and warm cache;
- successful hits and misses.
Report p50, p90, and p99 within each stratum. A mean over a mixture can make a rare spectacular win conceal a common small regression.
Block-refined candidate check
BLOCK-CAN-WIN(ITERATORS, THRESHOLD)
Input: live term ITERATORS with valid global and current-block bounds, THRESHOLD
Output: true only when the current block region may contain a winner
globalBound ← SUM-GLOBAL-BOUNDS(ITERATORS)
if globalBound < THRESHOLD
return false
blockBound ← SUM-CURRENT-BLOCK-BOUNDS(ITERATORS)
if blockBound < THRESHOLD
return false
return trueThe procedure is deliberately only a decision kernel. A complete Block-Max WAND evaluator also maintains document-ordered iterators, chooses pivots, performs shallow and deep advances, scores admitted candidates, and updates the heap. Chapter 10 already established those invariants; duplicating the full algorithm here would hide the new economic question.
Evidence before adoption
Keep the non-block evaluator and compare ordered top-k results over generated corpora. Then benchmark at least three contestants:
- exhaustive document-at-a-time scoring;
- term-bound WAND or MaxScore;
- block-refined evaluation.
Record index bytes and build time as well as query latency. Use an unchanged control run to estimate benchmark noise. A block-max variant earns adoption only in the workload region where its Pareto point—time, bytes, construction, and complexity—is actually wanted.
The falsifying cases belong in the benchmark corpus:
- all block maxima equal the global maximum;
- one-term queries dominate;
- is so large that the threshold rises late;
- every block is tiny enough that metadata dominates;
- every block is large enough that bounds become coarse;
- a new scoring factor is omitted from the stored maximum.
The last case is a correctness failure; the others are economic failures. The suite should label them differently.
Lessons
- Per-block maxima refine per-term maxima and inherit the same safety theorem.
- A tighter valid bound can still do no useful work.
- Pruning pays only when skipped decode and scoring work exceeds bound metadata and evaluation cost.
- Multi-list WAND coordination cannot pay on a one-list query; specialized single-list access may still exploit impact or block order.
- Bound refinement pays in proportion to the within-unit variation it exposes.
- Smaller blocks tighten ceilings while increasing metadata and lookup costs.
- Counters explain a skip mechanism; clocks alone do not.
- Ordinary scalar top-k has only a cardinality constraint. Diversity, coverage, cost, or sequence dependence changes the selection problem.
- Exhaustive and coarser evaluators remain differential oracles.
Practice
- Prove from the per-term block inequalities.
- With , , derive the minimum skip fraction predicted to break even.
- Construct two eight-posting lists with equal global maxima: one whose four-posting block maxima vary and one whose block maxima are all equal.
- Explain why increasing usually delays pruning. Give a countervailing workload effect that could complicate the measured result.
- Design a generated-corpus differential test that inserts an omitted scoring boost and catches the resulting underestimated maximum.
- Add a diversity quota to top-k and show why independent scalar selection no longer specifies the feasible result sets.
References
- Shuai Ding and Torsten Suel. “Faster Top-k Document Retrieval Using Block-Max Indexes.” Proceedings of SIGIR, 2011.
- Andrei Z. Broder, David Carmel, Michael Herscovici, Aya Soffer, and Jason Zien. “Efficient Query Evaluation Using a Two-Level Retrieval Process.” Proceedings of CIKM, 2003.
- Joel Mackenzie, J. Shane Culpepper, Roi Blanco, Matt Crane, Charles L. A. Clarke, and Jimmy Lin. “Query Driven Algorithm Selection in Early Stage Retrieval.” Proceedings of WSDM, 2017.
- Antonio Mallia, Michal Siedlaczek, Torsten Suel, and Nicola Tonellotto. “An Experimental Study of Index Compression and DAAT Query Processing Methods.” Proceedings of ECIR, 2019.