On the Optimal Memorization Power of ReLU Neural Networks

Gal Vardi, Gilad Yehudai, Ohad Shamir

Deep learning models are famous for their ability to memorize training data, perfectly fitting every sample. But what is the absolute minimum number of parameters required to memorize $N$ data points? This paper proves that feedforward ReLU neural networks are remarkably efficient at this task, requiring only $\tilde{O}(\sqrt{N})$ parameters to memorize $N$ points. This result is theoretically optimal, matching known lower bounds, and reveals a fascinating trade-off between network depth, parameter count, and weight precision.

The Memorization Problem

In learning theory, Vapnik–Chervonenkis (VC) dimension dictates that a network with $W$ parameters cannot "shatter" (and thus cannot always memorize) more than $O(W^2)$ points. This establishes a theoretical lower bound: you need at least $W \ge \Omega(\sqrt{N})$ parameters to memorize $N$ points.

However, constructive proofs have historically lagged behind this theoretical limit. For years, methods required $O(N)$ parameters to guarantee memorization, with a recent 2020 study improving this to $O(N^{2/3})$. This paper finally closes the gap, proving that the $\sqrt{N}$ limit is actually achievable for ReLU networks.

The Three-Stage Construction Method

The authors use a sophisticated three-stage mathematical construction to build a specific ReLU network architecture capable of optimal memorization. They assume an arbitrary dataset of $N$ labeled samples in $\mathbb{R}^d$ that satisfies a mild separability assumption (meaning no two points are infinitely close to each other).

  1. Dimensionality Reduction: The $d$-dimensional input data is first projected onto a 1D line while maintaining sufficient separation between the points.
  2. Data Partitioning and Encoding: The $N$ points are split into groups. For each group, the labels and point locations are encoded into a few extremely high-precision integers. These integers serve as the network's weights.
  3. The Bit Extractor: The core innovation is a very deep, narrow (width-12) sub-network that acts as a lookup mechanism. Using the "triangle function"—a classic tool in depth-complexity theory—it sequentially unpacks the bits stored in the high-precision weights to retrieve the correct label for any given input.

Key Insights and Results

  • Optimal Bound: A ReLU network with a width of 12 and a depth of $\tilde{O}(\sqrt{N})$ can perfectly memorize $N$ points using only $\tilde{O}(\sqrt{N})$ parameters.
  • Depth-Limited Optimality: The authors provide a generalized construction showing that for any fixed depth $1 \le L \le \sqrt{N}$, a network can memorize $N$ points using $\tilde{O}(N/L)$ parameters. This directly matches the lower bounds derived from recent VC-dimension research.
  • The Precision-Parameter Trade-off: Achieving sub-linear parameter complexity requires weights with massive "bit complexity" (extremely high precision). The authors prove this is a mathematical necessity: to memorize $N$ points with $N^{1-\epsilon}$ parameters, the weights must have a bit complexity of at least $\Omega(N^\epsilon)$. You cannot get sub-linear memorization without paying a price in precision.

Limitations and Future Directions

While a significant theoretical breakthrough, the paper outlines several practical limitations and avenues for future work:

  • Hardware Constraints: Because the optimal construction relies on weights with massive bit complexity, it cannot be implemented on modern hardware restricted to 16-bit or 32-bit floating-point numbers.
  • Optimization vs. Existence: The paper proves that such a highly efficient network exists, but it does not guarantee that standard training algorithms like Stochastic Gradient Descent (SGD) can actually find it. Investigating whether optimizers can converge to these sub-linear solutions remains a vital open question.
  • Generalization: While focused purely on memorization, understanding this "interpolation threshold" (where a model perfectly fits the data) is a critical stepping stone toward explaining phenomena like "double descent" in deep learning generalization.

Summary updated

BibTeX
@inproceedings{vardi2022optimal,
  author = {Gal Vardi and Gilad Yehudai and Ohad Shamir},
  title = {{On the Optimal Memorization Power of ReLU Neural Networks}},
  booktitle = {International Conference on Learning Representations},
  year = {2022},
  url = {https://openreview.net/forum?id=MkTPtnjeYTV},
}
Figure