Foundations to Frontier
Tests
E. Deep Learning › E1 Activation Functions (one page each)

Maxout

A maxout unit computes k affine functions of its input and outputs the largest: max(w₁ᵀx + b₁, …, w_kᵀx + b_k). It is a learned activation: with a zero piece it is ReLU, with pieces x and −x it is |x|, and with enough pieces it approximates any convex function. Maxout never has a zero gradient everywhere, since some piece always wins, and it was designed to work with dropout. This page covers the definition, its gradient routing, special cases, its convex-approximation property, and its parameter cost. In the exercises you build maxout layers and show that k tangent pieces approximate x² with error 1/k², then compare maxout with ReLU at equal numbers of linear pieces and find it learns faster and is unaffected by the bias initialisation that kills ReLU units.

Level 0: Foundation

★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.

Let the network choose its own activation

Every activation so far was a fixed curve. A maxout unit instead computes several straight lines from its input and outputs whichever is highest. The upper envelope of a set of lines can bend into many shapes: a ReLU (one line at zero), an absolute value (lines going up both ways), or a smooth-looking bowl with enough lines. Training adjusts the lines, so the network learns its own activation.

Activation lab: the curve, its slope, and what a network learns with it
max(z₁, z₂): a learned convex piecewise-linear unitz from −4 to 4 · orange f · dashed blue f′
maxout (2 pieces): training accuracy after 300 steps 1.000
Compare activations at the same number of steps. Smooth, non-saturating units usually fit the spirals fastest. Sigmoid and the hard-threshold units learn slowly or need surrogate gradients. Gated and maxout units use twice as many hidden pre-activations. Learning rates are fixed per activation and not tuned, so treat small differences as noise (press "new data and weights").
Why engineers care

Maxout networks are piecewise linear like ReLU networks, so they stay cheap and verifiable, but each unit is more flexible and never dies. The idea of taking a maximum over learned affine pieces also appears in convex model-predictive control, input-convex networks and piecewise-affine system identification.

📝 Quick check (Level 0)
0/3 answered
  1. 1. A maxout unit outputs…
  2. 2. Maxout with pieces z and 0 is…
  3. 3. Can a maxout unit have zero gradient for every input?

Level 1: Beginner

★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.

By hand

  • Definition: hᵢ(x) = max over j = 1…k of (w_ijᵀx + b_ij). A layer of u maxout units has u·k pieces.
  • Example: pieces (1, 3) and (−2, −5) per unit give outputs 3 and −2.
  • Special cases: max(z, 0) = ReLU; max(z, −z) = |z|; max(z, az) = leaky ReLU with slope a < 1.
  • Gradient routing: the upstream gradient goes entirely to the winning piece; the others get 0. For the example above with upstream (10, 20), the gradients are (0, 10, 20, 0).
  • Convexity: a maximum of affine functions is convex, so a single maxout unit can represent only convex functions of its input. A difference of two maxout units can represent any continuous piecewise-linear function.
  • Parameters: a maxout layer with u units of k pieces on d inputs has (d + 1)·u·k parameters: 64 inputs, 32 units and k = 2 give 4160.
📝 Quick check (Level 1)
0/3 answered
  1. 1. max(z, −z) =
  2. 2. A single maxout unit can represent…
  3. 3. The losing pieces of a maxout unit receive gradient…

Level 2: Intermediate

★★★☆☆ Intermediate⏱ 25 minUndergraduate students and practising engineers.

Approximating convex functions

Exercise 1. The analytic maxout gradient matches finite differences, and ReLU and |x| are reproduced exactly as maxout units. A maxout unit whose k pieces are tangent lines of x² at the centres of k equal cells of [−1, 1] approximates x² with maximum error:

k 2 4 8 16
max error 0.2500 0.0625 0.0156 0.0039

That is exactly 1/k². The error falls quadratically with the number of pieces, so 10 pieces give 0.01.

Practical notes.

  • Implementation: compute a linear layer of width u·k, reshape to (n, u, k), and take the max over the last axis.
  • Cost: k times the parameters of a ReLU layer with u outputs. Equivalently, at a fixed matrix width, maxout has k times fewer output units.
  • With dropout: Goodfellow et al. designed maxout to make dropout’s approximate model averaging more accurate. Maxout networks with dropout set records on MNIST, CIFAR-10 and SVHN in 2013.
z = linear(x).view(n, u, k); h = z.max(dim=-1).values   # maxout layer
🐍 Exercise 1: maxout layers and tangent approximation
Implement a maxout layer and its backward pass, reproduce ReLU and |x|, and approximate x² with k tangent pieces.
📝 Quick check (Level 2)
0/3 answered
  1. 1. Max error of 4 tangents to x² on [−1, 1]?
  2. 2. Pieces needed for error 0.01?
  3. 3. Maxout was designed to work well with…

Level 3: Advanced

★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.

Theory

Universal approximation. Any continuous function on a compact set can be approximated by a difference of two convex piecewise-linear functions. Each of those is a single maxout unit with enough pieces. So a maxout network with two hidden units and one linear output (their difference) is a universal approximator, given enough pieces per unit (Goodfellow et al., 2013).

Convex approximation rate. For a convex function with bounded second derivative f″ ≤ M on an interval of length L, k equally spaced tangents give error at most M(L/k)²/8. For x² on [−1, 1], M = 2 and L = 2, so the error is 2·(2/k)²/8 = 1/k², as measured.

Why units do not die. Some piece is always the maximum, so every maxout unit always passes gradient to one of its pieces. A constant added to all of a unit’s biases does not change which piece wins: it only shifts the output. This is why a negative bias initialisation, which kills ReLU units, cannot kill maxout units. A unit can, however, get stuck on one piece for every input, making it linear, the analogue of a dead unit.

Relation to other models.

  • Maxout is a learned piecewise-linear activation, in the same family as ReLU, leaky ReLU and PReLU.
  • Input-convex neural networks (Amos et al., 2017) use max-affine structure to guarantee convexity in the input, useful for optimisation-based control.
  • Max-affine regression is a classical tool for fitting convex functions.
📝 Quick check (Level 3)
0/3 answered
  1. 1. A universal maxout approximator uses…
  2. 2. Adding the same constant to all of a unit's piece biases changes…
  3. 3. The analogue of a dead ReLU in maxout is a unit…

Level 4: Expert

★★★★★ Expert⏱ 25 minResearchers: original papers and open problems.

Maxout versus ReLU, and the bias test

History.

  • I. Goodfellow, D. Warde-Farley, M. Mirza, A. Courville and Y. Bengio (2013) introduced maxout networks with dropout.
  • Earlier, local winner-take-all and channel-out networks used similar competition between units.
  • Maxout later appeared in speech recognition and in some GAN discriminators, before cheaper rectifiers with normalisation became dominant.

Exercise 2. A 3-hidden-layer network on spirals, trained with minibatch SGD at learning rate 0.3. Every hidden layer has 64 linear pieces: ReLU with 64 units (k = 1), or maxout with 32 units of 2 pieces or 16 units of 4. Because maxout layers have fewer outputs, they also have fewer parameters. The hidden biases start at 0 or at −0.5, the setting that killed ReLU units in E1-4. The last column is the fraction of ReLU units dead, or of maxout units stuck on one piece, for all training data.

k parameters initial bias accuracy after 50 steps after 300 dead or stuck
1 (ReLU) 8707 0 0.970, 0.920, 0.978 1.000, 1.000, 1.000 0.040
1 (ReLU) 8707 −0.5 0.480, 0.350, 0.605 0.957, 0.947, 0.997 0.260
2 4515 0 0.998, 0.987, 0.998 1.000, 1.000, 1.000 0.042
2 4515 −0.5 1.000, 1.000, 1.000 1.000, 1.000, 1.000 0.003
4 2419 0 0.997, 0.997, 0.988 1.000, 1.000, 1.000 0.007
4 2419 −0.5 1.000, 0.998, 1.000 1.000, 1.000, 1.000 0.000
  • Maxout learned faster with fewer parameters. After 50 steps it was at 0.99–1.00, against ReLU’s 0.92–0.98, with half or a quarter of the parameters.
  • The bias test did not affect maxout. The −0.5 initialisation killed 26% of ReLU units and cut early accuracy to 0.35–0.61, while maxout’s results were unchanged. As shown in Level 3, a bias shared by all pieces cannot change which piece wins.
  • The comparison counts pieces, not parameters. At equal parameters, maxout would have fewer pieces per layer. Each maxout unit also costs k multiply-adds per output, which is why cheaper rectifiers with normalisation replaced it in most modern networks.
🐍 Exercise 2 (research): maxout versus ReLU, and the bias test
Train ReLU and maxout networks (k = 2, 4) with the same number of linear pieces per layer, with biases initialised at 0 and −0.5, and compare early and final accuracy and dead or stuck units.

Maxout in AI, robotics and aerospace

  • Convex learned models for control: max-affine and input-convex networks give cost or value functions that a model-predictive controller can minimise reliably.
  • Piecewise-affine identification: hybrid systems (contact, saturation, mode switches) are naturally modelled as maxima or minima of affine pieces.
  • Verification: like ReLU networks, maxout networks are piecewise linear and can be verified exactly with mixed-integer programming.

References

  1. I. J. Goodfellow, D. Warde-Farley, M. Mirza, A. Courville, Y. Bengio (2013). “Maxout networks.” Proc. ICML.
  2. B. Amos, L. Xu, J. Z. Kolter (2017). “Input convex neural networks.” Proc. ICML.
  3. A. Magnani, S. P. Boyd (2009). “Convex piecewise-linear fitting.” Optimization and Engineering 10(1).