Meta-classifier free negative sampling for extreme multilabel classification

Mohammadreza Qaraei, Rohit BabbarMachine Learning 2024 · DOI

Abstract

Training deep models for Extreme Multilabel Classification (XMC) typically requires auxiliary "meta-classifiers" to identify hard negative examples, significantly increasing model complexity and memory requirements. We present a meta-classifier-free approach that leverages Maximum Inner Product Search (MIPS) combined with uniform random sampling. Our hybrid strategy achieves state-of-the-art accuracy while reducing the model footprint by up to 33%.

1. Introduction

Extreme Multilabel Classification (XMC) involves assigning relevant labels to data points from a massive label space, often containing millions of candidates. Due to the computational impossibility of calculating loss over all negative labels, negative sampling is essential. Current state-of-the-art methods, such as LightXML, utilize separate meta-classifiers to suggest "hard" negatives. While effective, this approach doubles the parameter count and complicates the training pipeline.

2. The Failure of Adaptive Sampling in Deep Networks

Adaptive sampling using Maximum Inner Product Search (MIPS) offers a potential alternative by searching the model's own weights for hard negatives. However, MIPS-based methods have historically struggled with deep neural networks.

Figure 1: Comparison of sampling strategies. Pure hard negative mining (NN-top) fails to converge in neural networks, whereas the hybrid approach (NN-top-uniform) matches or exceeds the performance of other methods.

As shown in Figure 1, pure hard negative mining (NN-top) fails completely in a neural network setting, remaining at zero precision. This failure stems from two primary issues:

  1. Gradient Instability: In neural networks with shared embeddings, aggressive hard negative mining early in training forces the model to push embeddings away from negatives before they have aligned with positive labels, leading to unstable updates.
  2. Index Staleness: MIPS indices are expensive to update. If the index becomes stale, the "hard" negatives it provides become "easy" for the model, providing no useful gradient signal.

3. Proposed Hybrid Negative Sampling

To address these challenges, we propose a hybrid strategy that mixes MIPS-derived hard negatives with static uniform sampling.

3.1 Clustering-based MIPS

We periodically cluster weight vectors using Spherical K-means. During training, the input embedding is compared against cluster centroids to retrieve a small set (5–15) of labels with the highest inner products. These represent the "hard" negatives.

3.2 Uniform Injection

The remainder of the negative sampling budget is filled with labels drawn from a uniform distribution. This injection of randomness ensures a diverse loss signal and mitigates the impact of stale MIPS indices, as the model always has a variety of negative signals to learn from.

4. Experimental Evaluation

We evaluated the hybrid method on the Amazon-670K, WikiLSHTC-325K, and Wikipedia-500K datasets using both shallow TF-IDF features and deep BERT encoders.

Figure 2: Impact of hard negative mining onset. The vertical dashed line indicates when MIPS-based mining begins. Different configurations (#MIPS and PPE) show varying levels of sensitivity and recovery during the training process.

Figure 2 illustrates the dynamics of the training process. When hard negative mining is introduced after an initial "warm-up" epoch, the model must navigate the transition. Configurations with high MIPS counts can experience significant performance dips before recovering, highlighting the sensitivity of the training process to sampling parameters and the importance of the initial training phase.

5. Key Results and Efficiency

  • Accuracy: The hybrid method (MIPS-s) matches the precision of meta-classifier models like LightXML within 1%. On Wikipedia-500K, our method achieved a P@1 of 75.5% vs. LightXML's 74.9%.
  • Model Footprint: By removing the meta-classifier, we reduce the total model size on disk by approximately 33% (e.g., from 1.5 GB to 1.0 GB on Wikipedia-500K).
  • Robustness: The hybrid approach remains stable even with infrequent MIPS index updates (every 30k–50k iterations), whereas pure MIPS approaches collapse under similar conditions.

6. Conclusion

Our findings demonstrate that meta-classifiers are largely redundant for XMC. By combining MIPS with uniform sampling, we can achieve state-of-the-art performance with a significantly smaller and more efficient model architecture. This work paves the way for more streamlined extreme classification systems that are easier to deploy in resource-constrained environments.

Summary updated

BibTeX
@article{qaraei2024meta,
  author = {Mohammadreza Qaraei and Rohit Babbar},
  title = {{Meta-classifier free negative sampling for extreme multilabel classification}},
  journal = {Machine Learning},
  year = {2024},
  doi = {10.1007/s10994-023-06468-w},
}
Figure