C HARACTERIZING SIGNAL PROPAGATION TO CLOSE THE PERFORMANCE GAP IN UNNORMALIZED R ES N ETS
Anonymous authors
Paper under double-blind review
A BSTRACT
Batch Normalization is a key component in almost all state-of-the-art image classiﬁers, but it also introduces practical challenges: it breaks the independence between training examples within a batch, can incur compute and memory overhead, and often results in unexpected bugs.
Building on recent theoretical analyses of deep ResNets at initialization, we propose a simple set of analysis tools to characterize signal propagation on the forward pass, and leverage these tools to design highly performant ResNets without activation normalization layers.
Crucial to our success is an adapted version of the recently proposed Weight Standardization.
Our analysis tools show how this technique preserves the signal in networks with
ReLU or Swish activation functions by ensuring that the per-channel activation means do not grow with depth.
Across a range of FLOP budgets, our networks attain performance competitive with the state-of-the-art EfﬁcientNets on ImageNet.
I NTRODUCTION
BatchNorm has become a core computational primitive in deep learning (Ioffe & Szegedy, 2015), and it is used in almost all state-of-the-art image classiﬁers (Tan & Le, 2019).
A number of different beneﬁts of BatchNorm have been identiﬁed.
It smoothens the loss landscape (Santurkar et al., 2018), which allows us to train with larger learning rates (Bjorck et al., 2018), and the noise arising from the minibatch estimates of the batch statistics introduces implicit regularization (Luo et al., 2018).
Crucially, recent theoretical work (Balduzzi et al., 2017; Zhang et al., 2019; De & Smith, 2020) has demonstrated that BatchNorm ensures good signal propagation at initialization in deep residual networks with identity skip connections (He et al., 2016b;a), and this beneﬁt has enabled practitioners to train deep ResNets with hundreds or even thousands of layers.
However, BatchNorm also has many disadvantages.
Its behavior is strongly dependent on the batch size (performing poorly when the batch size is too small or too large), and it introduces a discrepancy between the behaviour of the model during training and at inference time.
BatchNorm also adds memory overhead (Rota Bul ` o et al., 2018) and substantial implementation complexity, which often introduces unexpected bugs (Pham et al., 2019) or makes models trained on speciﬁc hardware difﬁcult to replicate on different hardware.
A number of alternative normalization layers have been proposed (Ba et al., 2016; Wu & He, 2018), but typically these alternatives generalize poorly or introduce their own drawbacks, such as added compute costs at inference.
Another line of work has sought to eliminate layers which normalize hidden activations entirely.
A common trend is to initialize residual branches to output zeros (Goyal et al., 2017; Zhang et al., 2019;
De & Smith, 2020; Bachlechner et al., 2020), which ensures that the signal is dominated by the skip path early in training.
However while this strategy enables us to train deep ResNets with thousands of layers, it still degrades generalization when compared to well-tuned baselines (De & Smith, 2020).
These simple initialization strategies are also not applicable to more complicated architectures like
EfﬁcientNets (Tan & Le, 2019), the current state of the art on ImageNet (Russakovsky et al., 2015).
This work seeks to establish a general recipe for training deep ResNets without normalization layers, which achieve test accuracy competitive with the state-of-the-art.
Our contributions are as follows:
• We introduce Signal Propagation Plots (SPPs): a simple set of visualizations which help us inspect signal propagation at initialization on the forward pass in deep residual net-
works.
Leveraging these SPPs, we show how to design unnormalized ResNets which are constrained to have signal propagation properties similar to batch-normalized ResNets.
• We identify a key failure mode in unnormalized ResNets with ReLU or Swish activations.
Because the mean output of these activation functions is positive, when they are used with Gaussian weights, the mean value of the hidden activations on each channel grow proportional to the network depth.
To resolve this, we propose Scaled Weight Standardization, a minor modiﬁcation of the recently proposed Weight Standardization (Qiao et al., 2019), which prevents the growth in the mean signal, leading to a substantial boost in performance.
• We apply our normalization-free network structure in conjunction with Scaled Weight Standardization to ResNets on ImageNet, where we for the ﬁrst time attain performance which is comparable or better than batch-normalized ResNets on networks as deep as 288 layers.
Finally, we apply our normalization-free approach to the RegNet architecture (Radosavovic et al., 2020).
By combining this architecture with the compound scaling strategy proposed by Tan & Le
we develop a class of models without normalization layers which are competitive with the current ImageNet state-of-the-art across a range of FLOP budgets.
B ACKGROUND
Deep ResNets at initialization: The combination of BatchNorm (Ioffe & Szegedy, 2015) and skip connections (Srivastava et al., 2015; He et al., 2016a) has allowed practitioners to train deep ResNets with hundreds or thousands of layers.
To understand this effect, a number of papers have analyzed signal propagation in normalized ResNets at initialization (Balduzzi et al., 2017; Yang et al., 2019).
In a recent work, De & Smith (2020) showed that in normalized ResNets with Gaussian initialization, the activations on the (cid:96) th residual branch are suppressed by factor of O ( √ (cid:96) ) , relative to the scale of the activations on the skip path.
This biases the residual blocks in deep ResNets towards the identity function at initialization, ensuring well-behaved gradients.
In unnormalized networks, one can preserve this beneﬁt by introducing a learnable scalar at the end of each residual branch, initialized to zero (Zhang et al., 2019; De & Smith, 2020; Bachlechner et al., 2020).
This simple change is sufﬁcient to train deep ResNets with thousands of layers without normalization.
However, while this method is easy to implement and achieves excellent convergence on the training set, it still achieves lower test accuracies than normalized networks when compared to well-tuned baselines.
These insights from studies of batch-normalized ResNets are also supported by theoretical analyses of unnormalized networks (Taki, 2017; Yang & Schoenholz, 2017; Hanin & Rolnick, 2018).
These works suggest that, in ResNets with identity skip connections, if the signal does not explode on the forward pass, the gradients will neither explode nor vanish on the backward pass.
Hanin & Rolnick (2018) conclude that multiplying the hidden activations on the residual branch by a factor of O (1 /d ) or less, where d denotes the network depth, is sufﬁcient to ensure trainability at initialization.
Alternate normalizers: To counteract the limitations of BatchNorm in different situations, a range of alternative normalization schemes have been proposed, each operating on different components of the hidden activations.
These include LayerNorm (Ba et al., 2016), InstanceNorm (Ulyanov et al., 2016), GroupNorm (Wu & He, 2018), and many more (Huang et al., 2020).
While these alternatives remove the dependency on the batch size and typically work better than BatchNorm for very small batch sizes, they also introduce limitations of their own, such as introducing additional computational costs during inference time.
Furthermore for image classiﬁcation, these alternatives still tend to achieve lower test accuracies than well-tuned BatchNorm baselines.
As one exception, we note that the combination of GroupNorm with Weight Standardization (Qiao et al., 2019) was recently identiﬁed as a promising alternative to BatchNorm in ResNet-50 (Kolesnikov et al., 2019).
S IGNAL P ROPAGATION P LOTS
Although papers have recently theoretically analyzed signal propagation in ResNets (see Section 2), practitioners rarely empirically evaluate the scales of the hidden activations at different depths inside a speciﬁc deep network when designing new models or proposing modiﬁcations to existing architectures.
By contrast, we have found that plotting the statistics of the hidden activations at different points inside a network, when conditioned on a batch of either random Gaussian inputs or training examples, can be extremely beneﬁcial.
This practice both enables us to immediately detect hidden bugs in our implementation before launching an expensive training run destined to fail, and also allows us to identify surprising phenomena which might be challenging to derive from scratch.
We therefore propose to formalize this good practice by introducing Signal Propagation Plots (SPPs), a simple graphical method for visualizing signal propagation on the forward pass in deep ResNets.
We assume identity residual blocks of the form x (cid:96) +
= f (cid:96) ( x (cid:96) )
+ x (cid:96) , where x (cid:96) denotes the input to the (cid:96) th block and f (cid:96) denotes the function computed by the (cid:96) th residual branch.
We consider 4dimensional input and output tensors with dimensions denoted by NHWC , where N denotes the batch dimension, C denotes the channels, and H and W denote the two spatial dimensions.
To generate SPPs, we initialize a single set of weights according to the network initialization scheme, and then provide the network with a batch of input examples sampled from a unit Gaussian distribution.
Then, we plot the following hidden activation statistics at the output of each residual block:
• Average Channel Squared Mean, computed as the square of the mean across the NHW axes, and then averaged across the C axis.
In a network with good signal propagation, we would expect the mean activations on each channel, averaged across a batch of examples, to be close to zero.
Importantly, we note that it is necessary to measure the averaged squared value of the mean, since the means of different channels may have opposite signs.
• Average Channel Variance, computed by taking the Channel Variance across the NHW axes, and then averaging across the C axis.
We ﬁnd this to generally be the most informative measure of the signal magnitude, and to clearly show signal explosion or attenuation.
• Average Channel Variance on the end of the residual branch, before merging with the skip path.
This helps assess whether the layers on the residual branch are correctly initialized.
We explore several other possible choices of statistics one could measure in Appendix G, but we have found these three to be the most informative.
We also experiment with feeding the network real data samples instead of random noise, but ﬁnd that this step does not meaningfully affect the key trends.
Finally, we emphasize that SPPs do not capture every property of signal propagation, and only consider the statistics of the forward pass.
Despite this simplicity, we ﬁnd SPPs surprisingly useful for analyzing deep ResNets.
As an example, in Figure 1 we present the SPP for a 600-layer pre-activation ResNet (He et al., 2016a) 1 with BatchNorm, ReLU, and He initialization (He et al., 2015), comparing BN-ReLU ordering (more standard) to ReLU-BN ordering.
Immediately, several key patterns emerge.
First, we note that the Average Channel Variance grows linearly with the depth in a given stage, and resets at each transition block to a ﬁxed value close to 1.
The linear growth arises because, at initialization, the variance of the activations satisfy Var( x (cid:96) +1 )
=
Var( x (cid:96) )
+ Var( f (cid:96) ( x (cid:96) )) , while BatchNorm ensures that the variance of the activations on the residual branch is independent of depth (De & Smith, 2020).
The variance reset arises from the transition blocks, where the skip connection is replaced by a convolution operating on a normalized input, undoing any signal growth on the skip path.
With the BN-ReLU-Conv ordering, the Average Squared Channel Means display similar behavior, growing linearly with depth between transition blocks.
This may seem surprising, since we expect
BatchNorm to center the activations.
However, with this ordering, the ﬁnal convolution in a block receives a rectiﬁed input that has positive mean.
As we show in the following section, this causes the output of the residual branch to also have positive mean, and explains why Var( f (cid:96) ( x (cid:96) ))
≈ 0 .for
all depths (cid:96) .
This “mean-shift” will be explicitly counteracted by normalization layers, enabling stable training in normalized networks, but will have serious consequences when attempting to remove normalizer layers, as discussed below.
In contrast, the ReLU-BN-Conv ordering trains equally stably while avoiding this mean-shift, with Var( f (cid:96) ( x (cid:96) ))
≈ 1 for all (cid:96) .
N ORMALIZER -F REE R ES N ETS (NF-R ES N ETS )
With SPPs in hand to aid our analysis, we now seek to develop ResNet variants without normalization layers, which have good signal propagation, are stable during training, and reach test accuracies competitive with batch-normalized ResNets.
We begin with two observations from Section 3.
First, at standard initializations, BatchNorm downscales the input to each residual block by a factor proportional to the standard deviation of the input signal (De & Smith, 2020).
Second, each residual block increases the variance of the signal by an approximately constant factor.
We propose to mimic this effect by using residual blocks of the form x (cid:96) +
= x (cid:96) + αf (cid:96) ( x (cid:96) /β
(cid:96) ) , where x (cid:96) denotes the input to the (cid:96) th residual block and f (cid:96) ( · ) denotes the (cid:96) th residual branch.
We design the network such that:
• f ( · ) , the function computed by the residual branch, is parameterized to be variance preserving at initialization, i
e., Var( f (cid:96) ( z )) =
Var( z ) for all (cid:96) .
This constraint enables us to reason about the signal growth in the network, and estimate the variances analytically.
• β (cid:96) is a ﬁxed scalar, chosen as (cid:112) Var( x (cid:96) ) , the expected empirical standard deviation of the activations x (cid:96) at initialization.
This ensures the input to f (cid:96) ( · ) has unit variance.
• α is a scalar hyperparameter which controls the rate of variance growth between blocks.
We compute the expected empirical variance at residual block (cid:96) analytically according to Var( x (cid:96) ) =
Var( x (cid:96) − 1 ) + α 2 , with an initial expected variance of Var( x 0 ) = 1 , and we set β (cid:96) =
(cid:112) Var( x (cid:96) ) .
A similar approach was proposed by Arpit et al.
(2016) for non-residual networks.
As noted in
Section 3, the signal variance in normalized ResNets is reset at each transition layer due to the shortcut convolution receiving a normalized input.
We mimic this reset by having the shortcut convolution in transition layers operate on ( x (cid:96) /β
(cid:96) ) rather than x (cid:96) , ensuring unit signal variance at the start of each stage ( Var( x (cid:96) +1 )
=
1 + α 2 following each transition layer).
For simplicity, we call residual networks employing this simple scaling strategy Normalizer-Free ResNets (NF-ResNets).
4. R E LU A CTIVATIONS I NDUCE M EAN S HIFTS
We plot the SPPs for Normalizer-Free ResNets (NF-ResNets) with α = 1 in Figure 2.
In green, we consider a simple NF-ResNet, which initializes the convolutions with Gaussian weights using
He initialization (He et al., 2015).
Although one might expect this simple recipe to be sufﬁcient to achieve good signal propagation, we observe two unexpected features in practice.
First, the average value of the squared channel mean grows rapidly with depth, achieving large values which exceed the average variance of the channel.
This indicates a “mean shift”, whereby the hidden activations for different training inputs (in this case different vectors sampled from the unit normal) are strongly correlated (Jacot et al., 2019).
Second, as also observed for BN-ReLU-Conv networks in section 3, the scale of the empirical variances on the residual branch are consistently smaller than one.
To identify the origin of these effects, in Figure 7 (in Appendix F) we provide a similar SPP for a linearized version of ResNetV2-600 without ReLU activation functions.
When the ReLU activations are removed, the averaged squared channel means remain close to zero for all block depths, and the empirical variance on the residual branch ﬂuctuates around one.
This motivates the following question: why might ReLU activations cause the scale of the mean activations on a channel to grow?
To develop an intuition for this phenomenon, consider the transformation z
=
Wg ( x ) , where W is arbitrary and ﬁxed, and g ( · ) is an activation function that acts component-wise on iid inputs x such that g ( x ) is also iid.
Thus, g ( · ) can be any popular activation function like ReLU, tanh, SiLU, etc.
Let E ( g ( x i ))
= µ g and Var( g ( x i ))
=
σ 2 g for all dimensions i .
It is straightforward to show that the expected value and the variance of any unit i of the output z i =
(cid:80) Nj W i,j g ( x j ) is given by:
[Equation]
and Var( z i ) =
Nσ 2 g ( σ
[Equation]
i
[Equation]
· + µ 2 W
[Equation] [Equation]
where µ W i, · and σ W i, · are the mean and standard deviation of the i th row of W : µ W
[Equation] [Equation]
1 N (cid:80)
[Equation]
W
[Equation]
, and σ 2 W i, · = 1 N (cid:80) Nj W 2 i,j − µ
[Equation]
W
[Equation]
Now consider g ( · ) to be the ReLU activation function, i.e., g ( x ) = max( x, 0) .
Then g ( x ) ≥ 0 , which implies that the input to the linear layer has positive mean (except for the edge case when all inputs are 0).
In particular, notice that if x i ∼ N (0 , 1) for all i , then µ g = 1 / √ 2 π > 0 .
Since we know that µ g > 0 , if µ W i, · is also non-zero, then the output of the transformation, z , will also exhibit a non-zero mean.
Crucially, even if we sample W from a distribution centred around zero (as is typically done with standard Gaussian initializations like He initialization), any speciﬁc weight matrix drawn from this distribution will almost surely have a non-zero empirical mean, and consequently the outputs of the residual branches will have mean values shifted away from zero.
This simple NF-ResNet model with He-initialized weights is unstable and performs poorly for deeper networks.
4. S CALED W EIGHT S TANDARDIZATION
To prevent the emergence of a mean shift, and to ensure that the residual branch f (cid:96) ( · ) is variance preserving, we propose Scaled Weight Standardization (a minor modiﬁcation of Weight Standardization (Qiao et al.
We re-parameterize the convolutional layers, by imposing,
[Equation]
where the mean µ and variance σ are computed across the fan-in extent of the convolutional ﬁlters.
We initialize the underlying parameters W from Gaussian weights, while γ is a ﬁxed constant.
As in Qiao et al.
(2019), we impose this constraint throughout training as a differentiable operation in the forward pass of the network.
Recalling equation 1, we can immediately see that the output of the transformation using Scaled WS, z
= ˆ
Wg ( x ) , has expected value E ( z i )
=
for all i , thus eliminating the mean shift.
Furthermore, the variance Var( z i ) =
γ 2 σ 2 g , meaning that for a correctly chosen γ , which depends on the non-linearity g , the layer will be variance preserving.
Scaled Weight Standardization is cheap during training and free at inference, scales well (with the number of parameters rather than activations), introduces no dependence between batch elements and no discrepancy in training and test behavior, and its implementation does not differ in distributed training.
These desirable properties make it a compelling alternative for replacing BatchNorm.
The SPP of a normalizer-free ResNet-600 employing Scaled WS is shown in Figure 2 in cyan.
As we can see, Scaled Weight Standardization eliminates the growth of the average channel squared means at initialization.
Indeed, the SPPs are almost identical to the SPPs for a batch-normalized network employing the ReLU-BN-Conv ordering, shown in red.
Note that we select the constant γ to ensure that the channel variance on the residual branch is close to one (discussed further below).
The variance on the residual branch decays slightly near the end of the network due to zero padding.
4. D ETERMINING N ONLINEARITY -S PECIFIC C ONSTANTS γ
The ﬁnal ingredient we need is to determine the value of the gain γ , in order to ensure that the variances of the hidden activations on the residual branch are close to 1 at initialization.
Note that the value of γ will depend on the speciﬁc nonlinearity used in the network.
We derive the value of γ assuming that the input x to the nonlinearity is sampled iid from N (0 , 1) .
For ReLU networks, this implies that the outputs, g ( x ) = max( x, 0) , will be sampled from the rectiﬁed Gaussian distribution with variance σ 2 g
= (1 / 2)(1 − (1 /π ))
(Arpit et al., 2016).
Since Var( ˆ Wg ( x ))
=
γ 2 σ 2 g , to ensure
Var( ˆ Wg ( x ))
= 1 , we set γ = 1 /σ g = √ 2 √ 1 − 1 π .
While the x ∼ N (0 , 1) will not typically be true unless the network width is large, we ﬁnd this approximation to work well in practice.
For simple nonlinearities like the ReLU or tanh, the analytical variance of the non-linearity g ( x ) when x is drawn from the unit normal may be known or easy to derive.
For other nonlinearities, such as SiLU ((Elfwing et al., 2018; Hendrycks & Gimpel, 2016), recently popularized as Swish (Ramachandran et al., 2017)), analytically determining the variance can involve solving difﬁcult integrals, or may even not have an analytical form.
In practice, we ﬁnd that it is sufﬁcient to numerically approximate this value with the simple procedure of drawing many N dimensional vectors x , computing the empirical variance Var( g ( x )) for each vector, and taking the square root of the average of this empirical variance.
We provide an example in Appendix D showing how this can be accomplished for any nonlinearity with just a few lines of code.
4. O THER B UILDING B LOCKS AND R ELAXED C ONSTRAINTS
Our method generally requires that any additional operations used in a network maintain good signal propagation, which means many common building blocks must be modiﬁed.
As with selecting γ values, the necessary modiﬁcation can be determined analytically or empirically.
For example, the popular Squeeze-and-Excitation operation (S+E, Hu et al.
, y = sigmoid ( MLP ( pool ( h ))) ∗ h , involves multiplication by an activation in [0 , 1] , and will tend to attenuate the signal and make the model unstable.
This attenuation can clearly be seen in the SPP of a normalizer-free ResNet using these blocks (see Figure 9 in Appendix F).
If we examine this operation in isolation using our simple numerical procedure explained above, we ﬁnd that the expected variance is 0.5 (for unit normal inputs), indicating that we simply need to multiply the output by 2 to recover good signal propagation.
We empirically veriﬁed that this simple change is sufﬁcient to restore training stability.
In practice, we ﬁnd that either a similarly simple modiﬁcation to any given operation is sufﬁcient to maintain good signal propagation, or that the network is sufﬁciently robust to the degradation induced by the operation to train well without modiﬁcation.
We also explore the degree to which we can relax our constraints and still maintain stable training.
As an example of this, to recover some of the expressivity of a normal convolution, we introduce learnable afﬁne gains and biases to the Scaled
WS layer (the gain is applied to the weight, while the bias is added to the activation, as is typical).
While we could constrain these values to enforce good signal propagation by, for example, scaling the output y with a scalar proportional to the values of the gains, we ﬁnd that this is not necessary for stable training, and that stability is not impacted when these parameters vary freely.
Relatedly, we ﬁnd that employing a learnable scalar multiplier at the end of the residual branch initialized to 0 (Goyal et al., 2017; De & Smith, 2020) helps when training networks over 150 layers, even if we ignore this modiﬁcation when computing β (cid:96) .
In our ﬁnal models, we employ several such relaxations without loss of training stability.
We provide detailed explanations for each operation and any modiﬁcations we make in Appendix C (also detailed in our model code in Appendix D).
4. S UMMARY
In summary, the core recipe for a Normalizer-Free ResNet (NF-ResNet) is:
Compute and forward propagate the expected signal variance β 2 (cid:96) , which grows by α 2 at each residual block ( β 0 = 1 ).
Downscale the input to each residual block by β (cid:96) .
Additionally, downscale the input to the convolution on the skip path in transition blocks by β (cid:96) , and reset β (cid:96) +
=
+ α 2 following a transition block.
[Table]
Standardization
[Table]
all
[Table]
layers, computing γ
[Table]
the gain speciﬁc
[Table]
Code is provided in Appendix D for a reference Normalizer-Free network.
E XPERIMENTS 5. A N EMPIRICAL EVALUATION ON R ES N ETS
[Table]
standard deviation across 5 random seeds.
∗ indicates a setting where two runs collapsed and results are reported only using the 3 seeds which train successfully.
We begin by investigating the performance of Normalizer-Free pre-activation ResNets on the
ILSVRC dataset (Russakovsky et al., 2015) relative to FixUp, (Zhang et al., 2019), SkipInit (De & Smith, 2020), and batch-normalized ResNets.
We use a training setup based on Goyal et al.
(2017), and train our models using SGD (Robbins & Monro, 1951) with Nesterov’s Momentum (Nesterov, 1983; Sutskever et al., 2013) for 90 epochs with a batch size of 1024 and a learning rate which warms up from zero to 0.4 over the ﬁrst 5 epochs, then decays to zero using cosine annealing (Loshchilov & Hutter, 2016).
We employ standard baseline preprocessing (sampling and resizing distorted bounding boxes, along with random ﬂips), weight decay of 5e-5, and label smoothing of 0.1 (Szegedy et al., 2016a).
For Normalizer-Free ResNets (NF-ResNets), we choose α = 0 .
2 via a small sweep, and employ SkipInit as discussed above.
For FixUp and SkipInit we must reduce the learning rate to 0.2 to enable stable training.
We ﬁnd that without any additional regularization, our unnormalized models achieve higher training accuracies and lower test accuracies than their batch-normalized counterparts, likely due to the known regularization effect of BatchNorm (Hoffer et al., 2017; Luo et al., 2018).
We therefore introduce stochastic depth (Huang et al., 2016) with a rate of 0.1, and Dropout (Srivastava et al., 2014) before the ﬁnal linear layer with a drop probability of 0.25.
We note that adding this same regularization does not substantially impact the performance of the normalized ResNets in our setup, suggesting that BatchNorm is indeed already providing some regularization beneﬁt.
In Table 1 we compare performance of our networks (NF-ResNets) against the baseline (BNResNets), across a wide range of network depths.
After introducing additional regularization, NFResNets achieve performance better than FixUp/SkipInit and competitive with BN across all network depths, with our regularized NF-ResNet-288 achieving top-1 accuracy of 79 .
However, some of the 288 layer normalizer-free models undergo training collapse at the chosen learning rate, but only when unregularized.
While we can remove this instability by reducing the learning rate to 0.2, this comes at the cost of test accuracy.
We investigate and discuss this observed failure mode in
Appendix A.
One noted limitation of BatchNorm is that its performance degrades when using small batch sizes, including small per-device batch sizes (Wu & He, 2018).
To demonstrate that our normalizer-free models overcome this limitation, we train ResNet-50s on ImageNet using very small batch sizes of 8 and 4, and report the results in Table 2.
These models are trained for 15 epochs (4.8M and 2.4M training steps, respectively) with a learning rate of 0.025 for batch size 8 and 0.01 for batch size 4.
For comparison, we include the accuracy obtained when training for 15 epochs at batch sizeand learning rate 0.4.
The performance of the NF models is substantially better in this setting, and is not affected by the shift from batch size 8 to 4, demonstrating the usefulness of our approach in the microbatch setting.
[Table]
additionally test the transferability of our learned representations the downstream semantic segmentation and depth estimation, and present the results in Appendix H
5. D ESIGNING P ERFORMANT N ORMALIZER -F REE N ETWORKS
We now turn our attention to developing unnormalized networks which are competitive with the state-of-the-art EfﬁcientNet model family across a range of FLOP budgets (Tan & Le, 2019), We focus primarily on the small budget regime (EfﬁcientNets B0-B4) but report results for B5 and hope to extend our investigation to larger variants in future work.
First, we apply Scaled WS and our
Normalizer-Free structure directly to the
EfﬁcentNet backbone.
2 While we succeed in training these networks stably without normalization, we ﬁnd that even after extensive tuning our NormalizerFree EfﬁcientNets still substantially underperform their batch-normalized baselines.
For example, our normalization free B0 variant achieves 73.5 % top-1, a 3.2 % absolute degradation relative to the baseline.
We hypothesize that this is because Weight Standardization imposes a very strong constraint on depth-wise convolutions (which have an input channel count of 1), and that this may remove a substantial fraction of their expressivity.
This is in line with the empirical observation that removing Scaled WS from the depth-wise convolutions improves the test accuracy, although this comes at the cost of training stability.
To overcome the potentially poor interactions between Scaled Weight Standardization and depthwise convolutions, we next investigate the RegNet model family (Radosavovic et al., 2020).
RegNets are slightly modiﬁed variants of ResNeXts (Xie et al., 2017), developed via manual architecture search.
Crucially, RegNets employ grouped convolutions, which we anticipate are more compatible with Scaled WS than depthwise convolutions, since the fraction of the degrees of freedom in the model weights remaining after the standardization operation is higher.
We develop a new base model by taking the 0.4B
FLOP RegNet variant, and making several architectural changes (see Appendix C), which cumulatively substantially improve the model performance.
In order to assess the performance of our Normalizer-Free RegNets across a range of FLOPS budgets, we next apply the EfﬁcientNet compound scaling approach (increasing the width, depth, and input resolution in tandem) to obtain model variants at a range of approximate FLOPS targets.
Denoting these models NF-RegNets, we train variants B0-B5 (analogous to EfﬁcientNet variants and obtained using the EfﬁcientNet width + depth scaling parameters exactly) using both baseline preprocessing and combined CutMix (Yun et al., 2019) and MixUp (Zhang et al., 2017) augmentation.
We report the results in Figure 3 and Table 3 in Appendix A, and present a comparison of training speed in Appendix A Table 5.
For each FLOPS and augmentation setting, NF-RegNets attain comparable but slightly worse performance than EfﬁcientNets, while being substantially faster to train.
In the augmented setting, we report EfﬁcientNet results for AutoAugment (AA) and RandAugment (RA), (Cubuk et al., 2019; 2020), which we ﬁnd to produce better accuracies than training EfﬁcientNets with CutMix+MixUp.
However, we ﬁnd that both AA and RA degrade performance and stability for NF-RegNets.
We hypothesize that this occurs because these stronger augmentations change the statistics of the dataset in a way that negatively impacts signal propagation.
To support this claim, we note that inserting a single batch-normalization layer after the ﬁrst convolution in an NF-RegNet removes these instabilities and enables us to train stably with either AA or RA, but that this does not result in improved hold-out performance.
This observation highlights that many advanced techniques like AA and RA were designed explicitly to optimize the performance of batch-normalized models, and may be accordingly better suited to such models.
Our goal with these experiments is to demonstrate that networks without activation normalization can be trained to a performance competitive with the modern state-of-the-art, and can beneﬁt from many of the advances and best practices derived from the tens of thousands of devicehours of tuning that has gone into developing this models. However, it is reasonable to assume that removing a component as critical as normalization may render certain techniques ineffective without modiﬁcation, as in the case of these augmentation strategies. This motivates our choice to tune a RegNet baseline and upgrade it with known best practices: we feel that it is important to do the necessary work to push our networks towards performance competitive with the state of the art and demonstrate that high performance is possible without BatchNorm, which has been a part of most every recent improvement in the state of the art on ImageNet. We anticipate that our results could be further improved by devoting similar computational resources to normalizer-free architecture search or re-tuning augmentation strategies on our networks, but leave this to future work.
C ONCLUSION
We introduce Normalizer-Free Networks, a simple approach for designing ResNet models which do not require normalization layers.
Across a range of FLOP budgets, our models achieve performance competitive with the state-of-the-art EfﬁcientNets on ImageNet.
Meanwhile, our empirical analysis of signal propagation suggests that batch normalization resolves two key failure modes at initialization in deep ResNets.
First, it suppresses the scale of the hidden activations on the residual branch, preventing signal explosion.
Second, it prevents the mean squared scale of the activations on each channel from exceeding the variance of the activations between examples.
Our Normalizer-Free
Networks were carefully designed to resolve both of these failure modes.
A PPENDIX A E XPERIMENT D ETAILS
[Table]
A. S TABILITY , L EARNING R ATES , AND B ATCH S IZES
Previous work (Goyal et al., 2017) has established a fairly robust linear relationship between the optimal learning rate (or highest stable learning rate) and batch size for Batch-Normalized ResNets.
As noted in Smith et al.
[Table]
we also ﬁnd that this relationship breaks down past batch size 1024 for our unnormalized ResNets, as opposed to 2048 or 4096 for normalized ResNets.
Both the optimal learning rate and the highest stable learning rate decrease for higher batch sizes.
This also appears to correlate with depth: when not regularized, our deepest layers are not always stable with a learning rate of 0.4.
While we can mitigate this collapse by reducing the learning rate for deeper nets, this introduces additional tuning expense and is clearly undesirable.
It is not presently clear why regularization aids in stability; we leave investigation of this phenomenon to future work.
Taking a closer look at collapsed networks, we ﬁnd that even though their outputs have exploded (becoming large enough to go NaN), their weight magnitudes are not especially large, even if we remove our relaxed afﬁne transforms and train networks whose layers are purely weight-standardized.
The singular values of the weights, however, end up poorly conditioned, meaning that the Lipschitz constant of the network can become quite large, an effect which Scaled WS does not prevent.
One might consider adopting one of the many techniques from the GAN literature to regularize or constrain this constant (Gulrajani et al., 2017; Miyato et al., 2018), but as we will show in the following section this added complexity and expense is not necessary to develop performant unnormalized networks.
This collapse highlights an important limitation of our approach, and of SPPs: as SPPs only show signal prop for a given state of a network (i.e. at init), no guarantees are provided far from initialization.
This fact drives us to prefer parameterizations like Scaled WS rather than solely relying on initialization strategies, and highlights that while good signal propagation is generally necessary for stable optimization, it is not always sufﬁcient.
A.
[Table] [Table]
OOM We evaluate the relative training speed of our normalizer-free models against batch-normalized models by comparing training speed (measured as the number of training steps per second).
For comparing NF-RegNets against EfﬁcientNets, we measure using the EfﬁcientNet image sizes for each variant to employ comparable settings, but in practice we employ smaller image sizes so that our actual observed training speed for NF-RegNets is faster.
A PPENDIX B M ODIFIED B UILDING B LOCKS
In order to maintain good signal propagation in our Normalizer-Free models, we must ensure that any architectural modiﬁcations do not compromise our model’s conditioning, as we cannot rely on activation normalizers to automatically correct for such changes.
However, our models are not so fragile as to be unable to handle slight relaxations in this realm.
We leverage this robustness to improve model expressivity and to incorporate known best practices for model design.
B. A FFINE G AINS AND B IASES
First, we add afﬁne gains and biases to our network, similar to those used by activation normalizers.
These are applied as a vector gain, each element of which multiplies a given output unit of a reparameterized convolutional weight, and a vector bias, which is added to the output of each convolution.
We also experimented with using these as a separate afﬁne transform applied before the
ReLU, but moved the parameters next to the weight instead to enable constant-folding for inference.
As is common practice with normalizer parameters, we do not weight decay or otherwise regularize these weights.
Even though these parameters are allowed to vary freely, we do not ﬁnd that they are responsible for training instability, even in networks where we observe collapse.
Indeed, we ﬁnd that for settings which collapse (typically due to learning rates being too high), removing the afﬁne transform has no impact on stability.
As discussed in Appendix A, we observe that model instability arises as a result of the collapse of the spectra of the weights, rather than any consequence of the afﬁne gains and biases.
B. S TOCHASTIC D EPTH
We incorporate Stochastic Depth (Huang et al., 2016), where the output of the residual branch of a block is randomly set to zero during training.
This is often implemented such that if the block is kept, its value is downscaled by the keep probability.
We remove this downscaling factor to help maintain signal propagation when the signal is kept, but otherwise do not ﬁnd it necessary to modify this block.
While it is possible that we might have an example where many blocks are dropped and signals are attenuated, in practice we ﬁnd that, as with afﬁne gains, removing Stochastic Depth does not improve stability, and adding it does not reduce stability.
One might also consider a slightly more principled variant of Stochastic Depth in this context, where the skip connection is upscaled by 1+ α if the residual branch is dropped, resulting in the variance growing as expected, but we did not ﬁnd this strategy necessary.
B. S QUEEZE AND E XCITE L AYERS
As mentioned in Section 4.4, we incorporate Squeeze and Excitation layers (Hu et al., 2018), which we empirically ﬁnd to reduce signal magnitude by a factor of 0.5, which is simply corrected by multiplying by 2.
This was determined using a similar procedure to that used to ﬁnd γ values for a given nonlinearity, as demonstrated in Appendix D.
We validate this empirically by training NFRegNet models with unmodiﬁed S+E blocks, which do not train stably, and NF-RegNet models with the additional correcting factor of 2, which do train stably.
B. A VERAGE P OOLING
In line with best practices determined by He et al.
(2019), in our NF-RegNet models we replace the strided 1x1 convolutions with average pooling followed by 1x1 convolutions, a common alternative also employed in Zagoruyko & Komodakis (2016).
We found that average pooling with a kernel of size k × k tended to attenuate the signal by a factor of k , but that it was not necessary to apply any correction due to this.
While this will result in mis-estimation of β values at initialization, it does not harm training (and average pooling in fact improved results over strided 1x1 convolutions in every case we tried), so we simply include this operation as-is.
A PPENDIX C M ODEL D ETAILS
We develop the NF-RegNet architecture starting with a RegNetY-400MF architecture (Radosavovic et al.
a low-latency RegNet variant which also uses Squeeze+Excite blocks (Hu et al., 2018)) and uses grouped convolutions with a group width of 8.
Following EfﬁcientNets, we ﬁrst add an additional expansion convolution after the ﬁnal residual block, expanding to 1024 w channels, where w is a model width multiplier hyperparameter.
We ﬁnd this to be very important for performance: if the classiﬁer layer does not have access to a large enough feature basis, it will tend to underﬁt (as measured by higher training losses) and underperform.
We also experimented with adding an additional linear expansion layer after the global average pooling, but found this not to provide the same beneﬁt.
Next, we replace the strided 1x1 convolutions in transition layers with average pooling followed by 1x1 convolutions (following He et al.
(2019)), which we also ﬁnd to improve performance.
We switch from ReLU activations to SiLU activations (Elfwing et al., 2018; Hendrycks & Gimpel, 2016;
Ramachandran et al., 2017).
We ﬁnd that SiLU’s beneﬁts are only realized when used in conjunction with EMA (the model averaging we use, explained below), as in EfﬁcientNets.
The performance of the underlying weights does not seem to be affected by the difference in nonlinearities, so the improvement appears to come from SiLU apparently being more amenable to averaging.
We then tune the choice of width w and bottleneck ratio g by sweeping them on the 0.4B FLOP model.
Contrary to Radosavovic et al.
(2020) which found that inverted bottlenecks (Sandler et al., 2018) were not performant, we ﬁnd that inverted bottlenecks strongly outperformed their compressive bottleneck counterparts, and select w = 0 .
75 and g = 2 . 25 .
Following EfﬁcientNets
(Tan &
Le, 2019), the very ﬁrst residual block in a network uses g = 1 , a FLOPs-reducing strategy that does not appear to harmfully impact performance.
We also modify the S+E layers to be wider by making their hidden channel width a function of the block’s expanded width, rather than the block’s input width (which is smaller in an inverted bottleneck).
This results in our models having higher parameter counts than their equivalent FLOP target EfﬁcientNets, but has minimal effect on FLOPS, while improving performance.
While both
FLOPs and parameter count play a part in the latency of a deployed model, (the quantity which is often most relevant in practice) neither are fully predictive of latency (Xiong et al., 2020).
We choose to focus on the FLOPs target instead of parameter count, as one can typically obtain large improvements in accuracy at a given parameter count by, for example, increasing the resolution of the input image, which will dramatically increase the FLOPs.
With our baseline model in hand, we apply the EfﬁcientNet compound scaling (increasing width, depth, and input image resolution) to obtain a family of models at approximately the same FLOPs targets as each EfﬁcientNet variant.
We directly use the EfﬁcientNet width and depth multipliers for models B0 through B5, and tune the test image resolution to attain similar FLOP counts (although our models tend to have slightly higher FLOP budgets).
Again contrary to Radosavovic et al.
(2020), which scales models almost entirely by increasing width and group width, we ﬁnd that the EfﬁcientNet compound scaling works effectively as originally reported, particularly with respect to image size.
Improvements might be made by applying further architecture search, such as tuning the w and g values for each variant separately, or by choosing the group width separately for each variant.
Following Touvron et al.
(2019), we train on images of slightly lower resolution than we test on, primarily to reduce the resource costs of training.
We do not employ the ﬁne-tuning procedure of
Touvron et al.
The exact train and test image sizes we use are visible in our model code in
Appendix D.
We train using SGD with Nesterov Momentum, using a batch size of 1024 for 360 epochs, which is chosen to be in line with EfﬁcientNet’s schedule of 360 epoch training at batch size 4096.
We employ a 5 epoch warmup to a learning rate of 0.4 (Goyal et al., 2017), and cosine annealing to 0 over the remaining epochs (Loshchilov & Hutter, 2016).
As with EfﬁcientNets, we also take an exponential moving average of the weights (Polyak, 1964), using a decay of 0.99999 which employs a warmup schedule such that at iteration i , the decay is decay = min ( i, 1+ i 10+ i ) .
We choose a larger decay than the EfﬁcientNets value of 0.9999, as EfﬁcientNets also take an EMA of the running average statistics of the BatchNorm layers, resulting in a longer horizon for the averaged model.
As with EfﬁcientNets, we ﬁnd that some of our models attain their best performance before the end of training, but unlike EfﬁcientNets we do not employ early stopping, instead simply reporting performance at the end of training.
The source of this phenomenon is that as some models (particularly larger models) reach the end of their decay schedule, the rate of change of their weights slows, ultimately resulting in the averaged weights converging back towards the underlying (less performant weights).
Future work in this area might consider examining the interaction between averaging and learning rate.
Following EfﬁcientNets, we also use stochastic depth (modiﬁed to remove the rescaling by the keep rate, so as to better preserve signal) with a drop rate that scales from 0 to 0.1 with depth (reduced from the EfﬁcientNets value of 0.2).
We swept this value and found the model to not be especially sensitive to it as long as it was not chosen beyond 0.25.
We apply Dropout (Srivastava et al., 2014) to the ﬁnal pooled activations, using the same Dropout rates as EfﬁcientNets for each variant.
We also use label smoothing (Szegedy et al., 2016a) of 0.1, and weight decay of 5e-5.
A PPENDIX D M ODEL C ODE
We here provide reference code using Numpy (Harris et al., 2020), JAX (Bradbury et al., 2018), and
PyTorch (Paszke et al., 2019).
D. N UMERICAL A PPROXIMATIONS OF N ONLINEARITY - SPECIFIC G AINS
It is often faster to determine the nonlinearity-speciﬁc constants γ empirically, especially when the chosen activation functions are complex or difﬁcult to integrate.
One simple way to do this is for the
SiLU function is to sample many (say, 1024) random C-dimensional vectors (of say size 256) and compute the average variance, which will allow for computing an estimate of the constant.
import jax import jax.numpy as jnp key =
jax.random.
PRNGKey(2)
# Arbitrary key # Produce a large batch of random noise vectors x = jax.random.normal(key, (1024, 256))
y =
jax.nn.silu(x) # Take the average variance of many random batches gamma = jnp.mean(jnp.var(y, axis=1))
D.
R EFERENCE P Y T ORCH I MPLEMENTATION OF NF-R EG N ETS class ScaledWSConv2d (nn.Conv2d): """2D Conv layer with Scaled Weight Standardization."
"" def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=
True, gain=
True, eps=1e-4): nn.
Conv2d.__init__(self, in_channels, out_channels, kernel_size, stride, padding, dilation, groups, bias) if gain: self.gain
= nn.
Parameter( torch.ones(self.out_channels, 1, 1, 1)) else : self.gain =
None # Epsilon, a small constant to avoid dividing by zero.
self.eps = eps def get_weight(self): # Get Scaled WS weight OIHW; fan_in
= np.prod(self.weight.shape[1:]) mean
= torch.mean(self.weight, axis=[1, 2, 3], keepdims=
True) var = torch.var(self.weight, axis=[1, 2, 3], keepdims=
True) weight = (self.weight - mean) / (var + self.eps) ** 0.
if self.gain is not None: weight = weight * self.gain return weight def forward(self, x): return F.conv2d(x, self.get_weight(), self.bias, self.stride, self.padding, self.dilation, self.groups) class SqueezeExcite (nn.
Module):
"""Simple Squeeze+Excite layers.""" def __init__(self, in_channels, width, activation): super().__init__() self.se_conv0=nn.
Conv2d(in_channels, width, kernel_size=1, bias=
True)
self.se_conv1 = nn.
Conv2d(width, in_channels, kernel_size=1, bias=
True)
self
.activation = activation def forward(self, x): # Mean pool for NCHW tensors
h = torch.mean(x, axis=[2, 3], keepdims=
True)
# Apply two linear layers with activation in between h = self.se_conv1(self.activation(self.se_conv0(h)))
# Rescale the sigmoid output and return return (torch.sigmoid(h) * 2) * x class NFBlock (nn.
Module): """NF-RegNet block."
"" def __init__(self, in_channels, out_channels, stride=1, activation=
F.relu, which_conv=ScaledWSConv2d, beta=1.0, alpha=1.0, expansion=2.25, keep_rate
=
None, se_ratio=0.5, group_size=8): super().__init__() self.in_ch,self.out_ch =
in_channels, out_channels self.activation = activation self.beta, self.alpha =
beta, alpha width =
int(in_channels * expansion) if group_size is None: groups =else : groups = width //
group_size # Round width up if you pick a bad group size width =
int(group_size * groups) self .stride = stride self.width = width self.conv1x1a = which_conv(in_channels, width,
kernel
_size=1, padding=
self.conv3x =
which_conv( width
, width, kernel_size=3, stride=stride, padding=1, groups=groups) self.conv1x1b = which_
conv
width, out
channels
, kernel_size=1, padding=0) if stride > 1 or in_channels !
= out_channels: self.conv_shortcut = which_conv(in_channels, out_channels, kernel_size=1, stride=1, padding=0) else : self.conv_shortcut =
None # Hidden size of the S+E MLP se_width = max(1, int(width * se_ratio)) self.se
= SqueezeExcite(width, se_width, self.activation) self.skipinit_gain =
nn.
Parameter(torch.zeros(()))
def forward(self, x): out = self.activation(x) / self.beta if self.conv_shortcut is not None: shortcut = self.conv_shortcut(F.avg_pool2d(out, 2)) else : shortcut = x out = self.conv1x1a
# Initial bottleneck conv
.conv3x .activation
Spatial conv
)) return out * skipinit
# Nonlinearities.
Note that we bake the constant into the # nonlinearites rather than the WS layers.
nonlinearities = { 'silu':
lambda x: x * torch.sigmoid(x) /
.5595, 'relu':
lambda x: F.relu(x) / (0.5 * (1 - 1 / np.pi))
** 0.5, 'identity': lambda x: x} # Block base widths and depths for each variant params = {'NF-RegNet-B0': {'width': [48, 104, 208, 440], 'depth': [1, 3, 6, 6], 'train_imsize': 192, 'test_imsize': 224,}, 'NF-RegNet-B1': {'width': [48, 104, 208, 440], 'depth': [2, 4, 7, 7], 'train_imsize': 240, 'test_imsize': 256,}, 'NF-RegNet-B2': {'width': [56, 112, 232, 488], 'depth': [2, 4, 8, 8], 'train_imsize': 240, 'test_imsize': 272,}, 'NF-RegNet-B3': {'width': [56, 128, 248, 528], 'depth': [2, 5, 9, 9], 'train_imsize': 288, 'test_imsize': 320,}, 'NF-RegNet-B4': {'width': [64, 144, 288, 616], 'depth': [2, 6, 11, 11], 'train_imsize': 320, 'test_imsize': 384,}, 'NF-RegNet-B5': {'width': [80, 168, 336, 704], 'depth': [3, 7, 14, 14], 'train_imsize': 384, 'test_imsize': 456,}, 'NF-RegNet-B6': {'width': [88, 184, 376, 792], 'depth': [3, 8, 16, 16], 'train_imsize': 448, 'test_imsize': 528,}, 'NF-RegNet-B7': {'width': [96, 208, 416, 880], 'depth': [4, 10, 19, 19], 'train_imsize': 512, 'test_imsize': 600,}, 'NF-RegNet-B8': {'width': [104, 232, 456, 968], 'depth': [4, 11, 22, 22], 'train_imsize': 600, 'test_imsize': 672,}, [Table] count_params(module): sum
item.
numel() for item in module.parameters()]) [Table] NFRegNet (nn. Module):
"""Normalizer-Free RegNets."""
def __init__(self, variant='NF-RegNet-B0', num_classes=1000, width=0.75, expansion=2.25, se_ratio=0.5, group_size=8, alpha=0.2, activation='silu', drop_rate=0.0, stochdepth_rate=0.0,): self.
variant = variant
self
.width
= width
self.expansion =
expansion
self.num_classes =
num_classes self.se_ratio =
se_ratio self.group_size =
group_size self.alpha = alpha self.activation =
nonlinearities.get(
activation
) self.drop_rate = drop_rate
self.stochdepth_rate =
stochdepth_rate self.which_conv = functools.partial(ScaledWSConv2d, gain=
True, bias=
True) # Get width and depth pattern self.width_pattern =
[int(val * self.width) for val in params[variant]['width']] self.depth_pattern = params[self.variant]['depth']
# Stem conv in_channels =
int(self.width_pattern[0]) self.initial_conv = self.which_conv(3, in_channels, kernel_size=3, stride=2, padding=1)
# Body blocks =
[] expected_var = 1.
index
=for block_width, stage_depth in zip(self.width_pattern, self.depth_pattern): for block_index in range(stage_depth): # Following EffNets, do not expand first block expand_ratio =
expansion
if index > 0 elsebeta = 1./ expected_var ** 0.
blocks +=
[NFBlock(in_channels, block_width, stride=
if block_index==0 else 1, activation=self.activation, which_conv=self.which_conv, beta=beta,alpha=self.alpha, expansion=
expand_ratio, se_ratio=
self.se_ratio, group_size=self.group_size)]
# Keep track of output channel count in_channels =
block_width # Reset expected var at a transition block if block_index =
= 0:
expected_var = 1.
# Even if reset occurs, increment expected variance expected_var += self.alpha **index +=self.blocks = nn.
Sequential(*blocks)
# Final convolution, following EffNets self.final_conv = self.which_conv(in_channels, int(1024*self.width), kernel_size=1, padding=0) in_channels =
int(1024 * self.width)
if self.drop_rate > 0.0: self.dropout = nn.
Dropout(drop_rate)
# Classifier layer.
Initialize this layer's weight with zeros!
self.fc
= nn.Linear(in_channels, self.num_classes, bias=
True) torch.nn.init.zeros_(self.fc.weight)
def forward(self, x): """Return the logits without any [log-]softmax.""" # Stem out = self.initial_conv(x)
# Blocks out = self.blocks(out)
# Final activation + conv out = self.activation(self.final_conv(out))
# Global average pooling pool = torch.mean(out, [2, 3])
if self.drop_rate > 0.0 and self.training:
pool = self.dropout(pool)
# Return logits return self.fc(pool)
A PPENDIX E O VERVIEW OF E XISTING B LOCKS
This appendix contains an overview of several different types of residual blocks
[Figure]
[Figure]
A PPENDIX F A DDITIONAL SPP S
In this appendix we include additional Signal Propagation Plots.
For reference, given an NHWC tensor, we compute the measured properties using the equivalent of the following Numpy (Harris et al., 2020) snippets:
• Average Channel Mean Squared: np.mean(np.mean(y, axis=[0, 1, 2])
** 2) • Average Channel Variance: np.mean(np.var(y, axis=[0, 1, 2]))
• Residual Average Channel Variance: np.mean
x),
=
A PPENDIX G N EGATIVE R ESULTS G. F ORWARD M ODE VS D ECOUPLED WS
Parameterization methods like Weight Standardization (Qiao et al., 2019), Weight Normalization (Salimans & Kingma, 2016), and Spectral Normalization (Miyato et al., 2018) are typically proposed as ”foward mode” modiﬁcations applied to parameters during the forward pass of a network.
This has two consequences: ﬁrst, this means that the gradients with respect to the underlying parameters are inﬂuenced by the parameterization, and that the weights which are optimized may differ substantially from the weights which are actually plugged into the network.
One alternative approach is to implement ”decoupled” variants of these parameterizers, by applying them as a projection step in the optimizer.
For example, ”Decoupled Weight Standardization” can be implemented atop any gradient based optimizer by replacing W with the normalized ˆ W after the update step.
Most papers proposing parameterizations (including the above) argue that the parameterization’s gradient inﬂuence is helpful for learning, but this is typically argued with respect to simply ignoring the parameterization during the backward pass, rather than with respect to a strategy such as this.
Using a Forward-Mode parameterization may result in interesting interactions with moving averages or weight decay.
For example, with WS, if one takes a moving average of the underlying weights, then applies the WS parameterization to the averaged weights, this will produce different results than if one took the EMA of the Weight-Standardized parameters.
Weight decay will have a similar phenomenon: if one is weight decaying a parameter which is actually a proxy for a weight-standardized parameter, how does this change the behavior of the regularization?
We experimented with Decoupled WS and found that it reduced sensitivity to weight decay (presumably because of the strength of the projection step) and often improved the accuracy of the EMA weights early in training, but ultimately led to worse performance than using the originally proposed ”forward-mode” formulation.
We emphasize that our experiments in this regime were only cursory, and suggest that future work might seek to analyze these interactions in more depth.
We also tried applying Scaled WS as a regularizer (”Soft WS”) by penalizing the mean squared error between the parameter W and its Scaled WS parameterization, ˆ W .
We implemented this as a direct addition to the parameters following Loshchilov & Hutter (2017) rather than as a differentiated loss, with a scale hyperparameter controlling the strength of the regularization.
We found that this scale could not be meaningfully decreased from its maximal value without drastic training instability, indicating that relaxing the WS constraint is better done through other means, such as the afﬁne gains and biases we employ.
G. M ISCELLANEOUS
• For SPPs, we initially explored plotting activation mean ( np.mean(h) ) instead of the average squared channel mean, but found that this was less informative.
• We also initially explored plotting the average pixel norm: the Frobenius norm of each pixel (reduced across the C axis) then averaged across the NHW axis, np.mean(np.linalg.norm(h, axis=-1)) ).
We found that this value did not add any information not already contained in the channel or residual variance measures, and was harder to interpret due to it varying with the channel count.
• We explored NF-ResNet variants which maintained constant signal variance, rather than mimicking Batch-Normalized ResNets with signal growth + resets.
The ﬁrst of two key components in this approach was making use of ”rescaled sum junctions,” where the sum junction in a residual block was rewritten to downscale the shortcut path as y
= α ∗ f ( x )+ x α, which is approximately norm-preserving if f ( x ) is orthogonal to x (which we observed to generally hold in practice).
Instead of scaled WS, this variant employed SeLU (Klambauer et al., 2017) activations, which we found to work as-advertised in encouraging centering and good scaling.
While these networks could be made to train stably, we found tuning them to be difﬁcult and were not able to easily recover the performance of BN-ResNets as we were with the approach ultimately presented in this paper.
A PPENDIX H E XPERIMENTS WITH A DDITIONAL T ASKS H. S EMANTIC S EGMENTATION ON P ASCAL VOC
[Table]
We present additional results investigating the transferability of our normalizer-free models to downstream tasks, beginning with the Pascal VOC Semantic Segmentation task.
We use the FCN architecture (Long et al., 2015) following He et al.
(2020) and Grill et al.
We take the ResNet backbones of each variant and modify the 3 3 convolutions in the ﬁnal stage to have dilation 2 and stride of 1, then add two extra 3 3 convolutions with dilation of 6, and a ﬁnal 1 1 convolution for classiﬁcation.
We train for 30000 steps at batch size 16 using SGD with Nesterov Momentum of 0.9, a learning rate of 0.003 which is reduced by a factor of 10 at 70% and 90% of training, and weight decay of 5e-5.
Training images are augmented with random scaling in the range [0.5, 2.0]), random horizontal ﬂips, and random crops.
Results in mean Intersection over Union (mIoU) are reported in Table 6 on the val2012 set using a single 513 pixel center crop.
We do not add any additional regularization such as stochastic depth or dropout.
NF-ResNets obtain comparable performance to their BN-ResNet counterparts across all variants.
H. D EPTH E STIMATION ON NYU D EPTH V
[Table]
We next present results for depth estimation on the NYU v2 dataset (Silberman et al., 2012) using the protocol from (Laina et al., 2016).
We downsample the images and center crop them to [304, 228] pixels, then randomly ﬂip and apply several color augmentations: grayscale with probability 30%, brightness with a maximum difference of 0.1255, saturation with a random factor picked from [0.5, 1.5], and Hue with adjustment factor picked in [-0.2, 0.2].
We take the features from the ﬁnal residual stage and feed them into the up-projection blocks from (Silberman et al., 2012), then train with a reverse Huber loss (Laina et al., 2016; Owen, 2007).
We train for 7500 steps at batch size 256 using SGD with Nesterov Momentum of 0.9, a learning rate of 0.16, and cosine annealing.
We report results in Table7 using ﬁve metrics commonly used for this task: the percentage of pixels where the magnitude of the relative error (taken as the ratio of the predicted depth and the ground truth, where the denominator is whichever is smaller) is below a certain threshold, as well as rootmean-squared and relative error (rms and rel).
As with semantic segmentation, we do not apply any additional regularization, and ﬁnd that our normalizer-free ResNets attain comparable performance across all model variants.