Wide Residual Networks
- Publication
- BMVC 2016Conference
- First submitted to arXiv
- arXiv:1605.07146
Cite this paper · BibTeX
The citation identifies the linked source version. It cites the original paper and its authors.
@misc{classiccnnswideresnet2016,
title = {{Wide Residual Networks}},
author = {Sergey Zagoruyko and Nikos Komodakis},
year = {2016},
eprint = {1605.07146},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/1605.07146}
}
In the first half of 2016, ResNets kept getting deeper and deeper.
The ResNet authors switched the residual unit to pre-activation and trained a 1001-layer network on CIFAR-10; around the same time, Stochastic Depth stacked a network up to 1202 layers.
More layers did give better results; they just kept getting more expensive. Going from 110 to 1001 layers, the pre-activation ResNet's CIFAR-10 error fell from 6.37% to 4.92%. The layer count went up ninefold, the error came down by less than one and a half percentage points, and training time stretched out along with it.
Sergey Zagoruyko and Nikos Komodakis of École des Ponts ParisTech in France thought about it from another angle. Does a ResNet really have to be this thin?
They made the network wider and shallower.
Defining the Problem
ResNets Keep Getting Thinner
The ResNet authors favored thin, deep networks, trading the parameters they saved for more layers. The later bottleneck block first reduces dimensionality with a convolution, runs the convolution, and then expands back up, making each block thinner still.
Take the ResNet used on CIFAR. Its three stages have just 16, 32, and 64 channels. VGG and Inception, which came before it, all had far more channels than that.
The Shortcut Is Too Easy
The authors point out that the identity shortcut, which lets ResNets train to a thousand layers and beyond, is also their weakness.
Gradients can travel all the way back along the shortcut, and nothing forces them through the weights of the residual branch. After training, perhaps only a few blocks have learned anything useful, or many blocks each contribute just a little. The authors call this phenomenon diminishing feature reuse.
The authors cite Stochastic Depth as evidence. Randomly switching off entire residual blocks during training actually makes the network better, which, as the authors see it, shows that many blocks weren't doing much in the first place.
Thin Networks Aren't Fast Either
GPUs are good at processing large tensors in one go, but a thin, deep network is a long chain of small convolutions that have to be computed one layer after another. As the authors note in the abstract, each small gain in accuracy requires nearly doubling the number of layers, so training gets slower and slower.
So the authors wanted to work out whether the same parameters are better used to make the network deeper or wider. Just how wide should a ResNet be?
Solving the Problem
What Can Be Changed
The authors start from ResNet v2's pre-activation block, where BN and ReLU come before every convolution. There are roughly three ways to make a residual block more expressive:
- Put more convolutional layers in the block.
- Widen the convolutions with more channels.
- Make the kernels larger.
The third is ruled out up front, since work on VGG and the Inception family has already shown how effective small kernels are. For the remaining two, the authors define one factor each. The deepening factor is the number of convolutional layers in a block, and the widening factor is how many times the channel count is multiplied. The original block is , .

The width of each box in the figure represents the channel count. (a) is the original basic block; (c) has the same structure, only with both convolutions widened. The bottleneck in (b) is the tool ResNet uses to make networks thinner, the opposite of the widening this paper studies, so the authors leave it out and build everything from the basic block. (d) adds dropout between the two convolutions; we'll come back to it later.
WRN-n-k
The network's skeleton follows ResNet v2's design for CIFAR, with the widening factor as the only addition:
| Group | Output size | Contents |
|---|---|---|
| conv1 | convolution, 16 channels | |
| conv2 | blocks, each with two convolutional layers, channels | |
| conv3 | blocks, channels | |
| conv4 | blocks, channels | |
| avg-pool | average pooling, followed by the classification layer |
The authors denote a network as WRN--, where is the total number of convolutional layers and is the widening factor. The official code requires , so WRN-28-10 is a network with blocks per group and channel counts multiplied by 10.
affects the parameter count quadratically. A convolution whose input and output both have channels has weights, so doubling the channels quadruples the weights. Let's build a few networks following the table above and count their parameters:
import torch.nn as nn
class Block(nn.Module):
"""BN-ReLU-conv3×3-BN-ReLU-conv3×3; the shortcut uses a 1×1 convolution when the shape changes"""
def __init__(self, cin, cout, stride):
super().__init__()
self.body = nn.Sequential(
nn.BatchNorm2d(cin), nn.ReLU(), nn.Conv2d(cin, cout, 3, stride, 1, bias=False),
nn.BatchNorm2d(cout), nn.ReLU(), nn.Conv2d(cout, cout, 3, 1, 1, bias=False))
self.shortcut = (nn.Identity() if cin == cout and stride == 1
else nn.Conv2d(cin, cout, 1, stride, bias=False))
def forward(self, x):
return self.shortcut(x) + self.body(x)
def wrn(n, k, num_classes=10):
N = (n - 4) // 6 # blocks per group
widths = [16 * k, 32 * k, 64 * k]
layers, cin = [nn.Conv2d(3, 16, 3, 1, 1, bias=False)], 16
for width, stride in zip(widths, (1, 2, 2)):
for i in range(N):
layers.append(Block(cin, width, stride if i == 0 else 1))
cin = width
layers += [nn.BatchNorm2d(cin), nn.ReLU(), nn.AdaptiveAvgPool2d(1), nn.Flatten(), nn.Linear(cin, num_classes)]
return nn.Sequential(*layers)
for n, k in [(40, 1), (40, 2), (40, 4), (16, 8), (22, 8), (28, 10)]:
params = sum(p.numel() for p in wrn(n, k).parameters())
print(f"WRN-{n}-{k}: {(n - 4) // 6} blocks per group, channels {16*k}/{32*k}/{64*k}, {params / 1e6:.1f}M parameters")
WRN-40-1: 6 blocks per group, channels 16/32/64, 0.6M parameters
WRN-40-2: 6 blocks per group, channels 32/64/128, 2.2M parameters
WRN-40-4: 6 blocks per group, channels 64/128/256, 8.9M parameters
WRN-16-8: 2 blocks per group, channels 128/256/512, 11.0M parameters
WRN-22-8: 3 blocks per group, channels 128/256/512, 17.2M parameters
WRN-28-10: 4 blocks per group, channels 160/320/640, 36.5M parameters
These numbers match the parameter counts in the paper's tables. At the same 40 layers, as goes from 1 to 2 to 4, the parameters go from 0.6M to 2.2M to 8.9M, roughly four times as many at each step. Looked at the other way, WRN-16-8 has only 16 layers, yet it already has more parameters than the 40-layer WRN-40-4.
What Goes Inside a Block
Should some convolutions be mixed in, as in NiN? The authors write a block's structure as , where lists the kernel sizes of the block's convolutional layers. For example, is the original basic block, and inserts an extra layer between the two layers.
These experiments all use , with the depth adjusted to keep the parameter counts similar, and each configuration is run 5 times on CIFAR-10, taking the median:
| Block | Depth | Parameters | One epoch (s) | CIFAR-10 error |
|---|---|---|---|---|
| 40 | 1.4M | 85.8 | 6.06% | |
| 40 | 1.2M | 67.5 | 5.78% | |
| 40 | 1.3M | 72.2 | 6.42% | |
| 40 | 1.3M | 82.2 | 5.86% | |
| 28 | 1.5M | 67.5 | 5.73% | |
| 22 | 1.1M | 59.9 | 5.78% |
is the best, but only by a small margin; and have fewer parameters and score almost the same. From this, the authors judge that blocks with similar parameter counts perform about the same, and from then on they use convolutions throughout.
How many layers should go in a block? The authors fix WRN-40-2's total layer count and parameter count (2.2M) and vary only the number of layers per block, :
| 1 | 2 | 3 | 4 | |
|---|---|---|---|---|
| CIFAR-10 error | 6.69% | 5.43% | 5.65% | 5.93% |
With the total layer count fixed, a larger means fewer blocks, and therefore fewer residual connections. The authors speculate that and are worse because the network, with fewer residual connections, is harder to optimize; , with a single layer per block, is clearly worse still. Two layers is just right, which is the original .
After trying all of that, the block's internals end up right back where they started, and the only thing left to change is the width .
Putting Dropout Inside the Block
Widening makes the parameter count balloon, which calls for regularization. BN has a regularizing effect of its own, but it usually needs heavy data augmentation alongside it, and the authors didn't want to rely on that.
They add a dropout layer between the block's two convolutions, after the ReLU, as in Figure 1(d). In code, that's one extra nn.Dropout after the second ReLU of the Block above:
self.body = nn.Sequential(
nn.BatchNorm2d(cin), nn.ReLU(), nn.Conv2d(cin, cout, 3, stride, 1, bias=False),
nn.BatchNorm2d(cout), nn.ReLU(), nn.Dropout(0.3), # between the two convolutions
nn.Conv2d(cout, cout, 3, 1, 1, bias=False))
ResNet v2 had also tried dropout in the residual block, but on the shortcut, and results got worse. Here the dropout touches only the residual branch, and the shortcut stays clean. The dropout probability is chosen by cross-validation, 0.3 for CIFAR and 0.4 for SVHN.
Discussion
Apart from ImageNet, every experiment uses the pre-activation ResNet as the baseline. CIFAR-10 and CIFAR-100 consist of small color images, each with 50,000 for training and 10,000 for testing, in 10 and 100 classes, respectively; the only data augmentation is horizontal flips and random crops. SVHN contains street-view house numbers, about 600,000 images, with no augmentation at all.
Splitting Between Width and Depth
| Depth | Parameters | CIFAR-10 | CIFAR-100 | |
|---|---|---|---|---|
| 40 | 1 | 0.6M | 6.85% | 30.89% |
| 40 | 2 | 2.2M | 5.33% | 26.04% |
| 40 | 4 | 8.9M | 4.97% | 22.89% |
| 40 | 8 | 35.7M | 4.66% | – |
| 28 | 10 | 36.5M | 4.17% | 20.50% |
| 28 | 12 | 52.5M | 4.33% | 20.43% |
| 22 | 8 | 17.2M | 4.38% | 21.22% |
| 22 | 10 | 26.8M | 4.44% | 20.75% |
| 16 | 8 | 11.0M | 4.81% | 22.07% |
| 16 | 10 | 17.1M | 4.56% | 21.59% |
First, hold the depth fixed. For the 40-, 22-, and 16-layer networks, a larger generally means a lower error. The only small exception is the 22-layer network going from to , where the CIFAR-10 error rises slightly from 4.38% to 4.44% while the CIFAR-100 error keeps falling.
Now hold the width fixed. At , going from 16 to 22 layers helps, but going further to 40 layers actually hurts, and WRN-40-8 loses to WRN-22-8. WRN-40-8 has 35.7M parameters, and the authors' view is that when depth and width grow together, once the parameter count passes a certain point, stronger regularization is needed.
Taking On the Thousand-Layer ResNet
Next comes a head-to-head comparison with the strongest thin networks of the time. These experiments switch to plain mean/std normalization, matching the preprocessing in the ResNet papers, and none of them use dropout:
| Network | Depth- | Parameters | CIFAR-10 | CIFAR-100 |
|---|---|---|---|---|
| Original ResNet | 110 | 1.7M | 6.43% | 25.16% |
| Original ResNet | 1202 | 10.2M | 7.93% | 27.82% |
| Stochastic Depth | 1202 | 10.2M | 4.91% | – |
| pre-act ResNet | 164 | 1.7M | 5.46% | 24.33% |
| pre-act ResNet | 1001 | 10.2M | 4.92% (4.64%) | 22.71% |
| WRN | 40-4 | 8.9M | 4.53% | 21.18% |
| WRN | 16-8 | 11.0M | 4.27% | 20.43% |
| WRN | 28-10 | 36.5M | 4.00% | 19.25% |
WRN-40-4 and ResNet-1001 have similar parameter counts (8.9M and 10.2M), yet with a twenty-fifth of the layers, WRN-40-4 wins on both datasets. From this, the authors conclude that at this parameter scale, depth brings no more regularization than width does.
WRN-28-10 has 3.6 times as many parameters as ResNet-1001. The common belief at the time was that depth has a regularizing effect while width invites overfitting, and by that logic it should overfit. In fact, at the same batch size, it wins by 0.92 percentage points on CIFAR-10 and 3.46 percentage points on CIFAR-100.
Wide Networks Run Faster

Blue is thin and red is wide. The thousand-layer thin ResNet takes 512 ms per batch (when a thousand layers have to queue up, nothing moves fast), while WRN-40-4, with about the same accuracy, needs only 68 ms, more than seven times faster. The most accurate one, WRN-28-10, has several times as many parameters and is still 1.6 times faster than the thousand-layer network.
The gap comes from the GPU behavior mentioned earlier. A wide convolutional layer processes a big block of tensor at once, keeping the GPU's parallel compute fully busy; a thin network is a thousand small convolutions lined up in a row, with each layer waiting for the previous one to finish.
The Effect of Dropout
| Depth | Dropout | CIFAR-10 | CIFAR-100 | SVHN | |
|---|---|---|---|---|---|
| 16 | 4 | 5.02% | 24.03% | 1.85% | |
| 16 | 4 | ✓ | 5.24% | 23.91% | 1.64% |
| 28 | 10 | 4.00% | 19.25% | – | |
| 28 | 10 | ✓ | 3.89% | 18.85% | – |
| 52 | 1 | 6.43% | 29.89% | 2.08% | |
| 52 | 1 | ✓ | 6.28% | 29.78% | 1.70% |
On CIFAR, the gains are small. With dropout, WRN-28-10's error drops by 0.11 percentage points on CIFAR-10 and 0.4 percentage points on CIFAR-100; WRN-16-4, which has fewer parameters, even does slightly worse on CIFAR-10.
On SVHN, the effect is clear, with both the wide and the thin networks improving by 0.2 to 0.4 percentage points. SVHN gets no data augmentation at all, and the authors think BN overfits here; without dropout, the training loss falls to very low values.
The authors also noticed that after the first learning-rate drop, the loss and validation error would suddenly rise together and oscillate at high values until the next learning-rate drop. They traced the cause to weight decay, but lowering the weight decay noticeably hurt accuracy. In most cases, dropout partially removes this effect.
The authors also list their best single-model results on each dataset. WRN-40-10 with dropout reaches 3.8% on CIFAR-10 and 18.3% on CIFAR-100, and WRN-16-8 with dropout reaches 1.54% on SVHN.
On ImageNet, Widen the Middle Layer
On ImageNet, the authors first widen basic-block networks such as ResNet-18 and ResNet-34 by 1.5 to 3 times. Widening helps here too, and networks with similar parameter counts reach similar accuracy even when one is twice as deep as the other. But these networks have anywhere from tens of millions to over a hundred million parameters, and they still can't match bottleneck networks with far fewer. For example, WRN-34 widened twofold has 86.0M parameters and a top-1 error of 23.39%, while ResNet-101 gets 22.44% with just 44.5M parameters.
The authors suspect that either the bottleneck is simply better suited to ImageNet, or this task needs a deeper network. So they start from ResNet-50 instead and widen only the convolution in the middle of the bottleneck by a factor of two, giving WRN-50-2-bottleneck:
| Network | Top-1 error | Top-5 error | Parameters | Time per batch (ms) |
|---|---|---|---|---|
| ResNet-50 | 24.01% | 7.02% | 25.6M | 49 |
| ResNet-101 | 22.44% | 6.21% | 44.5M | 82 |
| ResNet-152 | 22.16% | 6.16% | 60.2M | 115 |
| WRN-50-2-bottleneck | 21.9% | 6.03% | 68.9M | 93 |
| pre-ResNet-200 | 21.66% | 5.79% | 64.7M | 154 |
With only 50 layers, WRN-50-2 beats ResNet-152 and is faster too; compared with the 200-layer pre-activation ResNet, its error is slightly higher, but it needs only 93 ms per batch versus 154 ms. The authors also say frankly that larger bottleneck networks need an 8-GPU machine to train, so they didn't try any.
This network is wide_resnet50_2 in torchvision. Compared with the last block of ResNet-50, the block's input and output still have 2048 channels; only the middle layer goes from 512 to 1024. The whole network grows from 25.6M to 68.9M parameters, matching the paper's table.
The authors also entered the COCO 2016 object detection challenge with WRN-34-2, a 34-layer network widened twofold, reaching 35.2 mAP as a single model and beating models built on ResNet-152 and Inception-v4 backbones.
Conclusion
Back to the question from the start. Does a ResNet really have to be this thin? This paper's answer is no. On CIFAR, the same parameters do more good as width than as depth; a 16-layer WRN already beats the thousand-layer ResNet and trains several times faster. Inside that thousand-layer ResNet, it looks like quite a few layers were slacking off.
This conclusion comes mainly from CIFAR. On ImageNet, the authors only went up to 50 layers, for the practical reason that larger networks need an 8-GPU machine to train.
WRN later became one of the most common backbones on CIFAR; the semi-supervised FixMatch, for example, uses WRN-28-2. Next time you see that name in a paper, you'll know it's a 28-layer network widened twofold.