LeCun 1989 CNN

Reproduction of one of the first Convolutional Neural Networks

Y. LeCun, B. Boser, J. S. Denker, D. Henderson, R. E. Howard, W. Hubbard, L. D. Jackel
"Backpropagation Applied to Handwritten Zip Code Recognition"
Neural Computation, Vol. 1, pp. 541–551, 1989 — AT&T Bell Laboratories
Draw here
CNN input (16×16)
H1 learned kernels (5×5)
Prediction
?
Loading weights...

About This Paper

In 1989, Yann LeCun and his team at AT&T Bell Laboratories published a landmark paper in the history of deep learning. They demonstrated that a neural network could learn directly from raw pixels to recognize handwritten characters — without any hand-crafted features. This network was used by the U.S. Postal Service to automatically read zip codes on mail. Its architecture became the foundation of the Convolutional Neural Network (CNN) that dominates modern computer vision.

Network Architecture

LayerTypeOutputParams
InputImage1×16×16
H1Conv 5×5, stride 212×8×81,068
H2Sparse Conv 5×5, stride 212×4×42,592
H3Fully Connected305,790
OutputFully Connected10310

Total: only 9,760 parameters — incredibly small compared to modern models that have millions to billions of parameters.

Key Innovations

Training Details

Results

MetricPaper (1989)Karpathy (PyTorch)Ours (Node.js)
Train loss2.5e-34.07e-34.85e-3
Train error0.14%0.62%0.86%
Test loss1.8e-22.84e-23.02e-2
Test error5.0%4.09%4.19%
Test misses1028284

Small differences are expected due to different datasets (MNIST vs. original zip codes) and different PRNG implementations.

How This Demo Works

This implementation is fully reproduced in pure Node.js without any ML frameworks — all convolution, backpropagation, and SGD operations are written manually from scratch. After training for 23 epochs (~27 seconds), the weights are saved to JSON. The browser then runs the forward pass directly: your drawing is resized to 16×16 pixels, normalized to [-1, +1], and processed through the 4-layer CNN exactly as described in the original paper. Prediction happens in real-time in the browser with no server round-trip.