Language Modeling With Factorization Memory
Lee Xiong, Maksim Tkachenko, Johanes Effendi, Ting Cai
TL;DR
This work introduces Factorization Memory, a sparse-update RNN with a 2D memory that matches Transformer performance on short-context language modeling and outperforms it on long-context extrapolation. By combining dense and top-k sparse memory updates, it achieves scalable computation with maintained capacity, and it provides optimized CUDA/Triton kernels to facilitate reproducible research. Across empirical studies, Factorization Memory demonstrates competitive results on English/Japanese benchmarks and superior inference speed compared to Transformer and Mamba-2, particularly on long contexts. The approach advances efficient, memory-augmented sequence modeling, offering a compelling alternative to attention-based architectures for long-context tasks.
Abstract
We propose Factorization Memory, an efficient recurrent neural network (RNN) architecture that achieves performance comparable to Transformer models on short-context language modeling tasks while also demonstrating superior generalization in long-context scenarios. Our model builds upon Mamba-2, enabling Factorization Memory to exploit parallel computations during training while preserving constant computational and memory complexity during inference. To further optimize model efficiency and representational capacity, we develop a sparse formulation of Factorization Memory that updates only a subset of recurrent states at each step while preserving the strong performance of its dense counterpart. To our knowledge, this represents the first RNN architecture that successfully combines sparse memory activation with competitive performance across both short and long-context settings. This work provides a systematic empirical analysis of Factorization Memory in comparison to Transformer and Mamba-2 architectures.
