Logarithmic Time One-Against-Some

Hal Daumé Iii, Nikos Karampatziakis, John Langford, Paul Mineiro

In "extreme" multiclass classification, the number of possible labels ($K$) can reach hundreds of thousands or even millions. This scale is common in tasks like predicting the next word in a language model or identifying a specific face among billions.

The gold standard for accuracy in these scenarios is typically One-Against-All (OAA), where a separate classifier is trained for every single class. However, OAA's prediction time scales linearly with $K$, making it prohibitively slow for large-scale applications. While tree-based methods offer logarithmic scaling ($O(\log K)$), they historically suffer from a significant drop in accuracy.

To bridge this gap, researchers have introduced the Recall Tree, a novel online algorithm that reduces massive multiclass classification problems to logarithmic time complexity. By combining a dynamically built tree to ensure high recall with a "One-Against-Some" scoring strategy for precision, this approach achieves accuracy competitive with standard OAA while being orders of magnitude faster and more memory-efficient.

The One-Against-Some (OAS) Approach

The core philosophy of the paper is to split the labor between recall and precision using a two-stage approach powered by the Recall Tree.

  1. The Recall Tree: Instead of a traditional decision tree where each leaf represents one specific class, this tree is designed to maximize recall. As an example moves down the tree, the algorithm decides whether to continue branching or stop early based on an empirical Bernstein lower bound. This bound helps determine if the current node already contains the correct label in its "top $F$" most frequent classes with high probability.
The Recall Tree routes examples through binary decisions to a small subset of candidate classes.
  1. One-Against-Some (OAS): The tree doesn't need to be perfectly precise; it just needs to ensure the correct label is in the "shortlist." Once the tree identifies a small subset of candidate classes (of size $O(\log K)$), the algorithm only scores those specific classes using standard regressors.
  2. Path Features: To bridge the representational gap between trees and linear models, the authors use a representational trick. They augment the input features with the path taken through the tree. This allows a linear model to essentially "see" the tree's logic, making it as expressive as the tree itself.
  3. Online Learning: The entire structure—the tree routers, the candidate lists, and the class regressors—is updated online as new data arrives.

Key Results and Performance

The algorithm was evaluated on several large-scale datasets, including ALOI (1,000 classes), ImageNet (~20,000 classes), LTCB for language modeling (~80,000 classes), and ODP for document classification (~100,000 classes).

Performance comparison showing the Recall Tree's competitive error rates and massive inference time improvements over OAA.
  • Massive Speedups: On the ODP dataset, the Recall Tree was approximately 300 times faster than OAA during inference.
  • Competitive Accuracy: On the ALOI dataset, the Recall Tree actually outperformed the OAA baseline. On ImageNet and ODP, it remained highly competitive, significantly outperforming previous logarithmic-time models like LOMTree.
  • Memory Efficiency: Unlike previous logarithmic methods which required massive amounts of state, the Recall Tree uses roughly only twice the space of OAA, making it viable for GPU or mobile deployment.
  • Online Advantage: On the LTCB dataset, the model showed it could exploit non-stationarity (sequential correlations in text) better than batch-oriented approaches, achieving higher accuracy when data was presented in its original order versus permuted.

Limitations and Future Directions

While highly efficient, the Recall Tree does face some hardware-specific challenges. Because the tree involves conditional execution (different paths for different examples), it is harder to "vectorize" for CPUs/GPUs compared to the simple, dense matrix multiplications used in OAA. Consequently, OAA can still be faster for smaller values of $K$ due to low-level hardware optimization.

Additionally, in a highly parallelized setting, the root node of the tree could become a bottleneck since every example must pass through it. The authors suggest that exploring $O(\log K)$-way splits, rather than strictly binary splits, might further reduce the statistical gap with OAA without significantly increasing running time.

Summary updated

BibTeX
@inproceedings{iii2017logarithmic,
  author = {Hal Daumé III and Nikos Karampatziakis and John Langford and Paul Mineiro},
  title = {{Logarithmic Time One-Against-Some}},
  booktitle = {International Conference on Machine Learning},
  year = {2017},
  url = {https://openreview.net/forum?id=rk44MjWd-B},
}
Figure