Adversarial Reprogramming Revisited
Anonymous Author(s)
AffiliationAddress email
Abstract
Adversarial reprogramming, introduced by Elsayed, Goodfellow, and SohlDickstein, seeks to repurpose a neural network to perform a different task, bymanipulating its input without modifying its weights.
We prove that two-layer
ReLU neural networks with random weights can be adversarially reprogrammed toachieve arbitrarily high accuracy on Bernoulli data models over hypercube vertices,provided the network width is no greater than its input dimension.
We also substantially strengthen a recent result of Phuong and Lampert on directional convergenceof gradient flow, and obtain as a corollary that training two-layer ReLU neuralnetworks on orthogonally separable datasets can cause their adversarial reprogramming to fail.
We support these theoretical results by experiments that demonstratethat, as long as batch normalisation layers are suitably initialised, even untrainednetworks with random weights are susceptible to adversarial reprogramming.
Thisis in contrast to observations in several recent works that suggested that adversarialreprogramming is not possible for untrained networks to any degree of reliability.
Introduction
Elsayed, Goodfellow, and Sohl-Dickstein [2019] proposed adversarial reprogramming : given aneural network N which performs a task F : X → Y and given an adversarial task G : (cid:101)
X
→ (cid:101) Y ,repurpose N to perform G by finding mappings h in : (cid:101)
X
→ X and h out : Y → (cid:101) Y such that
G ≈ h out ◦ F ◦ h in .
They focused on a setting where F and G are image classification tasks, X consistsof large images,
(cid:101) X consists of small images, and h in and h out are simple and computationallyinexpensive: h in ( (cid:101) x )
= p + (cid:101) x draws the input (cid:101) x at the centre of the adversarial program p , and h out isa hard coded mapping from the class labels Y to the class labels (cid:101) Y .
Then the challenge of adversarialreprogramming is to find p such that h out ◦ F ◦ h in approximates well the adversarial task G .
Remarkably, Elsayed et al.
[2019] showed that a range of realistic neural networks can be adversariallyreprogrammed to perform successfully several tasks.
They considered six architectures trained on
ImageNet [Russakovsky, Deng, Su, Krause, Satheesh, Ma, Huang, Karpathy, Khosla, Bernstein, Berg,and Fei-Fei, 2015] and found adversarial programs that achieve very good accuracies on a countingtask, MNIST [LeCun, Bottou, Bengio, and Haffner, 1998], and CIFAR-10 [Krizhevsky, 2009].
Inaddition to the basic setting, they investigated limiting the visibility of the adversarial program byrestricting its size or scale, or even concealing both the input and the adversarial program by hidingthem within a normal image from ImageNet, and obtained good results.
Adversarial reprogramming can be seen as taking the crafting of adversarial examples [Biggio, Corona,
Maiorca, Nelson, Šrndi´c, Laskov, Giacinto, and Roli, 2013, Szegedy, Zaremba, Sutskever, Bruna,
Erhan, Goodfellow, and Fergus, 2014] to a next level.
Like the universal adversarial perturbation of
Moosavi-Dezfooli, Fawzi, Fawzi, and Frossard [2017], a single adversarial program is combinedwith every input from the adversarial task, but in contrast to the former where the goal is to cause natural images to be misclassified with high probability, adversarial reprogramming seeks a highaccuracy of classification for the given adversarial task.
Adversarial reprogramming is also related to transfer learning [Raina, Battle, Lee, Packer, and Ng,2007, Mesnil, Dauphin, Glorot, Rifai, Bengio, Goodfellow, Lavoie, Muller, Desjardins, Warde-Farley,
Vincent, Courville, and Bergstra, 2011], however with important differences.
Whereas transferlearning methods use the knowledge obtained from one task as a base for learning to perform another,and allow model parameters to be changed for the new task, in adversarial reprogramming the newtask may bear no similarity with the old, and the model cannot be altered but has to be manipulatedthrough its input.
The latter features are suggestive of potential nefarious uses of adversarial reprogramming, and
Elsayed et al.
[2019] list several, such as repurposing computational resources to perform a task whichviolates the ethics code of system providers.
However, its further explorations have demonstratedutility for virtuous deployments to medical image classification [Tsai, Chen, and Ho, 2020], naturallanguage processing [Hambardzumyan, Khachatrian, and May, 2021, Neekhara, Hussain, Dubnov,and Koushanfar, 2019, Neekhara, Hussain, Du, Dubnov, Koushanfar, and McAuley, 2022], moleculetoxicity prediction [Vinod, Chen, and Das, 2020], and time series classification [Yang, Tsai, and
Chen, 2021].
In the last three works, adversarial reprogramming was achieved between differentdomains, e.g. repurposing neural networks trained on ImageNet to perform classification of DNAsequences, and of natural language sentiments and topics.
In spite of the variety of fruitful applications, it is still largely a mystery when adversarial reprogramming is possible and why.
In the only work in this direction, Zheng, Feng, Xia, Jiang, Demontis,
Pintor, Biggio, and Roli [2021] proposed the alignment ∥ g ∥ 1 / ( 1 / n (cid:80) i ∥ g i ∥ 1 ) of the gradients
g i ofthe inputs from the adversarial task with their average g as the main indication of whether adversarialreprogramming will succeed.
However, their experiments did not show a significant correlationbetween accuracy after reprogramming and the gradient alignment before reprogramming.
Thecorrelation was statistically significant with the gradient alignment after reprogramming, but that isunsurprising and it is unclear how to use it for predicting success.
Specifically, a central question on adversarial reprogramming is:
Can neural networks with random weights be adversarially reprogrammed, and more generally, how does training impact adversarial reprogrammability?
First, addressing this question is important for assessing scope of two claims made in the literature:“[Adversarial] reprogramming usually fails when applied to untrained networks” [Zheng et al.
In addition to networks trained on ImageNet, Elsayed et al.
[2019] experimented using thesame architectures untrained, i.e. with random weights, and obtained generally poor results.
Similarly,the experimental results of Neekhara et al.
[2019] and Zheng et al.
[2021] for random networks aresignificantly worse than their experimental results for trained networks.
However, they remarked thatthis was surprising given the known richness of random networks (see e.g. He, Wang, and Hopcroft[2016c], Lee, Bahri, Novak, Schoenholz, Pennington, and Sohl-Dickstein [2018]), and that it waspossibly due to simple reasons such as poor scaling of the random weights.
“The original task the neural networks perform is important for adversarial reprogramming”
[Elsayed et al., 2019].
Nevertheless a number experimental results including those of Tsai et al.
Neekhara et al.
[2022], Vinod et al.
[2020], Yang et al.
[2021], Zheng et al.
[2021] demonstratedsuccessful adversarial reprogramming between tasks that are seemingly unrelated (e.g. repurposingnetworks trained on ImageNet to act as HCL2000 [Zhang, Guo, Chen, and Li, 2009] classifiers) orfrom different domains, so the interaction between the original and adversarial tasks remains unclear.
Second, the question above is important because of implications for the following two appliedconsiderations:
Disentangling architecture and training as factors in adversarial reprogrammability.
Clarifyingthe respective bearings on adversarial reprogramming success of the network architecture and of thetask (if any) it was trained for would improve decision making, either to maximise the success inbeneficial scenarios or to minimise it in detrimental ones.
Managing the cost of adversarial reprogramming.
Understanding when training the network is notessential, and when training for longer does not help or even hinders adversarial reprogrammability,should make it possible to control better the economic and environmental costs.
1.1 Our contributions
We initiate a theoretical study of adversarial reprogramming.
In it we focus on two-layer neuralnetworks with ReLU activation, and on adversarial tasks given by the Bernoulli distributions of Schmidt, Santurkar, Tsipras, Talwar, and M ˛adry [2018] over hypercube vertices.
The latter are binaryclassification data models in which the two classes are represented by opposite hypercube vertices,and when sampling a data point for a given class, we flip each coordinate of the corresponding classvertex with a certain probability.
This probability is a parameter that controls the difficulty of theclassification task.
These data models are inspired by the MNIST dataset because MNIST imagesare close to binary (many pixels are almost fully black or white).
The remaining parameters are theradius of the hypercube, the input dimension of the neural network, and its width.
We prove that, in this setting, for networks with random weights, adversarial programs exist thatachieve arbitrarily high accuracy on the Bernoulli adversarial tasks.
This holds for a wide variety ofparameter regimes, provided the network width is no greater than its input dimension.
The adversarialprograms we construct depend on the weights of the network and on the class vertices (i.e. thedirection) of the Bernoulli data model, and their Euclidean length is likely to be close to the squareroot of the input dimension.
We present these results in Section 2. We also prove that, in the same setting, training the network on orthogonally separable datasets cancause adversarial reprogramming to fail.
Phuong and Lampert [2021] recently showed that, underseveral assumptions, training a two-layer ReLU network on such datasets by gradient flow makesit converge to a linear combination of two maximum-margin neurons; and subsequently Wang and
Pilanci [2022] obtained in a different manner the same conclusion under the same assumptions.
Weprovide a simpler proof of a significantly stronger result: we show that the assumptions in Phuongand Lampert [2021] and Wang and Pilanci [2022] of small initialisation, and of positive and negativesupport examples spanning the whole space, are not needed; and we generalise to the exponentialloss function as well as the logistic one.
We then observe that, for any Bernoulli data model whosedirection is in a half-space of the difference of the maximum-margin neurons, and for any adversarialprogram, the accuracy tends to 1 / 2 (i.e. approaches guessing) under a mild assumption on the growthrate of the difficulty of the data model. We present these results in Section 3.
Both for the neworks with random weights and for the networks trained for long on orthogonallyseparable datasets, we then show that similar theoretical results can be obtained with a different kindof adversarial task, namely those given by the Gaussian distributions also of Schmidt et al.
The latter are mixtures of two spherical multivariate Gaussians, one per data class.
Please see theappendix.
In the experimental part of our work, we demonstrate that, as long as batch normalisation layersare suitably initialised, even untrained networks with random weights are susceptible to adversarialreprogramming.
Both the random weighs and the batch normalisation layers are kept fixed throughoutthe finding of adversarial programs and their evaluation.
Our experiments are conducted with sixrealistic network architectures and MNIST as the adversarial task.
We investigate two differentschemes to combine input images with adversarial programs: replacing the centre of the programby the image as was done by Elsayed et al.
[2019], and scaling the image to the size of the programand then taking a convex combination of the two.
Each of the two schemes has a ratio parameter,and we explore their different values.
We find that the second scheme gives better results in ourexperiments, and that for some choices of the ratio parameter, the accuracies on the test set acrossall six architectures are not far below what Elsayed et al.
[2019] reported for networks trained on ImageNet.
Please see Section 4.
We conduct the same experiments also on the more challenging Fashion-MNIST [Xiao, Rasul, and
Vollgraf, 2017] and Kuzushiji-MNIST [Clanuwat, Bober-Irizar, Kitamoto, Lamb, Yamamoto, and
Ha, 2018] datasets, and obtain broadly similar results, however with lower test accuracies in severalcases; they are reported in the appendix.
For a further discussion of relations with other works, please see the appendix.
We conclude the paper in Section 5, where we discuss limitations of our work and suggest directionsfor future work.
Random networks
Basic notations.
We write: [ n ] for the set { 1 , . . . , n } , ∥ v ∥ for the Euclidean length of a vector v ,∠ ( v , v ′ ) for the angle between v and v ′ , and H d for the d -dimensional unit hypercube {± 1 / √ d } d .
Two-layer ReLU networks.
We consider two-layer neural networks N with the ReLU activation.
We write d for the input dimension, k for the width, w 1 , . . .
, w k ∈ R d for the weights of the firstlayer, and a 1 , . . .
, a k ∈ R for the weights of the second layer.
For an input x ∈ R d , the output is thus
[Equation]
where ψ ( u ) = max { u, 0 } is the ReLU function.
Random weights.
In this section, we assume that the weights in N are random as follows:
• each w j consists of d independent centred Gaussians with variance 1 /d , and • each a j is independently uniformly distributed in {± 1 / √ k } .
This distribution is as in Bubeck, Cherapanamjeri, Gidel, and Tachet des Combes [2021], and standardfor theoretical investigations.
It is similar to He’s initialisation [He, Zhang, Ren, and Sun, 2015], withthe second layer discretised for simplicity.
The variances of the weights are such that, for any input x ∈ R d of Euclidean length √ d , each w ⊤ j xis a standard Gaussian, and for large widths k the distribution of N ( x ) is close to centred Gaussianwith variance 1 / 2 .
Bernoulli data models.
Adapting from Schmidt et al.
[2018], given a hypercube vertex ϕ ∈ H d , aradius ρ > 0 , and a class bias parameter 0 < τ ≤ 1 / 2 , we define the ( ϕ , ρ, τ ) -Bernoulli distributionover ( x , y ) ∈
ρ H d × {± 1 } as follows:
• first draw the label y uniformly at random from {± 1 } , • then sample the data point x by taking yρ ϕ and flipping the sign of each coordinateindependently with probability 1 / 2 − τ .
These binary classification data models on hypercube vertices are inspired by the MNIST dataset [LeCun et al., 1998].
The class bias parameter τ controls the difficulty of the classification task, whichincreases as τ tends to zero, i.e. as 1 /τ tends to infinity.
In this section and the next, we consider adversarial tasks that are ( ϕ , ρ, τ ) -Bernoulli data models,and investigate variations of the parameters ϕ , ρ and τ .
Adversarial program.
In this section, we assume that k ≤ d , i.e. the network width is no greaterthan the input dimension, and we define an adversarial program p which depends on the weights ofthe network N and on the direction ϕ of the Bernoulli data model.
With probability 1 , for all j ∈ [ k ], we have that a j w ⊤ j ϕ ̸ = 0 .
Let us write K + for { j ∈ [ k ] |a
j w ⊤ j ϕ > 0 } , and K − for { j ∈ [ k ] | a j w ⊤ j ϕ < 0 } .
Then, for all j ∈ [ k ], let:
[Equation]
Since k ≤ d , with probability 1 , the weights vectors w j are linearly independent, i.e. the k × dmatrix W whose rows are w j has a positive smallest singular value s min ( W ) .
Hence p ∈ R d existssuch that
[Equation]
The neurons in K + can be thought of as “helpful” for the adversarial task, and those in K − as“unhelpful”.
This definition of an adversarial program p ensures that its effect is to introduce asfirst-layer biases the entries of the vector p ′ .
They are 0 (i.e. do nothing) for every “helpful” neuron,and the negative value − (cid:112) d/ | K − | (i.e. reduce the contribution to the network output) for every“unhelpful” neuron.
From the inequalities in (1), we can expect ∥ p ∥ ≈ √ d if k = o ( d ) (see the appendix for details).
Expected reprogramming accuracy.
The accuracy for an adversarial task D is the probability thatthe sign of the output of the reprogrammed network conforms to the input label, i.e.
[Equation]
Our main result in this section is that, for sufficiently large input dimensions d , and under mildrestrictions on the growth rates of the network width k , the radius ρ and the difficulty 1 /τ of the Bernoulli data model, in expectation over the random network weights, the reprogramming accuracyis at least (1 − C 1 γ )(1 − γ † ) , which by tuning the probability parameters γ and γ † can be arbitrarilyclose to 100% .
The growth rate restrictions indicate that networks with smaller widths can bereprogrammed for tasks with larger radii, but that networks with larger widths can be reprogrammedfor tasks that are more difficult.
The proof proceeds by analysing concentrations of the underlyingdistributions and involves establishing a theorem that bounds the reprogrammed network output; thedetails can be found in the appendix.
Corollary 1.
Suppose that
[Equation]
where η ( k ) , η ( ρ ) , η ( τ ) ∈ [ 0 , 1 ] are arbitrary constants that satisfyη ( ρ ) < 1 − η ( k ) / 2 and η ( τ ) <
η ( k ) / 2 .
Then, for sufficiently large input dimensions d , the expected accuracy of the adversarially reprogrammed network N on the ( ϕ , ρ, τ ) -Bernoulli data model is arbitrarily close to 100% .
Implicit bias
Orthogonally separable dataset.
In this section, we consider training the network on a binaryclassification dataset S =
{ ( x 1 , y 1 ) , . . .
, ( x n , y n ) } ⊆
R d × {± 1 } which is orthogonally separable [Phuong and Lampert, 2021], i.e. for all i, i ′ ∈ [ n ] we have:
[Equation]
In other words, every data point can act as a linear separator, although some data points from theopposite class may be exactly orthogonal to it.
Gradient flow with exponential or logistic loss.
For two-layer ReLU networks with input dimension d and width k as before (but without the assumption k ≤ d , which is not needed in this section),we denote the vector of all weights by
[Equation]
[Equation] [Equation] [Equation] [Equation]
∈
[Equation]
k
[Equation]
) , and we write N θ for the network whose weights are the coordinates of the vector θ .
The empirical loss of N θ on S is L ( θ ) :
= (cid:80) ni
=1 ℓ ( y i N θ ( x i )) , where ℓ is either the exponentialℓ exp ( u ) =
e − u or the logistic ℓ log ( u ) =
ln(1 + e − u ) loss function.
A trajectory of gradient flow is a function θ ( t ) : [ 0 , ∞ )
→ R k ( d +1) that is an arc, i.e. it is absolutelycontinuous on every compact subinterval, and that satisfies the differential inclusiond θ d t ∈ − ∂
L ( θ ( t ))
for almost all t ∈ [ 0 , ∞ ) , where ∂ L denotes the Clarke subdifferental [Clarke, 1975] of the locally Lipschitz function L .
Gradient flow is gradient descent with infinitesimal step size.
We work with the Clarke subdifferentialin order to handle the non-differentiability of the ReLU function at zero: ∂ψ (0) is the wholeinterval [ 0 , 1 ].
At points of continuous differentiability, the Clarke subdifferential amounts to thegradient, e.g. ∂ L ( θ )
=
{∇L ( θ ) } .
For some further background, see the appendix.
Initialisation of network weights.
In this section, we assume that the initialisation isbalanced: for all j ∈ [ k ], at time t =
we have | a j | = ∥ w j ∥ > 0 ; andlive: for both signs s ∈ {± 1 } there exist i s ∈ [ n ] and j s ∈ [ k ] such that y i s =
s and at time t = 0we have y
i s a j s ψ ( w ⊤ j s x i s ) > 0 .
The balanced assumption has featured in previous work (see e.g. Phuong and Lampert [2021], Lyu,
Li, Wang, and Arora [2021]).
It ensures that it remains to hold throughout the training, and that thesigns of the second-layer weights a j do not change (see the proof of Theorem 2).
The live assumption(present probabilistically in Phuong and Lampert [2021]) is mild: it states that at least one positivelyinitialised neuron is active for at least one positive input, and the same for negative ones.
Convergence of gradient flow.
Our main result in this section establishes that the early phase oftraining necessarily reaches a point where the empirical loss is less than ℓ (0) , which implies thatthen every input is classified correctly by the network.
Perhaps surprisingly, no small initialisationassumption is needed, however the proof makes extensive use of orthogonal separability of the dataset(see the appendix, which contains all proofs for this section).
Theorem 2.
There exists a time t 0 such that L ( θ ( t 0 )) <
ℓ (0) .
This enables us to apply to the late phase recent results of Lyu and Li [2020], Ji and Telgarsky [2020],
Lyu et al.
[2021] and obtain the next corollary, which is significantly stronger than the main resultof Phuong and Lampert [2021], extending it to exponential loss, and showing that assumptions ofsmall initialisation, and of positive and negative support examples spanning the whole space, are notneeded.
The corollary establishes that each neuron converges to one of three types: a scaling of themaximum-margin vector for the positive data class, a scaling of the maximum-margin vector for thenegative data class, or zero.
The two maximum-margin vectors are defined as follows: for both signss ∈ {± 1 } , let I s :
= { i ∈ [ n ] | y i = s } , and let v s be the unique minimiser of the quadratic problemminimise
[Equation]
subject to ∀ i ∈
I s : v ⊤ x i ≥ 1 .
That a trajectory θ ( t ) converges in direction to a vector (cid:101) θ means lim t →∞ θ ( t ) /
∥ θ ( t ) ∥
= (cid:101) θ / ∥ (cid:101) θ ∥ .
Corollary 3.
As the time tends to infinity, we have that the empirical loss converges to zero, the
Euclidean norm of the weights converges to infinity, and the weights converge in direction to some θsuch that for all j ∈ [ k ] we have | a j | =
∥ w j ∥ , and if a j ̸ = 0 then
[Equation]
Thanks to homogeneity, the sign of the network output does not depend on the norm of the weights,only on their direction. Examining networks whose weights are directional limits as in Corollary 3is therefore informative of consequences for adversarial reprogramming of training for long. Thefollowing result tells us that, for any Bernoulli data model whose direction is in a half-space of thedifference of the maximum-margin vectors, and for any adversarial program, the accuracy tendsto 1 / 2 provided that the difficulty 1 /τ of the data model increases slower than the square root of theinput dimension d .
The latter assumption is considerably weaker than in the results of Schmidt et al.[2018] on the Bernoulli data model, where the bound is in terms of the fourth root.
The statementalso tells us that this failure cannot be fixed by choosing in advance a different mapping from theclass labels of the original task to the class labels of the adversarial task. Since we consider binaryclassification tasks here, the mapping can be represented by a multiplier m ∈ {± 1 } .
Proposition 4.
Suppose network weights θ are is in Corollary 3, class label mapping m ∈ {± 1 } isarbitrary, data model D is any ( ϕ , ρ, τ ) -Bernoulli distribution such that m cos ∠ ( v 1 − v − 1 , ϕ ) < 0 ,and adversarial program p is arbitrary.
Then we have that
[Equation]
Experiments
Network architectures and initialisation.
Our experiments are conducted using the following sixnetwork architectures: ResNet-
[He, Zhang, Ren, and Sun, 2016a], ResNet-50V2, ResNet-101V2, [Figure] [Figure]
ResNet-152V
[He, Zhang, Ren, and Sun, 2016b], Inception-v3 [Szegedy, Vanhoucke, Ioffe, Shlens,and Wojna, 2016], and EfficientNet-B0 [Tan and Le, 2019].
We use the networks exactly as implemented in Keras in TensorFlow 2.8.0 including the method forrandomly initialising the trainable weights.
For biases, this means they are initialised with 0 .
For allother trainable weights, mostly, the Glorot uniform initialiser [Glorot and Bengio, 2010] is used inthis implementation.
EfficientNet is an exception, where many layers instead use a truncated normaldistribution that has mean 0 and standard deviation (cid:112) 2 / number of output units.
Details of how we randomly initialise batch normalisation layers can be found in the appendix.
Combining input images with adversarial programs.
Our adversarial programs are colour imageswhose sizes match the expected input size of the networks.
This is 224 × 224 for all networks except
Inception-v3, where it is 299 × 299 .
We use two different schemes to combine input images with the adversarial program.
The firstscheme, used by Elsayed et al.
[2019], is to take the adversarial program and overwrite a portion ofit by the input image.
We do this in such a way that the input image is, up to rounding, centred inthe adversarial program.
We can vary the construction by scaling the input image up or down beforeapplying this procedure.
In particular, we use a parameter r ∈ [ 0 , 1 ] and scale the input image, usingbilinear interpolation, in such a way that r times the width of the adversarial program is equal to thewidth of the scaled image.
That we focus on the width is not important because all our inputs andprograms are square.
An illustration is shown in Figure 1.
Our second scheme involves scaling the image to the same size as the adversarial program and thentaking a convex combination of the two.
We use a parameter v ∈ [ 0 , 1 ] to specify how much weightthe input image should get in this convex combination.
Specifically, the combined image is obtainedby calculating v · I + (1 − v ) · P , where I is the input image and P is the adversarial program.
Anillustration is shown in Figure 2.
Adversarial task dataset.
Elsayed et al.
[2019] evaluate adversarial reprogramming on randomnetworks using the MNIST [LeCun et al., 1998] dataset.
In other words, they were asking whether it
[Figure]
[-Scheme0 .0 .
-]Scheme [Figure] [Figure]
v
Scheme
[Figure]
is possible to repurpose a random network for the task of classifying the handwritten digits from the
MNIST dataset.
We use the same dataset, which consists of 60 , 000 training images and 10 , 000 testimages, for our experiments.
It is available under the Creative Commons Attribution Share-Alike 3.0licence.
The networks we use classify inputs into 1 , 000 classes. We map the 10 labels of the MNIST datasetonto the first 10 of these classes. For additional experimental results on the Fashion-MNIST and Kuzushiji-MNIST datasets, pleasesee the appendix. Finding and evaluating adversarial programs.
Internally, we represent adversarial programsusing unconstrained weights.
We then apply a softsign function to the weights to map them into therange ( − 1 , 1) , and further shift and scale the program such that the pixel values lie in the same rangethat is used for the input images.
The program is initialised in such a way that after the application ofthe softsign function, each value lies uniformly at random in ( − 1 , 1) .
We use the 60 , 000 training images to run an Adam optimiser [Kingma and Ba, 2015] with learningrate 0 .
01 and a batch size of 50 to optimise the unconstrained weights of the adversarial program.
Wereport the accuracy on the 10 , 000 test images after 20 epochs, please see Figure 3.
The experiments were mainly run on two internal clusters utilising a mix of NVIDIA GPUs such as
GeForce RTX 3080 Ti, Quadro RTX 6000, GeForce RTX 3060, GeForce RTX 2080 Ti, and GeForce
GTX 1080.
Depending on the network, optimising a single adversarial program for 20 epochs takesbetween 30 minutes and 1 .
5 hours on a standard desktop computer with two NVIDIA GeForce RTX3080 Ti GPUs.
We did not explore different optimisers and learning rates, since our first choices already resulted insuitable adversarial programs for these random networks.
We only reduced the batch size to 50 afterfirst trying 100 , in order to reduce the requirement on GPU memory and be able to easily run theexperiments on a wider range of hardware.
However, we did extensively explore the two differentschemes of combing input images with adversarial programs, and different values for the respectiveparameters r and v .
For each network, and each value of r and v , we ran 5 experiments, each with anew random initialisation of the network, and are reporting the average of the test accuracy.
Discussion.
Overall, the second scheme of combining input images with adversarial programsappears to give better and more reliable results in our experiments.
For both schemes, the choice ofparameters is important.
Clearly, when r or v is 0 , the input image is not visible to the network at all.
On the other hand, when r or v is 1 , there no longer is an adversarial program.
In most cases, bestresults are achieved when the adversarial program is significantly larger (either by actual size in thefirst scheme, or in terms of pixel value ranges in the second scheme) than the input image.
In the second scheme in particular, we see accuracies on the test set which are lower, but not muchlower than what Elsayed et al.
[2019] reported for networks trained on ImageNet.
For v ≈ 0 .
046for example, we see accuracies of 91 .
8% , 72 . 0% for EfficientNet-B0,
ResNet-50, ResNet-101V2, Inception-v3, ResNet-50V2, ResNet-152V2, respectively.
This suggeststhat, while training, say, on ImageNet may impact the possibility of finding suitable adversarialprograms, such a training may be less important than previously thought and other factors are ofsignificant importance.  Conclusion and future work
We proved the first theoretical results on adversarial reprogrammability of neural networks, inwhich we focused on architectures with two layers and ReLU activations, and on Bernoulli and
Gaussian adversarial tasks.
Provided the input dimension is sufficiently large, and for a wide varietyof parameter regimes, our results show that: firstly, arbitrarily high reprogramming accuracies areachievable in expectation for networks with random weights; and secondly, reprogramming accuraciesthat are no better than guessing may be unavoidable for networks that were trained for long withsmall learning rates on orthogonally separable datasets.
In the theoretical results that conclude arbitrarily high expected reprogramming accuracies, weassumed that the width of the random network is no grater than its input dimension, which issimilar to the assumption on widths in e.g. Daniely and Shacham [2020] and enabled us to showexistence of suitable adversarial programs by matrix inversion.
Interesting directions for future workinclude relaxing this assumption, extending the whole theoretical analysis to deeper networks, andinvestigating derivation of adversarial programs by gradient methods. It would also be interesting to consider more permissive data models; however, our theoretical resultson the failure of adversarial reprogramming on networks that were trained for long rely on implicitbias properties of gradient methods, and in that area separability assumptions on training data arecommon and appear challenging to lift (see e.g. Lyu et al. The outcomes of our experiments, which are on six realistic convolutional network architecturesdesigned for image classification, and on three adversarial tasks provided by the MNIST, FashionMNIST and Kuzushiji-MNIST datasets, are consistent with our theoretical results on high reprogramming accuracies. Both the experimental plots of test accuracies and the theoretical boundsof network outputs indicate existence of “sweet spot” maximising parameter values.
1 Since in theexperiments, the network architectures have widths, depths and other features that are currentlybeyond our theoretical assumptions, and the adversarial programs are derived by gradient descent,their outcomes provide further motivation for extending the theory as suggested above.
A conclusion that emerges across our experimental results is that the EfficientNet-B0 architecturetends to be more susceptible to adversarial reprogramming, and the ResNet-152V2 architecture tendsto be less susceptible, than the remaining four.
We suggest for future work investigating the causes ofthis, as well as seeking to reprogram random networks for adversarial tasks that are more difficult than
MNIST, Fashion-MNIST and Kuzushiji-MNIST.
In the context of the latter, it would be interesting toconsider also vision transformer [Dosovitskiy, Beyer, Kolesnikov, Weissenborn, Zhai, Unterthiner,
Dehghani, Minderer, Heigold, Gelly, Uszkoreit, and Houlsby, 2021] architectures.
Another direction for experimental work is to verify that training for long can cause adversarialreprogramming to fail.
Checklist
For all authors...
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s
contributions and scope?
[Yes]
(b) Did you describe the limitations of your work?
[Yes] They are determined by the
assumptions of the theoretical results and by the restrictions of the experiments ran,
and we stated both.
(c) Did you discuss any potential negative societal impacts of your work?
[Yes] They stem
from potential nefarious uses of adversarial reprogramming, which we indicated on
page 2 with a reference to a fuller discussion in the literature.
(d) Have you read the ethics review guidelines and ensured that your paper conforms to
them?
[Yes]
If you are including theoretical results...
(a) Did you state the full set of assumptions of all theoretical results?
[Yes]
(b) Did you include complete proofs of all theoretical results?
[Yes]
In the paper together
with its appendix.
If you ran experiments...
(a) Did you include the code, data, and instructions needed to reproduce the main ex- perimental results (either in the supplemental material or as a URL)?
[Yes] In the supplemental material.
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)?
[Yes] See Section 4 and the appendix.
(c) Did you report error bars (e.g., with respect to the random seed after running experi- ments multiple times)?
[Yes] See the appendix.
(d) Did you include the total amount of compute and the type of resources used (e.g., typeof GPUs, internal cluster, or cloud provider)?
[Yes] See Section 4.
[Table]
If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
(a) If your work uses existing assets, did you cite the creators?
[Yes]
[Table]
(b) Did you mention the license of the assets?
[Yes]
[Table]
(c) Did you include any new assets either in the supplemental material or as a URL?
[N/A]
[Table]
(d) Did you discuss whether and how consent was obtained from people whose data you’re
using/curating?
[N/A]
(e) Did you discuss whether the data you are using/curating contains personally identifiable
information or offensive content?
[N/A]
[Table]
If you used crowdsourcing or conducted research with human subjects...
[Table] (a) Did you include the full text of instructions given to participants and screenshots, if [Table]
applicable?
[N/A]
[Table]
(b) Did you describe any potential participant risks, with links to Institutional Review
[Table]
Board (IRB) approvals, if applicable?
[N/A]
[Table] (c) Did you include the estimated hourly wage paid to participants and the total amount [Table] spent on participant compensation?
[N/A]