What do CNNs Learn in the First Layer and Why? A Linear Systems Perspective

Rhea Chowers, Yair Weiss

It is a well-known phenomenon in deep learning that different Convolutional Neural Networks (CNNs) tend to learn very similar, Gabor-like edge filters in their very first layer. The standard assumption has long been that these filters emerge because they are semantically meaningful—that is, they are optimal for object recognition tasks, helping to ignore lighting changes and highlight object boundaries.

However, recent research challenges this foundational assumption. By examining the first layer through a linear systems perspective, researchers have discovered that CNNs consistently learn the same spatial frequency filters regardless of the architecture, the dataset, or even if the training labels are completely random. This suggests that the emergence of these filters is driven by an underlying mathematical mechanism rather than task-specific utility.

Measuring First-Layer Representations

To rigorously compare the first layers of different networks, it is necessary to avoid comparing individual, unaligned neurons. Instead, researchers treat the first layer as a linear filter bank and measure its "energy profile." This profile essentially captures how sensitive the layer is to different spatial frequencies, defined by the Principal Component Analysis (PCA) vectors of the input image patches.

By evaluating standard CNNs like VGG and ResNet across benchmarks such as CIFAR10, CelebA, and ImageNet, a striking pattern emerges. The energy distribution of the learned filters is vastly different from their initial random weights, yet remarkably consistent across different architectures.

Energy profiles of VGG and ResNet on CIFAR10 compared to random initialization.

As seen above, despite architectural differences, VGG and ResNet converge on nearly identical energy profiles, which are highly correlated (often >0.98) and distinct from the random initialization baseline.

The Illusion of Task Usefulness

Perhaps the most surprising finding is that task usefulness is largely an illusion for the first layer. When CNNs are trained on datasets with completely random labels, they learn the exact same first-layer energy profile as they do when trained on true labels.

Energy profiles on CIFAR10 trained with true versus completely random labels.

The correlation between the first layer of models trained on true labels versus random labels remains >0.90 across multiple datasets. This shatters the idea that these early filters are learned specifically because they are "good for vision" or semantically necessary for classification.

Furthermore, deep networks are highly resilient to suboptimal early representations. If the first layer of a deep CNN is frozen to its completely random initialization, the network can still achieve the exact same final accuracy. The subsequent layers simply learn to compensate for the random first layer, proving that the specific Gabor-like filters are not strictly required for high performance.

Implicit Whitening and Data-Driven Filters

If the task doesn't dictate the first layer's weights, what does? The answer lies in the statistical properties of the input data.

Theoretical modeling of a simplified, two-layer linear CNN trained with Mean Squared Error (MSE) loss reveals a closed-form analytical formula for the energy profile. This formula shows that gradient descent implicitly drives the first layer to perform approximate "whitening"—a process that decorrelates adjacent pixels and removes redundant information from the input.

While biologists have long theorized that early biological visual systems perform "redundancy reduction," in CNNs, this emerges purely as an implicit artifact of gradient descent and the input data's second-order statistics (PCA eigenvalues), not as an explicit design choice. The analytical formula derived for the linear model fits the empirical energy profiles of complex, nonlinear CNNs (trained with cross-entropy loss) with a correlation of >0.90. Measurements of spatial autocorrelation confirm this: at a distance of 10 pixels, correlation drops from >0.5 in raw RGB images to ~0.2 after training, proving the first layer actively whitens the input.

Limitations and Future Directions

While these findings provide a robust mathematical explanation for early CNN representations, some gaps remain. The theoretical proof relies on a simplified linear CNN trained with MSE loss. Although it empirically maps exceptionally well to nonlinear CNNs trained with cross-entropy, the formal theoretical bridge between the two is still incomplete.

Additionally, the theory predicts that at infinite training steps, the network will perform perfect whitening. In practice, real networks plateau at partial whitening. This is likely because the gradients for the first layer become vanishingly small (dropping to a ratio of ~$10^{-10}$) as training progresses, effectively halting the dynamics before perfect decorrelation is achieved. Future work aims to extend this analytical framework to understand representations in deeper layers and explore more complex definitions of feature disentanglement.

Summary updated

BibTeX
@inproceedings{chowers2023what,
  author = {Rhea Chowers and Yair Weiss},
  title = {{What do CNNs Learn in the First Layer and Why? A Linear Systems Perspective}},
  booktitle = {International Conference on Machine Learning},
  year = {2023},
  url = {https://openreview.net/forum?id=RJGad2VFYk},
}
Figure