深度神经网络通常过度分辨,并且可能不容易实现模型泛化。对抗性训练通过规则地改变普遍选择的扰动之外的损失变化来提高普遍性的效果。最近提出的清晰度感知最小化(SAM)算法采用对抗性重量扰动,鼓励模型收敛于扁平最小值。遗憾的是,由于计算成本增加,对抗性重量扰动只能有效地近似于每批次而不是每个实例,导致性能下降。在本文中,我们提出了在每个批处理中动态重新缓解的扰动,其中揭开的实例被加权,可以用作每个实例扰动的更好近似。我们提出了充满活力的重新重量({\ Delta} -Sam)的清晰度感知最小化,这实现了高效的防护估计的想法。胶水基准测试的实验证明了{\ delta} -sam的有效性。
translated by 谷歌翻译
In today's heavily overparameterized models, the value of the training loss provides few guarantees on model generalization ability. Indeed, optimizing only the training loss value, as is commonly done, can easily lead to suboptimal model quality. Motivated by prior work connecting the geometry of the loss landscape and generalization, we introduce a novel, effective procedure for instead simultaneously minimizing loss value and loss sharpness. In particular, our procedure, Sharpness-Aware Minimization (SAM), seeks parameters that lie in neighborhoods having uniformly low loss; this formulation results in a minmax optimization problem on which gradient descent can be performed efficiently. We present empirical results showing that SAM improves model generalization across a variety of benchmark datasets (e.g., CIFAR-{10, 100}, Ima-geNet, finetuning tasks) and models, yielding novel state-of-the-art performance for several. Additionally, we find that SAM natively provides robustness to label noise on par with that provided by state-of-the-art procedures that specifically target learning with noisy labels. We open source our code at https: //github.com/google-research/sam. * Work done as part of the Google AI Residency program.
translated by 谷歌翻译
模型不合时宜的元学习(MAML)目前是少量元学习的主要方法之一。尽管它具有有效性,但由于先天的二聚体问题结构,MAML的优化可能具有挑战性。具体而言,MAML的损失格局比其经验风险最小化的对应物更为复杂,可能的鞍点和局部最小化可能更复杂。为了应对这一挑战,我们利用了最近发明的清晰度最小化的最小化,并开发出一种清晰感的MAML方法,我们称其为Sharp MAML。我们从经验上证明,Sharp-MAML及其计算有效的变体可以胜过流行的现有MAML基准(例如,Mini-Imagenet上的$+12 \%$ $精度)。我们通过收敛速率分析和尖锐MAML的概括结合进行了经验研究。据我们所知,这是在双层学习背景下对清晰度感知最小化的第一个经验和理论研究。该代码可在https://github.com/mominabbass/sharp-maml上找到。
translated by 谷歌翻译
Modern deep learning models are over-parameterized, where the optimization setup strongly affects the generalization performance. A key element of reliable optimization for these systems is the modification of the loss function. Sharpness-Aware Minimization (SAM) modifies the underlying loss function to guide descent methods towards flatter minima, which arguably have better generalization abilities. In this paper, we focus on a variant of SAM known as mSAM, which, during training, averages the updates generated by adversarial perturbations across several disjoint shards of a mini-batch. Recent work suggests that mSAM can outperform SAM in terms of test accuracy. However, a comprehensive empirical study of mSAM is missing from the literature -- previous results have mostly been limited to specific architectures and datasets. To that end, this paper presents a thorough empirical evaluation of mSAM on various tasks and datasets. We provide a flexible implementation of mSAM and compare the generalization performance of mSAM to the performance of SAM and vanilla training on different image classification and natural language processing tasks. We also conduct careful experiments to understand the computational cost of training with mSAM, its sensitivity to hyperparameters and its correlation with the flatness of the loss landscape. Our analysis reveals that mSAM yields superior generalization performance and flatter minima, compared to SAM, across a wide range of tasks without significantly increasing computational costs.
translated by 谷歌翻译
Adversarial training is widely used to improve the robustness of deep neural networks to adversarial attack. However, adversarial training is prone to overfitting, and the cause is far from clear. This work sheds light on the mechanisms underlying overfitting through analyzing the loss landscape w.r.t. the input. We find that robust overfitting results from standard training, specifically the minimization of the clean loss, and can be mitigated by regularization of the loss gradients. Moreover, we find that robust overfitting turns severer during adversarial training partially because the gradient regularization effect of adversarial training becomes weaker due to the increase in the loss landscapes curvature. To improve robust generalization, we propose a new regularizer to smooth the loss landscape by penalizing the weighted logits variation along the adversarial direction. Our method significantly mitigates robust overfitting and achieves the highest robustness and efficiency compared to similar previous methods. Code is available at https://github.com/TreeLLi/Combating-RO-AdvLC.
translated by 谷歌翻译
Knowledge Distillation (KD) is a commonly used technique for improving the generalization of compact Pre-trained Language Models (PLMs) on downstream tasks. However, such methods impose the additional burden of training a separate teacher model for every new dataset. Alternatively, one may directly work on the improvement of the optimization procedure of the compact model toward better generalization. Recent works observe that the flatness of the local minimum correlates well with better generalization. In this work, we adapt Stochastic Weight Averaging (SWA), a method encouraging convergence to a flatter minimum, to fine-tuning PLMs. We conduct extensive experiments on various NLP tasks (text classification, question answering, and generation) and different model architectures and demonstrate that our adaptation improves the generalization without extra computation cost. Moreover, we observe that this simple optimization technique is able to outperform the state-of-the-art KD methods for compact models.
translated by 谷歌翻译
已知最近的清晰度感知最小化(SAM)可以找到平坦的最小值,这有助于改善稳健性。 Sam通过报告当前迭代周围的小社区内的最大损失值来修改损失函数。但是,它使用欧几里得球来定义邻域,这可能是不准确的,因为神经网络的损失函数通常是根据概率分布(例如类预测概率)定义的,从而使参数空间空间非欧几里得。在本文中,我们在定义邻里时考虑了模型参数空间的信息几何形状,即用Fisher信息引起的椭圆形取代Sam的欧几里得球。我们称为Fisher Sam的方法定义了符合基础统计歧管的内在度量的更准确的邻域结构。例如,由于我们的Fisher Sam避免了参数空间几何形状,因此SAM可能会在附近或不当远处探测最坏情况下的损失值。最近,另一种自适应SAM方法会根据参数幅度的规模拉伸/收缩欧几里得球。这可能是危险的,有可能破坏邻里结构。我们证明了在几个基准数据集/任务上提出的Fisher SAM的性能提高。
translated by 谷歌翻译
现代神经网络Excel在图像分类中,但它们仍然容易受到常见图像损坏,如模糊,斑点噪音或雾。最近的方法关注这个问题,例如Augmix和Deepaulment,引入了在预期运行的防御,以期望图像损坏分布。相比之下,$ \ ell_p $ -norm界限扰动的文献侧重于针对最坏情况损坏的防御。在这项工作中,我们通过提出防范内人来调和两种方法,这是一种优化图像到图像模型的参数来产生对外损坏的增强图像的技术。我们理论上激发了我们的方法,并为其理想化版本的一致性以及大纲领提供了足够的条件。我们的分类机器在预期对CiFar-10-C进行的常见图像腐败基准上提高了最先进的,并改善了CIFAR-10和ImageNet上的$ \ ell_p $ -norm有界扰动的最坏情况性能。
translated by 谷歌翻译
尽管对抗性和自然训练(AT和NT)之间有基本的区别,但在方法中,通常采用动量SGD(MSGD)进行外部优化。本文旨在通过研究AT中外部优化的忽视作用来分析此选择。我们的探索性评估表明,与NT相比,在诱导较高的梯度规范和方差。由于MSGD的收敛速率高度取决于梯度的方差,因此这种现象阻碍了AT的外部优化。为此,我们提出了一种称为ENGM的优化方法,该方法将每个输入示例对平均微型批次梯度的贡献进行正规化。我们证明ENGM的收敛速率与梯度的方差无关,因此适合AT。我们介绍了一种技巧,可以使用有关梯度范围W.R.T.规范的相关性的经验观察来降低ENGM的计算成本。网络参数和输入示例。我们对CIFAR-10,CIFAR-100和Tinyimagenet的广泛评估和消融研究表明,Engm及其变体一致地改善了广泛的AT方法的性能。此外,Engm减轻了AT的主要缺点,包括强大的过度拟合和对超参数设置的敏感性。
translated by 谷歌翻译
最终的语言系统旨在在适应各种情况时具有高度的概括和鲁棒性。不幸的是,最近的怀特希望预训练的语言模型(PRLMS)几乎没有从堆叠过多的参数逃脱到过度参数化的变压器体系结构,以实现更高的性能。因此,本文提出了\ textIt {对抗自我注意力}机制(ASA),该机制在对抗性上重建了变压器的注意力,并促进了从受污染的模型结构中进行模型培训,并结合了快速,简单的实现,以实现更好的PRLM构建。我们在预训练和微调阶段进行各种任务进行全面评估。对于预训练,与常规培训相比,ASA会展现出显着的性能增长。为了进行微调,考虑到概括和鲁棒性,ASA授权模型始终超过了天真的模型。
translated by 谷歌翻译
清晰度感知最小化(SAM)是一种最近的训练方法,它依赖于最严重的重量扰动,可显着改善各种环境中的概括。我们认为,基于pac-bayes概括结合的SAM成功的现有理由,而收敛到平面最小值的想法是不完整的。此外,没有解释说在SAM中使用$ m $ sharpness的成功,这对于概括而言至关重要。为了更好地理解SAM的这一方面,我们理论上分析了其对角线性网络的隐式偏差。我们证明,SAM总是选择一种比标准梯度下降更好的解决方案,用于某些类别的问题,并且通过使用$ m $ -sharpness可以放大这种效果。我们进一步研究了隐性偏见在非线性网络上的特性,在经验上,我们表明使用SAM进行微调的标准模型可以导致显着的概括改进。最后,当与随机梯度一起使用时,我们为非凸目标提供了SAM的收敛结果。我们从经验上说明了深层网络的这些结果,并讨论了它们与SAM的概括行为的关系。我们的实验代码可在https://github.com/tml-epfl/understanding-sam上获得。
translated by 谷歌翻译
网络量化是一种有效的压缩方法,以降低模型大小和计算成本。尽管压缩比高,但训练低精度模型由于量化的离散和不可分散的性质,难以实现相当大的性能下降。最近,提出了清晰度感知最小化(SAM),以通过同时最小化损耗值和损耗曲率来改善模型的泛化性能。在本文中,我们设计了锐度感知量化(SAQ)方法来培训量化模型,从而导致更好的泛化性能。此外,由于每个层与网络的损耗和损耗锐度有不同的贡献,我们进一步设计了一种有效的方法,该方法学习配置生成器以自动确定每层的位宽度配置,鼓励平面区域的较低位,反之亦然尖锐的景观,同时促进最小值的平整度,以实现更积极的量化。对CiFar-100和Imagenet的广泛实验显示了所提出的方法的优越性。例如,我们的量化Reset-18具有55.1X比特操作(BOP)减少甚至在前1个精度方面均匀地优于0.7%。代码可在https://github.com/zhuang-group/saq获得。
translated by 谷歌翻译
虽然多步逆势培训被广泛流行作为对抗强烈的对抗攻击的有效防御方法,但其计算成本与标准培训相比,其计算成本是众所周知的。已经提出了几种单步侵权培训方法来减轻上述开销费用;但是,根据优化设置,它们的性能并不能充分可靠。为了克服这些限制,我们偏离了现有的基于输入空间的对抗性培训制度,并提出了一种单步潜在培训方法(SLAT),其利用潜在的代表梯度作为潜在的对抗扰动。我们证明,与所采用的潜伏扰动,恢复局部线性度并确保与现有的单步逆势训练方法相比,恢复局部线性度并确保可靠性的特征梯度的L1规范。因为潜伏的扰动基于可以在输入梯度计算过程中免费获得的潜在表示的梯度,所以所提出的方法与快速梯度标志方法相当成本。实验结果表明,尽管其结构简单,但优于最先进的加速的对抗训练方法。
translated by 谷歌翻译
自我监督的学习方法,如对比学习,在自然语言处理中非常重视。它使用对培训数据增强对具有良好表示能力的编码器构建分类任务。然而,在对比学习的学习成对的构建在NLP任务中更难。以前的作品生成单词级更改以形成对,但小变换可能会导致句子含义的显着变化作为自然语言的离散和稀疏性质。在本文中,对对抗的训练在NLP的嵌入空间中产生了挑战性和更难的学习对抗性示例作为学习对。使用对比学学习提高了对抗性培训的泛化能力,因为对比损失可以使样品分布均匀。同时,对抗性培训也提高了对比学习的稳健性。提出了两种小说框架,监督对比对抗学习(SCAS)和无监督的SCAS(USCAL),通过利用对比学习的对抗性培训来产生学习成对。利用基于标签的监督任务丢失,以产生对抗性示例,而无监督的任务会带来对比损失。为了验证所提出的框架的有效性,我们将其雇用到基于变换器的模型,用于自然语言理解,句子语义文本相似性和对抗学习任务。胶水基准任务的实验结果表明,我们的微调监督方法优于BERT $ _ {基础} $超过1.75 \%。我们还评估我们对语义文本相似性(STS)任务的无监督方法,并且我们的方法获得77.29 \%with bert $ _ {base} $。我们方法的稳健性在NLI任务的多个对抗性数据集下进行最先进的结果。
translated by 谷歌翻译
到目前为止对抗训练是抵御对抗例子的最有效的策略。然而,由于每个训练步骤中的迭代对抗性攻击,它遭受了高的计算成本。最近的研究表明,通过随机初始化执行单步攻击,可以实现快速的对抗训练。然而,这种方法仍然落后于稳定性和模型稳健性的最先进的对手训练算法。在这项工作中,我们通过观察随机平滑的随机初始化来更好地优化内部最大化问题,对快速对抗培训进行新的理解。在这种新的视角之后,我们还提出了一种新的初始化策略,向后平滑,进一步提高单步强大培训方法的稳定性和模型稳健性。多个基准测试的实验表明,我们的方法在使用更少的训练时间(使用相同的培训计划时,使用更少的培训时间($ \ sim $ 3x改进)时,我们的方法达到了类似的模型稳健性。
translated by 谷歌翻译
随着最近在移动和边缘设备上部署神经网络模型的需求,希望提高模型对看不见的测试数据的普遍性,以及提高模型在固定点量化下的稳健性,以实现有效部署。然而,最大限度地减少培训损失在泛化和量化性能上提供了一些保证。在这项工作中,我们通过在改善模型对界限重量扰动的框架下理论上统一它们的理论上统一并最小化模型权重的稳健性并最小化了模型权重的框架的框架,同时履行泛化和量化性能。因此,我们提出了HESSIAN增强的鲁棒优化方法,以通过基于梯度的训练过程最小化Hessian特征值,同时提高泛化和量化性能。 HERO在测试准确性上高达3.8%,高度高达30%,在80%的培训标签扰动下的准确性高达30%,以及各种精度范围内的最佳训练后量化精度,包括在SGD上的高精度改善> 10%在各种数据集上的共同模型架构培训模型。
translated by 谷歌翻译
域对抗训练无处不在地实现不变表示,并广泛用于各种域适应任务。近来,融合到平滑最佳的方法已显示出对分类等监督学习任务的改进的概括。在这项工作中,我们分析了增强配方对域对抗训练的影响,其目的是任务损失(例如分类,回归等)和对抗性术语的组合。我们发现,相对于(W.R.T.)任务损失融合了平滑的最小值,可以稳定对抗性训练,从而在目标域上获得更好的性能。与任务损失相反,我们的分析表明,融合到平滑的最小W.R.T.对抗损失导致目标结构域的次级概括。基于分析,我们介绍了平滑的域对抗训练(SDAT)程序,该程序有效地增强了现有域对抗方法的性能,以进行分类和对象检测任务。我们的分析还提供了对社区中亚当(Adam)对域名对抗训练的广泛使用的洞察力。
translated by 谷歌翻译
Language models with the Transformers structure have shown great performance in natural language processing. However, there still poses problems when fine-tuning pre-trained language models on downstream tasks, such as over-fitting or representation collapse. In this work, we propose HyPe, a simple yet effective fine-tuning technique to alleviate such problems by perturbing hidden representations of Transformers layers. Unlike previous works that only add noise to inputs or parameters, we argue that the hidden representations of Transformers layers convey more diverse and meaningful language information. Therefore, making the Transformers layers more robust to hidden representation perturbations can further benefit the fine-tuning of PLMs en bloc. We conduct extensive experiments and analyses on GLUE and other natural language inference datasets. Results demonstrate that HyPe outperforms vanilla fine-tuning and enhances generalization of hidden representations from different layers. In addition, HyPe acquires negligible computational overheads, and is better than and compatible with previous state-of-the-art fine-tuning techniques.
translated by 谷歌翻译
A lot of theoretical and empirical evidence shows that the flatter local minima tend to improve generalization. Adversarial Weight Perturbation (AWP) is an emerging technique to efficiently and effectively find such minima. In AWP we minimize the loss w.r.t. a bounded worst-case perturbation of the model parameters thereby favoring local minima with a small loss in a neighborhood around them. The benefits of AWP, and more generally the connections between flatness and generalization, have been extensively studied for i.i.d. data such as images. In this paper, we extensively study this phenomenon for graph data. Along the way, we first derive a generalization bound for non-i.i.d. node classification tasks. Then we identify a vanishing-gradient issue with all existing formulations of AWP and we propose a new Weighted Truncated AWP (WT-AWP) to alleviate this issue. We show that regularizing graph neural networks with WT-AWP consistently improves both natural and robust generalization across many different graph learning tasks and models.
translated by 谷歌翻译
最近的研究表明,深度神经网络(DNNS)极易受到精心设计的对抗例子的影响。对那些对抗性例子的对抗性学习已被证明是防御这种攻击的最有效方法之一。目前,大多数现有的对抗示例生成方法基于一阶梯度,这几乎无法进一步改善模型的鲁棒性,尤其是在面对二阶对抗攻击时。与一阶梯度相比,二阶梯度提供了相对于自然示例的损失格局的更准确近似。受此启发的启发,我们的工作制作了二阶的对抗示例,并使用它们来训练DNNS。然而,二阶优化涉及Hessian Inverse的耗时计算。我们通过将问题转换为Krylov子空间中的优化,提出了一种近似方法,该方法显着降低了计算复杂性以加快训练过程。在矿工和CIFAR-10数据集上进行的广泛实验表明,我们使用二阶对抗示例的对抗性学习优于其他FISRT-阶方法,这可以改善针对广泛攻击的模型稳健性。
translated by 谷歌翻译