<?xml-model href='http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng' schematypens='http://relaxng.org/ns/structure/1.0'?><TEI xmlns="http://www.tei-c.org/ns/1.0">
	<teiHeader>
		<fileDesc>
			<titleStmt><title level='a'>CR-SAM: Curvature Regularized Sharpness-Aware Minimization</title></titleStmt>
			<publicationStmt>
				<publisher>AAAI</publisher>
				<date>03/25/2024</date>
			</publicationStmt>
			<sourceDesc>
				<bibl> 
					<idno type="par_id">10544299</idno>
					<idno type="doi">10.1609/aaai.v38i6.28431</idno>
					<title level='j'>Proceedings of the AAAI Conference on Artificial Intelligence</title>
<idno>2159-5399</idno>
<biblScope unit="volume">38</biblScope>
<biblScope unit="issue">6</biblScope>					

					<author>Tao Wu</author><author>Tie Luo</author><author>Donald C Wunsch II</author>
				</bibl>
			</sourceDesc>
		</fileDesc>
		<profileDesc>
			<abstract><ab><![CDATA[The capacity to generalize to future unseen data stands as one of the utmost crucial attributes of deep neural networks. Sharpness-Aware Minimization (SAM) aims to enhance the generalizability by minimizing worst-case loss using one-step gradient ascent as an approximation. However, as training progresses, the non-linearity of the loss landscape increases, rendering one-step gradient ascent less effective. On the other hand, multi-step gradient ascent will incur higher training cost. In this paper, we introduce a normalized Hessian trace to accurately measure the curvature of loss landscape on both training and test sets. In particular, to counter excessive non-linearity of loss landscape, we propose Curvature Regularized SAM (CR-SAM), integrating the normalized Hessian trace as a SAM regularizer. Additionally, we present an efficient way to compute the trace via finite differences with parallelism. Our theoretical analysis based on PAC-Bayes bounds establishes the regularizer's efficacy in reducing generalization error. Empirical evaluation on CIFAR and ImageNet datasets shows that CR-SAM consistently enhances classification performance for ResNet and Vision Transformer (ViT) models across various datasets. Our code is available at https://github.com/TrustAIoT/CR-SAM.]]></ab></abstract>
		</profileDesc>
	</teiHeader>
	<text><body xmlns="http://www.tei-c.org/ns/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink">
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Introduction</head><p>Over the past decade, rapid advancements in deep neural networks (DNNs) have significantly reshaped various pattern recognition domains including computer vision <ref type="bibr">(He et al. 2016)</ref>, speech recognition <ref type="bibr">(Oord et al. 2018)</ref>, and natural language processing <ref type="bibr">(Kenton and Toutanova 2019)</ref>. However, the success of DNNs hinges on their capacity to generalize-how well they would perform on new, unseen data. With their intricate multilayer structures and non-linear characteristics, modern DNNs possess highly non-convex loss landscapes that remain only partially understood. Prior landscape analysis has linked flat local minima to better generalization <ref type="bibr">(Hochreiter and Schmidhuber 1997;</ref><ref type="bibr">Keskar et al. 2016;</ref><ref type="bibr">Dziugaite and Roy 2017;</ref><ref type="bibr">Neyshabur et al. 2017;</ref><ref type="bibr">Jiang et al. 2020)</ref>. In particular, <ref type="bibr">(Jiang et al. 2020</ref>) conducted a comprehensive empirical study on various generalization metrics, revealing that measures based on sharpness exhibit the highest correlation with generalization performance. Recently, <ref type="bibr">(Foret et al. 2021)</ref> introduced Sharpness-Aware Minimization (SAM), an efficient technique for minimizing loss landscape sharpness. This method has proven highly effective in enhancing DNN generalization across diverse scenarios. Given SAM's remarkable success and the significance of DNN generalization, a substantial body of subsequent research has emerged <ref type="bibr">(Liu et al. 2022a;</ref><ref type="bibr">Du et al. 2022a,b;</ref><ref type="bibr">Jiang et al. 2023;</ref><ref type="bibr">Liu et al. 2022b)</ref>.</p><p>Specifically, the SAM approach formulates the optimization of neural networks as a minimax problem, where it aims to minimize the maximum loss within a small radius &#961; around the parameter w. Given that the inner maximization problem is NP-hard, SAM employs a practical sharpness calculation method that utilizes one-step gradient ascent as an approximation. However, our experimentation reveals a notable decline in the accuracy of this one-step approximation as training progresses (see Fig. <ref type="figure">1</ref>). This phenomenon likely stems from the heightened non-linearity within the loss landscape during later stages of training. Our further investigation highlights a limitation in conventional curvature measures like the Hessian trace and the top eigenvalue of the Hessian matrix. These measures diminish as training advances, incorrectly suggesting reduced curvature and overlooking the actual non-linear characteristics.</p><p>Consequently, we posit that the escalating non-linearity in SAM training undermines the precision of approximating and effectiveness of mitigating sharpness. Building upon these insights, we introduce the concept of a normalized Hessian trace. This novel metric serves as a dependable indicator of loss landscape non-linearity and behaves consistently across training and testing datasets. Guided by this metric, we propose Curvature Regularized SAM (CR-SAM), a novel regularization approach for SAM training. CR-SAM incorporates the normalized Hessian trace to counteract excessive non-linearity effectively.</p><p>To calculate the normalized Hessian trace, we present a computationally efficient strategy based on finite differences (FD). This approach enables parallel execution without additional computational burden. Through both theoretical analysis and empirical evaluation, we demonstrate that CR-SAM training converges towards flatter minima, resulting in substantially enhanced generalization performance.</p><p>Our main contributions can be summarized as follows:</p><p>&#8226; We identify that the one-step gradient ascent approximation becomes less effective during the later stages of SAM training. In response, we introduce normalized Hessian trace, a metric that can accurately and consistently characterize the non-linearity of neural network loss landscapes. &#8226; We propose CR-SAM, a novel algorithm that infuses curvature minimization into SAM and thereby enhance the generalizability of deep neural networks. For scalable computation, we devise an efficient technique to approximate the Hessian trace using finite differences (FD). This technique involves only independent function evaluations and can be executed in parallel without additional overhead. Moreover, we also theoretically show the efficacy of CR-SAM in reducing generalization error, leveraging PAC-Bayes bounds.</p><p>&#8226; Our comprehensive evaluation of CR-SAM spans a diverse range of contemporary DNN architectures. The empirical findings affirm that CR-SAM consistently outperforms both SAM and SGD in terms of improving model generalizability, across multiple datasets including CIFAR10/100 and ImageNet-1k/-C/-R.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Background and Related Work</head><p>Empirical risk minimization (ERM) is a fundamental principle in machine learning for model training on observed data. Given a training dataset S = {(x i , y i )} n i=1 drawn i.i.d. from an underlying unknown distribution D, we denote by f (x; w) a deep neural network model with trainable parameters w &#8712; R p , where a differentiable loss function w.r.t. an input x i is given by &#8467; (f (x i ; w) , y i ) and is taken to be the cross entropy loss in this paper. The empirical loss can be written as L S (w) = 1 n n i=1 &#8467; (f (x i ; w) , y i ) whereas the population loss is defined as L D (w) = E (x,y)&#8764;D [&#8467; (f (x; w) , y)]. The generalization error is defined as the difference between L D (w) and L S (w), i.e., e(f ) = L D (w) -L S (w).</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>SAM and Variants</head><p>Sharpness-Aware Minimization (SAM) <ref type="bibr">(Foret et al. 2021</ref>) is a novel optimization algorithm that directs the search for model parameters within flat regions. Training DNNs with this method has demonstrated remarkable efficacy in enhancing generalization, especially on transformers. SAM introduces a new objective that aims to minimize the maximum loss in the vicinity of weight w within a radius &#961;:</p><p>Through the minimization of the SAM objective, the neural network's weights undergo updates that shift them towards a smoother loss landscape. As a result, the model's generalization performance is improved. To ensure practical feasibility, SAM adopts two approximations: (1) employs one-step gradient ascent to approximate the inner maximization; (2) simplifies gradient calculation by omitting the second and higher-order terms, i.e.,</p><p>Nevertheless, behind the empirical successes of SAM in training computer vision models <ref type="bibr">(Foret et al. 2021;</ref><ref type="bibr">Chen, Hsieh, and Gong 2022)</ref> and natural language processing models <ref type="bibr">(Bahri, Mobahi, and Tay 2021)</ref>, there are two inherent limitations.</p><p>Firstly, SAM introduces a twofold computational overhead to the base optimizer (e.g., SGD) due to the inner maximization process. In response, recent solutions such as LookSAM <ref type="bibr">(Liu et al. 2022a)</ref>, Efficient SAM (ESAM) <ref type="bibr">(Du et al. 2022a)</ref>, Sparse SAM (SSAM) <ref type="bibr">(Mi et al. 2022</ref>), Sharpness-Aware Training for Free (SAF) <ref type="bibr">(Du et al. 2022b)</ref>, and Adaptive policy SAM (AE-SAM) <ref type="bibr">(Jiang et al. 2023)</ref> have emerged, which propose various strategies to reduce the added overhead.</p><p>Secondly, the high non-linearity of DNNs' loss landscapes means that relying solely on one-step ascent may not consistently lead to an accurate approximation of the maximum loss. To address this issue, Random SAM (R-SAM) <ref type="bibr">(Liu et al. 2022b</ref>) introduced random smoothing to the loss landscape, but its reliance on heuristic methods without strong theoretical underpinnings limits its justification. Empirically, we have included R-SAM in our baseline comparisons, demonstrating our method's superior performance (as seen in Table <ref type="table">2</ref>).</p><p>Beyond these two limitations, our proposed approach to enhance computational efficiency remains orthogonal to the various SAM variants mentioned above. It can be seamlessly integrated with them, further amplifying efficiency gains.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Regularization Methods for Generalization</head><p>The work <ref type="bibr">(Wilson and Izmailov 2020)</ref> contends that model generalization hinges primarily on two traits: the model's support and its inductive biases. Given the broad applicability of modern DNNs to various datasets, the inductive biases is the remaining crucial factor for guiding a model towards the true data distribution. From a Bayesian standpoint, inductive bias can be viewed as a prior distribution over the parameter space. Classical &#8467; 1 and &#8467; 2 regularization, for instance, correspond to Laplacian and Gaussian prior distributions respectively. In practice, one can employ regularization techniques to instill intended inductive biases, thereby enhancing model generalization. Such regularization can be applied to three core components of modern deep learning models: data, model architecture, and optimization.</p><p>Data-based regularization involves transforming raw data or generating augmented data to combat overfitting. Methods like label smoothing <ref type="bibr">(Szegedy et al. 2016)</ref>, Cutout (DeVries and Taylor 2017), Mixup (Zhang et al. 2017), and RandAugment <ref type="bibr">(Cubuk et al. 2020)</ref> fall under this category. Model-based regularization aids feature extraction and includes techniques such as dropout <ref type="bibr">(Srivastava et al. 2014)</ref>, skip connections <ref type="bibr">(He et al. 2016)</ref>, and batch normalization <ref type="bibr">(Ioffe and Szegedy 2015)</ref>. Lastly, optimizationbased regularization imparts desired properties like sparsity or complexity into the model. Common methods include weight decay <ref type="bibr">(Krogh and Hertz 1991)</ref>, gradient norm penalty <ref type="bibr">(Drucker and Le Cun 1992;</ref><ref type="bibr">Zhao, Zhang, and Hu 2022)</ref>, Jacobian regularization <ref type="bibr">(Sokoli&#263; et al. 2017)</ref>, and confidence penalty <ref type="bibr">(Pereyra et al. 2017)</ref>. Our proposed cur- vature regularizer in this work aligns with the optimizationbased strategies, fostering flatter loss landscapes.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Flat Minima</head><p>Recent research into loss surface geometry underscores the strong correlation between generalization and the flatness of minima reached by DNN parameters. Among various mathematical definitions of flatness, including &#1013;-sharpness <ref type="bibr">(Keskar et al. 2016)</ref>, PAC-Bayes measure <ref type="bibr">(Jiang et al. 2020</ref>), Fisher Rao Norm <ref type="bibr">(Liang et al. 2019)</ref>, and entropy measures <ref type="bibr">(Pereyra et al. 2017;</ref><ref type="bibr">Chaudhari et al. 2019)</ref>, notable ones include Hessian-based metrics like Frobenius norm <ref type="bibr">(Wu, Wang, and Su 2022a,b)</ref>, trace of the Hessian <ref type="bibr">(Dinh et al. 2017)</ref>, largest eigenvalue of the Hessian <ref type="bibr">(Kaur, Cohen, and Lipton 2023)</ref>, and effective dimensionality of the Hessian <ref type="bibr">(Maddox, Benton, and Wilson 2020)</ref>. In this work, our focus is on exploring the Hessian trace and its connection to generalization. Akin to our objective, (Liu, Yu, and Lin 2023) also proposes Hessian trace regularization for DNNs. However, <ref type="bibr">(Liu, Yu, and Lin 2023)</ref> utilizes the computationally demanding Hutchinson method <ref type="bibr">(Avron and Toledo 2011)</ref> with dropout as an unbiased estimator for Hessian trace. In contrast, our method employs finite difference (FD), offering greater computational efficiency and numerical stability. Moreover, our rationale and regularization approach significantly differ from <ref type="bibr">(Liu, Yu, and Lin 2023)</ref>.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Methodology</head><p>Our Empirical Findings about SAM Training 1) Declining accuracy of one-step approximation. The optimal solution to the inner maximization in SAM's objective is intractable, which led SAM to resort to an approximation using one-step gradient ascent. However, we found that this approximation's accuracy diminishes progressively as training advances. To show this, we introduce the approximation ratio (AR) for sharpness, approximated by one-step gradient ascent, defined as:</p><p>) where &#948; represents one-step gradient ascent perturbation, and &#948; * denotes the optimal perturbation. An AR closer to 1 indicates a better approximation. Given the infeasibility of obtaining the optimal &#948; * , we employ the perturbation from a 20-step gradient ascent as &#948; * and approximate its expectation by sampling 5000 data points from the training set and calculating their average. Our assessment of AR through multiple experiments, illustrated in Fig. <ref type="figure">1</ref>, reveals its progression during training. Notably, the one-step ascent approximation for sharpness demonstrates diminishing accuracy as training unfolds, with a significant decline in the later stages. This suggests an increasing curvature of the loss landscape as training advances. In the realm of DNNs, the curvature of a function at a specific point is commonly assessed through the Hessian matrix calculated at that point. However, the dependence on gradient scale make Hessian metrics fail to measure the curvature precisely. Specifically, models near convergence of training exhibit smaller gradient norms and inherently correspond to reduced Hessian norms, but does not imply a more linear model.</p><p>We show the evolution of conventional curvature metrics like Hessian trace and the top eigenvalue of the Hessian in Fig. <ref type="figure">1</ref>, both metrics increase initially and then decrease, which fail to capture true loss landscape curvature since AR's consistent decline implies a higher curvature. This phenomenon also verify their dependence on the scaling of model gradients; as gradients decrease near convergence, Hessian-based curvature metrics like Hessian trace and top eigenvalue of the Hessian also decrease.</p><p>The degrading effectiveness of the one-step gradient ascent approximation can be theoretically confirmed through a Taylor expansion. The sharpness optimized by SAM in prac- tice is represented as:</p><p>Eq.</p><p>(3) highlights that as training nears convergence, the gradient &#8711;L S (w) tends toward 0, causing R SAM (w) to approach 0 as well. Consequently, sharpness ceases to be effectively captured, and SAM training mirrors standard training behavior.</p><p>2) A new metric for accurate curvature characterization. Our initial observation underscores the limitations of the top Hessian eigenvalue and Hessian trace in capturing loss landscape curvature during SAM training. These metrics suffer from sensitivity to gradient scaling, prompting the need for a more precise curvature characterization. To address this challenge, we introduce a novel curvature metric, normalized Hessian trace, defined as follows:</p><p>This metric exhibits continual growth during SAM training, indicating increasing curvature. This behavior aligns well with the decreasing AR of one-step gradient ascent, as depicted in Fig. <ref type="figure">2</ref>. An additional advantage of the normalized Hessian trace is its consistent trends and values across both training and test sets. In contrast, plain Tr &#8711; 2 L S (w) display inconsistent behaviors between these sets, as evidenced in Fig. <ref type="figure">2 (a</ref>,<ref type="figure">b</ref>,<ref type="figure">c</ref>). This discrepancy questions the viability of solely utilizing Hessian trace or the top Hessian eigenvalue for DNN regularization based on training data.</p><p>Curvature Regularized Sharpness-Aware Minimization (CR-SAM)</p><p>For the sake of generalization, it is preferable to steer clear of excessive non-linearity in deep learning models, as it implies highly non-convex loss surfaces. On such models, the challenge of flattening minima (which improves generalization) becomes considerably harder, potentially exceeding the capabilities of gradient-based optimizers. In this context, our proposed normalized Hessian trace (4) can be employed to train deep models with more manageable loss landscapes. However, a direct minimization of C(w) would lead to an elevation in the gradient norm |&#8711;L S (w)| 2 , which could adversely affect generalization (Zhao, Zhang, and Hu 2022). Therefore, we propose to optimize Tr &#8711; 2 L S (w) and &#8741;&#8711;L S (w)&#8741; 2 separately. Specifically, we penalize both Tr &#8711; 2 L S (w) and &#8741;&#8711;L S (w)&#8741; 2 but with different extent such that they jointly lead to a smaller C(w). Thus, we introduce our proposed curvature regularizer as:</p><p>where &#945; &gt; &#946; &gt; 0 such that the numerator of C(w) is penalized more than the denominator. This regularizer is equivalent to &#945; log C(w) + (&#945; + &#946;) log &#8741;&#8711;L S (w)&#8741; 2 , which is a combination of normalized Hessian trace with gradient norm penalty regularizer. Our regularization strategy can also be justified by analyzing the sharpness:</p><p>We can see that max &#8741;v&#8741;2&#8804;1 &#961;v &#8868; &#8711;L S (w) = &#961;&#8741;&#8711;L S (w)&#8741; 2 (cf. ( <ref type="formula">1</ref>)). Under the condition that v &#8764; N (0, I), we have E v&#8764;N (0,I) v &#8868; &#8711; 2 L S (w)v = Tr &#8711; 2 L S (w) for the second term. However, the firstorder term &#8741;&#8711;L S (w)&#8741; 2 vanishes at the local minimizers of the loss L, and thus the second-order term will become prominent and hence be penalized. Therefore, introducing our regularizer will have the effect of penalizing both the Hessian trace and the gradient norm and thereby reduce the sharpness of a loss landscape.</p><p>Informed by our heuristic and theoretical analysis above, our CR-SAM optimizes the following objective:</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Solving Computational Efficiency</head><p>Computing the Hessian trace as in R c (w) for very large matrices is computationally intensive, especially for modern over-parameterized DNNs with millions of parameters.</p><p>To address this issue, we first propose a stochastic estimators for R c (w):</p><p>w) which reduces Hessian trace computation to averages of Hessian-vector products. However, the complexity of computing the Hessian-vector products in the above estimator is still high for optimizers in large scale problems. Hence, we further propose an approximation based on finite difference (FD) which not only reduces the computational complexity, but also makes the computation parallelizable.</p><p>By Theorem 1, we can instantiate R c (w) as:</p><p>(7) The above formulation involves an expectation over v, which uniformly penalizes expected curvature across all directions. Previous studies <ref type="bibr">(Fawzi et al. 2018;</ref><ref type="bibr">Moosavi-Dezfooli et al. 2019)</ref> highlight that gradient directions represent high-curvature directions. Hence, we choose to optimize over perturbations solely along gradient directions, approximating R c (w) by considering v = &#8711;L S (w). Additionally, the terms L S (w + &#961;v) and L S (w&#961;v) can be computed in parallel as shown in Fig. <ref type="figure">3</ref>.</p><p>We offer a meaningful interpretation of the finite difference regularizer (7): The second term within R c (w), i.e., [L S (w + &#961;v) -L S (w&#961;v)], resembles the surrogate gap [L S (w+&#961;v)-L S (w)] as introduced in (Zhuang et al. 2022). However, unlike solely focusing on optimizing the ridge (locally worst-case perturbation) within the &#961;-bounded neighborhood around the current parameter vector, our proposed regularizer also delves into the valley (locally best-case perturbation) of the DNN loss landscape, with their loss discrepancies similarly constrained by R c (w). Additionally, by expressing the first term within R c (w) as [L S (w + &#961;v) -L S (w)]-[L S (w)-L S (w -&#961;v)], our approach encourages minimizing the disparity between the worst-case perturbed sharpness and the best-case perturbed sharpness. In essence, our strategy jointly optimizes the worst-case and best-case perturbations within the parameter space neighborhood, promoting a smoother, flatter loss landscape with fewer excessive wavy ridges and valleys.</p><p>The full pseudo-code of our CR-SAM training is given in Algorithm 1. Algorithm 1: Training with CR-SAM Input: Training set S; DNN model f (x; w); Loss funtion &#8467; (f (x i ; w) , y i ); Batch size B; Learning rate &#951;; Perturbation size &#961;; regularizer coefficients &#945; and &#946; Output: model trained by CR-SAM 1: Parameter initialization w 0 . 2: while not converged do 3: Sample batch B = {(x i , y i )} B i=0 from S; 4: Compute v = &#8711;L S (w) &#8741;&#8711;L S (w)&#8741;2 ; 5: Compute L S (w + &#961;v) and L S (w&#961;v) ; 6: Compute &#8711;R c (w) per equation 7; 7: w t+1 = w t&#951;(&#8711;L (w t ) + R c (w t )); 8: end while 9: return w t Experiments To assess CR-SAM, we conduct thorough experiments on prominent image classification benchmark datasets: CIFAR-10/CIFAR-100 and ImageNet-1k/-C/-R. Our evaluation encompasses a wide array of network architectures, including ResNet, WideResNet, PyramidNet, and Vision Transformer (ViT), in conjunction with diverse data augmentation techniques. These experiments are implemented using PyTorch and executed on Nvidia A100 and V100 GPUs.</p><p>Training from Scratch on CIFAR-10 / CIFAR-100 Setup. In this section, we evaluate CR-SAM using the CIFAR-10/100 datasets <ref type="bibr">(Krizhevsky, Hinton et al. 2009)</ref>. Our evaluation encompasses a diverse selection of widelyused DNN architectures with varying depths and widths. Specifically, we employ ResNet-18 <ref type="bibr">(He et al. 2016)</ref>, ResNet-50 <ref type="bibr">(He et al. 2016)</ref>, Wide ResNet-28-10 (WRN-28-10) (Zagoruyko and Komodakis 2016), and PyramidNet-110 <ref type="bibr">(Han, Kim, and Kim 2017)</ref>, along with a range of data augmentation techniques, including basic augmentations (horizontal flip, padding by four pixels, and random crop) <ref type="bibr">(Foret et al. 2021)</ref>, Cutout (DeVries and Taylor 2017), and Au-toAugment <ref type="bibr">(Cubuk et al. 2018)</ref>, to ensure a comprehensive assessment.</p><p>Following the setup in <ref type="bibr">(Liu et al. 2022b;</ref><ref type="bibr">Du et al. 2022b)</ref>, we train all models from scratch for 200 epochs, using batch size 128 and employing a cosine learning rate schedule. We conduct grid search to determine the optimal learning rate, weight decay, perturbation magnitude (&#961;), coefficient (&#945; and &#946;) values that yield the highest test accuracy. To ensure a fair comparison, we run each experiment three times with different random seeds. Further details of the setup are provided in Appendix.</p><p>Results. Refer to Table ?? for a comprehensive overview. CR-SAM consistently outperforms both vanilla SAM and SGD across all configurations on both CIFAR-10 and CIFAR-100 datasets. Notable improvements are observed, such as a 1.11% enhancement on CIFAR-100 with ResNet-18 employing cutout augmentation and a 1.30% boost on CIFAR-100 with WRN-28-10 using basic augmentation.</p><p>Furthermore, we empirically observe that CR-SAM exhibits a faster convergence rate in comparison to vanilla SAM (details in Appendix). This accelerated convergence could be attributed to CR-SAM's ability to mitigate excessive curvature, ultimately reducing optimization complexity and facilitating swifter arrival at local minima.</p><p>Training from Scratch on ImageNet-1k/-C/-R Setup. This section details our evaluation on the ImageNet dataset <ref type="bibr">(Deng et al. 2009)</ref>, containing 1.28 million images across 1000 classes. We assess the performance of ResNet <ref type="bibr">(He et al. 2016)</ref> and Vision Transformer (ViT) <ref type="bibr">(Dosovitskiy et al. 2020)</ref> architectures. Evaluation is extended to out-ofdistribution data, namely ImageNet-C <ref type="bibr">(Hendrycks and Dietterich 2019)</ref> and ImageNet-R <ref type="bibr">(Hendrycks et al. 2021</ref>). ResNet50, ResNet101, ViT-S/32, and ViT-B/32 are evaluated with Inception-style preprocessing.</p><p>For ResNet models, SGD serves as the base optimizer. We follow the setup in <ref type="bibr">(Du et al. 2022a)</ref>, training ResNet50 and ResNet101 with batch size 512 for 90 epochs. The initial learning rate is set to 0.1, progressively decayed using a cosine schedule. For ViT models, we adopt AdamW <ref type="bibr">(Loshchilov and Hutter 2019)</ref> as the base optimizer with parameters &#946; 1 = 0.9 and &#946; 2 = 0.999. ViTs are trained with batch size 512 for 300 epochs. Refer to the Appendix for further training specifics.</p><p>Results. Summarized in Table <ref type="table">2</ref>, our results indicate substantial accuracy improvements across various DNN models, including ResNet and ViT, on the ImageNet dataset. Notably, CR-SAM's performance surpasses that of SAM by 1.16% for ResNet-50 and by 1.77% for ViT-B/32. These findings underscore the efficacy of our CR-SAM approach.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Model Geometry Analysis</head><p>CR-SAM aims to reduce the normalized trace of the Hessian to promote flatter minima. Empirical validation of CR-SAM's ability to locate optima with lower curvature is presented through model geometry comparisons among mod-Table <ref type="table">2</ref>: Results on ImageNet, the base optimizer for ResNets and ViTs are SGD+M and AdamW, respectively. els trained by SGD, SAM, and CR-SAM (see Table <ref type="table">3</ref>). Our analysis is based on ResNet-18 trained on CIFAR-100 for 200 epochs using the three optimization methods. Hutchinson's method <ref type="bibr">(Avron and Toledo 2011;</ref><ref type="bibr">Yao et al. 2020</ref>) is utilized to compute the Hessian trace, with values obtained from the test set across three independent runs. Notably, the results reveal that CR-SAM significantly reduces both gradient norms and Hessian traces throughout training in contrast to SGD and SAM. This reduction contributes to a smaller normalized Hessian trace, affirming the effectiveness of our proposed regularization strategy.</p><p>w) SGD 19.97 &#177;0.52 32673 &#177;1497 1674 &#177;78 SAM 11.51 &#177;0.31 14176 &#177;327 1193 &#177;59 CR-SAM 8.26 &#177;0.19 7968 &#177;145 884 &#177;23</p><p>Table 3: Model geometry of ResNet-18 models trained with SGD, SAM and CR-SAM, values are computed on test set.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Visualization of Landscapes</head><p>We  </p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Conclusion</head><p>In this paper, we identify the limitations of the one-step gradient ascent in SAM's inner maximization during training due to the excessive non-linearity of the loss landscape. In addition, existing curvature metrics lack the ability to precisely capture the loss function geometry. To address these issues, we introduce normalized Hessian trace, which offers consistent and accurate characterization of loss function curvature on both training and test data. Building upon this metric, we present CR-SAM, a novel training approach for enhancing neural network generalizability by regularizing our proposed curvature metric. Additionally, to mitigate the overhead of computing the Hessian trace, we incorporate a parallelizable finite difference method. Our comprehensive experiments that span a wide variety of model architectures across popular image classification datasets including CI-FAR10/100 and ImageNet-1k/-C/-R, affirm the effectiveness of our proposed CR-SAM training strategy.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>SUPPLEMENTARY MATERIALS Proofs</head><p>In this section we provide proofs for Theorem 1 and Theorem 2 in the main text.</p><p>Proof of Theorem 1. </p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Faster and Smoother Convergence</head><p>The convergence in a single run of SAM vs. CR-SAM is presented in Fig. <ref type="figure">5</ref>. See caption for details. </p></div><note xmlns="http://www.tei-c.org/ns/1.0" place="foot" xml:id="foot_0"><p>The Thirty-Eighth AAAI Conference on Artificial Intelligence </p></note>
		</body>
		</text>
</TEI>
