All models

LeNet-5

LeCun's 7-layer convolutional network for handwritten digits, the classic CNN.

Documents and OCR · 23 operations Checked

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

Loading diagram (25 KB)

Open in a new tab

Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.

At a glance

Parameters
61.8K
Operations
23
Framework
PyTorch
Recurrent
No
Published
1998, Proceedings of the IEEE
Cited by
59,929 (as of 4 October 2026)
Authors
Yann LeCun, Léon Bottou, Yoshua Bengio, Patrick Haffner
Checked
Passed: the trace was replayed operation by operation and matched the model's own output for this input.

Files

The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m1574
Graph hash
3be84a77753bd9b5e4ce935ff5e8fcb4e66e815e0a6afcef997a1a16e23fa563
Skeleton hash
bf765ade3a27e16842befb1484d083e691e05502de4366a70b6e450933c61ed3
Architecture hash
781cbfd7f34c740f47363bc628fa1343938e34fdb7ea632224e321b59d630f53
Diagram SHA-256
8e08a140cd772c55c8af184655f642966a9e38c5991fb8d14a1533baab28a5f3
TorchLens version
2.36.0
Renderer
graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
Check
Forward pass replayed in PyTorch

How this diagram was made

menagerie.classics.lenet5_classic:build: build({})

What it is

LeNet-5 is the convolutional neural network that LeCun, Bottou, Bengio and Haffner used for handwritten digit recognition in their 1998 review of gradient-based learning for document recognition. The paper's larger argument is that multilayer networks trained with backpropagation are the best example of a successful gradient-based learning technique, and that convolutional networks built for the variability of 2D shapes beat every other method on a standard handwritten digit task.

LeNet-5 comprises 7 layers, not counting the input, all of which contain trainable parameters. The input is a 32x32 pixel image, deliberately larger than the largest character in the database so that distinctive features like stroke end-points or corners can fall in the centre of the receptive fields of the highest-level feature detectors. Layer C1 is a convolutional layer with 6 feature maps, each unit connected to a 5x5 neighbourhood in the input, giving 28x28 feature maps. It is followed by S2, a sub-sampling layer with 6 feature maps of size 14x14, each unit looking at a 2x2 neighbourhood of the corresponding C1 map. Input pixels are normalised so that white background maps to -0.1 and black foreground to 1.175, keeping the mean input near 0 and the variance near 1 to speed up learning.

The same paper also introduces Graph Transformer Networks, a way to train multi-module document recognition systems globally with gradient-based methods.

Key idea. The key contribution is showing that a convolutional network trained end to end by gradient descent, with minimal preprocessing, outperforms all other techniques on handwritten digit recognition.

  • LeNet-5
  • LeNet5
  • LeNet
  • LeCun 1998
  • handwritten digit recognition
  • MNIST
  • gradient-based learning
  • document recognition
  • classic CNN

AI-written summary, checked automatically against its sources; not reviewed by a person. Corrections welcome.

Cite the paper

@article{lenet5classic1998,
  title = {Gradient-based learning applied to document recognition},
  author = {Yann LeCun and Léon Bottou and Yoshua Bengio and Patrick Haffner},
  year = {1998},
  journal = {Proceedings of the IEEE}
}