Towards Memory-Efficient Training for Extremely Large Output Spaces - Learning with 500k Labels on a Single Commodity GPU

Erik Schultheis, Rohit BabbararXiv 2023 · DOI

Introduction

Extreme Multi-label Classification (XMC) involves assigning a subset of relevant labels to an instance from a pool of millions of possibilities. While computationally efficient methods like hierarchical trees have been developed, the memory footprint remains a significant barrier. For a model with a 1,024-unit hidden layer and 3 million labels, the final weight matrix alone requires over 10 GiB. Incorporating state-of-the-art optimizers like ADAM can push peak memory usage beyond 40 GiB, necessitating expensive, high-end server GPUs. This research introduces a method to train such models on commodity hardware with as little as 4GB of VRAM.

Methodology

The proposed architecture addresses the memory bottleneck through three primary innovations:

1. Sparse Evolutionary Training (SET) with an Intermediate Layer

To avoid the accuracy degradation typical of naive sparse layers, the authors introduce a dense penultimate layer between the input and the sparse output layer. This intermediate layer provides the necessary representational capacity. The output layer uses Sparse Evolutionary Training (SET), which dynamically prunes weak connections and regrows random ones during training to optimize the subnetwork structure.

2. Uniform Sparsity and Optimized Kernels

Standard sparse formats like Coordinate (COO) or Compressed Sparse Column (CSC) often lead to load imbalance on GPUs. The authors enforce uniform sparsity, where every output neuron has an identical number of incoming connections. This regularity allows for a custom CUDA implementation that balances workloads perfectly across GPU threads.

Comparison of sparse matrix storage formats: COO, CSC, and the proposed Uniform format which enables efficient GPU indexing.

3. Implicit Negative Mining

The model utilizes a squared-hinge loss, which naturally results in zero gradients for "easy" negative examples. The custom backward pass identifies these zeros and skips the corresponding calculations, accelerating training without sacrificing precision.

Experimental Results

The approach was evaluated on three major XMC benchmarks: WIKI10-31K, Amazon-670K, and Wikipedia-500K, using both "Slice" (fast-text) and "Cascade" (transformer-based) features.

Performance comparison across benchmarks showing memory usage, training time, and precision metrics for dense vs. sparse models.

As shown in the results table, the uniform sparse architecture achieves massive memory savings. On the Amazon-670K dataset, peak memory usage was reduced from 13.4 GiB in the dense baseline to just 1.4 GiB—a nearly 10-fold improvement. Crucially, this reduction comes with minimal impact on Precision@k scores, and in some instances, the sparse model even outperformed the dense baseline.

Discussion

The success of this approach highlights that uniformity in sparsity is a powerful architectural feature rather than a limitation. By ensuring every label has the same capacity, the model avoids "head label" dominance, where common labels consume most of the model's parameters. The intermediate layer acts as a critical buffer, allowing the final layer to be extremely sparse (e.g., 32 connections per label) while maintaining high accuracy.

Conclusion

This work demonstrates that training extreme classifiers with hundreds of thousands of labels is feasible on a single commodity GPU. By combining dynamic sparse training, an intermediate representational layer, and hardware-optimized uniform sparsity, the researchers have significantly lowered the hardware barrier for XMC research. Future work will explore end-to-end training with learnable feature extractors and further optimizations for the forward pass.

Summary updated

BibTeX
@misc{schultheis2023towards,
  author = {Erik Schultheis and Rohit Babbar},
  title = {{Towards Memory-Efficient Training for Extremely Large Output Spaces - Learning with 500k Labels on a Single Commodity GPU}},
  year = {2023},
  eprint = {2306.03725},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2306.03725},
}
Figure