This note makes the case for CNNs concrete and quantitative โ showing exactly why feeding an image into a plain fully-connected network is impractical, and precisely which two design choices in convolution fix that.
The Parameter Explosion Problem with a Plain MLP
Consider a modest 224ร224 RGB image, flattened into a single vector: \(224\times224\times3 = 150{,}528\) values. A single fully-connected hidden layer with just 1,000 neurons would need a weight matrix of shape \((1000, 150{,}528)\) โ over 150 million parameters, for one layer alone, on a fairly small image. This is both computationally wasteful and prone to severe overfitting, especially with limited training data.
Two Design Choices That Fix This
| Design Choice | What It Means | Why It Helps |
|---|---|---|
| Sparse (local) connectivity | Each output value depends only on a small local neighborhood of the input (the kernel's receptive field), not the entire image | Dramatically fewer connections per output, matching the intuition that a pixel's meaning mostly depends on its immediate neighbors |
| Parameter sharing | The exact same kernel (weights) is reused at every spatial position across the image | The number of learnable parameters depends only on the kernel size, not the image size โ a small 3ร3 kernel has just 9 weights (plus channels), regardless of whether the image is 32ร32 or 4000ร4000 |
Numerical Comparison
For that same 224ร224ร3 image, a single convolutional layer with 64 filters of size 3ร3 has \(64\times(3\times3\times3+1) = 1{,}792\) parameters (each filter: 3ร3 spatial ร 3 input channels, plus one bias) โ compare this to the 150+ million parameters a single fully-connected layer with even modestly-sized output would need. This roughly five-order-of-magnitude reduction is exactly why CNNs became practical for image tasks where MLPs were not.
Translation Invariance โ A Bonus Property
Because the same kernel scans across every position, a pattern (like an edge or a specific texture) is detected wherever it appears in the image โ a cat in the top-left corner activates the same filters as a cat in the bottom-right corner. Plain MLPs have no such built-in property; they'd need to separately learn to recognize a pattern at every possible position, using entirely separate weights for each.
Code โ Comparing Parameter Counts Directly
import torch.nn as nn
# A single fully-connected layer processing a small flattened 32x32x3 image
fc_layer = nn.Linear(32*32*3, 1000)
print(sum(p.numel() for p in fc_layer.parameters())) # over 3 million parameters
# A convolutional layer processing the SAME image, unflattened
conv_layer = nn.Conv2d(in_channels=3, out_channels=64, kernel_size=3, padding=1)
print(sum(p.numel() for p in conv_layer.parameters())) # under 2,000 parameters
Common Mistakes
- Assuming CNNs are simply "smaller" MLPs by coincidence โ the parameter reduction is a direct, structural consequence of sparse connectivity and parameter sharing, not an incidental difference.
- Overstating translation invariance as perfect โ CNNs are only approximately translation-invariant in practice (pooling and certain architectural choices contribute to this), not perfectly invariant under all transformations.
Interview Relevance
Q: "What two specific properties of convolution make CNNs far more parameter-efficient than fully-connected networks for image data?" Sparse (local) connectivity โ each output depends only on a small local neighborhood, not the entire input โ and parameter sharing โ the same small set of weights (the kernel) is reused at every spatial position, so the parameter count doesn't scale with image size at all, only with kernel size.
Practice Question
A 64ร64ร3 image is fed into a fully-connected layer with 500 output neurons. How many weight parameters does this single layer have? Compare this to a convolutional layer with 32 filters of size 5ร5 on the same input.