Memory-based Language Models: An Efficient, Explainable, and Eco-friendly Approach to Large Language Modeling
Antal van den Bosch, Ainhoa Risco Patón, Teun Buijse, Peter Berck, Maarten van Gompel
TL;DR
This work investigates memory-based language modeling as an efficient, explainable, and eco-friendly alternative to neural language models. It introduces OLIFANT, a CPU-based framework that uses a prefix trie to implement three $k$-NN–style variants (IB1-IG, TRIBL2, IGTree) for next-token prediction, enabling incremental learning and scalable data-driven performance. The study provides learning curves, latency and emission analyses, memorization and explainability assessments, and a distributional perplexity analysis, showing log-linear gains with more data and substantially lower CO$_2$ emissions than large Transformer training, though with limited context width and sparser output distributions. Although current performance lags the largest GPT-style models on very large data, OLIFANT offers a transparent, composable, and energy-efficient alternative for scenarios demanding CPU-based, interpretable, and scalable next-token prediction.
Abstract
We present memory-based language modeling as an efficient, eco-friendly alternative to deep neural network-based language modeling. It offers log-linearly scalable next-token prediction performance and strong memorization capabilities. Implementing fast approximations of k-nearest neighbor classification, memory-based language modeling leaves a relatively small ecological footprint both in training and in inference mode, as it relies fully on CPUs and attains low token latencies. Its internal workings are simple and fully transparent. We compare our implementation of memory-based language modeling, OLIFANT, with GPT-2 and GPT-Neo on next-token prediction accuracy, estimated emissions and speeds, and offer some deeper analyses of the model.
