EXPLAINING AND HARNESSING ADVERSARIAL EXAMPLES


初次编辑于2020.9.7 by EnEn

ABSTRACT

本文认为神经网络易受对抗性扰动影响的主要原因是它们的线性性质。
同时,本文提供了新的简单的快速的产生对抗干扰样本的模型。

INTRODUCTION

在许多情况下,不同结构的模型,不同训练子集都会把相同的对抗性样本分类错误,这一事实说明,在我们的训练算法中存在盲点,使神经网络无法正确分类对抗性样本。许多人认为其中的原因来自深度神经网络的极端非线性,有可能包括纯监督学习下的不充分模型平均insufficient model averaging和不充分的正规化。
*The cause of these adversarial examples was a mystery, and speculative explanations have suggested it is due to extreme nonlinearity of deep neural networks, perhaps combined with insufficient model averaging and insufficient regularization of the purely supervised learning problem. *

而我们不这么认为,我们认为在高维空间中,线性行为也能产生对抗样本。我们发现把对抗性样本加入到训练集中,比仅仅由dropout带来的正则化的正确率更高。一般正则化策略(如dropout、pretraining和model averaging )不会显著降低模型对对抗性样本的脆弱性,但利用非线性模型系列(如 RBF 网络)可以提高对对抗性样本的脆弱性。

我们认为,设计由于线性性而易于训练的模型与设计使用非线性效应来抵抗对抗扰动的模型之间具有根本的对立关系。从长远来看,通过设计更强大的优化方法可以成功训练更多的非线性模型,可以摆脱这种权衡。
Our explanation suggests a fundamental tension between designing models that are easy to train due to their linearity and designing models that use nonlinear effects to resist adversarial perturbation. In the long run, it may be possible to escape this tradeoff by designing more powerful optimization methods that can succesfully train more nonlinear models.

RELATED WORK

  • Box-constrained L-BFGS可以
  • 在某些数据集上,对抗性样本和原图几乎相同,无法用肉眼区分
  • 同一个对抗性样本可以被不同训练数据集的分类器或不同结构的分类器分类错误
  • Shallow softmax regression models也无法抵抗对抗性样本带来的错误率
  • 利用对抗性样本可以帮助模型正则化,但是很不实际(因为代价昂贵)

THE LINEAR EXPLANATION OF ADVERSARIAL EXAMPLES

本段来源 @鱼非子子.
线性模型中,对抗性样本存在的原因

因为样本输入特征(input feature)的精度有限(电子图像的每个像素是8bits, 样本中所有低于动态范围1/255的信息都会被丢弃),所以当样本 x x x中每个元素值添加的扰动值 η \eta η 小于样本输入特征精度时,分类器无法将样本 x x x和对抗样本 x ~ = x + η \tilde{x}=x+\eta x~=x+η区分开。也就是对一个分类良好的分类器而言,如果 ϵ \epsilon ϵ 是一个足够小以至于被舍弃掉的值,那么只要 ∣ ∣ η ∣ ∣ ∞ < ||\eta||_{\infty}< η< ϵ \epsilon ϵ,分类器将认为 x x x x ~ \tilde{x} x~属于同一个类。
下图为 y = s i g n ( x ) y=sign(x) y=sign(x)在这里插入图片描述

下面考虑权重向量 ω ⊤ \omega^{\top} ω和对抗样本 x ~ \tilde{x} x~的点积为 ω ⊤ x ~ = ω ⊤ ( x + η ) = ω ⊤ x + ω ⊤ η \omega^{\top}\tilde{x}=\omega^{\top}(x+\eta)=\omega^{\top}x+\omega^{\top}\eta ωx~=ω(x+η)=ωx+ωη。可以看出,对抗扰动使得activation增加了 ω ⊤ η \omega^{\top}\eta ωη,作者提出让 η = s i g n ( ω ) \eta=sign(\omega) η=sign(ω)从而使 ω ⊤ η \omega^{\top}\eta ωη最大化。假设权重向量 ω \omega ω n n n个维度,且权重向量中元素的平均量值是 m m m,那么activation将增加 ϵ m n ( ⇒ ω ⊤ η ≤ n ∗ m ∗ ϵ , \epsilon mn(\Rightarrow \omega^{\top}\eta\leq n*m*\epsilon, ϵmn(ωηnmϵ, ∣ ∣ η ∣ ∣ ∞ < ||\eta||_{\infty}< η< ϵ ) \epsilon) ϵ)。虽然 ∣ ∣ η ∣ ∣ ∞ ||\eta||_{\infty} η不会随着维度 n n n的变化而变化,但是由 η \eta η导致的activation的增加量 ϵ m n \epsilon mn ϵmn会随着维度 n n n线性增长。那么对于一个高维度的问题,一个样本中大量维度的无限小的干扰加在一起就可以对输出造成很大的变化。

所以对抗样本的线性解释表明,对线性模型而言,如果其输入样本有足够大的维度,那么线性模型也容易受到对抗样本的攻击。

LINEAR PERTURBATION OF NON-LINEAR MODELS

假设NN是线性的,而对对抗性样本敏感,

  • θ \theta θ为模型的参数
  • x x x为模型的输入
  • y y y x x x模型对应的目标值
  • J ( θ , x , y ) J(\theta,x,y) J(θ,x,y)为神经网络的损失函数
  • J ( θ , x , y ) J(\theta,x,y) J(θ,x,y) θ \theta θ附近做线性近似,得到无穷范数限制的最优的扰动 η = ϵ s i g n ( ∇ x J ( θ , x , y ) ) \eta=\epsilon sign(\nabla_x J(\theta,x,y)) η=ϵsign(xJ(θ,x,y))

这是产生对抗性样本的“fast gradient sign method”方法,需要利用 backpropagation快速得到梯度。
ϵ = 0.25 \epsilon=0.25 ϵ=0.25时,
shallow softMax 分类器在Mnist数据集上error rate 99.9 % 99.9\% 99.9%average confidence 79.3 % 79.3\% 79.3%
maxout 分类器在Mnist数据集上 error rate 89.4 % 89.4\% 89.4%average confidence 97.6 % 97.6\% 97.6%

ADVERSARIAL TRAINING OF LINEAR MODELS VERSUS WEIGHT DECAY

最简单的概率模型是逻辑回归模型。
假设要训练一个逻辑回归模型来识别标签 y ∈ { − 1 , 1 } y\in \{-1,1\} y{1,1},预测函数为 P ( y = 1 ) = σ ( ω ⊤ x + b ) P_{(y=1)}=\sigma(\omega^{\top}x+b) P(y=1)=σ(ωx+b)(PS:意味着 P ( y = − 1 ) = 1 − σ ( ω ⊤ x + b ) P_{(y=-1)}=1-\sigma(\omega^{\top}x+b) P(y=1)=1σ(ωx+b)),其中 σ \sigma σ函数是sigmoid函数,那么该样本的损失函数为: E x , y ∼ P d a t a ζ ( − y ( ω ⊤ x + b ) ) \mathbb{E}_{x,y\sim P_{data}}\zeta(-y(\omega^{\top}x+b)) Ex,yPdataζ(y(ωx+b)),其中 ζ ( z ) = l o g ( 1 + e z ) \zeta(z)=log(1+e^z) ζ(z)=log(1+ez)是softplus函数。

对该模型使用FGSM方法,扰动量 η = ϵ s i g n ( ∇ x J ( θ , x , y ) ) = ϵ s i g n ( ∇ x ζ ( − y ( ω ⊤ x + b ) ) ) = ϵ s i g n ( − ω ⊤ ∗ σ ( − ( ω ⊤ x + b ) ) ) = − ϵ s i g n ( − ω ) = − ϵ ( ω ) \eta=\epsilon sign(\nabla_x J(\theta,x,y))=\epsilon sign(\nabla_x \zeta(-y(\omega^{\top}x+b)))=\epsilon sign(-\omega^{\top}*\sigma(-(\omega^\top x+b)))=-\epsilon sign(-\omega)=-\epsilon(\omega) η=ϵsign(xJ(θ,x,y))=ϵsign(xζ(y(ωx+b)))=ϵsign(ωσ((ωx+b)))=ϵsign(ω)=ϵ(ω) ω ⊤ s i g n ( ω ) = ∣ ∣ ω ∣ ∣ 1 \omega^{\top}sign(\omega)=||\omega||_1 ωsign(ω)=ω1, 那么逻辑回归模型的对抗形式即为: E x , y ∼ P d a t a \mathbb{E}_{x,y\sim P_{data}} Ex,yPdata ζ ( − y ( ω ⊤ x ~ + b ) ) \zeta(-y(\omega^{\top}\tilde{x}+b)) ζ(y(ωx~+b)) = ⏟ x ~ = x + η , η = ϵ − s i g n ( ω ) \underbrace{=}_{\tilde{x}=x+\eta,\eta=\epsilon-sign(\omega)} x~=x+η,η=ϵsign(ω) = E x , y ∼ P d a t a \mathbb{E}_{x,y\sim P_{data}} Ex,yPdata ζ ( y ( ϵ ∣ ∣ ω ∣ ∣ 1 − ω ⊤ x − b ) ) \zeta(y(\epsilon||\omega||_1-\omega^{\top}x-b)) ζ(y(ϵω1ωxb))

上面公式非常类似于L1正则化,但不同的是 L 1 L^1 L1正则化是在训练过程中,为模型的激活函数减去 L 1 L^1 L1惩罚项;而本文的方法却是为模型的损失函数添加 L 1 L^1 L1惩罚项。如果模型里的 ζ \zeta ζ饱和(损失函数饱和,即训练基本完成),则损失函数 ζ \zeta ζ已不再被惩罚。
在深度神经网络中,Weight decay高估了扰动带来的影响。因为 L 1 L^1 L1Weight decay高估了一个对抗性样本(adversary)的影响,所以它需要使用比与特征相关的 e p s i l o n epsilon epsilon更小的 L 1 L^1 L1Weight decay系数。(即,在使用 L 1 L^1 L1Weight decay时,权重系数一定需要比 e p s i l o n epsilon epsilon小)

问题

  • 黄色荧光的这句话能否理解为 “adversarial training会使得模型无法拟合合适的函数,而 L 1 L^1 L1 weight decay更不会拟合出适合的函数,因为它在good margin的情况下无法激活”?This is somewhat similar to L 1 L^1 L1 regularization. However, there are some important differences. Most significantly, the L 1 L^1 L1penalty is subtracted off the model’s activation during training, rather than added to the training cost. This means that the penalty can eventually start to disappear if the model learns to make confident enough predictions that ζ saturates.This is not guaranteed to happen—in the underfitting regime, adversarial training will simply worsen underfitting. We can thus view L 1 L^1 L1 weight decay as being more “worst case” than adversarial training, because it fails to deactivate in the case of good margin.
  • 上一个问题中,good margin是什么?We can thus view L 1 L^1 L1 weight decay as being more “worst case” than adversarial training, because it fails to deactivate in the case of good margin.
  • 不能理解 L 1 L^1 L1weight decay高估对抗性样本(adversary)的破坏的原因? Weight decay overestimates the damage achievable with perturbation even more in the case of a deep network with multiple hidden units. Because L 1 L^1 L1weight decay overestimates the amount of damage an adversary can do, it is necessary to use a smaller L 1 L^1 L1weight decay coefficient than the ε associated with the precision of our features.
  • E x , y ∼ P d a t a \mathbb{E}_{x,y\sim P_{data}} Ex,yPdata ζ ( − y ( ω ⊤ x ~ + b ) ) \zeta(-y(\omega^{\top}\tilde{x}+b)) ζ(y(ωx~+b)) = ⏟ x ~ = x + η , η = ϵ − s i g n ( ω ) \underbrace{=}_{\tilde{x}=x+\eta,\eta=\epsilon-sign(\omega)} x~=x+η,η=ϵsign(ω) = E x , y ∼ P d a t a \mathbb{E}_{x,y\sim P_{data}} Ex,yPdata ζ ( y ( ϵ ∣ ∣ ω ∣ ∣ 1 − ω ⊤ x − b ) ) \zeta(y(\epsilon||\omega||_1-\omega^{\top}x-b)) ζ(y(ϵω1ωxb))中,
    计算后得到
    − y ( ω ⊤ x ~ + b ) -y(\omega^{\top}\tilde{x}+b) y(ωx~+b)
    = − y ( ω ⊤ ( x + ϵ − s i g n ( w ) ) + b ) =-y(\omega^{\top}(x+\epsilon-sign(w))+b) =y(ω(x+ϵsign(w))+b)
    = y ( ∣ ∣ ω ∣ ∣ 1 − ω ⊤ ϵ − ω ⊤ x − b ) =y(||\omega||_1-\omega^{\top}\epsilon-\omega^{\top}x-b) =y(ω1ωϵωxb)
    无法得到论文中的公式,即为什么 ∣ ∣ ω ∣ ∣ 1 − ω ⊤ ϵ 等 于 ϵ ∣ ∣ ω ∣ ∣ 1 ||\omega||_1-\omega^{\top}\epsilon等于\epsilon||\omega||_1 ω1ωϵϵω1?
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值