ElemedexA pocket encyclopedia of AI architectures
No. 016

Convolutional network (LeNet)

LeNet-5 · red convolucional (CNN)

Shared Filter

It looks at the world through a tiny 5×5-pixel window and uses the same window everywhere: if it learned to spot a stroke in one corner, it spots it anywhere. For years it read millions of checks a day in American banks without the customers ever learning its name.

Height
7 (not counting the input)
Weight
≈ 240 KB (fp32)
Parameters
≈ 60,000 (340,908 connections)
Context
no sequence: one 32×32 image
Training data
MNIST: 60,000 digits (+ 10,000 for testing)
Year
1998
Generation
2 · Classical machine learning
Creators
LeCun, Bottou, Bengio & Haffner (AT&T Labs)
Kind
Architecture

Base stats

Total
122

Approximate, ordinal scales meant for comparing species with each other; the hard numbers are in the data sheet.

Weaknesses

  • It needs characters already centered and size-normalized; it does not look for objects in a scene.
  • It learns a narrow task (ten digits) on small grayscale images.
  • Its assumptions (locality, translation invariance) help with images and get in the way where they fail.
  • It needs far more examples than a human to learn the same categories.

Habitat

It grew up at Bell Labs on digits written by US Census employees and high school students (the NIST databases) and worked reading checks for NCR's systems. Today it lives in every deep learning course, because MNIST, the dataset it helped assemble, is still the field's "hello world."

Moves

Abilities

Local receptive fields
Each unit looks only at a small patch of the previous layer (5×5 in LeNet-5), like neurons in visual cortex.
Weight sharing
All the units in a map use the same filter: a detector useful in one place is applied everywhere, and 340,908 connections come down to about 60,000 weights.
Subsampling
Lowers the resolution and tolerates small shifts: what matters is that there is a stroke around here, not the exact pixel.

Anatomy

LeNet-5 as described by LeCun et al. (1998). Two rounds of convolution (shared 5×5 filters) and subsampling (2×2) reduce a 32×32 image to 16 maps of 5×5; fully connected layers then choose among the ten digits. "6@28×28" means six 28×28 feature maps. C5 is formally convolutional, but with 1×1 maps it amounts to a dense layer.

Evolution chain

016 Convolutional network (LeNet)

A convolutional network (CNN) is a feedforward neural network whose first layers do not connect each unit to the whole input: they slide one small filter across the entire image and then reduce the resolution. LeNet-5, described by LeCun, Bottou, Bengio and Haffner in 1998, is the canonical specimen: a seven-layer network that reads handwritten digits (LeCun et al., 1998).

How it works

According to its authors, the architecture combines three ideas: local receptive fields, shared weights, and spatial subsampling (LeCun et al., 1998, sec. II.A).

  • Convolution. Each unit looks at a 5×5-pixel window, and all the units in a "feature map" share the same 25 weights: they detect the same feature (an edge, a corner, a stroke ending) at every position. It is like passing a stencil over the image and noting where it fits (Buckner, 2024, p. 125).
  • Subsampling. Each unit in the next layer summarizes a 2×2 patch of the previous map. Resolution halves and the network tolerates small shifts: what matters is that there is an edge around here, not at which exact pixel (Witten et al., 2017, p. 438).
  • Classifier. After two rounds of convolution and subsampling, fully connected layers (an ordinary MLP) decide the digit.

A 32×32 image goes through C1 (6 maps of 28×28), S2 (6 of 14×14), C3 (16 of 10×10), S4 (16 of 5×5), C5 (120 units), F6 (84) and an output of 10 units. There are 340,908 connections but only about 60,000 trainable parameters, because the weights are shared (LeCun et al., 1998, secs. II.A–B). Everything, filters included, is tuned by backpropagation: the network builds its own feature extractor (LeCun et al., 1998, sec. II.A; Witten et al., 2017, p. 441). Earlier solutions for these digits relied on hand-crafted features, such as the number of loops in the stroke (Chollet, 2021, sec. 5.4.2).

What changed

An ordinary MLP treats the image as a list of pixels with no geometry: it would have to learn separately to recognize a stroke at each position. The CNN builds in two assumptions from the start: that relevant features are local, and that a detector useful in one place is useful everywhere. This is an inductive bias (Chollet speaks of architecture priors) that saves parameters and data (Chollet, 2021, sec. 5.3.2; Buckner, 2024, p. 130).

The genealogy is neuroscientific. Hubel & Wiesel (1962) distinguished, in cat visual cortex, "simple" cells, sensitive to an edge at one position, and "complex" cells, which respond to the same feature with some spatial invariance. Fukushima carried that division into his Neocognitron (Fukushima, 1980), which alternated convolution and subsampling but had no global supervised learning procedure like backpropagation (LeCun et al., 1998, sec. II.A; Buckner, 2024, pp. 122–124). In 1989 LeCun brought the two together at Bell Labs, and that network read ZIP codes for the US Postal Service (LeCun et al., 1989; Chollet, 2021, sec. 1.2.2). LeNet-5 is its mature form.

On MNIST (60,000 training digits, 10,000 test digits), LeNet-5 made 0.95% errors, and 0.8% when also trained on deformed versions of the images (LeCun et al., 1998, sec. III.B). Compared with other methods, such as k-nearest neighbors or SVMs (Witten et al., 2017, p. 421):

Classifier (MNIST) Test error
Linear 12.0%
k-nearest neighbors 5.0%
MLP with 300 hidden units 4.7%
SVM with Gaussian kernel 1.4%
LeNet-5 0.95%

Training it took two to three days of CPU time (LeCun et al., 1998, sec. III.D), and from 1996 a system built on it read millions of checks a day in American banks (1998, sec. X).

Limits

LeNet-5 needs characters already centered and normalized, works on small grayscale images, and learns a single task. CNNs had to wait for ImageNet and GPUs to reach real photographs with AlexNet (Witten et al., 2017, p. 462). Even then, they model at most the first hundred milliseconds or so of vision, without recurrence or top-down control (Buckner, 2024, p. 124), and they need far more examples than a person does (2024, pp. 131–132).

Sources

  • Buckner, C. J. (2024). From deep learning to rational machines: What the history of philosophy can teach us about the future of artificial intelligence. Oxford University Press. https://doi.org/10.1093/oso/9780197653302.001.0001 §
  • Chollet, F. (2021). Deep learning with Python (2nd ed.). Manning Publications. §
  • Fukushima, K. (1980). Neocognitron: A self-organizing neural network model for a mechanism of pattern recognition unaffected by shift in position. Biological Cybernetics, 36(4), 193–202. https://doi.org/10.1007/BF00344251 §
  • Hubel, D. H., & Wiesel, T. N. (1962). Receptive fields, binocular interaction and functional architecture in the cat’s visual cortex. The Journal of Physiology, 160(1), 106–154. https://doi.org/10.1113/jphysiol.1962.sp006837 §
  • LeCun, Y., Boser, B., Denker, J. S., Henderson, D., Howard, R. E., Hubbard, W., & Jackel, L. D. (1989). Backpropagation applied to handwritten zip code recognition. Neural Computation, 1(4), 541–551. https://doi.org/10.1162/neco.1989.1.4.541 §
  • LeCun, Y., Bottou, L., Bengio, Y., & Haffner, P. (1998). Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86(11), 2278–2324. https://doi.org/10.1109/5.726791 §
  • Witten, I. H., Frank, E., Hall, M. A., & Pal, C. J. (2017). Data mining: Practical machine learning tools and techniques (4th ed.). Morgan Kaufmann. https://doi.org/10.1016/C2015-0-02071-8 §