G-MemLLM: Gated Latent Memory Augmentation for Long-Context Reasoning in Large Language Models

Xu, Xun

–arXiv.org Artificial Intelligence 

By integrating a trainable latent memory bank with a frozen LLM backbone, we decouple linguistic processing from stateful information storage. Our primary technical innovation is the implementation of a GRU-style gated update logic, which allows the model to selectively preserve or overwrite latent memory slots. This mechanism, supported by a composite loss function emphasizing sparsity and entropy, successfully mitigates common issues such as context rot and information dilution found in traditional recurrent or compressed architectures. Empirical evaluations across scales, from GPT-2 (124M) to Llama 3.1-8B, demonstrate that GMemLLM provides significant performance gains on the HotpotQA and ZsRE benchmarks. These results suggest that as LLMs grow in capacity, they become increasingly efficient at using explicit memory modules to index and organize their internal knowledge. As a machine learning course project, this work highlights the transition from passive context windows to active gated cognitive architectures. We successfully navigated challenges related to memory collapse and high-dimensional state projection on limited hardware. The findings underscore that adding a small, trainable working memory, representing less than 3% additional parameters, is a highly efficient strategy for extending the reasoning capabilities of pre-trained models without the prohibitive cost of full-parameter fine-tuning.