LibAUC: A Deep Learning Library for X-Risk Optimization

Zhuoning Yuan, Dixian Zhu, Zi-Hao Qiu, Gang Li, Xuanhui Wang, Tianbao Yang

TL;DR

This paper introduces LibAUC, a new deep learning library designed to efficiently optimize "X-risks," a class of complex loss functions crucial for tasks like imbalanced classification, learning to rank, and contrastive learning. LibAUC addresses convergence issues and large mini-batch requirements of existing methods by introducing novel dynamic mini-batch losses and controlled data samplers, leading to faster and more robust optimization.

What Problem Does This Paper Address?

Many critical AI tasks, such as classifying rare diseases (imbalanced data), recommending relevant content (learning to rank), and learning meaningful data representations (contrastive learning), rely on optimizing complex "X-risk" functions. These functions often involve comparing a data point against a large set of others. Existing deep learning frameworks and libraries struggle with these X-risks, frequently failing to converge or requiring impractically large mini-batches to achieve good performance. This is largely due to their reliance on the standard Empirical Risk Minimization (ERM) framework and static mini-batch techniques, which don't adequately handle the inherent complexities of X-risk optimization.

Methods

LibAUC introduces a novel deep learning pipeline specifically for Deep X-Risk Optimization (DXO). The core innovations lie in two key components:

  • Dynamic Mini-batch Losses: Instead of static losses that only use the current mini-batch, LibAUC employs dynamic losses. These losses incorporate moving averages of past computations, allowing for more stable and accurate gradient estimation. This approach enables convergence even with smaller mini-batches and leverages automatic differentiation from frameworks like PyTorch.
  • Controlled Data Samplers: Traditional libraries use random samplers. LibAUC introduces samplers (e.g., DualSampler for classification, TriSampler for ranking) that allow explicit control over the ratio of positive to negative samples within a mini-batch. This is crucial for imbalanced datasets and for balancing the estimation of different parts of the X-risk function, leading to improved convergence and performance.

The library also provides a flexible structure with modules for datasets, models, and optimizers, allowing seamless integration with existing PyTorch workflows.

Datasets

The paper evaluates LibAUC on a variety of datasets across different domains:

  • Classification for Imbalanced Data (CID): CIFAR10 (with 1% imbalance ratio), CheXpert (medical images, ~24.54% average imbalance), and OGB-HIV (molecular graphs, 1.76% imbalance).
  • Learning to Rank (LTR): MovieLens20M and MovieLens25M (movie recommendation datasets).
  • Contrastive Learning of Representations (CLR): ImageNet-100 (subset), ImageNet-1000 (full), MS-COCO (image-text), and CC3M (image-text).

No new benchmarks were introduced; instead, existing datasets were used to demonstrate the effectiveness of LibAUC on established tasks.

Key Insights and Ideas

  • X-risks are a unifying concept: The paper highlights that many seemingly disparate loss functions (AUROC, AUPRC, NDCG, contrastive losses) can be unified under the "X-risk" framework, suggesting a common underlying optimization challenge.
  • Dynamic losses are key to convergence: The core innovation of dynamic mini-batch losses is shown to be critical for achieving stable convergence, especially when dealing with complex, compositional loss functions that are sensitive to the estimation of intermediate values.
  • Controlled sampling matters for imbalanced data: Explicitly controlling the ratio of positive to negative samples in mini-batches significantly improves performance on imbalanced datasets, outperforming standard random sampling.
  • LibAUC is more than just a collection of algorithms: It's a carefully designed library with a pipeline that addresses fundamental issues in optimizing X-risks, offering a more robust and efficient solution than simply implementing existing algorithms in standard frameworks.
  • Performance gains are task-agnostic: The benefits of LibAUC's approach are demonstrated across classification, ranking, and representation learning, indicating its broad applicability.

Key Results

  • Improved Performance: LibAUC consistently outperforms baseline methods (like CE and Focal Loss for classification) and existing libraries (like TFCO for AP, TF-Ranking for NDCG) across various tasks and datasets. For example, on OGB-HIV, LibAUC's SOPAS achieved the highest pAUC.
  • Faster Convergence: LibAUC algorithms, particularly those using dynamic mini-batch losses, demonstrate faster convergence compared to static mini-batch approaches.
  • Robustness to Batch Size: LibAUC's methods are shown to be more robust to varying mini-batch sizes, a common limitation in traditional approaches.
  • Scalability: The library is designed to handle millions of items for ranking and contrastive tasks.
  • Specific Gains:
    • CID: PESG, SOAP, and SOPAS significantly outperform CE and Focal Loss.
  • LTR: LibAUC's SONG and K-SONG achieve better NDCG scores and faster training times than TF-Ranking.
  • CLR: SogCLR shows improved accuracy over SimCLR and CLIP on various datasets.

Limitations and Future Work

  • Pretraining: While the paper demonstrates that pretraining generally improves performance (especially for tasks like NDCG@K), the core experiments for CID and LTR were conducted without pretraining to focus on the library's direct optimization capabilities.
  • Exhaustiveness: The authors acknowledge that the current implementation of LibAUC is not exhaustive and plan to implement more algorithms for a wider range of X-risks, including performance metrics like "recall at top-K positions" and "precision at a certain recall level."
  • Hyperparameter Tuning: While LibAUC aims to simplify optimization, tuning hyperparameters for dynamic losses and samplers is still necessary, though the paper provides guidance and empirical findings on their impact.

Summary updated

BibTeX
@inproceedings{yuan2023libauc,
  author = {Zhuoning Yuan and Dixian Zhu and Zi-Hao Qiu and Gang Li and Xuanhui Wang and Tianbao Yang},
  title = {{LibAUC: A Deep Learning Library for X-Risk Optimization}},
  booktitle = {ACM SIGKDD Conference on Knowledge Discovery and Data Mining},
  year = {2023},
  url = {https://openreview.net/forum?id=ld-HiEnYfJl},
}

Loading related content...

Figure