Adaptive Random Feature Regularization on Fine-tuning Deep Neural Networks

Shin'ya Yamaguchi, Sekitoshi Kanai, Kazuki Adachi, Daiki Chijiwa

Abstract

Fine-tuning large-scale pre-trained models on specialized, small-scale datasets is a standard practice in modern computer vision. However, this process often suffers from "feature collapse" and overfitting, where the model loses the rich representations acquired during pre-training. This paper introduces AdaRand (Adaptive Random Feature Regularization), a lightweight, plug-and-play regularizer designed to preserve feature diversity. By guiding feature vectors toward class-specific, adaptive random targets, AdaRand prevents feature norm shrinkage and maintains discriminative margins. Experimental results across various benchmarks—including fine-grained classification and robustness tasks—demonstrate that AdaRand outperforms existing state-of-the-art methods, including those requiring access to original source data, while maintaining superior computational efficiency.

Introduction

The paradigm of "pre-train then fine-tune" has revolutionized deep learning. By leveraging models pre-trained on massive datasets like ImageNet or CLIP’s WebImageText, practitioners can achieve high performance on niche tasks with relatively little data. Despite its success, fine-tuning on small target datasets often leads to a degradation of the feature space. This phenomenon, often termed feature collapse, occurs when the model over-optimizes for the small target sample, causing features to become less diverse and potentially leading to vanishing gradients.

Existing regularization strategies to combat this typically fall into two camps: source-dependent methods and source-independent methods. Source-dependent methods (e.g., Co-tuning) require access to the original pre-training data or labels, which is often impractical due to privacy concerns or data scale. Source-independent methods, such as RandReg, use random noise as targets but often inadvertently shrink feature norms, which can stall the learning process. AdaRand addresses these limitations by providing a source-independent, adaptive framework that structures the feature space dynamically.

The AdaRand Framework

AdaRand builds upon the concept of Random Feature Regularization but introduces adaptive, class-conditional Gaussian priors. Instead of forcing all features toward a single, static random vector, AdaRand assigns each class a unique distribution in the feature space.

Adaptive Class-Conditional Priors

For a given input, AdaRand samples a reference vector from a Gaussian distribution specific to that input's class. To ensure these targets remain relevant and effective throughout training, the means of these distributions are updated dynamically using two primary loss components:

  1. Intra-class Loss ($\ell_{intra}$): This component pulls the class prior toward the current average feature representation of that class. This ensures the regularization target remains "realistic" relative to the model's evolving state.
  2. Inter-class Loss ($\ell_{inter}$): This component pushes the priors of different classes away from one another. By maximizing the distance between class targets, AdaRand enforces a larger margin in the feature space, enhancing the model's discriminative power.

Warm-Starting

To prevent the regularization from being too disruptive in the early stages of fine-tuning, AdaRand employs a "warm-start" initialization. The priors are initialized using the statistics of the pre-trained model’s features on the target data, ensuring a smooth transition from the pre-trained state to the fine-tuned state.

Key Insights: Overcoming the Vanishing Gradient

A critical discovery in this research is the "Vanishing Gradient Trap" associated with naive random regularization (RandReg). In RandReg, the fixed targets often lead to a reduction in feature norms. Since the gradient of the loss function is often proportional to the feature norm, shrinking features lead to stagnant learning.

AdaRand circumvents this by maintaining healthy feature norms through its adaptive targets. By forcing features toward spread-out, class-specific targets, the method increases the mutual information between the learned features and the labels. This results in a more robust feature space where classes are more easily separable by a linear classifier.

Experimental Results

Performance Benchmarks

AdaRand was evaluated across diverse image classification tasks, including fine-grained datasets (CUB-200, Stanford Cars, Oxford-IIIT Pet) and robustness benchmarks (ImageNet-A, ImageNet-R).

  • Accuracy Gains: On the Stanford Cars dataset using a ResNet-50 backbone, AdaRand achieved 91.17% accuracy, significantly higher than standard fine-tuning (88.29%) and the previous state-of-the-art random-feature method (90.61%).
  • Small Data Efficiency: In extreme low-data scenarios (using only 10% of training data), AdaRand outperformed the baseline by approximately 8% (27.55% vs 19.58%), highlighting its effectiveness as a regularizer for small datasets.

Computational Efficiency

Unlike many competitive methods that require keeping a copy of the source model in memory or performing expensive contrastive calculations, AdaRand is highly efficient. It runs nearly 2x faster than DR-Tune and consumes 3x less GPU memory than Core-tuning, making it suitable for resource-constrained environments.

Conclusion

AdaRand represents a significant step forward in source-independent fine-tuning. By replacing static random targets with adaptive, class-conditional priors, it effectively mitigates feature collapse and the vanishing gradient problem. Its ability to outperform source-dependent methods suggests that the structural organization of the feature space is a more critical factor in successful fine-tuning than the retention of specific source-data knowledge. Future work may explore the application of adaptive regularization in generative contexts, such as diffusion models, and further refine the hyperparameter tuning process for diverse data modalities.

Summary updated

BibTeX
@inproceedings{yamaguchi2024adaptive,
  author = {Shin'ya Yamaguchi and Sekitoshi Kanai and Kazuki Adachi and Daiki Chijiwa},
  title = {{Adaptive Random Feature Regularization on Fine-tuning Deep Neural Networks}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2024},
}
Figure