Madry A, Makelov A, Schmidt L, et al. Towards Deep Learning Models Resistant to Adversarial Attacks.[J]. arXiv: Machine Learning, 2017.
@article{madry2017towards, title={Towards Deep Learning Models Resistant to Adversarial Attacks.}, author={Madry, Aleksander and Makelov, Aleksandar and Schmidt, Ludwig and Tsipras, Dimitris and Vladu, Adrian}, journal={arXiv: Machine Learning}, year={2017}}
概
利用特定的方法产生"坏"样本(Adversarial samples), 以此来促进网络的稳定性是当下的热点之一, 本文以实验为主, 比较PGD( projected gradient descent) 和 FGSM(fast gradient sign method)在不同数据下的表现, 以及由普通样本产生"坏"样本会出现的一些现象.
主要内容
Adversarial attacks 主要聚焦于下列问题:
min
?
θ
ρ
(
θ
)
w
h
e
r
e
ρ
(
θ
)
=
E
(
x
,
y
)
?
D
[
max
?
δ
∈
S
L
(
θ
,
x
+
δ
,
y
)
]
.
(2.1)
\tag{2.1} \min_{\theta} \rho (\theta) \quad where \quad \rho(\theta) =\mathbb{E}_{(x,y)\sim D}[\max_{\delta \in S} L(\theta, x+\delta, y)].
θ min ? ρ ( θ ) w h e r e ρ ( θ ) = E ( x , y ) ? D ? [ δ ∈ S max ? L ( θ , x + δ , y ) ] . ( 2 . 1 )
其中
S
S
S 是我们指定的摄动集合, 直接一点就是
∣
δ
∣
<
c
o
n
s
t
a
n
t
|\delta| <constant
∣ δ ∣ < c o n s t a n t 之类.
通过FGSM产生"坏"样本:
x
+
?
?
s
g
n
(
?
x
L
(
θ
,
x
,
y
)
)
.
x + \epsilon \: \mathrm{sgn}(\nabla_x L(\theta,x,y)).
x + ? s g n ( ? x ? L ( θ , x , y ) ) . 这个思想是很直接的(从线性感知器谈起, 具体看here).
PGD的思路是, 给定摄动集
S
S
S , 比如小于某个常数的摄动(e.g.
{
x
~
:
∥
x
?
x
~
∥
∞
<
c
}
\{\tilde{x}:\|x-\tilde{x}\|_{\infty}<c\}
{ x ~ : ∥ x ? x ~ ∥ ∞ ? < c } ), 多次迭代寻找合适的adversarial samples:
x
t
+
1
=
∏
x
+
S
(
x
t
+
α
?
s
g
n
(
?
x
L
(
θ
,
x
,
y
)
)
,
x^{t+1} = \prod_{x+S} (x^t + \alpha \: \mathrm{sgn} (\nabla_x L(\theta,x, y)),
x t + 1 = x + S ∏ ? ( x t + α s g n ( ? x ? L ( θ , x , y ) ) , 其中
∏
\prod
∏ 表示投影算子, 假设
S
=
{
x
~
:
∥
x
?
x
~
∥
∞
<
c
}
S=\{\tilde{x}:\|x-\tilde{x}\|_{\infty}<c\}
S = { x ~ : ∥ x ? x ~ ∥ ∞ ? < c } ,
x
t
+
1
=
arg
?
min
?
z
∈
x
+
S
1
2
∥
z
?
(
x
t
+
α
?
s
g
n
(
?
x
L
(
θ
,
x
,
y
)
)
∥
2
2
,
x^{t+1} = \arg \min_{z \in x+S} \frac{1}{2} \|z - (x^t + \alpha \: \mathrm{sgn} (\nabla_x L(\theta,x, y))\|_2^2,
x t + 1 = arg z ∈ x + S min ? 2 1 ? ∥ z ? ( x t + α s g n ( ? x ? L ( θ , x , y ) ) ∥ 2 2 ? , 实际上, 可以分开讨论第
(
i
,
j
)
(i,j)
( i , j ) 个元素,
y
:
=
(
x
t
+
α
?
s
g
n
(
?
x
L
(
θ
,
x
,
y
)
)
y:=(x^t + \alpha \: \mathrm{sgn} (\nabla_x L(\theta,x, y))
y : = ( x t + α s g n ( ? x ? L ( θ , x , y ) ) , 只需找到
z
i
j
z_{ij}
z i j ? 使得
∥
z
i
j
?
y
i
j
∥
2
\|z_{ij}-y_{ij}\|_2
∥ z i j ? ? y i j ? ∥ 2 ? 最小即可. 此时有显示解为:
z
i
j
=
{
x
i
j
+
c
y
i
j
>
x
i
j
+
c
x
i
j
?
c
y
i
j
<
x
i
j
?
c
y
i
j
e
l
s
e
.
z_{ij}= \left \{ \begin{array}{ll} x_{ij} +c & y_{ij} > x_{ij}+c \\ x_{ij} -c & y_{ij} < x_{ij}-c \\ y_{ij} & else. \end{array} \right.
z i j ? = ? ? ? ? x i j ? + c x i j ? ? c y i j ? ? y i j ? > x i j ? + c y i j ? < x i j ? ? c e l s e . ? 简而言之就是一个截断.
重复几次, 至到
x
t
x^t
x t 被判断的类别与初始的
x
x
x 不同或者达到最大迭代次数.
Note
如果我们训练网络能够免疫PGD的攻击, 那么其也能很大一部分其它的攻击.
FGSM对抗训练不能提高网络的稳定性(在摄动较大的时候).
weak models may fail to learn non-trival classfiers.
网络越强(参数等程度)训练出来的稳定性越好, 同时可转移(指adversarial samples 在多个网络中被误判)会变差.