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

Haotian Ju, Dongyue Li, Hongyang R. Zhang

Introduction

Fine-tuning massive pretrained models like BERT or ResNet to adapt them to specific tasks is the bread and butter of modern AI. However, these models are so large that they easily "memorize" training data, leading to poor generalization on new examples. This overfitting is exacerbated when training labels are "noisy" (incorrectly labeled), a common issue in real-world datasets or those generated via weak supervision.

While previous research suggested that keeping the fine-tuned model "close" to its starting point (initialization) helps, simple distance measures like the Frobenius norm often fail to accurately predict how well a model will actually perform. To address this, the authors introduce a new generalization bound based on the Hessian (the second-order derivatives of the loss function) and propose a robust algorithm that combines "consistent losses" with distance-based constraints to significantly improve performance in noisy environments.

Methods: PAC-Bayesian Analysis and Consistent Losses

The researchers approached the problem through the lens of PAC-Bayesian analysis, a theoretical framework used to bound the gap between training error and test error.

  1. Hessian-based Generalization Bounds: They discovered that the "noise stability" of a network—how much the loss changes when you perturb the weights—is captured by the Hessian. A "flat" loss landscape (small Hessian values) suggests better generalization. They developed a new mathematical bound that incorporates both the distance from initialization and the Hessian of the loss.
  2. Consistent Loss Reweighting: To handle noisy labels, they designed an algorithm that uses an estimated "confusion matrix" (which describes how labels are likely to be flipped) to reweight the loss function. In expectation, the model learns as if it were seeing clean labels.
  3. Layerwise Projection: They enforce a hard constraint on how far each layer's weights can move from their pretrained starting point, preventing the model from drifting too far into overfitted territory.

Key Insights

Hessian > Norms: The most striking insight is that the Hessian distance measure correlates much more tightly with actual generalization error than simple distance measures. If you want to know if your fine-tuned model will overfit, looking at the curvature of the loss landscape is far more informative than just measuring how much the weights changed.

Correlation between Hessian measure and generalization error across different architectures.

The "Flatness" Advantage: By incorporating the Hessian into the training objective, the model is encouraged to find "flat minima." These regions are more robust to the perturbations inherent in noisy data. Furthermore, the use of "consistent losses" effectively undoes the damage of label noise, keeping the training process theoretically grounded.

Key Results

The authors evaluated their approach across several challenging scenarios, including DomainNet (for correlated noise), MRPC (for NLP), and CIFAR-10/100.

  • Accuracy Boost: On six image classification tasks with programmatic (weak) labels, the proposed algorithm improved accuracy by 3.26% on average over state-of-the-art baselines. On specific domains like "Sketch," the jump was as high as 6.43%.
  • Tighter Bounds: Their theoretical generalization bound is orders of magnitude tighter than previous norm-based bounds. For example, on CIFAR-10, their bound was 2.26, while previous methods yielded values in the millions or higher (which are practically useless).
Comparison of generalization error bounds. The Hessian-based measure closely tracks actual error, while distance-based measures become vacuous.
  • Stability: The Hessian distance of models trained with their algorithm was six times lower than those trained with standard methods, confirming that their approach successfully finds flatter, more stable regions of the loss landscape.

Limitations and Future Work

The authors acknowledge a few hurdles for future research. First, the current theory assumes that activation functions are twice-differentiable; while they used ReLU in experiments with great success, the formal theory for non-differentiable functions needs further development. Second, the algorithm relies on an estimated confusion matrix—if this estimate is wildly inaccurate, the "consistent loss" might not perform as intended. Finally, applying these Hessian-based insights to massive "black-box" architectures where calculating the full Hessian is computationally prohibitive remains an open challenge.

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