Abstract
Training a neural network is synonymous with learning the values of theweights. In contrast, we demonstrate that randomly weighted neural networkscontain subnetworks which achieve impressive performance without ever trainingthe weight values. Hidden in a randomly weighted Wide ResNet50 we show thatthere is a subnetwork (with random weights) that is smaller than, but matchesthe performance of a ResNet34 trained on ImageNet. Not only do these"untrained subnetworks" exist, but we provide an algorithm to effectively findthem. We empirically show that as randomly weighted neural networks with fixedweights grow wider and deeper, an "untrained subnetwork" approaches a networkwith learned weights in accuracy.
Quick Read (beta)
What’s Hidden in a Randomly Weighted Neural Network?
Abstract
Training a neural network is synonymous with learning the values of the weights. In contrast, we demonstrate that randomly weighted neural networks contain subnetworks which achieve impressive performance without ever training the weight values. Hidden in a randomly weighted Wide ResNet50 [28] we show that there is a subnetwork (with random weights) that is smaller than, but matches the performance of a ResNet34 [8] trained on ImageNet [3]. Not only do these “untrained subnetworks” exist, but we provide an algorithm to effectively find them. We empirically show that as randomly weighted neural networks with fixed weights grow wider and deeper, an “untrained subnetwork” approaches a network with learned weights in accuracy.
1 Introduction
What lies hidden in an overparameterized neural network with random weights? If the distribution is properly scaled, then it contains a subnetwork which performs well without ever modifying the values of the weights (as illustrated by Figure 1).
The number of subnetworks is combinatorial in the size of the network, and modern neural networks contain millions or even billions of parameters [21]. We should expect that even a randomly weighted neural network contains a subnetwork that performs well on a given task. In this work, we provide an algorithm to find these subnetworks.
Finding subnetworks contrasts with the prevailing paradigm for neural network training – learning the values of the weights by stochastic gradient descent. Traditionally, the network structure is either fixed during training (e.g. ResNet [8] or MobileNet [9]), or optimized in conjunction with the weight values (e.g. Neural Architecture Search (NAS)). We instead optimize to find a good subnetwork within a fixed, randomly weighted network. We do not ever tune the value of any weights in the network, not even the batch norm [10] parameters or first or last layer.
In [4], Frankle and Carbin articulate The Lottery Ticket Hypothesis: neural networks contain sparse subnetworks that can be effectively trained from scratch when reset to their initialization. We offer a complimentary conjecture: within a sufficiently overparameterized neural network with random weights (e.g. at initialization), there exists a subnetwork that achieves competitive accuracy. Specifically, the test accuracy of the subnetwork is able to match the accuracy of a trained network with the same number of parameters.
This work is catalyzed by the recent advances of Zhou et al. [29]. By sampling subnetworks in the forward pass, they first demonstrate that subnetworks of randomly weighted neural networks can achieve impressive accuracy. However, we hypothesize that stochasticity may limit their performance. As the number of parameters in the network grows, they are likely to have a high variability in their sampled networks.
To this end we propose the edgepopup algorithm for finding effective subnetworks within randomly weighted neural networks. We show a signifigant boost in performance and scale to ImageNet. For each fixed random weight in the network, we consider a positive realvalued score. To choose a subnetwork we take the weights with the top$k\%$ highest scores. With a gradient estimator we optimize the scores via SGD. We are therefore able to find a good neural network without ever changing the values of the weights. We empirically demonstrate the efficacy of our algorithm and formally show that under certain technical assumptions the loss decreases on the minibatch with each modification of the subnetwork.
We experiment on small and large scale datasets for image recognition, namely CIFAR10 [12] and Imagenet [3]. On CIFAR10 we empirically demonstrate that as networks grow wider and deeper, untrained subnetworks perform just as well as the dense network with learned weights. On ImageNet, we find a subnetwork of a randomly weighted Wide ResNet50 which is smaller than, but matches the performance of a trained ResNet34. Moreover, a randomly weighted ResNet101 [8] with fixed weights contains a subnetwork that is much smaller, but surpasses the performance of VGG16 [23]. In short, we validate the unreasonable effectiveness of randomly weighted neural networks for image recognition.
2 Related Work
Lottery Tickets and Supermasks
In [4], Frankle and Carbin offer an intriguing hypothesis: neural networks contain sparse subnetworks that can be effectively trained from scratch when reset to their initialization. These socalled winning tickets have won the “initialization lottery”. Frankle and Carbin find winning tickets by iteratively shrinking the size of the network, masking out weights which have the lowest magnitude at the end of each training run.
Follow up work by Zhou et al. [29] demonstrates that winning tickets achieve better than random performance without training. Motivated by this result they propose an algorithm to identify a “supermask” – a subnetwork of a randomly initialized neural network that achieves high accuracy without training. On CIFAR10, they are able to find subnetworks of randomly initialized neural networks that achieve 65.4% accuracy.
The algorithm presented by Zhou et al. is as follows: for each weight $w$ in the network they learn an associated probability $p$. On the forward pass they include weight $w$ with probability $p$ and otherwise zero it out. Equivalently, they use weight $\stackrel{~}{w}=wX$ where $X$ is a Bernoulli$(p)$ random variable ($X$ is $1$ with probability $p$ and $0$ otherwise). The probabilities $p$ are the output of a sigmoid, and are learned using stochastic gradient descent. The terminology supermask” arises as finding a subnetwork is equivalent to learning a binary mask for the weights.
Our work builds upon Zhou et al., though we recognize that the stochasticity of their algorithm may limit performance. In section 3.1 we provide more intuition for this claim. We show a significant boost in performance with an algorithm that does not sample supermasks on the forward pass. For the first time we are able to match the performance of a dense network with a supermask.
Neural Architecture Search (NAS)
The advent of modern neural networks has shifted the focus from feature engineering to feature learning. However, researchers may now find themselves manually engineering the architecture of the network. Methods of Neural Architecture Search (NAS) [30, 2, 16, 24] instead provide a mechanism for learning the architecture of neural network jointly with the weights. Models powered by NAS have recently obtained state of the art classification performance on ImageNet [25].
As highlighted by Xie et al. [27], the connectivity patterns in methods of NAS remain largely constrained. Surprisingly, Xie et al. establish that randomly wired neural networks can achieve competitive performance. Accordingly, Wortsman et al. [26] propose a method of Discovering Neural Wirings (DNW) – where the weights and structure are jointly optimized free from the typical constraints of NAS. We highlight DNW as we use a similar method of analysis and gradient estimator to optimize our supermasks. In DNW, however, the subnetwork is chosen by taking the weights with the highest magnitude. There is therefore no way to learn supermasks with DNW as the weights and connectivity are inextricably linked – there is no way to separate the weights and the structure.
Weight Agnostic Neural Networks
In Weight Agnostic Neural Networks (WANNs) [5], Gaier and Ha question if an architecture alone may encode the solution to a problem. They present a mechanism for building neural networks that achieve high performance when each weight in the network has the same shared value. Importantly, the performance of the network is agnostic to the value itself. They are able to obtain $\sim 92\%$ accuracy on MNIST [15].
We are quite inspired by WANNs, though we would like to highlight some important distinctions. Instead of each weight having the same value, we explore the setting where each weight has a random value. In Section A.2.2 of their appendix, Gaier and Ha mention that they were not successful in this setting. However, we find a good subnetwork for a given random initialization – the supermasks we find are not agnostic to the weights. Finally, Gaier and Ha construct their network architectures, while we look for supermasks within standard architectures.
Linear Classifiers
Linear classifiers on top of randomly weighted neural networks are often used as baselines in unsupervised learning [18]. Our work is different in motivation, we explicitly find untrained subnetworks which achieve high performance without changing any weight values, including the final layer.
3 Method
In this section we present our optimization method for finding effective subnetworks within randomly weighted neural networks. We begin by building intuition in an unusual setting – the infinite width limit. Next we motivate and present our algorithm for finding effective subnetworks.
3.1 Intuition
The Existence of Good Subnetworks
Modern neural networks have a staggering number of possible subnetworks. Consequently, even at initialization, a neural network should contain a subnetwork which performs well.
To build intuition we will consider an extreme case – a neural network $N$ in the infinite width limit (for a convolutional neural networks, the width of the network is the number of channels). As in Figure 1, let $\tau $ be a network with the same structure of $N$ that achieves achieves good accuracy. If the weights of $N$ are initialized using any standard scaling of a normal distribution, e.g. xavier [6] or kaiming [7], then we may show there exists a subnetwork of $N$ that achieves the same performance as $\tau $ without training. Let $q$ be the probability that a given subnetwork of $N$ has weights that are close enough to $\tau $ to obtain the same accuracy. This probability $q$ is extremely small, but it is still nonzero. Therefore, the probability that no subnetwork of $N$ is close enough to $\tau $ is effectively ${(1q)}^{S}$ where $S$ is the number of subnetworks. $S$ grows very quickly with the width of the network, and this probability becomes arbitrarily small.
How Should We Find A Good Subnetwork
Even if there are good subnetworks in randomly weighted neural networks, how should we find them?
Zhou et al. learn an associated probability $p$ with each weight $w$ in the network. On the forward pass they include weight $w$ with probability $p$ (where $p$ is the output of a sigmoid) and otherwise zero it out. The infinite width limit provides intuition for a possible shortcoming of the algorithm presented by Zhou et al. [29]. Even if the parameters $p$ are fixed, the algorithm will likely never observe the same subnetwork twice. As such, the gradient estimate becomes more unstable, and this in turn may make training difficult.
Our algorithm for finding a good subnetwork is illustrated by Figure 2. With each weight $w$ in the neural network we learn a positive, real valued popup score $s$. The subnetwork is then chosen by selecting the weights in each layer corresponding to the top$k\%$ highest scores. For simplicity we use the same value of $k$ for all layers.
How should we update the score ${s}_{uv}$? Consider a single edge in a fully connected layer which connects neuron $u$ to neuron $v$. Let ${w}_{uv}$ be the weight of this edge, and ${s}_{uv}$ the associated score. If this score is initially low then ${w}_{uv}$ is not selected in the forward pass. But we would still like a way to update its score to allow it to pop back up. Informally, with backprop [22] we compute how the loss “wants” node $v$’s input to change (i.e. the negative gradient). We then examine the weighted output of node $u$. If this weighted output is aligned with the negative gradient, then node $u$ can take node $v$’s output where the loss “wants” it to go. Accordingly, we should increase the score. If this alignment happens consistently, then the score will continue to increase and the edge will reenter the chosen subnetwork (i.e. popup).
More formally, if ${w}_{uv}{\mathcal{Z}}_{u}$ denotes the weighted output of neuron $u$, and ${\mathcal{I}}_{v}$ denotes the input of neuron $v$, then we update ${s}_{uv}$ as
${s}_{uv}\leftarrow {s}_{uv}\alpha {\displaystyle \frac{\partial \mathcal{L}}{\partial {\mathcal{I}}_{v}}}{\mathcal{Z}}_{u}{w}_{uv}.$  (1) 
This argument and the analysis that follows is motivated and guided by the work of [26]. In their work, however, they do not consider a score and are instead directly updating the weights. In the forward pass they use the top $k\%$ of edges by magnitude, and therefore there is no way of learning a subnetwork without learning the weights. Their goal is to train sparse neural networks, while we aim to showcase the efficacy of randomly weighted neural networks.
3.2 The edgepopup Algorithm and Analysis
We now formally detail the edgepopup algorithm.
For clarity, we first describe our algorithm for a fully connected neural network. In Section B.2 we provide the straightforward extension to convolutions along with code in PyTorch [20].
A fully connected neural network consists of layers $1,\mathrm{\dots},L$ where layer $\mathrm{\ell}$ has ${n}_{\mathrm{\ell}}$ nodes ${\mathcal{V}}^{(\mathrm{\ell})}=\{{v}_{1}^{(\mathrm{\ell})},\mathrm{\dots},{v}_{{n}_{\mathrm{\ell}}}^{(\mathrm{\ell})}\}$. We let ${\mathcal{I}}_{v}$ denote the input to node $v$ and let ${\mathcal{Z}}_{v}$ denote the output, where ${\mathcal{Z}}_{v}=\sigma ({\mathcal{I}}_{v})$ for some nonlinear activation function $\sigma $ (e.g. ReLU [13]). The input to neuron $v$ in layer $\mathrm{\ell}$ is a weighted sum of all neurons in the preceding layer. Accordingly, we write ${\mathcal{I}}_{v}$ as
${\mathcal{I}}_{v}={\displaystyle \sum _{u\in {\mathcal{V}}^{(\mathrm{\ell}1)}}}{w}_{uv}{\mathcal{Z}}_{u}$  (2) 
where ${w}_{uv}$ are the network parameters for layer $\mathrm{\ell}$. The output of the network is taken from the final layer while the input data is given to the very first layer. Before training, the weights ${w}_{uv}$ for layer $\mathrm{\ell}$ are initialized by independently sampling from distribution ${\mathcal{D}}_{\mathrm{\ell}}$. For example, if we are using kaiming normal initialization [7] with ReLU activations, then ${\mathcal{D}}_{\mathrm{\ell}}=\mathcal{N}(0,\sqrt{2/{n}_{\mathrm{\ell}1}})$ where $\mathcal{N}$ denotes the normal distribution.
Normally, the weights ${w}_{uv}$ are optimized via stochastic gradient descent. In our edgepopup algorithm, we instead keep the weights at their random initialization, and optimize to find a subnetwork $\mathcal{G}=(\mathcal{V},\mathcal{E})$. We then compute the input of node $v$ in layer $\mathrm{\ell}$ as
${\mathcal{I}}_{v}={\displaystyle \sum _{(u,v)\in \mathcal{E}}}{w}_{uv}{\mathcal{Z}}_{u}$  (3) 
where $\mathcal{G}$ is a subgraph of the original fully connected network^{1}^{1} 1 The original network has edges ${\mathcal{E}}_{\text{fc}}={\bigcup}_{\mathrm{\ell}=1}^{L1}\left({\mathcal{V}}_{\mathrm{\ell}}\times {\mathcal{V}}_{\mathrm{\ell}+1}\right)$ where $\times $ denotes the crossproduct..
As mentioned above, for each weight ${w}_{uv}$ in the original network we learn a popup score ${s}_{uv}$. We choose the subnetwork $\mathcal{G}$ by selecting the weights in each layer which have the top$k\%$ highest scores. Equation 3 may therefore be written equivalently as
${\mathcal{I}}_{v}={\displaystyle \sum _{u\in {\mathcal{V}}^{(\mathrm{\ell}1)}}}{w}_{uv}{\mathcal{Z}}_{u}h({s}_{uv})$  (4) 
where $h({s}_{uv})=1$ if ${s}_{uv}$ is among the top $k\%$ highest scores in layer $\mathrm{\ell}$ and $h({s}_{uv})=0$ otherwise. Since the gradient of $h$ is 0 everywhere it is not possible to directly compute the gradient of the loss with respect to ${s}_{uv}$. We instead use the straightthrough gradient estimator [1], in which $h$ is treated as the identity in the backwards pass – the gradient goes “straightthrough” $h$.
Consequently, we approximate the gradient to ${s}_{uv}$ as
${\widehat{g}}_{{s}_{uv}}=\text{pdv}\mathcal{L}{\mathcal{I}}_{v}\text{pdv}{\mathcal{I}}_{v}{s}_{uv}=\text{pdv}\mathcal{L}{\mathcal{I}}_{v}{w}_{uv}{\mathcal{Z}}_{u}$  (5) 
where $\mathcal{L}$ is the loss we are trying to minimize. The scores ${s}_{uv}$ are then updated via stochastic gradient descent with learning rate $\alpha $. If we ignore momentum and weight decay [14] then we update ${s}_{uv}$ as
${\stackrel{~}{s}}_{uv}={s}_{uv}\alpha \text{pdv}\mathcal{L}{\mathcal{I}}_{v}{w}_{uv}{\mathcal{Z}}_{u}$  (6) 
where ${\stackrel{~}{s}}_{uv}$ denotes the score after the gradient step^{2}^{2} 2 To ensure that the scores are positive we take the absolute value..
As the scores change certain edges in the subnetwork will be replaced with others. Motivated by the analysis of [26] we show that when swapping does occur, the loss decreases for the minibatch.
Theorem 1: When edge $(i,\rho )$ replaces $(j,\rho )$ and the rest of the subnetwork remains fixed then the loss decreases for the minibatch (provided the learning rate $\alpha $ is sufficiently small, and the loss is smooth).
Proof. Let ${\stackrel{~}{s}}_{uv}$ denote the score of weight ${s}_{uv}$ after the gradient update. If edge $(i,\rho )$ replaces $(j,\rho )$ then our algorithm dictates that $$ but ${\stackrel{~}{s}}_{i\rho}>{\stackrel{~}{s}}_{j\rho}$. Accordingly,
${\stackrel{~}{s}}_{i\rho}{s}_{i\rho}>{\stackrel{~}{s}}_{j\rho}{s}_{j\rho}$  (7) 
which implies that
$\alpha \text{pdv}\mathcal{L}{\mathcal{I}}_{\rho}{w}_{i\rho}{\mathcal{Z}}_{i}>\alpha \text{pdv}\mathcal{L}{\mathcal{I}}_{\rho}{w}_{j\rho}{\mathcal{Z}}_{j}$  (8) 
by the update rule given in Equation 6. Let ${\stackrel{~}{\mathcal{I}}}_{\rho}$ denote the input to node $k$ after the swap is made and ${\mathcal{I}}_{\rho}$ denote the original input. Note that ${\stackrel{~}{\mathcal{I}}}_{\rho}{\mathcal{I}}_{\rho}={w}_{i\rho}{Z}_{i}{w}_{j\rho}{Z}_{j}$ by Equation 3. We now wish to show that $$.
When the learning rate is sufficiently small (and the loss is smooth) we may assume that ${\stackrel{~}{\mathcal{I}}}_{\rho}$ is close to ${\mathcal{I}}_{\rho}$ and ignore secondorder terms in a Taylor expansion:
$\mathcal{L}\left({\stackrel{~}{\mathcal{I}}}_{\rho}\right)$  $=\mathcal{L}\left({\mathcal{I}}_{\rho}+\left({\stackrel{~}{\mathcal{I}}}_{\rho}{\mathcal{I}}_{\rho}\right)\right)$  (9)  
$\approx \mathcal{L}\left({\mathcal{I}}_{\rho}\right)+{\displaystyle \frac{\partial \mathcal{L}}{\partial {\mathcal{I}}_{\rho}}}\left({\stackrel{~}{\mathcal{I}}}_{\rho}{\mathcal{I}}_{\rho}\right)$  (10)  
$=\mathcal{L}\left({\mathcal{I}}_{\rho}\right)+{\displaystyle \frac{\partial \mathcal{L}}{\partial {\mathcal{I}}_{\rho}}}({w}_{i\rho}{\mathcal{Z}}_{i}{w}_{j\rho}{\mathcal{Z}}_{j})$  (11) 
and from equation 8 we have that $$ and so $$ as needed. $\mathrm{\square}$
We examine a more general case of Theorem 1 in Section B.1 of the supplementary material.
4 Experiments
We demonstrate the unreasonable effectiveness of randomly weighted neural networks image recognition on standard benchmark datasets CIFAR10 [12] and ImageNet [3]. This section is organized as follows: in Section 4.1 we discuss the experimental setup and hyperparameters. We perform a series of ablations at small scale: we examine the effect of $k$, the $\%$ of Weights which remain in the subnetwork, and the effect of width. In Section 4.4 we compare against the algorithm of Zhou et al., followed by Section 4.5 in which we study the effect of the distribution used to sample the weights. We conclude with Section 4.6, where we otpimize to find subnetworks of randomly weighted neural networks which achieve good performance on ImageNet [3].
4.1 Experimental Setup
We use two different distributions for the weights in our network:
 •

•
Signed Kaiming Constant which we denote ${U}_{k}$. Here we set each weight to be a constant and randomly choose its sign to be $+$ or $$. The constant we choose is the standard deviation of Kaiming Normal, and as a result the variance is the same. We use the notation ${U}_{k}$ as we are sampling uniformly from the set $\{{\sigma}_{k},{\sigma}_{k}\}$ where ${\sigma}_{k}$ is the standard deviation for Kaiming Normal (i.e. $\sqrt{2/{n}_{\mathrm{\ell}1}}$).
In Section 4.5 we reflect on the importance of the random distribution and experiment with alternatives.
On CIFAR10 [12] we experiment with simple VGGlike architectures of varying depth. These architectures are also used by Frankle and Carbin [4] and Zhou et al. [29] and are provided in Table 1. On ImageNet we experiment with ResNet50 and ResNet101 [8], as well as their wide variants [28].
Model  Conv2  Conv4  Conv6  Conv8 

Conv Layers  64, 64, pool  64, 64, pool 128, 128, pool  64, 64, pool 128, 128, pool 256, 256, pool  64, 64, pool 128, 128, pool 256, 256, pool 512, 512, pool 
FC  256, 256, 10  256, 256, 10  256, 256, 10  256, 256, 10 
In every experiment we train for 100 epochs and report the last epoch accuracy on the validation set. When we optimize with Adam [11] we do not decay the learning rate. When we optimize with SGD we use cosine learning rate decay [17]. On CIFAR10 [12] we train our models with weight decay 1e4, momentum 0.9, batch size 128, and learning rate 0.1. We also often run both an Adam and SGD baseline where the weights are learned. The Adam baseline uses the same learning rate and batch size as in [4, 29]^{3}^{3} 3 Batch size 60, learning rate 2e4, 3e4 and 3e4 for Conv2, Conv4, and Conv6 respectively Conv8 is not tested in [4], though we use find that learning rate 3e4 still performs well.. For the SGD baseline we find that training does not converge with learning rate 0.1, and so we use 0.01. As standard we also use weight decay 1e4, momentum 0.9, and batch size 128.
For the ImageNet experiments we use the hyperparameters found on NVIDIA’s public github example repository for training ResNet [19]. For simplicity, our edgepopup algorithm does not modify batch norm parameters, they are frozen at their default initialization in PyTorch (i.e. bias 0, scale 1).
This discussion has encompassed the extent of the hyperparameter tuning for our models. We do, however, perform hyperparameter tuning for the Zhou et al. [29] baseline and improve accuracy significantly. We include further discussion of this in Section 4.4.
In all experiments on CIFAR10 [12] we use 5 different random seeds and plot the mean accuracy $\pm $ one standard deviation. Moreover, on all figures, Learned Dense Weights denotes the standard training the full model (all weights remaining).
4.2 Varying the % of Weights
Our algorithm has one associated parameter: the % of weights which remain in the subnetwork, which we refer to as $k$. Figure 3 illustrates how the accuracy of the subnetwork we find varies with $k$, a trend which we will now dissect. We consider $k\in [10,30,50,70,90]$ and plot the dense model when it is trained as a horizontal line (as it has 100% of the weights).
We recieve the worst accuracy when $k$ approaches $0$ or $100$. When $k$ approaches 0, we are not able to perform well as our subnetwork has very few weights. On the other hand, when $k$ approaches 100, our network outputs are random.
The best accuracy occurs when $k\in [30,70]$, and we make a combinatorial argument for this trend. We are choosing $kn$ weights out of $n$, and there are $\left(\genfrac{}{}{0pt}{}{n}{kn}\right)$ ways of doing so. The number of possible subnetworks is therefore maximized when $k\approx 0.5$, and at this value our search space is at its largest.
4.3 Varying the Width
Our intuition from Section 3.1 suggests that as the network gets wider, a subnetwork of a randomly weighted model should approach the trained model in accuracy. How wide is wide enough?
In Figure 4 we vary the width of Conv4 and Conv6. The width of a linear layer is the number of “neurons”, and the width of a convolution layer is the number of channels. The width multiplier is the factor by which the width of all layers is scaled. A width multiplier of 1 corresponds to the models tested in Figure 3.
As the width multiplier increases, the gap shrinks between the accuracy a subnetwork found with edgepopup and the dense model when it is trained. Notably, when Conv6 is wide enough, a subnetwork of the randomly weighted model (with $\%\text{\mathit{W}\mathit{e}\mathit{i}\mathit{g}\u210e\mathit{t}\mathit{s}}=50$) performs just as well as the dense model when it is trained.
Moreover, this boost in performance is not solely from the subnetwork having more parameters. Even when the # of parameters is fixed, increasing the width and therefore the search space leads to better performance. In Figure 5 we fix the number of parameters and while modifying $k$ and the width multiplier. Specifically, we test $k\in [30,50,70]$ for subnetworks of constant size ${c}_{1},{c}_{2}$ and ${c}_{3}$. On Figure 5 we use $\mathcal{E}$ denote the size of the subnetwork.
4.4 Comparing with Zhou et al. [29]
In Figure 6 we compare the performance of edgepopup with Zhou et al. Their work considers distributions ${\mathcal{N}}_{x}$ and ${U}_{x}$, which are identical to those presented in Section 4.1 but with xavier normal [6] instead of kaiming normal [7] – the factor of $\sqrt{2}$ is omitted from the standard deviation. By running their algorithm with ${\mathcal{N}}_{k}$ and ${U}_{k}$ we witness a significant improvement. However, even the ${N}_{x}$ and ${U}_{x}$ results exceed those in the paper as we perform some hyperparameter tuning. As in our experiments on CIFAR10, we use SGD with weight decay 1e4, momentum 0.9, batch size 128, and a cosine scheduler [17]. We double the learning rate until we see their performance become worse, and settle on 200^{4}^{4} 4 An absurdly high learning rate is required as mentioned in their work..
4.5 Effect of The Distribution
The distribution that the random weights are sampled from is very important. As illustrated by Figure 7, the performance of our algorithm vastly decreases when we switch to using xavier normal [6] or kaiming uniform [7].
Following the derivation in [7], the variance of the forward pass is not exactly 1 when we consider a subnetwork with only $k\%$ of the weights. To reconcile for this we could scale standard deviation by $\sqrt{1/k}$. This distribution is referred to as “Scaled Kaiming Normal” on Figure 7. We may also consider this scaling for the Signed Kaiming Constant distribution which is described in Section 4.1.
4.6 ImageNet [3] Experiments
On ImageNet we observe similar trends to CIFAR10. As ImageNet is much harder, computationally feasible models are not overparameterized to the same degree. As a consequence, the performance a randomly weighted subnetwork does not match the full model with learned weights. However, we still witness a very encouraging trend – the performance increases with the width and depth of the network.
As illustrated by Figure 8, a randomly weighted Wide ResNet50 contains a subnetwork that is smaller than, but matches the accuracy of ResNet34 when trained on ImageNet [3]. As strongly suggested by our trends, better and larger “parent” networks would result in even stronger performance on ImageNet [3]. A table which reports the numbers in Figure 8 may be found in Section A of the supplementary material.
Figure 9 illustrates the effect of $k$, which follows an almost identical trend: $k\in [30,70]$ performs best though 30 now provides the best performance. Figure 9 also demonstrates that we significantly outperform Zhou et al. at scale (they do not test on ImageNet in their paper). Their algorithm does not allow an explicit choice of the % of weights remaining in the subnetwork, and we found the algorithm unstable outside of the range reported.
The choice of the random distribution matters more for ImageNet. The “Scaled” distribution we discuss in Section 4.5 did not show any discernable difference on CIFAR10. However, Figure 10 illustrates that on ImageNet it is much better. Recall that the “Scaled” distribution adds a factor of $\sqrt{1/k}$, which has less of an effect when $k$ approaches $100\%=1$. This result highlights the possibility of finding better distributions which works best for this algorithm.
5 Conclusion
Hidden within randomly weighted neural networks we find subnetworks with compelling accuracy. This work provides an avenue for many areas of exploration. For example, we anticipate the development of faster algorithms, or the alternating optimization of the structure and the weights.
Finally, we hope that our findings serve as a useful step in the pursuit the understanding of the optimization of neural networks.
Acknowledgments
We thank Jesse Dodge and Nicholas Lourie for many helpful discussions, Gabriel Ilharco for valuable feedback, and Sarah Pratt for $\left(\genfrac{}{}{0pt}{}{n}{2}\right)$.
References
 [1] Yoshua Bengio, Nicholas Léonard, and Aaron Courville. Estimating or propagating gradients through stochastic neurons for conditional computation, 2013.
 [2] Han Cai, Ligeng Zhu, and Song Han. ProxylessNAS: Direct neural architecture search on target task and hardware. In ICLR, 2019.
 [3] Jia Deng, Wei Dong, Richard Socher, LiJia Li, Kai Li, and Li FeiFei. Imagenet: A largescale hierarchical image database. In CVPR, 2009.
 [4] Jonathan Frankle and Michael Carbin. The lottery ticket hypothesis: Finding sparse, trainable neural networks. In ICLR 2019, 2019.
 [5] Adam Gaier and David Ha. Weight agnostic neural networks. 2019. https://weightagnostic.github.io.
 [6] Xavier Glorot and Yoshua Bengio. Understanding the difficulty of training deep feedforward neural networks. In Yee Whye Teh and Mike Titterington, editors, Proceedings of the Thirteenth International Conference on Artificial Intelligence and Statistics, volume 9 of Proceedings of Machine Learning Research, pages 249–256, Chia Laguna Resort, Sardinia, Italy, 13–15 May 2010. PMLR.
 [7] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Delving deep into rectifiers: Surpassing humanlevel performance on imagenet classification. In Proceedings of the 2015 IEEE International Conference on Computer Vision (ICCV), ICCV ’15, pages 1026–1034, Washington, DC, USA, 2015. IEEE Computer Society.
 [8] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016.
 [9] Andrew G. Howard, Menglong Zhu, Bo Chen, Dmitry Kalenichenko, Weijun Wang, Tobias Weyand, Marco Andreetto, and Hartwig Adam. Mobilenets: Efficient convolutional neural networks for mobile vision applications. ArXiv, abs/1704.04861, 2017.
 [10] Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In ICML, 2015.
 [11] Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization, 2014.
 [12] Alex Krizhevsky. Learning multiple layers of features from tiny images. Technical report, University of Toronto, 2009.
 [13] Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In F. Pereira, C. J. C. Burges, L. Bottou, and K. Q. Weinberger, editors, Advances in Neural Information Processing Systems 25, pages 1097–1105. Curran Associates, Inc., 2012.
 [14] Anders Krogh and John A. Hertz. A simple weight decay can improve generalization. In NIPS, 1991.
 [15] Yann LeCun and Corinna Cortes. MNIST handwritten digit database. 2010.
 [16] Chenxi Liu, Barret Zoph, Maxim Neumann, Jonathon Shlens, Wei Hua, LiJia Li, Li FeiFei, Alan Yuille, Jonathan Huang, and Kevin Murphy. Progressive neural architecture search. In Proceedings of the European Conference on Computer Vision (ECCV), pages 19–34, 2018.
 [17] Ilya Loshchilov and Frank Hutter. Sgdr: Stochastic gradient descent with warm restarts, 2016.
 [18] Mehdi Noroozi and Paolo Favaro. Unsupervised learning of visual representations by solving jigsaw puzzles, 2016.
 [19] NVIDIA. Deeplearningexamples/pytorch/classification. https://github.com/NVIDIA/DeepLearningExamples/tree/master/PyTorch/Classification/RN50v1.5, 2019.
 [20] Adam Paszke, Sam Gross, Soumith Chintala, Gregory Chanan, Edward Yang, Zachary Devito, Zeming Lin, Alban Desmaison, Luca Antiga, and Adam Lerer. Automatic differentiation in pytorch. 2017.
 [21] Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. Exploring the limits of transfer learning with a unified texttotext transformer. arXiv eprints, 2019.
 [22] David E. Rumelhart, Geoffrey E. Hinton, and Ronald J. Williams. Learning representations by backpropagating errors. Nature, 323:533–536, 1986.
 [23] Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for largescale image recognition. 2015.
 [24] Mingxing Tan, Bo Chen, Ruoming Pang, Vijay Vasudevan, and Quoc V. Le. Mnasnet: Platformaware neural architecture search for mobile. CoRR, abs/1807.11626, 2018.
 [25] Mingxing Tan and Quoc V. Le. Efficientnet: Rethinking model scaling for convolutional neural networks. In ICML, 2019.
 [26] Mitchell Wortsman, Ali Farhadi, and Mohammad Rastegari. Discovering neural wirings. ArXiv, abs/1906.00586, 2019.
 [27] Saining Xie, Alexander Kirillov, Ross Girshick, and Kaiming He. Exploring randomly wired neural networks for image recognition. arXiv preprint arXiv:1904.01569, 2019.
 [28] Sergey Zagoruyko and Nikos Komodakis. Wide residual networks, 2016.
 [29] Hattie Zhou, Janice Lan, Rosanne Liu, and Jason Yosinski. Deconstructing lottery tickets: Zeros, signs, and the supermask, 2019.
 [30] Barret Zoph and Quoc V Le. Neural architecture search with reinforcement learning. arXiv preprint arXiv:1611.01578, 2016.
Method  Model  Initialization  % of Weights  # of Parameters  Accuracy 

ResNet34 [8]      21.8M  73.3%  
Learned Dense Weights (SGD)  ResNet50 [8]      25M  76.1% 
Wide ResNet50 [28]      69M  78.1%  
ResNet50  Kaiming Normal  30%  7.6M  61.71%  
edgepopup  ResNet101  Kaiming Normal  30%  13M  66.15% 
Wide ResNet50  Kaiming Normal  30%  20.6M  67.95%  
ResNet50  Signed Constant  30%  7.6M  68.6%  
edgepopup  ResNet101  Signed Constant  30%  13M  72.3% 
Wide ResNet50  Signed Constant  30%  20.6M  73.3% 
Appendix A Table of ImageNet Results
Appendix B Additional Technical Details
In this section we first prove a more general case of Theorem 1 then provide an extension of edgepopup for convolutions along with code in PyTorch [20], found in Algorithm B.2.
B.1 A More General Case of Theorem 1
We now examine a more general case of Theorem 1, where the two swapped edges are not connected to the same node. Again we are motivated by the analysis of [26], though we tackle a more general case.
Theorem 1 (more general): When a nonzero number of edges are swapped in one layer and the rest of the network remains fixed then the loss decreases for the minibatch (provided the learning rate $\alpha $ is sufficiently small, and the loss is smooth).
Proof. As before, we let ${\stackrel{~}{s}}_{uv}$ denote the score of weight ${s}_{uv}$ after the gradient update. Additionally, let ${\stackrel{~}{\mathcal{I}}}_{v}$ denote the input to node $v$ after the gradient update whereas ${\mathcal{I}}_{v}$ is the input to node $v$ before the update. Finally, let ${i}_{1},\mathrm{\dots},{i}_{n}$ denote the $n$ nodes in layer $\mathrm{\ell}1$ and ${j}_{1},\mathrm{\dots},{j}_{m}$ denote the $m$ notes in layer $\mathrm{\ell}$. Our goal is to show that
$$  (12) 
where the loss is written as a function of layer $\mathrm{\ell}$’s input for brevity. Since $\alpha $ is small and the loss is smooth we may assume that each ${\stackrel{~}{\mathcal{I}}}_{{j}_{k}}$ is close to ${\mathcal{I}}_{{j}_{k}}$ and ignore secondorder terms in a Taylor expansion:
$\mathcal{L}({\stackrel{~}{\mathcal{I}}}_{{j}_{1}},\mathrm{\dots},{\stackrel{~}{\mathcal{I}}}_{{j}_{m}})$  (13)  
$=\mathcal{L}({\mathcal{I}}_{{j}_{1}}+\left({\stackrel{~}{\mathcal{I}}}_{{j}_{1}}{\mathcal{I}}_{{j}_{1}}\right),\mathrm{\dots},{\mathcal{I}}_{{j}_{m}}+\left({\stackrel{~}{\mathcal{I}}}_{{j}_{m}}{\mathcal{I}}_{{j}_{m}}\right))$  (14)  
$=\mathcal{L}({\mathcal{I}}_{{j}_{1}},\mathrm{\dots},{\mathcal{I}}_{{j}_{m}})+{\displaystyle \sum _{k=1}^{m}}{\displaystyle \frac{\partial \mathcal{L}}{\partial {\mathcal{I}}_{{j}_{k}}}}\left({\stackrel{~}{\mathcal{I}}}_{{j}_{k}}{\mathcal{I}}_{{j}_{k}}\right)$  (15) 
And so, in order to show Equation 12 it suffices to show that
$$  (16) 
It is helpful to rewrite the sum to be over edges. Specifically, we will consider the sets ${\mathcal{E}}_{\text{old}}$ and ${\mathcal{E}}_{\text{new}}$ where ${\mathcal{E}}_{\text{new}}$ contains all edges that entered the network after the gradient update and ${\mathcal{E}}_{\text{old}}$ consists of edges which were previously in the subnetwork, but have now exited. As the total number of edges is conserved we know that ${\mathcal{E}}_{\text{new}}={\mathcal{E}}_{\text{old}}$, and by assumption ${\mathcal{E}}_{\text{new}}>0$.
Using the definition of ${\mathcal{I}}_{k}$ and ${\stackrel{~}{\mathcal{I}}}_{k}$ from Equation 3 we may rewrite Equation 16 as
$$  (17) 
which, by Equation 6 and factoring out $1/\alpha $ becomes
$$  (18) 
We now show that
$$  (19) 
for any pair of edges $({i}_{a},{j}_{b})\in {\mathcal{E}}_{\text{new}}$ and $({i}_{c},{j}_{d})\in {\mathcal{E}}_{\text{old}}$. Since ${\mathcal{E}}_{\text{new}}={\mathcal{E}}_{\text{old}}>0$ we are then able to conclude that Equation 18 holds.
As $({i}_{a},{j}_{b})$ was not in the edge set before the gradient update, but $({i}_{c},{j}_{d})$ was, we can conclude
$$  (20) 
Likewise, since $({i}_{a},{j}_{b})$ is in the edge set after the gradient update, but $({i}_{c},{j}_{d})$ isn’t, we can conclude
$$  (21) 
B.2 Extension to Convolutional Neural Networks
In order to show that our method extends to convolutional layers we recall that convolutions may be written in a form that resembles Equation 2. Let $\kappa $ be the kernel size which we assume is odd for simplicity, then for $w\in \{1,\mathrm{\dots},W\}$ and $h\in \{1,\mathrm{\dots},H\}$ we have
$$\begin{array}{cc}\hfill {\mathcal{I}}_{v}^{w,h}=\sum _{u\in {\mathcal{V}}^{(\mathrm{\ell}1)}}& \sum _{{\kappa}_{1}=1}^{\kappa}\sum _{{\kappa}_{2}=1}^{\kappa}\hfill \\ & {w}_{uv}^{({\kappa}_{1},{\kappa}_{2})}{\mathcal{Z}}_{u}^{(w+{\kappa}_{1}\lceil \frac{\kappa}{2}\rceil ,h+{\kappa}_{2}\lceil \frac{\kappa}{2}\rceil )}\hfill \end{array}$$  (22) 
where instead of “neurons”, we now have “channels”. The input ${\mathcal{I}}_{v}$ and output ${\mathcal{Z}}_{v}$ are now two dimensional and so ${\mathcal{Z}}_{v}^{(w,h)}$ is a scalar. As before, ${\mathcal{Z}}_{v}=\sigma \left({\mathcal{I}}_{v}\right)$ where $\sigma $ is a nonlinear function. However, in the convolutional case $\sigma $ is often batch norm [10] followed by ReLU (and then implicitly followed by zero padding).
Instead of simply having weights ${w}_{uv}$ we now have weights ${w}_{uv}^{({\kappa}_{1},{\kappa}_{2})}$ for ${\kappa}_{1}\in \{1,\mathrm{\dots},\kappa \}$, ${\kappa}_{2}\in \{1,\mathrm{\dots},\kappa \}$. Likewise, in our edgepopup Algorithm we now consider scores ${s}_{uv}^{({\kappa}_{1},{\kappa}_{2})}$ and again use the top $k$% in the forwards pass. As before, let $h\left({s}_{uv}^{({\kappa}_{1},{\kappa}_{2})}\right)=1$ if ${s}_{uv}^{({\kappa}_{1},{\kappa}_{2})}$ is among the top $k\%$ highest scores in the layer and $h\left({s}_{uv}^{({\kappa}_{1},{\kappa}_{2})}\right)=0$ otherwise. Then in edgepopup we are performing a convolution as
$\begin{array}{cc}\hfill {\mathcal{I}}_{v}^{w,h}=& {\displaystyle \sum _{u\in {\mathcal{V}}^{(\mathrm{\ell}1)}}}{\displaystyle \sum _{{\kappa}_{1}=1}^{\kappa}}{\displaystyle \sum _{{\kappa}_{2}=1}^{\kappa}}\hfill \\ & {w}_{uv}^{({\kappa}_{1},{\kappa}_{2})}{\mathcal{Z}}_{u}^{(w+{\kappa}_{1}\lceil \frac{\kappa}{2}\rceil ,h+{\kappa}_{2}\lceil \frac{\kappa}{2}\rceil )}h\left({s}_{uv}^{({\kappa}_{1},{\kappa}_{2})}\right)\hfill \end{array}$  (23) 
which mirrors the formulation of edgepopup in Equation 4. In fact, when $\kappa =W=H=1$ (i.e. a 1x1 convolution on a 1x1 feature map) then Equation 23 and Equation 4 are equivalent.
The update for the scores is quite similar, though we must now sum over all spatial (i.e. $w$ and $h$) locations as given below:
$$\begin{array}{cc}& {s}_{uv}^{({\kappa}_{1},{\kappa}_{2})}\leftarrow {s}_{uv}^{({\kappa}_{1},{\kappa}_{2})}\hfill \\ & \alpha \sum _{w=1}^{W}\sum _{h=1}^{H}\text{pdv}\mathcal{L}{\mathcal{I}}_{v}^{w,h}{w}_{uv}^{({\kappa}_{1},{\kappa}_{2})}{\mathcal{Z}}_{u}^{(w+{\kappa}_{1}\lceil \frac{\kappa}{2}\rceil ,h+{\kappa}_{2}\lceil \frac{\kappa}{2}\rceil )}\hfill \end{array}$$  (24) 
In summary, we now have ${\kappa}^{2}$ edges between each $u$ and $v$. The PyTorch [20] code is given by Algorithm B.2, where $h$ is GetSubnet. The gradient goes straight through $h$ in the backward pass, and PyTorch handles the implementation of these equations.
[t]