Back to paper library
Paper notesarXiv 2015ICML Workshop 2015

Highway Networks

On the Eve of Residuals

Original paper

Highway Networks

Paper authors

Rupesh Kumar Srivastava · Klaus Greff · Jürgen Schmidhuber

First submitted to arXiv
arXiv:1505.00387
Cite this paper · BibTeX

The citation identifies the linked source version. It cites the original paper and its authors.

@misc{classiccnnshighwaynetworks2015,
  title = {{Highway Networks}},
  author = {Rupesh Kumar Srivastava and Klaus Greff and Jürgen Schmidhuber},
  year = {2015},
  eprint = {1505.00387},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1505.00387}
}
On this page

By 2015, the benefits of depth were well understood. In the introduction, the authors take ImageNet as an example, where deeper networks and smaller receptive fields pushed top-5 accuracy from about 84% with AlexNet to about 95% within a few years.

The trouble is that once a network gets deep, it becomes hard to train.

To get deep networks to train, some people at the time designed initializations that keep the signal variance stable, some trained a shallow network first and then deepened it one stage at a time, and others attached auxiliary loss functions to intermediate layers. All of these help, but they're all ways of working around depth.

In May 2015, Rupesh Kumar Srivastava, Klaus Greff, and Jürgen Schmidhuber of IDSIA in Switzerland released this short paper, which comes at the problem from another angle. Instead of trying to get the signal safely through every layer, it gives the signal a path that can skip the layer.

Defining the Problem

In an ordinary feedforward network, each layer applies a nonlinear transformation to its input:

y=H(x,WH)y = H(x, W_H)

HH is usually an affine transformation followed by an activation function. When the network is very deep, training with SGD often stalls right from the start, unless the weights are initialized just right so that the signal neither grows nor decays during forward and backward propagation (Glorot initialization or He initialization, for example).

Initializations like these have two limitations. First, they depend on the exact form of HH, so switching to another activation function may mean deriving a new initialization. Second, the authors found that even with He initialization, very deep plain networks are still hard to optimize, as we'll see in the experiments.

So is there an architecture that can be trained directly with SGD, whatever HH looks like and however many layers are stacked?

Solving the Problem

Adding Two Gates

The authors' inspiration comes from LSTMs. An LSTM uses gates to decide how much of its memory to keep and how much to update; here the same idea is carried over to every layer of a feedforward network.

They define two additional nonlinear transformations, the transform gate T(x,WT)T(x, W_T) and the carry gate C(x,WC)C(x, W_C):

y=H(x,WH)⋅T(x,WT)+x⋅C(x,WC)y = H(x, W_H)\cdot T(x, W_T) + x\cdot C(x, W_C)

TT decides how much of the output comes from “transforming the input,” and CC decides how much comes from “carrying the input straight through.” For simplicity, the paper sets C=1−TC = 1 - T:

y=H(x,WH)⋅T(x,WT)+x⋅(1−T(x,WT))y = H(x, W_H)\cdot T(x, W_T) + x\cdot\big(1 - T(x, W_T)\big)

Look at the two extremes:

y={x,T=0H(x,WH),T=1dydx={I,T=0H′(x,WH),T=1y=\begin{cases}x, & T=0\\ H(x, W_H), & T=1\end{cases} \qquad\qquad \frac{dy}{dx}=\begin{cases}I, & T=0\\ H'(x, W_H), & T=1\end{cases}

When T=0T=0, the layer simply hands over its input; the derivative with respect to the input is the identity matrix, and gradients flow back untouched. When T=1T=1, it's an ordinary network layer. In practice TT lies somewhere in between, so each layer can adjust smoothly between “ordinary layer” and “pass straight through.”

TT here is a vector of the same length as xx, so each unit has its own gate, and the output of the ii-th unit is yi=Hi(x) Ti(x)+xi (1−Ti(x))y_i = H_i(x)\,T_i(x) + x_i\,\big(1 - T_i(x)\big). That's why xx, yy, H(x)H(x), and T(x)T(x) must all have the same dimensionality.

What if you need to change the dimensionality? The authors offer two options, the first being to subsample or zero-pad xx as appropriate, and the second to change the dimensionality with an ordinary layer and follow it with highway layers. The paper uses the latter.

The convolutional version of a highway layer works the same way, with HH and TT both computed by convolutions, each with its own shared weights, and zero padding keeping their feature maps the same size as the input.

Lean Toward “Pass Straight Through” at First

The transform gate has the form:

T(x)=σ(WTTx+bT)T(x) = \sigma(W_T^T x + b_T)

The authors give an initialization that doesn't depend on HH, setting the bias bTb_T to a negative value, such as −1-1 or −3-3, so that the network starts out biased toward carrying, that is, toward passing straight through. This idea also comes from LSTMs. In 1999, Gers et al. suggested initially biasing the gates of an LSTM in a particular direction so that the model could bridge long-range dependencies early in learning.

How small does TT get with a negative bias? At bT=−1b_T=-1, T≈0.27T\approx0.27; at bT=−3b_T=-3, it is only 0.047, so each layer takes only about 5% from the transform and 95% is the input carried straight through. Because the sigmoid's output always stays between 0 and 1, the two extreme conditions above never hold exactly; they only come close.

Stack many layers and the difference grows. At initialization, after a few dozen layers a plain network's output has almost nothing to do with its input, while a highway network, which mostly carries the input straight through at every layer, still keeps a good part of the input's direction. From the very start of training, information and gradients have a path that is barely transformed, and the network can gradually learn when to transform and by how much. The authors found in their experiments that as long as the bias is negative, very deep networks can start learning, whatever zero-mean initial distribution WHW_H uses and whatever activation function HH uses.

Discussion

The Deeper, the Easier to Train?

To look at optimization alone, without mixing in generalization, the authors measure cross-entropy on the MNIST training set.

Each network's first layer is always an ordinary fully connected layer, followed by 9, 19, 49, or 99 more layers and finally a softmax. Plain networks have 71 units per layer and highway networks 50, so the two have roughly the same number of parameters. For fairness, each kind of network gets a random search of 40 runs over the learning rate, momentum, learning-rate decay, and the activation function of HH (ReLU or tanh); for highway networks, the search also covers the transform gate bias (−1-1 to −10-10). All other weights use He initialization.

Four training-curve plots side by side, titled depth 10, 20, 50, and 100. The vertical axis is mean cross-entropy (log scale), and the horizontal axis is epochs. Blue lines are plain networks and green lines are highway networks. At depth 10 the blue line ends lowest; as depth increases the blue line ends higher and higher, and at depth 100 it barely comes down; the green line drops very low in all four plots
Figure 1 from the paper, excerpted from page 4 of the v2 PDF, CC BY 4.0. Each curve is the best result of the random search for that setting; blue lines are plain networks, green lines are highway networks.

The vertical axis is logarithmic: each gridline down is ten times smaller.

At depth 10, the plain network does very well and ends up even lower than the highway network. As depth increases, the plain network has a harder and harder time coming down; at depth 100, the blue line stays stuck up high.

The green line, on the other hand, shows no visible effect of depth. The authors point out that the 100-layer highway network's final error is about an order of magnitude better than the 10-layer highway network's, on par with the 10-layer plain network; and highway networks consistently converge faster than plain ones. They also started training a 900-layer highway network on CIFAR-100. At the time of writing it had only reached epoch 80, but so far it had shown no signs of optimization difficulties.

Easy to Train, but What About Accuracy?

Being easy to train is one thing; performance on the test set is another. The authors compare against FitNets, the thin, deep networks built with maxout that Romero et al. proposed in 2014. Romero et al. found that with parameters limited to about 250,000 and multiplications to about 30 million, plain backpropagation could train only up to about 5 layers; deeper networks required first training a shallow teacher network, then training the student in two stages, using the teacher's intermediate layers as hints together with the teacher's soft targets.

The highway networks, by contrast, are all trained directly with backpropagation. The comparison is on CIFAR-10 augmented with random translations:

Table: Excerpted from Table 1 of the paper. Networks marked * were trained on only 40,000 of the 50,000 training images. The paper's text calls the counterpart of Fitnet 4 “Highway 4,” while the table labels it Highway 2; we follow the table here.
NetworkLayersParametersTest accuracy
Teacher (the FitNets teacher)5~9M90.18%
Fitnet 111~250K89.01%
Fitnet 419~2.5M91.61%
Highway 1 (counterpart of Fitnet 1)11~236K89.18%
Highway 2 (counterpart of Fitnet 4)19~2.3M92.24%
Highway 3*19~1.4M90.68%
Highway 4*32~1.25M90.34%

At similar parameter counts, the directly trained highway networks match or beat the accuracy of the two-stage FitNets. The thinner, deeper Highway 3 and 4, with only a little over a million parameters, also perform about as well as the 9-million-parameter teacher network.

What Did the Gates Learn?

Finally, the authors open up trained 50-layer fully connected highway networks to see how the gates actually behave:

Heat maps in two rows and four columns. The top row is MNIST and the bottom row is CIFAR-100; in each plot the vertical axis is depth and the horizontal axis is the 50 units. The first column is the transform gate biases; the second is the mean transform gate output over 10,000 samples; the third is the transform gate output for a single sample, mostly low blue values with only scattered bright spots; the fourth is the block output for a single sample, showing vertical stripes running from top to bottom
Figure 2 from the paper, excerpted from page 5 of the v2 PDF, CC BY 4.0. Top row MNIST, bottom row CIFAR-100. The four columns are, in order, the transform gate biases, the mean gate output over 10,000 samples, the gate output for a single sample, and the block output for that same sample.

The figure shows a few patterns.

The biases are more negative than expected. The two networks' biases were initialized to −2-2 and −4-4, respectively. The authors expected training to push them up, but most actually became even more negative. On CIFAR-100, the biases rise with depth, forming a gradient, and this gradient runs exactly opposite to the mean gate output in the second column. The authors' reading: the strongly negative biases in the shallow layers make the gates more selective, so they open only for particular inputs. The very sparse single-sample gate output in the third column also supports this reading.

Most units pass straight through. The block outputs in the fourth column form vertical stripes: many units' outputs stay almost unchanged across dozens of layers. These are the so-called information highways. Most of the change in output happens in the early layers, about the first 10 for MNIST and about the first 30 for CIFAR-100; the authors suspect this has to do with CIFAR-100 being more complex.

From this, the authors conclude that the gates are more than a tool for making training easier: trained networks really do use them to decide which route information takes, and the decisions vary strongly with the input.

Conclusion

Highway Networks let each layer learn “how much to transform and how much to pass straight through.” Paired with an initialization biased toward passing straight through, even 100-layer networks can be trained with simple SGD; on CIFAR-10, they reach the level of FitNets without needing a teacher network.

Seven months later, Microsoft Research's ResNet used ungated identity shortcuts to push networks to 152 layers and won ILSVRC 2015. The ResNet paper mentions highway networks in its related work and also spells out the differences. Highway gates depend on the input and have parameters, and when a gate is closed, the layer no longer learns a residual; ResNet's identity shortcuts have no parameters and are never closed, so all information always passes through. Highway networks had also not yet shown accuracy gains at extreme depths (over 100 layers, for example).

This relationship was later described differently, too. In his 2025 technical report Who invented deep residual learning?, Schmidhuber describes ResNet as “like an open-gated Highway Net” and traces the origins of residual connections back to his lab's work since 1991.

If you're training a very deep network today, you probably won't pick Highway, because ResNet's identity shortcuts have no gates and no extra parameters, and you don't have to worry about what to initialize a gate bias to.

Still, “give the signal a path without transformation” is something Highway made work first, in hundred-layer networks. Next, you can see how ResNet tore that gate down.