Understanding Hessian Alignment for Domain Generalization
Sobhan Hemati, Guojun Zhang, Amir Hossein Estiri, Xi Chen
Abstract
Out-of-distribution (OOD) generalization is a critical ability for deep learning models in many real-world scenarios including healthcare and autonomous vehicles. Recently, different techniques have been proposed to improve OOD generalization. Among these methods, gradient-based regularizers have shown promising performance compared with other competitors. Despite this success, our understanding of the role of Hessian and gradient alignment in domain generalization is still limited. To address this shortcoming, we analyze the role of the classifier’s head Hessian matrix and gradient in domain generalization using recent OOD theory of transferability. Theoretically, we show that spectral norm between the classifier’s head Hessian matrices across domains is an upper bound of the transfer measure, a notion of distance between target and source domains. Furthermore, we analyze all the attributes that get aligned when we encourage similarity between Hessians and gradients. Our analysis explains the success of many regularizers like CORAL, IRM, V-REx, Fish, IGA, and Fishr as they regularize part of the classifier’s head Hessian and/or gradient. Finally, we propose two simple yet effective methods to match the classifier’s head Hessians and gradients in an efficient way, based on the Hessian Gradient Product (HGP) and Hutchinson’s method (Hutchinson), and without directly calculating Hessians. We validate the OOD generalization ability of proposed methods in different scenarios, including transferability, severe correlation shift, label shift and diversity shift. Our results show that Hessian alignment methods achieve promising performance on various OOD benchmarks. The code is available here.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Cited by top-tier papers8
- CRoFT: Robust Fine-Tuning with Concurrent Optimization for OOD Generalization and Open-Set OOD DetectionLin Zhu, Yifeng Yang, Qinying Gu, Xinbing Wang et al.ICML 2024 · 10 citations
- Δ Energy: Optimizing Energy Change During Vision-Language Alignment Improves both OOD Detection and OOD GeneralizationLin Zhu, Yifeng Yang, Xinbing Wang, Qinying Gu et al.NeurIPS 2025 · 2 citations
- FedGTST: Boosting Global Transferability of Federated Models via Statistics TuningEvelyn Ma, Chao Pan, S. Rasoul Etesami, Han Zhao et al.NeurIPS 2024 · 1 citation
- One-Step Generalization Ratio Guided Optimization for Domain GeneralizationSumin Cho, Dongwon Kim, Kwangsu KimICML 2025
- SCISSOR: Mitigating Semantic Bias through Cluster-Aware Siamese Networks for Robust ClassificationShuo Yang, Bardh Prenkaj, Gjergji KasneciICML 2025
Builds on10
- Moment Matching for Multi-Source Domain AdaptationXingchao Peng, Qinxun Bai, Xide Xia, Zijun Huang et al.ICCV 2019 · 2,239 citations
- In Search of Lost Domain GeneralizationIshaan Gulrajani, David Lopez-PazICLR 2021 · 1,416 citations
- Out-of-Distribution Generalization via Risk Extrapolation (REx)David Krueger, Ethan Caballero, Jörn-Henrik Jacobsen, Amy Zhang et al.ICML 2021 · 1,163 citations
- Learning from Failure: De-biasing Classifier from Biased ClassifierJun Hyun Nam, Hyuntak Cha, Sungsoo Ahn, Jaeho Lee et al.NeurIPS 2020 · 428 citations
- Gradient Matching for Domain GeneralizationYuge Shi, Jeffrey Seely, Philip H. S. Torr, Siddharth Narayanaswamy et al.ICLR 2022 · 358 citations
Related papers
- Fishr: Invariant Gradient Variances for Out-of-Distribution GeneralizationAlexandre Ramé, Corentin Dancette, Matthieu CordICML 2022 · 262 citations
- An Empirical Investigation of Domain Generalization with Empirical Risk MinimizersRamakrishna Vedantam, David Lopez-Paz, David J. SchwabNeurIPS 2021 · 49 citations
- On the Connection between Invariant Learning and Adversarial Training for Out-of-Distribution GeneralizationShiji Xin, Yifei Wang, Jingtong Su, Yisen WangAAAI 2023 · 14 citations
- Density-driven Regularization for Out-of-distribution DetectionWenjian Huang, Hao Wang, Jiahao Xia, Chengyan Wang et al.NeurIPS 2022 · 17 citations
- Quantifying and Improving Transferability in Domain GeneralizationGuojun Zhang, Han Zhao, Yaoliang Yu, Pascal PoupartNeurIPS 2021 · 56 citations
