Enabling Efficiency-Precision Trade-offs for Label Trees in Extreme Classification

Tavor Z. Baharav, Daniel L. Jiang, Kedarnath Kolluri, Sujay Sanghavi, Inderjit S. Dhillon

TL;DR

This paper introduces a novel algorithm for constructing label trees in extreme multi-label classification (XMC) that allows for a tunable trade-off between prediction accuracy and inference speed. By bridging the gap between methods that prioritize precision and those that prioritize efficiency, their approach enables better performance on real-world applications like e-commerce recommendations.

What Problem Does This Paper Address?

Extreme Multi-Label Classification (XMC) deals with scenarios where a single data point can be assigned to one or more labels from an enormous set of possibilities. Think of tagging products on an e-commerce site with millions of items, or categorizing news articles into thousands of topics. Traditional methods like "one-vs-all" (training a separate classifier for each label) become computationally infeasible due to the sheer number of labels.

A common and effective solution is to organize labels into a tree structure. This allows for faster inference because instead of checking every label, we only traverse a path down the tree. However, designing the best tree structure is tricky. Some methods, like Parabel, build trees based on label similarity to maximize accuracy. Others, like fastText, use coding theory (e.g., Huffman coding) to create trees that minimize the expected path length (inference time), often at the cost of accuracy. This paper addresses the challenge of finding a sweet spot between these two extremes, allowing for a flexible balance between precision and efficiency that wasn't previously achievable.

Methods

The core contribution is a new algorithm for constructing "Probabilistic Label Trees" (PLTs) that can interpolate between similarity-based and coding-theoretic approaches.

  • Unified Framework: They propose a unified framework that considers both label similarity (using embeddings) and label frequencies.
  • Interpolation Objective: They introduce a novel objective function with a tunable hyperparameter ($\lambda$) that smoothly blends the goals of similarity-based clustering (like balanced 2-means) and frequency-based coding (like Fano coding).
  • At $\lambda=0$, it resembles similarity-based methods.
  • At $\lambda=2$, it leans towards frequency-based methods.
  • Intermediate values of $\lambda$ allow for a controlled trade-off.
  • Algorithm: They develop an alternating maximization algorithm to efficiently optimize this objective. This involves iteratively updating cluster assignments and cluster centers, with a clever way to handle the constraints and achieve near-optimal solutions. They also introduce a "weighted 2-means clustering" as an intermediate step.
  • Frequency Vector Construction: They discuss and propose methods for constructing a "frequency vector" that is crucial for the coding-theoretic aspect of their approach. This vector is not just the raw label frequency but is tailored to minimize expected depth.

Datasets

The authors evaluated their method on several public XMC datasets and newly introduced e-commerce datasets:

  • Public Datasets:
    • Wiki-500K
    • AmazonCat-13K
    • Amazon-670K
  • E-commerce Datasets:
    • Amazon-705K
    • Amazon-1M
    • Amazon-2M
    • Amazon-3M
    • Amazon-10M

These e-commerce datasets are derived from aggregated customer product engagement logs and vary significantly in size, ranging from ~700,000 to 10 million labels.

Key Insights and Ideas

  • The "No Free Lunch" Theorem Doesn't Always Apply: Surprisingly, in some cases, their method can marginally improve precision while simultaneously reducing expected depth. This suggests that by better organizing frequently occurring labels higher in the tree, they can improve routing and prediction accuracy without a significant latency penalty.
  • Flexibility is Key: The ability to tune the $\lambda$ parameter is crucial. This allows practitioners to select the optimal operating point for their specific application, whether it's a real-time recommendation system needing low latency or a batch processing task where accuracy is paramount.
  • Frequency Matters More Than Just Similarity (Sometimes): While similarity-based trees are good for accuracy, ignoring label frequencies can lead to suboptimal latency. Conversely, purely frequency-based trees can sacrifice accuracy. Their method elegantly combines both.
  • The Importance of "Popular" Labels: Placing frequently occurring labels higher in the tree is beneficial because errors in routing at higher levels compound. By prioritizing these "popular" labels, they can improve overall performance.

Key Results

  • Wiki-500K: Reduced expected depth by up to 28% while maintaining the same accuracy as Parabel.
  • E-commerce Datasets: Improved expected latency metric by up to 20% while maintaining the same accuracy.
  • Augmented fastText: Improved model accuracy by 40.6% while increasing expected depth by only 6.5% on the Wiki-500K dataset when replacing its Huffman tree.
  • General Trend: Across various datasets, their method consistently shows a favorable trade-off, often allowing for reduced latency with no loss in precision, and sometimes even a slight gain in precision.

Limitations and Future Work

  • Realizing Latency Gains: The paper acknowledges that translating "expected depth" improvements into actual wall-clock latency gains in deployed models is an application-specific challenge. This would likely involve modifying beam search algorithms with adaptive stopping conditions.
  • Non-Convex Optimization: The optimization problem is non-concave, meaning their algorithm converges to a stationary point, not necessarily a global optimum. However, they demonstrate empirically that this leads to good results.
  • Future Work: The authors explicitly mention developing and analyzing modified beam search procedures to achieve deployable latency improvements as a critical future direction. They also suggest extending the framework to handle context frequencies in real-world applications.

Summary updated

BibTeX
@inproceedings{baharav2021enabling,
  author = {Tavor Z. Baharav and Daniel L. Jiang and Kedarnath Kolluri and Sujay Sanghavi and Inderjit S. Dhillon},
  title = {{Enabling Efficiency-Precision Trade-offs for Label Trees in Extreme Classification}},
  booktitle = {ACM International Conference on Information and Knowledge Management},
  year = {2021},
  doi = {10.1145/3459637.3481914},
}
Figure