Xiao C, Li B, Zhu J, et al. Generating Adversarial Examples with Adversarial Networks[J]. arXiv: Cryptography and Security, 2018.
@article{xiao2018generating,
title={Generating Adversarial Examples with Adversarial Networks},
author={Xiao, Chaowei and Li, Bo and Zhu, Junyan and He, Warren and Liu, Mingyan and Song, Dawn},
journal={arXiv: Cryptography and Security},
year={2018}}
概
本文利用GAN生成adversarial samples.
主要內容
其中G \mathcal{G} G 是生成器, D \mathcal{D} D 是用於判別真假的判別器, 二者都是需要訓練的, 而f f f 是已知的我們需要攻擊的模型(在white-box下是不需要訓練的).
訓練判別器很普通的GAN是類似的, 即最大化下式:
L G A N = E x log D ( x ) + E x log ( 1 − D ( x + G ( x ) ) ) . (1)
\tag{1}
\mathcal{L}_{GAN} = \mathbb{E}_{x} \log \mathcal{D}(x) + \mathbb{E}_{x} \log (1-\mathcal{D}(x+\mathcal{G}(x))).
L G A N = E x log D ( x ) + E x log ( 1 − D ( x + G ( x ) ) ) . ( 1 )
訓練生成器, 除了L G A N \mathcal{L}_{GAN} L G A N , 還需要
L a d v f = E x ℓ f ( x + G ( x ) , t ) , (2)
\tag{2}
\mathcal{L}_{adv}^f = \mathbb{E}_x \ell_f (x+\mathcal{G}(x),t),
L a d v f = E x ℓ f ( x + G ( x ) , t ) , ( 2 )
其中t t t 是我們所需要的攻擊目標(注意這裏通過對ℓ \ell ℓ 的一些額外的選擇, 是可以用到untargeted attack的).
L h i n g e = E x max ( 0 , ∥ G ( x ) ∥ 2 − c ) , (3)
\tag{3}
\mathcal{L}_{hinge} = \mathbb{E}_x \max (0, \|\mathcal{G}(x)\|_2 -c),
L h i n g e = E x max ( 0 , ∥ G ( x ) ∥ 2 − c ) , ( 3 )
顯然(3)是保證攝動不要太大.
所以訓練生成器是最小化
L = L a d v f + α L G A N + β L h i n g e . (4)
\tag{4}
\mathcal{L}=\mathcal{L}_{adv}^f+ \alpha \mathcal{L}_{GAN} + \beta \mathcal{L}_{hinge}.
L = L a d v f + α L G A N + β L h i n g e . ( 4 )
black-box 拓展
該方法可以拓展到black-box上, 假設b ( x ) b(x) b ( x ) 是目標網絡, 其結構和訓練數據都是未知的, 此時我們構建一個替代網絡f ( x ) f(x) f ( x ) 用於逼近b ( x ) b(x) b ( x ) . 利用交替訓練, 更新生成器G \mathcal{G} G 和f f f .
固定f i − 1 f_{i-1} f i − 1 , 更新G i \mathcal{G}_i G i : G i \mathcal{G}_i G i 初始化參數爲G i − 1 \mathcal{G}_{i-1} G i − 1 , 則
G i , D i = arg min G max D L a d v f + α L G A N + β L h i n g e .
\mathcal{G}_i, \mathcal{D}_i = \arg \min _{\mathcal{G}} \max_{\mathcal{D}} \mathcal{L}_{adv}^f+ \alpha \mathcal{L}_{GAN} + \beta \mathcal{L}_{hinge}.
G i , D i = arg G min D max L a d v f + α L G A N + β L h i n g e .
固定G i \mathcal{G}_i G i , 更新f i f_i f i : 初始化f i f_i f i 的參數爲f i − 1 f_{i-1} f i − 1 , 則
f i = arg min f E x H ( f ( x ) , b ( x ) ) + E x H ( f ( x + G i ( x ) ) , b ( x + G i ( x ) ) ) .
f_i=\arg \min_f \mathbb{E}_x \mathcal{H} (f(x), b(x)) + \mathbb{E}_x \mathcal{H} (f(x+\mathcal{G}_i(x)), b(x+\mathcal{G}_i(x))).
f i = arg f min E x H ( f ( x ) , b ( x ) ) + E x H ( f ( x + G i ( x ) ) , b ( x + G i ( x ) ) ) .
其中H \mathcal{H} H 表示交叉熵損失.