Introduction
Training models for Extreme Multi-label Classification (XMC)—where the goal is to predict relevant labels from a pool of millions—presents a significant "memory wall." For instance, a model with 1,024 hidden units and 3 million labels requires approximately 10.7 GiB for the weight matrix alone. When using state-of-the-art optimizers like Adam, which track gradients and moments, this requirement can exceed 40 GiB, necessitating expensive high-end server clusters. This paper presents a method to train such models on a single commodity GPU with as little as 1.4 GiB of VRAM.
Methodology
The proposed architecture overcomes memory constraints through four key innovations:
- Dynamic Sparse Training (SET): Instead of a dense final layer, the model utilizes the Sparse Evolutionary Training (SET) algorithm. It begins with a random sparse mask and iteratively prunes weak weights while regrowing new ones, allowing the network to learn an optimal sparse connectivity pattern.
- Intermediate Layer Buffer: To prevent the underfitting typically associated with sparse output layers, a dense intermediate layer (e.g., 32k units) is introduced. This layer provides the necessary expressive capacity to maintain predictive performance.
- Constant Fan-In Sparsity: Standard sparse formats like COO or CSC often lead to uneven GPU workloads. By enforcing a "constant fan-in" rule—where every output neuron has an identical number of incoming connections—the authors achieve better load balancing and faster GPU kernels.
- Implicit Negative Mining: Utilizing a squared-hinge loss allows for custom CUDA kernels that skip calculations for "easy" negative examples with zero gradients, significantly accelerating the backward pass.
Experimental Results
The approach was evaluated on standard XMC benchmarks, including Wiki500k and Amazon-670k.
Memory and Performance
On the Amazon-670k dataset, memory consumption was reduced from 13.4 GiB (dense) to just 1.4 GiB (sparse). Despite this 90% reduction in memory, the model maintained comparable Precision@1 (P@1) scores, often within 1-2% of the dense baseline. In some instances, such as Wiki500k-Slice, the sparse model even outperformed the dense version, likely due to the regularizing effect of the architecture.
Training Efficiency
The combination of constant fan-in sparsity and implicit negative mining resulted in training speeds up to 3x faster than standard sparse implementations in frameworks like TensorFlow.
Discussion and Conclusion
A critical insight from this work is that sparsity in XMC requires a "buffer" (the intermediate layer) to restore predictive power. Furthermore, hardware-aware constraints like constant fan-in are more important for GPU performance than unstructured sparsity. By switching to 32-bit integers for sparse indices, researchers can further halve index memory, supporting up to 4 billion labels. This work democratizes extreme-scale machine learning, enabling researchers to train massive models on accessible hardware.
Future work will focus on end-to-end training, where feature extractors are learned alongside the sparse classifier, and scaling the approach to datasets with over 50 million labels.
Summary updated