How Much Information Can We Fit inside a Transformer?
Amirhossein Basareh, Rishabh Sanjay, Daniel de Mello, Abulhair Saparov
Abstract
How efficiently can transformers store factual knowledge? The answer to this question has implications for both model design and understanding the limits of transformer-based systems. Prior studies observe a linear relationship between the number of facts memorized and the number of model parameters required, substantially worse than what theoretical analyses predict is achievable. We re-examine empirical scaling: through rigorous and systematic experiments, including extensive hyperparameter search via Bayesian optimization, we determine the smallest model that can perfectly memorize a given set of facts, and measure how this minimum size scales with the number of facts. On synthetic datasets of random, independent (subject, relation, object) triples---e.g., (Paris, capital_of, France) ---drawn at random with no exploitable structure, we find that memorization capacity, the size of the largest dataset that a model memorizes completely, grows exponentially with the transformer dimension. Equivalently, the minimum transformer dimension required to memorize facts grows logarithmically in . Across 11 dataset sizes spanning to , a lack-of-fit F-test does not reject the logarithmic fit (with an offset), but it does reject all other tested alternatives including power-law. Along the depth axis, however, at fixed width, the maximum memorizable dataset size grows sublinearly with the number of layers over the measured range. We further extend our exploration to structured data containing symmetric relations or two-hop composition. In this setting, we find that transformers exploit these regularities to further improve capacity. All code to reproduce our results is available at https://github.com/Magronox/transformer_information_capacity.
Create a lesson
Related papers
STEdgeFormer: MCU and NPU Deployable Transformer Architecture
Shared title terminologycs.AISudhakar Sah
EA-Bench: Measuring information and action efficiency under imperfect instructions
Shared title terminologycs.AIXu Wan, Wenyue Xu, Shenjie Zhao
When do stored facts become available in looped transformers?
Shared title terminologycs.AIFabio Valerio Massoli, Arnau Padrés Masdemont, Jordi Ros Giralt et al.
Persuasion from Within: Model-Based Insider Attacks in Multi-Agent LLM Debate and Consensus
Shared title terminologycs.AIBangyan Ju, Xiaolin Sun, Yibin Hu et al.
GERF: A Token-Efficient Multimodal Retrieval Framework for Schema-Guided Scientific Information Extraction
Shared title terminologycs.AIYiyu Qian, Xing Wu
Specialized Large Language Models for Markovian Reasoning: Structural Cache Compression, Transition Pretraining, and Dual-Loop Transformers
Shared title terminologycs.AIHaibin Tong, Liangliang Xin, Yamei Zhu et al.