Robust Fine-Tuning of Deep Neural Networks with Hessian-based Generalization Guarantees

Haotian Ju, Dongyue Li, Hongyang R. Zhang

TL;DR

This paper introduces a novel Hessian-based distance measure derived via PAC-Bayesian analysis to accurately quantify and bound the generalization error of fine-tuned deep neural networks. Leveraging this theory, the authors design a robust fine-tuning algorithm that combines statistically-consistent loss re-weighting with explicit layer-wise distance regularization, significantly mitigating overfitting even under severe label noise.

What Problem Does This Paper Address?

Fine-tuning large, pretrained foundation models on target tasks is standard practice in modern deep learning. However, these models frequently overfit when the target dataset is small or contains noisy labels. While existing generalization theories look at a model's distance from its initialization or its stability to noise, a massive gap remains between these theoretical bounds and actual empirical performance—often resulting in vacuous bounds that are orders of magnitude larger than reality. This paper aims to find a tighter, data-dependent measure that truly correlates with the generalization gap in fine-tuning.

Methods

The authors use PAC-Bayesian analysis combined with a Taylor expansion of the loss function to incorporate the loss Hessian ($Hi$) into the generalization metric. This yields a "Hessian distance measure" that scales with both the curvature of the loss landscape and the distance from the pretrained initialization ($vi = Wi - W_i^{(s)}$).

To handle label noise (specifically class-conditional independent noise), they introduce Algorithm 1: Statistically-consistent loss re-weighting with layer-wise projection. This algorithm integrates an unbiased loss re-weighting scheme (using the inverse of the label confusion matrix, $\Lambda = F^{-1}$) with explicit layer-wise weight projections to constrain the model's distance from its initialization during optimization.

Datasets

The approach is evaluated across multiple modalities and architectures using the following datasets:

  • DomainNet: Six distinct domains (Clipart, Infograph, Painting, Quickdraw, Real, Sketch) used for image classification under both synthetic and real-world programmatic label noise.
  • CIFAR-10 & CIFAR-100: Used for validating the tightness of the theoretical generalization bounds.
  • GLUE Benchmark (MRPC & SST-2): Used to evaluate text classification performance using BERT-Base and RoBERTa-Base models.

Key Insights and Ideas

  • Hessian Matters: Distance from initialization alone doesn't tell the whole story. Weight changes in directions where the loss landscape is flat (low Hessian eigenvalues) hurt generalization much less than changes in steep directions. Incorporating the Hessian accurately tracks the empirical generalization gap.
Figure 1: We identify a Hessian dis- tance measure (cf. equation (1)) that better captures empirical generaliza- tion errors of fine-tuned models.
  • Noise Stability Equivalence: Under class-conditional label noise, the expectation of the noisy loss Hessian matches the clean loss Hessian when using unbiased weighted losses. This means optimizing a properly re-weighted loss naturally favors stable, flat minima.
  • Explicit vs. Implicit Regularization: Explicit distance-based regularization (like layer-wise weight projection) reduces the Hessian distance measure far more effectively than implicit methods like early stopping.

Key Results

  • Tighter Bounds: The proposed Hessian-based generalization bound delivers non-vacuous values (e.g., 2.26 on CIFAR-10 and 7.23 on CIFAR-100), whereas prior norm- and margin-based bounds yield values in the millions or billions (see Table 6).
  • Robustness to Label Noise: On the DomainNet Sketch dataset with 40% and 60% synthetic noise, Algorithm 1 improves test accuracy by 6.43% (ResNet-18) and 6.03% (ResNet-101) over baselines.
  • Real-World/Weak Supervision: On weakly-supervised image classification across six DomainNet tasks, the algorithm outperforms prior methods by an average of 3.26%.
  • Cross-Architecture Success: When applied to Vision Transformers (ViT-Base), the method boosts performance by 2.42% on average over baseline approaches under correlated label noise.

Limitations and Future Work

  • Smoothness Assumption: The theoretical guarantees assume that activation functions are twice-differentiable, which strictly excludes standard ReLU networks. The authors suggest that a "smoothed analysis" framework could bridge this gap in future work to argue that non-differentiable states occur with negligible probability.
  • Broader Architectures: While the empirical results span ResNets, ViTs, and BERT, exploring the interplay between second-order gradients and generalization in other black-box models (such as Graph Neural Networks) remains an open area of study.

Summary updated

BibTeX
@inproceedings{ju2022robust,
  author = {Haotian Ju and Dongyue Li and Hongyang R. Zhang},
  title = {{Robust Fine-Tuning of Deep Neural Networks with Hessian-based Generalization Guarantees}},
  booktitle = {International Conference on Machine Learning},
  year = {2022},
  url = {https://openreview.net/forum?id=71TE-Y7qFO},
}
Figure