Abstract
Scaling the capacity of Pre-trained Language Models (PLMs) typically requires increasing the number of layers, which leads to higher computational costs and slower inference. This paper proposes a method to scale model capacity without the typical "compute tax" by utilizing Product Key Memory (PKM). The authors identify "catastrophic drift" as the primary reason standard PKM fails in BERT-style models and introduce two solutions: a Residual Memory (ResM) layer and a warm-start initialization strategy. Experimental results show that a BERT-Base model augmented with ResM matches the performance of BERT-Large while maintaining significantly higher inference speeds.
Introduction: The Scaling Bottleneck
In natural language processing, increasing model size generally leads to better performance. However, larger models—characterized by more layers and parameters—are computationally expensive to train and slow to deploy. Product Key Memory (PKM) was previously proposed to address this by allowing models to access a massive external memory (billions of parameters) via efficient nearest-neighbor search, adding capacity with negligible computational overhead.
Despite its success in simple text generation, PKM has historically failed to improve downstream task performance in models like BERT. The authors discover that this is due to "catastrophic drift": the model's internal representations change so rapidly during training that memory slots become "stale" and go unused. In standard setups, only about 2% of memory slots are typically utilized.
Proposed Methods: ResM and Warm-Starting
To overcome the limitations of standard PKM, the authors propose two architectural and procedural modifications:
- Residual Memory (ResM) Layer: Instead of replacing the Feed-Forward Network (FFN) with a PKM layer, the authors introduce the PKM layer as a parallel branch. The output of the block is the sum of the FFN and PKM outputs: $x' = LN(x + FFN(x) + PKM(x))$. This allows the model to rely on the stable FFN logic while gradually learning to leverage the additional memory capacity.
- Initialization from Pre-trained Weights: Rather than training from scratch, the model is initialized with weights from a standard pre-trained BERT. The memory layers are then "plugged in" for continued training. This stable starting point prevents the model from diverging during the early stages of learning.
Key Insights: Solving the Staleness Trap
The core contribution of this work is identifying and solving the "staleness trap." Because memory updates are sparse (only a few slots are updated per training step), they cannot keep pace with the rapidly changing weights of the rest of the network.
To track this, the authors introduced Top-1 memory usage ($\widehat{MU}$), a metric measuring how many memory slots are selected as the "best" match. Their proposed ResM and initialization strategies boosted this utilization from 2% to over 95%, effectively activating the model's massive parameter count.
Experimental Results
The effectiveness of ResM was evaluated across several benchmarks:
- GLUE and SQuAD: BERT-Base + ResM achieved an average GLUE score of 85.3, identical to BERT-Large. Crucially, the ResM model processed 59.3 batches/sec, significantly outperforming BERT-Large's 43.1 batches/sec.
- Language Modeling: On the PG-19 dataset, the proposed model reduced perplexity from 6.18 (standard BERT-Base) to 5.14, indicating a superior grasp of long-range dependencies and knowledge.
- Efficiency: While the BERT-Base + ResM model has more total parameters (~515M) than BERT-Large (~340M), it is faster because it maintains a shallower computational depth. This demonstrates that computational depth, rather than raw parameter count, is the primary bottleneck for inference speed.
Conclusion and Future Work
By combining Residual Memory with a warm-start initialization, the authors successfully scaled BERT-style models without sacrificing inference speed. While the current approach requires a two-stage training process, it opens new avenues for "memory-augmented" architectures. Future research may focus on regularizing memory keys or pruning unused slots to further optimize these high-capacity, high-speed models.
Summary updated