Abstract
This paper introduces the Large Memory Model (LM2), a decoder-only Transformer architecture enhanced with an auxiliary memory module designed to overcome the limitations of standard Transformers in multi-step reasoning and long-context synthesis. LM2 incorporates a memory bank that acts as a contextual representation repository, interacting with input tokens via cross-attention and updating through gating mechanisms. By maintaining the original information flow while integrating a complementary memory pathway, LM2 preserves general-purpose capabilities while excelling at complex reasoning. Experimental results on the BABILong benchmark show that LM2 outperforms the memory-augmented RMT model by 37.1% and the baseline Llama-3.2 model by 86.3% on average. Furthermore, LM2 achieves a 5.0% improvement on the MMLU dataset over a vanilla pre-trained model, proving that explicit memory enhances rather than degrades general performance.
Introduction: The "Goldfish Memory" Problem
Despite the transformative success of Large Language Models (LLMs), standard Transformer architectures face a significant hurdle: as context length increases, the attention mechanism often fails to distinguish essential facts from irrelevant data. This "needle-in-a-haystack" challenge limits the model's ability to perform multi-step reasoning or relational argumentation over long sequences.
Existing approaches typically fall into two categories, both with significant drawbacks. Recurrent models like RMT summarize context into prompts but often hit performance "cliffs" once context exceeds a certain length (e.g., 16K tokens). Conversely, many memory-augmented models become so specialized for retrieval that they lose their general-purpose reasoning abilities, performing poorly on standard benchmarks like MMLU. LM2 was developed to bridge this gap, providing a robust architecture for 128K+ token contexts without sacrificing common-sense reasoning.
Architecture and Methodology
LM2 is a decoder-only Transformer, based on the Llama-3 framework, enhanced with an auxiliary memory module integrated across all 16 decoder blocks. The core innovation is the Dual-Path Information Flow, which ensures that the standard Transformer operations remain intact while a parallel pathway manages long-term memory.
Key components of the LM2 architecture include:
- The Memory Bank ($M$): An explicit repository of $N$ slots for contextual representations.
- Cross-Attention Retrieval: Input tokens act as queries to look up relevant information in the memory bank, which provides the keys and values.
- Gated Updates: Borrowing from LSTM logic, LM2 utilizes Input ($I$), Forget ($F$), and Output ($O$) gates. These learnable gates determine what new information to write to memory, what outdated facts to erase, and how much retrieved memory should influence the current layer's output.
Experimental Results
To evaluate the effectiveness of the memory module, the researchers tested LM2 on the BABILong benchmark, which spans 10 reasoning tasks across context lengths from 0K to 128K tokens.
Key Performance Metrics:
- BABILong Dominance: LM2-1.7B outperformed the baseline Llama-3.2 model by an average of 86.3%. While other models saw performance crater at 32K tokens, LM2 remained robust up to the 128K token limit.
- Generalization Win: On the MMLU benchmark, LM2 achieved a 29.4% score compared to the vanilla model's 28.0%. This 5.0% improvement demonstrates that explicit memory management actually aids general reasoning by providing better context organization.
- Memory Interpretability: Using the "Neuron Explainer" method, the authors found that specific memory slots specialize. For instance, certain slots focused on factual Q&A structures, while others specialized in structural cues like "Options:" and "Answer:".
Conclusion and Future Work
LM2 demonstrates that explicit, gated memory is a powerful tool for extending the reasoning capabilities of Transformers. By decoupling long-term storage from immediate processing, the model avoids the performance degradation typical of long-context tasks. While LM2 slightly trailed Retrieval-Augmented Generation (RAG) on specific "Relation Tracking" tasks due to RAG's document-chunking advantage, its overall performance across reasoning and general benchmarks marks a significant step forward. Future work will explore scaling these explicit memory mechanisms to larger "frontier" models beyond the 1.7B parameter scale.
Summary updated