Deep Networks with Stochastic Depth

Gao Huang, Yu Sun, Zhuang Liu, Daniel Sedra, Kilian Q. Weinberger

TL;DR

Stochastic depth is a training procedure for deep residual networks (ResNets) that randomly drops a subset of layers for each mini-batch during training while using the full-depth network at test time. This approach significantly reduces training time, alleviates vanishing gradients, and acts as a powerful regularizer, enabling the successful training of networks with over 1,200 layers.

What Problem Does This Paper Address?

As Convolutional Neural Networks (CNNs) have evolved from the 5-layer AlexNet to the 152-layer ResNet, "depth" has become a primary driver of model expressiveness. However, extreme depth introduces three major hurdles:

  1. Vanishing Gradients: During backpropagation, gradients can shrink to near-zero as they pass through many layers, making it nearly impossible to update the weights of earlier layers.
  2. Diminishing Feature Reuse: In the forward pass, information from the input can get "washed out" by repeated transformations.
  3. Long Training Times: Computational cost scales linearly with depth; training a state-of-the-art ResNet on ImageNet can take weeks.

The authors sought a way to gain the representational benefits of a very deep network at test time without suffering the training-time penalties and optimization difficulties associated with that depth.

Methods

The authors introduce Stochastic Depth, a method designed specifically for architectures with identity skip connections (like ResNets).

The Mechanism

In a standard Residual Block, the output is defined as $H_\ell = \text{ReLU}(f_\ell(H_{\ell-1}) + \text{id}(H_{\ell-1}))$. Stochastic depth introduces a Bernoulli random variable $b_\ell \in \{0, 1\}$ that acts as a gate for the transformation function $f_\ell$: $$H_\ell = \text{ReLU}(b_\ell f_\ell(H_{\ell-1}) + \text{id}(H_{\ell-1}))$$ - If $b_\ell = 1$ (active), the block behaves normally. - If $b_\ell = 0$ (inactive), the transformation is bypassed entirely, and the block reduces to a simple identity function.

Survival Probabilities

The probability of a layer staying active ($p_\ell$) is a hyper-parameter. The authors found that a linear decay rule works best: earlier layers (which extract low-level features) have a higher survival probability than later layers. For example, if $p_0=1$ and $p_L=0.5$, the network's "expected depth" during training is reduced by roughly 25%.

Testing Phase

At test time, all layers are kept active to utilize the full capacity of the model. To account for the fact that layers saw more "signal" during training than they will at test time, the authors re-calibrate the outputs by the survival probability, similar to how Dropout scales weights: $$H_\ell^{Test} = \text{ReLU}(p_\ell f_\ell(H_{\ell-1}^{Test}) + H_{\ell-1}^{Test})$$

Datasets

The method was evaluated on four standard computer vision benchmarks:

  • CIFAR-10 and CIFAR-100: Small 32x32 color images (10 and 100 classes).
  • SVHN (Street View House Numbers): 32x32 images of digits.
  • ImageNet (ILSVRC 2012): A large-scale dataset with 1.2 million images and 1,000 classes.

Key Insights and Ideas

  • The "Train Short, Test Deep" Paradox: By randomly bypassing layers, the network effectively becomes a collection of $2^L$ possible subnetworks with varying depths. During training, the "expected" path is much shorter, which keeps gradients healthy and speeds up the clock.
  • Implicit Ensembling: Stochastic depth can be viewed as training an implicit ensemble of networks of different depths. This provides a strong regularization effect, similar to Dropout, but by making the network "shorter" rather than "thinner."
  • Complementary to Batch Normalization: While Dropout often struggles when combined with Batch Normalization, Stochastic Depth works exceptionally well with it, providing further error reduction on top of normalized ResNets.
  • Overcoming the Depth Limit: The authors demonstrated that while a 1202-layer ResNet normally suffers from overfitting/optimization issues (6.67% error on CIFAR-10), adding stochastic depth allowed it to reach a record-breaking 4.91% error.

Key Results

  • Speedup: Using a linear decay rule with $p_L=0.5$ resulted in a 25% reduction in training time across most datasets.
  • Accuracy Gains:
    • On CIFAR-10, the error dropped from 6.41% (constant depth) to 5.25% (stochastic depth).
  • On CIFAR-100, the error dropped from 27.76% to 24.98%.
  • Gradient Strength: Empirical analysis showed that the mean gradient magnitude in the first layer was significantly higher and more stable throughout training compared to constant-depth networks.

Limitations and Future Work

  • ImageNet Scaling: While the method improved ImageNet results, the gains were more modest (21.98% vs 21.78% error) and required training for more epochs to fully realize the benefits. The authors suggest that for extremely large datasets, the model complexity required might be higher, making aggressive layer-dropping less immediately beneficial.
  • Architecture Specificity: This method relies on the presence of identity skip connections. While common in ResNets, it is not directly applicable to "plain" architectures without such bypasses.
  • Future Directions: The authors suggest that stochastic depth could enable researchers to explore even deeper architectures (thousands of layers) that were previously considered untrainable due to hardware or optimization constraints.

Summary updated

BibTeX
@inproceedings{huang2016deep,
  author = {Gao Huang and Yu Sun and Zhuang Liu and Daniel Sedra and Kilian Q. Weinberger},
  title = {{Deep Networks with Stochastic Depth}},
  booktitle = {European Conference on Computer Vision},
  year = {2016},
  url = {https://openreview.net/forum?id=rybRHYW_Wr},
}
Figure