Introduction
Conventional machine learning wisdom suggests that memorizing training data leads to overfitting. This paper flips the script, demonstrating theoretically and empirically that memorizing rare, "long-tail" features actually allows models to compose them together, enabling accurate predictions on entirely new, never-before-seen combinations of those rare features.
Background and Motivation
For decades, statistical learning theory warned against "memorization"—fitting the training data so perfectly that the model fails to generalize to new data. However, modern deep learning routinely memorizes training data (achieving near-zero training loss) yet still generalizes beautifully. Recent research suggests memorization is actually necessary to learn rare, "long-tail" examples that don't appear often enough to be learned via general statistical trends.
But similarity to training data doesn't explain everything. Large models also exhibit compositionality: the ability to combine distinct pieces of learned information to solve novel tasks. This paper asks a fascinating question: What is the synergy between memorization and composition? Specifically, if a model memorizes isolated rare features, can it mathematically "snap them together" like Lego bricks to handle out-of-distribution (OOD) examples that combine these rare features in ways never seen during training?
Methods
The authors tackle this question through both theoretical proofs and empirical experiments:
- Theoretical Linear Model: They analyze an overparameterized linear regression model (specifically, the minimum $\ell_2$-norm interpolator, which perfectly memorizes training data). They assume the data features follow a long-tail (power-law) distribution, meaning a few features are very common, but most appear rarely—sometimes only once.
- Neural Network Ablations: To see if the linear theory holds in deep learning, they train simple ResNet-18 architectures on a custom image-summation task. They test two types of architectures:
- Modular: Processes each image independently to extract features before aggregating them (using a Sum, Linear, or 2-layer network).
- Monolithic (Cross-channel): Stacks the images as input channels and processes them all at once, mixing their information from layer one.
- Regularization Toggling: They experiment with turning weight decay on (preventing memorization) and off (allowing memorization) to isolate the exact impact of memorization on compositional generalization.
Datasets
The authors rely on custom datasets designed to test out-of-distribution composition:
- Synthetic Linear Data: Vectors generated with power-law feature frequencies to test the theoretical proofs.
- Long-tail MNIST (3-digit sum): A modified MNIST dataset where digits appear with Zipf's law frequencies (e.g., '0' is extremely common, '9' is extremely rare). The task is to predict the sum of 3 randomly stacked images. The test set forces the inclusion of the rare digit '9' in combinations never seen during training.
- MNIST + Omniglot: A fascinating stress test where exactly one image from 10 different Omniglot classes is injected into the MNIST training set. The test set then asks the model to sum two Omniglot images—a combination that literally never occurred in the training data.
Key Insights
- Memorization is a prerequisite for rare composition: If a feature appears only once in your dataset, you can't learn it through statistical concentration; you must memorize it. Once memorized, a compositional model can successfully deploy that feature in entirely novel contexts.
- The "Isolation" of the Long Tail: The theoretical proof hinges on a cool combinatorial insight: in sparse, long-tailed data, most samples contain at most one rare feature. Because the rare feature appears alongside well-learned common features, the model can isolate and perfectly memorize the weight of that rare feature.
- Architecture dictates compositionality: Neural networks don't automatically compose. The modular ResNets (which processed digits independently before summing) exhibited strong compositionality. The monolithic "Cross-channel" ResNet failed completely, as it entangled the features too early to learn reusable concepts.
- Regularization can be the enemy of OOD generalization: Standard techniques to prevent overfitting (like weight decay) actively destroyed the models' ability to compose rare features, because they prevented the necessary memorization of those features in the first place.
Key Results
- Theoretical Guarantee: The authors mathematically prove that for the linear model, the out-of-distribution test loss on novel combinations of rare features is bounded by $\sigma^2 t$ (where $\sigma$ is label noise and $t$ is the number of rare features). If there is no noise, the model predicts novel combinations perfectly.
- Empirical Success on MNIST: On the Long-tail MNIST task, modular ResNets successfully generalized to unseen combinations of the rare digit '9', with test loss decreasing smoothly as the model saw slightly more '9's during training. The Cross-channel model failed to generalize.
- The Omniglot Stress Test: When tested on combinations of Omniglot characters seen only once during training, modular models that were allowed to memorize (0 weight decay) achieved impressive test losses (0.13 to 0.17). When weight decay was applied to prevent memorization, test loss exploded (0.64 to 2.87), proving memorization was the key driver of success.
Limitations and Future Work
- Scope of Theory: The theoretical proofs are strictly limited to linear models. While the empirical results show the intuition carries over to neural networks, a rigorous non-linear proof remains open.
- Scale: The experiments utilize small networks (ResNet-18) on supervised learning tasks (MNIST/Omniglot). It is not definitively proven how exactly this scales to massive unsupervised models like LLMs.
- The Dark Side of Memorization: The authors note that memorization only helps composition if the rare features are valid. If long-tail features are mislabeled or spuriously correlated with the wrong outputs, memorization will actively hurt generalization.
- Future Work: The authors suggest this work serves as a starting point for understanding the interplay between memorization and composition in more complex, real-world foundation models.
Summary updated