Worst-case Feature Risk Minimization for Data-Efficient Learning

Jingshi Lei, Da Li, Chengming Xu, Liming Fang, Timothy Hospedales, Yanwei FuTMLR 2023

Abstract

Deep learning models typically require massive amounts of annotated data to train a strong model for a task of interest. However, data annotation is time-consuming and costly. How to use labeled data from a related but distinct domain, or just a few samples to train a satisfactory model are thus important questions. To achieve this goal, models should resist overfitting to the specifics of the training data in order to generalize well to new data. This paper proposes a novel Worst-case Feature Risk Minimization (WFRM) method that helps improve model generalization. Specifically, we tackle a minimax optimization problem in feature space at each training iteration. Given the input features, we seek the feature perturbation that maximizes the current training loss and then minimizes the training loss of the worst-case features. By incorporating our WFRM during training, we significantly improve model generalization under distributional shift – Domain Generalization (DG) and in the low-data regime – Few-shot Learning (FSL). We theoretically analyze WFRM and find the key reason why it works better than ERM – it induces an empirical risk-based semi-adaptive $L_{2}$ regularization of the classifier weights, enabling a better risk-complexity trade-off. We evaluate WFRM on two data-efficient learning tasks, including three standard DG benchmarks of PACS, VLCS, OfficeHome and the most challenging FSL benchmark Meta-Dataset. Despite the simplicity, our method consistently improves various DG and FSL methods, leading to the new state-of-the-art performances in all settings.

Introduction

Deep learning models are notoriously "data-hungry," requiring massive amounts of labeled data to perform well. When data is scarce—as in Few-Shot Learning (FSL)—or when the test data comes from a different distribution than the training data—Domain Generalization (DG)—models tend to overfit to the specific quirks of their training set. Existing solutions often involve adversarial training (perturbing pixels) or Sharpness-Aware Minimization (SAM, which perturbs model weights). However, pixel-level perturbations don't always capture high-level semantic shifts, and weight-space methods like SAM are computationally expensive, often doubling or tripling training time. This research introduces Worst-case Feature Risk Minimization (WFRM), a method designed to make models robust to "feature-level" shifts without massive computational overhead.

Methodology

The authors propose Worst-case Feature Risk Minimization (WFRM). Instead of looking for the worst-case image or the worst-case weights, the algorithm identifies the worst-case features.

The WFRM framework: Perturbations are applied to extracted features $h$ to find the worst-case scenario before updating the classifier.
  1. Minimax Optimization: At each training step, the algorithm performs an "inner" search to find a small perturbation ($\epsilon$) to the extracted features that maximizes the current loss. Then, it performs an "outer" step to update the model parameters to minimize that "worst-case" loss.
  2. Closed-Form Solution: Unlike many adversarial methods that require iterative loops (like PGD) to find the worst perturbation, WFRM utilizes an analytic closed-form solution. This allows the "worst-case" feature to be calculated almost instantly using the gradient of the loss with respect to the features.
  3. Plug-and-Play Integration: WFRM is inserted just before the final classifier layer. It can be added to almost any existing architecture (ResNets, ViTs) and training framework (ERM, ProtoNets) with minimal code changes.

Theoretical Insights

A significant theoretical finding is that WFRM acts as a semi-adaptive $L_2$ regularization. Unlike standard $L_2$ regularization (weight decay), which applies a constant penalty to large weights, WFRM’s penalty is proportional to the training loss. If the model fits the data well, the penalty disappears; if the model is struggling, the penalty increases. This allows the model to search a larger parameter space more effectively during early training stages while stabilizing as it converges.

Furthermore, WFRM is highly efficient. While SAM takes approximately 3x longer than standard Empirical Risk Minimization (ERM), WFRM takes only 1.03x longer—essentially providing robustness for free. Through "inverse visualization," the authors demonstrated that WFRM perturbations tend to modify image "style" (colors, textures) while keeping "semantics" (the object itself) intact, which is critical for Domain Generalization.

Experimental Evaluation

The researchers evaluated WFRM across several rigorous benchmarks, including PACS, VLCS, and OfficeHome for Domain Generalization, and the Meta-Dataset for Few-Shot Learning. Meta-Dataset is considered the most challenging FSL benchmark because it requires models to generalize across 10 diverse sub-datasets (e.g., OmniGlot, Aircraft, Fungi).

Performance on Meta-Dataset: WFRM achieves the best average rank (1.7) across various backbones and benchmarks.

Key results include:

  • State-of-the-Art Performance: WFRM consistently outperformed baselines. On the PACS benchmark, it improved accuracy by 2.1% over standard ERM. On the Meta-Dataset, it achieved the #1 average rank among all compared methods.
  • Stability and Robustness: WFRM showed lower standard deviation across training runs compared to standard methods. Sensitivity analysis also showed that the method is robust to hyperparameter choices, specifically the perturbation radius ($\rho$) and loss weighting ($\alpha$).

Conclusion and Future Work

WFRM provides a simple yet powerful "plug-and-play" module that improves how AI models generalize to new, unseen data. While the current theoretical analysis focuses on linear classifiers, the empirical success across ResNets and ViTs suggests broad applicability. Future work may explore different "shapes" of perturbation spaces beyond the $L_2$ ball and investigate how WFRM interacts with massive foundation models like CLIP or DINOv2 during fine-tuning.

Summary updated

BibTeX
@article{lei2023worst,
  author = {Jingshi Lei and Da Li and Chengming Xu and Liming Fang and Timothy Hospedales and Yanwei Fu},
  title = {{Worst-case Feature Risk Minimization for Data-Efficient Learning}},
  journal = {Accepted by TMLR},
  year = {2023},
  url = {https://openreview.net/forum?id=czev0exHXT},
}
Figure