1 00:00:00,000 --> 00:00:06,860 The next presentation is from Vincent Zhao and Yao Zhao. 2 00:00:10,220 --> 00:00:13,420 They bring us high-frequency targeted attacks. 3 00:00:13,860 --> 00:00:19,000 They used this method to win the CAR-CTF yesterday. 4 00:00:21,300 --> 00:00:22,420 Thank you, Hai Bing. 5 00:00:23,520 --> 00:00:25,300 Hi, my name is Yao Zhao. 6 00:00:25,420 --> 00:00:27,180 This is my friend Vincent Zhao. 7 00:00:27,180 --> 00:00:32,000 We're both NLP researchers, and in our spare time, 8 00:00:32,100 --> 00:00:35,580 we work on adversarial attack and defenses for neural networks. 9 00:00:35,980 --> 00:00:39,600 And today, we're going to talk about our method, 10 00:00:40,110 --> 00:00:41,700 high-frequency targeted attacks, 11 00:00:42,480 --> 00:00:45,940 that we used in yesterday's CAD computation. 12 00:00:47,880 --> 00:00:52,500 So in the first half, I'm going to introduce some basic concepts 13 00:00:52,500 --> 00:00:54,800 of adversarial attacks and defense. 14 00:00:55,160 --> 00:00:56,560 And then in the second part, 15 00:00:56,560 --> 00:00:58,880 we're going to talk about our techniques in the computation. 16 00:00:59,780 --> 00:01:07,380 So neural networks are becoming a lot more popular in image classification 17 00:01:07,380 --> 00:01:09,720 and are deployed in a lot of commercial systems. 18 00:01:10,260 --> 00:01:14,600 In this case, when an image is given to a neural network, 19 00:01:14,720 --> 00:01:16,500 the network takes in the raw pixel 20 00:01:16,500 --> 00:01:20,200 and calculates the activation through a lot of hidden layers 21 00:01:20,200 --> 00:01:23,880 and then outputs a final label for the image. 22 00:01:24,080 --> 00:01:26,440 In a popular case like ImageNet, 23 00:01:26,560 --> 00:01:30,300 there can be a thousand labels for an image. 24 00:01:30,500 --> 00:01:35,480 And an adversarial attack against a neural network 25 00:01:35,480 --> 00:01:40,380 is that we apply some small perturbation on the input image 26 00:01:40,380 --> 00:01:45,020 and make the prediction of the neural network fail to another class. 27 00:01:45,180 --> 00:01:49,920 In this case, we changed a correct label from snail to fox. 28 00:01:52,000 --> 00:01:55,820 There are generally two types of labels. 29 00:01:59,360 --> 00:02:01,800 The first one is non-targeted attacks. 30 00:02:02,380 --> 00:02:09,060 It basically changes the correct label to any non-correct label 31 00:02:09,060 --> 00:02:10,400 without a specific target. 32 00:02:10,640 --> 00:02:12,820 The other one is the targeted attacks. 33 00:02:13,040 --> 00:02:16,560 That is to give a target and perturb the image 34 00:02:17,360 --> 00:02:21,420 to have it classified wrong in the other target. 35 00:02:21,960 --> 00:02:25,560 So the method of constructing adversarial images, 36 00:02:26,560 --> 00:02:31,280 the most popular method is the gradient-based attack. 37 00:02:32,820 --> 00:02:37,840 When given an input image and the neural network, 38 00:02:37,980 --> 00:02:44,760 we can calculate the loss through the neural network 39 00:02:44,760 --> 00:02:48,420 and calculate the gradients back to the image. 40 00:02:48,620 --> 00:02:53,940 And then if we perturb the image in the way that is opposite to the gradients, 41 00:02:54,080 --> 00:02:56,460 then we can get an adversarial image, 42 00:02:56,560 --> 00:02:58,700 which that can fool the original neural network. 43 00:03:00,380 --> 00:03:04,740 A more powerful attack is the iterative attack. 44 00:03:05,020 --> 00:03:11,480 It applies the same gradient method again and again over many iterations. 45 00:03:11,940 --> 00:03:13,760 And as you can see in the curve, 46 00:03:13,900 --> 00:03:18,780 the more iterations we apply this method, 47 00:03:19,660 --> 00:03:23,840 the higher successful rate the attack can be. 48 00:03:27,300 --> 00:03:30,040 In a realistic system, 49 00:03:30,260 --> 00:03:33,360 there can be black-box attacks and white-box attacks. 50 00:03:34,040 --> 00:03:37,460 So for white-box attacks, 51 00:03:38,840 --> 00:03:41,480 the attacker have access to the model weights. 52 00:03:42,160 --> 00:03:46,760 In this case, gradient attack can be applied 53 00:03:46,760 --> 00:03:50,140 and the gradients can be accurately calculated. 54 00:03:50,540 --> 00:03:53,920 Usually the attack success rate is very, very high. 55 00:03:54,080 --> 00:03:55,740 In the black-box case, 56 00:03:55,740 --> 00:03:58,760 model weights are not accessible to attackers. 57 00:03:59,160 --> 00:04:02,180 So as to successfully attack a neural network, 58 00:04:02,360 --> 00:04:08,000 we need to either guess the neural network the defender is using 59 00:04:08,000 --> 00:04:13,480 or ensemble a lot of neural networks and attack them at the same time. 60 00:04:15,940 --> 00:04:17,660 For those ensemble attacks, 61 00:04:20,900 --> 00:04:24,480 like single neural network attack, 62 00:04:24,760 --> 00:04:25,160 we, 63 00:04:25,480 --> 00:04:25,720 like single neural network attack, 64 00:04:25,720 --> 00:04:30,860 add the loss function of many different kinds of neural networks together 65 00:04:31,380 --> 00:04:36,280 and calculate the gradients back through all of the neural network at the same time 66 00:04:36,280 --> 00:04:39,620 and apply the same gradient-based attack as the previous step. 67 00:04:43,320 --> 00:04:47,020 So in this competition, 68 00:04:47,360 --> 00:04:50,140 we focused on the targeted attack. 69 00:04:50,910 --> 00:04:54,230 And the target attack has some specific behavior. 70 00:04:55,700 --> 00:04:59,500 That when you use the attack method on model, 71 00:04:59,740 --> 00:05:04,620 it usually doesn't transfer to a different model. 72 00:05:04,900 --> 00:05:07,560 In this case, we have a lot of a different attack method 73 00:05:07,560 --> 00:05:09,780 on the rows and columns. 74 00:05:10,100 --> 00:05:12,240 And they can only attack the model, 75 00:05:15,500 --> 00:05:18,480 they can only attack the defender using the same model. 76 00:05:18,720 --> 00:05:25,060 And rarely, the attack images rarely apply to new defenders. 77 00:05:26,960 --> 00:05:29,780 So Vincent is going to talk about this computation 78 00:05:29,780 --> 00:05:32,140 and the method and system we're using. 79 00:05:32,660 --> 00:05:35,720 Okay, so thank you, Yao, for the introduction. 80 00:05:36,060 --> 00:05:39,700 So something I want to add is, for example, here. 81 00:05:39,860 --> 00:05:44,480 So you see that, especially for a targeted attack, 82 00:05:44,860 --> 00:05:46,480 the image is not transferable. 83 00:05:46,580 --> 00:05:50,460 So which means you have to guess. 84 00:05:50,640 --> 00:05:54,420 So first thing is that it's really expensive to train a new model. 85 00:05:54,420 --> 00:05:58,720 So we think that in practice, so people usually, 86 00:05:59,020 --> 00:06:01,560 I mean, if you work on the ImageNet datasets, 87 00:06:01,920 --> 00:06:05,220 usually people will use the pre-existing, pre-trained model, right? 88 00:06:05,340 --> 00:06:07,260 Instead of train their own model. 89 00:06:07,480 --> 00:06:11,320 So they only have, like, a couple of dozens of models out there. 90 00:06:11,560 --> 00:06:13,920 So the question is if we can attack them all, 91 00:06:14,040 --> 00:06:16,980 so we can, with high probability, attack any system. 92 00:06:17,120 --> 00:06:22,740 Because we assume that people are using ensembles of those models, 93 00:06:22,840 --> 00:06:24,300 some combination of them, too. 94 00:06:24,420 --> 00:06:24,820 So we do the defense. 95 00:06:25,040 --> 00:06:27,060 So that's our assumption. 96 00:06:27,420 --> 00:06:31,140 And it's basically the case, actually. 97 00:06:31,360 --> 00:06:33,640 And then the other thing is that it's not transferable. 98 00:06:33,820 --> 00:06:38,340 So that means if somebody is using, like, the Inception V3 99 00:06:38,340 --> 00:06:39,340 and we don't have that model, 100 00:06:39,480 --> 00:06:43,240 so it's really hard for us to build an attack model, 101 00:06:43,600 --> 00:06:47,320 an adversarial image to attack that model 102 00:06:47,320 --> 00:06:49,980 without using that model to generate the image. 103 00:06:52,620 --> 00:06:54,400 So what's for the next slide? 104 00:06:54,420 --> 00:06:56,340 So for competition, what's important here? 105 00:06:56,520 --> 00:07:00,680 So we are allowed to submit our attack every six seconds. 106 00:07:01,020 --> 00:07:03,720 So that's the budget we have. 107 00:07:03,880 --> 00:07:07,180 So the competition runs for, like, 30 minutes. 108 00:07:07,260 --> 00:07:10,960 So that means we can try 300 times or maybe 200 times. 109 00:07:11,300 --> 00:07:18,020 So the key here is we want to try different combinations of ensembles 110 00:07:18,020 --> 00:07:19,080 and to generate the image. 111 00:07:19,280 --> 00:07:20,700 But we want to do that really fast. 112 00:07:20,860 --> 00:07:21,520 So how to do that? 113 00:07:24,420 --> 00:07:26,540 So basically it's quite simple. 114 00:07:26,760 --> 00:07:30,320 I mean, so we run a multi-thread program. 115 00:07:30,500 --> 00:07:35,140 So there is one thread which do the submission. 116 00:07:35,400 --> 00:07:39,740 So the submission is controlled by one thread. 117 00:07:40,140 --> 00:07:42,900 And the image is put into the double-ended queue. 118 00:07:43,180 --> 00:07:49,260 And we have an automatic generator to generate an image 119 00:07:49,260 --> 00:07:52,420 as well as a manual generator. 120 00:07:52,760 --> 00:07:53,820 So automatically generated, 121 00:07:53,820 --> 00:07:56,600 so we have some prefixed ensembles combinations. 122 00:07:57,040 --> 00:07:58,780 We have, like, 50 of them. 123 00:07:59,020 --> 00:08:01,260 And we will try them all. 124 00:08:01,340 --> 00:08:02,380 So it's fully automatic. 125 00:08:02,880 --> 00:08:06,560 And to make it run fast, so you have to... 126 00:08:07,640 --> 00:08:10,740 I mean, the technical details is basically we use a TensorFlow, 127 00:08:10,960 --> 00:08:13,300 and the TensorFlow is pretty slow to build the graph. 128 00:08:13,840 --> 00:08:16,040 The build graph takes, like, 30 seconds. 129 00:08:16,220 --> 00:08:18,960 So you don't want to build a graph for each iteration. 130 00:08:19,200 --> 00:08:22,220 So we want to reuse the graph, but we want to change the ensembles. 131 00:08:22,220 --> 00:08:26,640 So for each ensemble, you have some weights, right? 132 00:08:26,740 --> 00:08:29,580 So weights is as an input, so not a graph. 133 00:08:29,920 --> 00:08:33,120 And the bad thing for TensorFlow is, like, 134 00:08:34,040 --> 00:08:37,260 for example, in this batch, you don't want to use that model. 135 00:08:37,420 --> 00:08:39,540 So you don't want to evaluate that model, right? 136 00:08:39,820 --> 00:08:41,680 But TensorFlow didn't support that. 137 00:08:41,860 --> 00:08:44,180 So there's some space you can improve that. 138 00:08:44,280 --> 00:08:46,540 But basically, right now it's, like, 139 00:08:46,560 --> 00:08:49,180 if you have five models in your ensemble, 140 00:08:49,340 --> 00:08:52,020 so no matter you use it or not, 141 00:08:52,020 --> 00:08:54,440 so TensorFlow will always evaluate that model. 142 00:08:54,620 --> 00:08:57,100 So it takes time, but still good enough. 143 00:08:57,780 --> 00:09:00,940 And so that's basically for our automatic generator. 144 00:09:01,120 --> 00:09:02,640 And for manual generators, 145 00:09:02,760 --> 00:09:05,320 we will look at the results of the feedbacks 146 00:09:05,320 --> 00:09:08,060 and come up with some combinations we think might work 147 00:09:08,060 --> 00:09:11,280 and submit that job to CPU. 148 00:09:11,680 --> 00:09:14,220 So automatic generator is run on GPU. 149 00:09:14,600 --> 00:09:18,740 And manual generator is run on CPU, 150 00:09:18,900 --> 00:09:21,120 so that they will not compete 151 00:09:21,120 --> 00:09:22,700 for our memories. 152 00:09:23,840 --> 00:09:26,760 But definitely manual generator is slower. 153 00:09:27,240 --> 00:09:28,460 So that's our strategy. 154 00:09:28,880 --> 00:09:33,260 And so, yeah, so what you can see yesterday 155 00:09:33,260 --> 00:09:36,740 is, like, we attack everybody crazy, right? 156 00:09:36,880 --> 00:09:40,380 So, I mean, the success rate is not high, 157 00:09:40,480 --> 00:09:44,340 but as long as we can get some scores, that's fine. 158 00:09:44,540 --> 00:09:45,820 So that's what we do. 159 00:09:46,300 --> 00:09:47,500 That's what we did yesterday. 160 00:09:48,280 --> 00:09:49,640 Yeah, our strategy. 161 00:09:51,160 --> 00:09:52,160 Yeah, thank you. 162 00:09:52,540 --> 00:09:53,060 Question? 163 00:09:57,660 --> 00:09:59,940 Oh, it's tremendous, yeah. 164 00:10:00,260 --> 00:10:04,000 Yeah, so it's like if you use our model. 165 00:10:04,300 --> 00:10:06,460 So our biggest ensemble is that we use seven models. 166 00:10:06,820 --> 00:10:09,360 So to build a graph, it takes, like, 30 seconds. 167 00:10:09,920 --> 00:10:11,440 And then to do the computation, 168 00:10:11,840 --> 00:10:15,760 I mean, we compute 10 images at once. 169 00:10:16,020 --> 00:10:17,800 So 10 images takes, like, 20 seconds. 170 00:10:18,540 --> 00:10:21,000 But for CPU, 171 00:10:21,720 --> 00:10:24,440 if you do the same thing for just one image, 172 00:10:25,340 --> 00:10:27,860 it takes, like, four minutes. 173 00:10:28,320 --> 00:10:29,380 Something like that, yeah. 174 00:10:29,960 --> 00:10:32,340 So different scale, yeah. 175 00:10:32,480 --> 00:10:34,280 So you basically, so in CTF, 176 00:10:34,280 --> 00:10:35,680 you probably did, like, one. 177 00:10:35,800 --> 00:10:37,780 You guys do, like, one main work type program? 178 00:10:37,980 --> 00:10:39,680 Yeah, yeah, yeah, so we, yeah, 179 00:10:39,740 --> 00:10:41,540 we heavily rely on the automatic, 180 00:10:41,740 --> 00:10:44,220 so those predefined ensembles. 181 00:10:44,300 --> 00:10:46,080 So we guess them, you know, 182 00:10:46,160 --> 00:10:48,020 we guess, okay, those people might use them. 183 00:10:48,480 --> 00:10:50,440 So that's the strategy. 184 00:10:50,440 --> 00:10:52,900 Yeah, because nowadays, we still believe that. 185 00:10:52,920 --> 00:10:54,640 So for the black box text, 186 00:10:54,840 --> 00:10:57,740 the key is to guess what model 187 00:10:57,740 --> 00:10:59,840 the opponent is using, right? 188 00:11:00,680 --> 00:11:00,700 Yeah. 189 00:11:03,120 --> 00:11:03,720 Cool. 190 00:11:05,620 --> 00:11:06,380 Thank you. 191 00:11:15,120 --> 00:11:17,060 Thanks, Vincent and Yao. 192 00:11:17,520 --> 00:11:20,140 So this is the last presentation. 193 00:11:20,440 --> 00:11:23,840 Yeah, we're finished this morning. 194 00:11:24,060 --> 00:11:24,540 Okay. 195 00:11:28,220 --> 00:11:29,040 Thanks, everyone.