Enterprise-Scale Search: Accelerating Inference for Sparse Extreme Multi-Label Ranking Trees

Philip A. Etter, Kai Zhong, Hsiang-Fu Yu, Lexing Ying, Inderjit S. Dhillon

Executive Summary

Researchers from Stanford and Amazon have introduced Masked Sparse Chunk Multiplication (MSCM), a novel sparse matrix technique designed to accelerate inference for extreme multi-label ranking (XMR) trees. By exploiting the inherent "chunked" sparsity structure of tree-based beam searches, MSCM achieves speedups of 2x to 20x. Notably, it enables sub-millisecond latency on a 100-million-product search task without any loss in model accuracy.

The Challenge: Scaling Extreme Multi-label Ranking

Extreme Multi-label Ranking (XMR) involves identifying the most relevant items from a pool of millions—for instance, matching a search query to one of 100 million products. Tree-based models are widely used for this task because they employ "beam search" to navigate the label space in sub-linear time.

However, at enterprise scale, these models encounter a significant computational bottleneck. The core operation involves multiplying a sparse query vector by a sparse weight matrix. Standard sparse matrix routines (such as SpMSpV) treat columns independently and fail to account for the tree's structure. In a tree, evaluating a specific node typically implies evaluating its siblings as well. Traditional methods lead to redundant memory traversals and poor cache locality, making real-time, large-scale search computationally expensive.

Methods: Masked Sparse Chunk Multiplication (MSCM)

The authors propose Masked Sparse Chunk Multiplication (MSCM) to address these inefficiencies. The primary innovation lies in how the model's weight matrix is organized and accessed during inference.

  1. Column Chunking: Instead of using a standard Compressed Sparse Column (CSC) format, weights are stored in "chunks" that correspond to groups of siblings within the tree.
  2. Vector-Chunk Product: During inference, the algorithm performs a single multiplication against an entire chunk rather than individual dot products for every node in the beam.
  3. Iteration Strategies: The paper evaluates four methods for finding the intersection between sparse query features and sparse model weights:
  4. Marching Pointers: A simple linear scan.
  5. Binary Search: Efficient for highly sparse queries.
  6. Hash-maps: Optimal for small-to-medium batch sizes.
  7. Dense Lookup: Fastest for large batches, albeit more memory-intensive.
Illustration of Masked Sparse Chunk Multiplication (MSCM) mapping tree nodes to weight matrix chunks.

MSCM is a "lossless" optimization; it refines the execution of the mathematical operations without altering the underlying logic, ensuring that the output remains identical to traditional, slower methods.

Benchmarking and Datasets

The approach was evaluated on six public datasets from the Extreme Classification Repository: Eurlex-4k, AmazonCat-13k, Wiki10-31k, Wiki-500k, Amazon-670k, and Amazon-3m. To demonstrate industrial applicability, the authors also tested on a proprietary Enterprise-Scale Product Search dataset featuring 100 million labels and 4 million features.

Key Insights

  • Structural Sparsity: Beam search creates a specific mask over the weight matrix. Since siblings share a parent, they are evaluated together. MSCM converts this logical grouping into a physical memory optimization.
  • Sparsity Correlation: Siblings in a label tree often share similar feature supports. By grouping them, the algorithm traverses the query vector once to update scores for all siblings, significantly reducing cache misses.
  • Zero Accuracy Trade-off: Because the technique is mathematically equivalent to standard sparse multiplication, it provides performance gains with zero impact on Precision@k or Recall.

Results

  • Significant Latency Reduction: On the 100-million-label dataset, MSCM reduced average latency from 7.28 ms to 0.88 ms per query.
  • Performance Gains: MSCM provided a 10x performance gain over NapkinXC, a popular XMC framework, across multiple datasets.
  • Scalability: The performance boost increases with the tree's branching factor. With a branching factor of 32, speedups were consistently higher than with a factor of 2.
Wall-time speedup across different datasets and iteration strategies using MSCM.

Limitations and Future Directions

  • Model Scope: MSCM is currently optimized for linear rankers where scores are derived from dot products. It does not yet support trees using non-linear deep learning models at each node.
  • Hardware Focus: The study focuses on CPU-based inference. While GPU implementations are possible, the unique memory-access patterns of sparse-sparse multiplication on GPUs present distinct challenges.
  • Query Optimization: Future work may explore query reordering to further enhance memory locality and performance.

Summary updated

BibTeX
@inproceedings{etter2022enterprise,
  author = {Philip A. Etter and Kai Zhong and Hsiang-Fu Yu and Lexing Ying and Inderjit S. Dhillon},
  title = {{Enterprise-Scale Search: Accelerating Inference for Sparse Extreme Multi-Label Ranking Trees}},
  booktitle = {The Web Conference},
  year = {2022},
  doi = {10.1145/3485447.3511973},
}
Figure