Learning sparse features can lead to overfitting in neural networks

Leonardo Petrini, Francesco Cagnetta, Eric Vanden-Eijnden, Matthieu Wyart

Abstract

Feature learning is widely considered the primary driver of neural network performance, allowing models to overcome the curse of dimensionality by adapting to relevant data directions. However, this paper identifies a "sparsity trap" where feature learning leads to sparse representations that overfit, especially in tasks requiring smooth or invariant features. Through theoretical analysis of Gaussian random functions and empirical tests on image benchmarks, the authors show that "lazy" training regimes—where weights remain near initialization—can outperform feature learning by maintaining smoother, more stable representations.

Introduction

In high-dimensional machine learning, the "curse of dimensionality" typically requires an exponential amount of data for effective learning. Neural networks are thought to circumvent this through feature learning, where neurons adapt to specific relevant directions in the data. Yet, a persistent puzzle remains: for certain architectures like fully-connected networks (FCNs) trained on images, feature learning often performs worse than "lazy training," where the network behaves like a fixed kernel method (e.g., the Neural Tangent Kernel). This paper investigates this discrepancy, revealing that the implicit bias of feature learning toward sparsity can be detrimental when the target function is smooth.

Methods and Theoretical Framework

The authors compare two training regimes for one-hidden-layer ReLU networks:

  1. The Lazy Regime (NTK/RFK): Weights stay close to their random initialization, and the network acts as a linear predictor over fixed features.
  2. The Feature Learning Regime (Mean-Field): Weights evolve significantly to adapt to the data.

To analyze these, they utilize a theoretical model involving the regression of Gaussian random functions on a $d$-dimensional sphere ($S^{d-1}$). This setup allows for precise control over the "smoothness" ($\nu_t$) of the target function.

Visualization of target functions on a sphere with varying smoothness parameters ($\nu_t$). (a) represents a smooth function ($\nu_t=4$), while (b) represents a rougher function ($\nu_t=1/2$).

The Sparsity-Smoothness Tradeoff

A key insight of the study is the Sparsity-Smoothness Tradeoff. Feature learning has an implicit bias toward sparsity, attempting to represent the target function using as few "active" neurons as possible. While efficient for functions depending on only a few directions, this bias is harmful for smooth functions that are constant along many directions—a common characteristic of image data where classes are invariant to small transformations.

In contrast, lazy training produces a continuous, smoother distribution of representations because it does not force neurons to "clump" around specific features. This inherent smoothness makes lazy models more stable and better suited for tasks like image classification, where a "cat" remains a "cat" despite slight pixel shifts or warps.

Empirical Results and Diffeomorphism Sensitivity

The theoretical predictions were tested on benchmark datasets including MNIST, Fashion-MNIST, and CIFAR10. The authors measured the generalization error $\epsilon(n)$ as a function of the training set size $n$.

Test error vs. training set size for MNIST, F-MNIST, and CIFAR10, comparing Feature and Lazy training regimes.

As shown in the results, FCNs in the lazy regime consistently achieved lower test errors than those in the feature learning regime across all three datasets. Furthermore, the authors introduced a relative sensitivity ($R_f$) metric to measure prediction changes under small image deformations (diffeomorphisms). They found that feature-learned models are significantly more sensitive to these deformations, correlating directly with their poorer generalization performance.

Conclusion

The "FCN Paradox"—where feature learning fails in fully-connected networks but succeeds in Convolutional Neural Networks (CNNs)—is likely explained by architecture. CNNs possess built-in smoothness through local connectivity and pooling. FCNs, lacking these priors, must learn smoothness, which is hindered by the feature learning regime's drive toward jagged, sparse solutions. Future research should explore how deep architectures manage to learn features without falling into this sparsity trap, potentially through the regularizing effects of layers like pooling or batch normalization.

Summary updated

BibTeX
@inproceedings{petrini2022learning,
  author = {Leonardo Petrini and Francesco Cagnetta and Eric Vanden-Eijnden and Matthieu Wyart},
  title = {{Learning sparse features can lead to overfitting in neural networks}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2022},
}
Figure