cnn

A convolutional neural network (CNN) is the architecture built for grid-shaped data — images, spectrograms, volumetric scans — on two assumptions baked directly into its wiring: useful patterns are local (an edge or texture shows up in a small neighborhood of pixels, not across the whole image at once), and those patterns mean the same thing wherever they appear (a cat's ear looks like a cat's ear whether it's in the top-left or bottom-right of the photo). Those two assumptions, locality and translation invariance, are what let a CNN process a million-pixel image with a tiny fraction of the parameters a fully connected network pointed at the same image would need. At a high level, an image moves through a CNN like this:

Input image
Raw pixel grid
Convolutional stackRepeated across several blocks, deeper each time
Convolution
Small shared filter slides across the image
Activation
ReLU, nonlinearity
Pooling
Downsample, keep strongest signal
↻ next block
Classification head
Fully connected, final prediction

A convolutional filter is a small grid of learned weights that gets reused at every position in the image, and that single reuse decision is most of why CNNs are parameter-efficient. A 3x3 filter has only 9 weights (plus a bias), and the exact same 9 numbers slide across the entire image computing a dot product at every position — a fully connected layer doing the equivalent job on a 224x224 image would need weights numbering in the tens of millions for a single layer. Early layers' filters learn simple things (edges, color gradients); because each layer's output feeds the next layer's convolution, filters several layers deep effectively see a much larger region of the original image and can represent whole object parts, then whole objects — this growing effective view is called the receptive field, and it's what lets a stack of small, cheap filters build up to recognizing something as complex as a face.

One Filter, Reused Everywhere the same 9 weights slide across the whole image input image same 3x3 filter, three positions shown output feature map bright = filter matched this pattern at that location one 9-weight filter, reused everywhere, instead of a unique weight for every single pixel

Pooling layers exist specifically to make the network tolerant of small shifts and to keep the parameter count manageable as the network gets deeper. Max pooling takes a small window (commonly 2x2) and keeps only the strongest activation, halving the spatial resolution at each use — this means a cat shifted two pixels to the left still triggers roughly the same downstream activations, and it shrinks the data volume fed into deeper, more expensive layers. This combination (convolution, nonlinearity, pooling, repeated and stacked) is the pattern behind essentially every CNN from early LeNet through AlexNet, VGG, and ResNet; ResNet's specific contribution was adding skip connections that let gradients bypass blocks of layers entirely, which is what allowed CNNs to scale from roughly 20 layers deep to over 150 without the gradient signal dying before reaching the earliest layers.

CNNs dominated computer vision for roughly a decade before vision transformers (ViT) began displacing them on the largest-scale benchmarks, and the trade is a direct extension of the locality assumption itself. A convolution only looks at a small local neighborhood per layer, which is efficient but means relating two distant regions of an image (a dog's head at one edge of a photo and its tail at the other) requires passing through many layers before that information combines; a vision transformer's self-attention can relate any two image patches directly in a single layer, at the cost of needing far more training data and compute to learn what the convolution's locality assumption gave CNNs for free. In practice this has made CNNs the more compute-efficient default for small-to-moderate labeled datasets, and ViT-style architectures the choice once training data and compute budgets are large enough to make the weaker, more data-hungry prior pay off.

Read a CNN's locality and weight-sharing as a hardcoded assumption about the physical world, not an arbitrary engineering shortcut: images really do have local structure that repeats across position, and baking that fact directly into the architecture is what let a few thousand learned weights, reused everywhere a filter slides, outperform a fully connected network with orders of magnitude more parameters pointed at the exact same pixels.

Go deeper with CFSGPT

Get AI-powered deep-dives, save terms, and run advanced simulations — free account.

Create Free Account