Abstract
Retrieval-augmented language models (kNN-LMs) consistently outperform standard language models, even when retrieving from their own training data. This paper investigates this phenomenon, debunking the "softmax bottleneck" theory and identifying "over-specification"—a training failure where models overfit to redundant context—as the primary cause. The authors further propose a storage-efficient MLP-based retrieval mechanism that achieves significant performance gains with 25x less memory than traditional kNN-LMs.
Introduction
Language models (LMs) augmented with $k$-nearest neighbor (kNN) retrieval achieve lower perplexity by looking up relevant tokens from a datastore during inference. Paradoxically, this advantage persists even when the datastore contains only the model's own training data. If the model has already processed this information, why can it not internalize it within its parameters? This research challenges the prevailing "softmax bottleneck" hypothesis—which blames architectural limitations of the final linear layer—and proposes a new explanation centered on generalization failures.
Debunking the Softmax Bottleneck
Previous literature suggested that the final linear layer of an LM is mathematically restricted from representing the complex probability distributions produced by kNN retrieval. To test this, the authors formulated an optimization problem to see if the last layer ($f$) could be "forced" to produce the kNN-LM distribution by finding an optimal input vector ($z^*$).
As shown in Figure 3, when the kNN distribution is projected into the model's output space, the resulting perplexity (16.76) is actually lower than the kNN-LM itself (16.92) and significantly better than the original LM (20.13). This confirms that the bottleneck is not architectural capacity, but rather a failure of the training process to map contexts to the correct internal representations.
The "Over-specification" Trap
The authors identify over-specification as the root cause of this training failure. In many training examples, "distractor" information is present that is not causally necessary for the output (e.g., a specific descriptor for a person). LMs tend to overfit to these details, "locking" facts to specific contexts. When these distractors are removed at test time, the model fails to retrieve the core knowledge from its parameters.
To study this, the authors introduced the Macondo dataset, a synthetic environment containing villager relationships with irrelevant descriptors. While vanilla models like GPT-2 XL and even GPT-3.5 Turbo struggle when descriptors are removed, kNN-augmented versions generalize significantly better. The retrieval mechanism allows the model to find core information based on intermediate representations, bypassing the inability to generalize away from over-specified training prefixes.
Efficient Retrieval via MLP-LMs
While effective, traditional kNN-LMs require massive, memory-intensive datastores. As a practical alternative, the authors propose replacing the datastore with a compact Multi-Layer Perceptron (MLP) that learns to map hidden states to target tokens.
This MLP-based approach (MLP-LM) provides a 25x reduction in storage costs. On the WikiText-103 benchmark, it reduces perplexity from 20.13 to 18.68 while utilizing less than 4% of the storage required for a full kNN-LM. On the synthetic Macondo dataset, the MLP-LM shows even more dramatic improvements, nearly halving the perplexity compared to the base LM (10.76 vs 19.66).
Conclusion
This work demonstrates that retrieval augmentation serves as a "generalization hack" that compensates for the training system's tendency toward over-specification. While the proposed MLP-LM offers a highly efficient path forward, the findings suggest that future research should focus on developing more robust training objectives. By reducing the model's sensitivity to over-specified contexts, it may be possible to achieve the benefits of retrieval augmentation directly within the model's parameters.
Summary updated