Table of Contents
Fetching ...

Empirical Capacity Model for Self-Attention Neural Networks

Aki Härmä, Marcin Pietrasik, Anna Wilbik

TL;DR

The paper addresses how much information a self-attention transformer can memorize under common optimization with synthetic data. It introduces an interpretable Empirical Capacity Model (ECM) that predicts memorization capacity $C$ as $C = \max( f(H,N)\cdot B, \alpha H + \beta )$ with $f(N,H) = a /(N^{bH+c}+d) + e$, capturing a presaturation linear rise in $B$ and a saturation bound governed by $H$. Through large-scale experiments varying token-vector size $B$, heads $H$, and sequence length $N$, the authors show that the ECM fits measured capacity better than a high-order polynomial and provides a practical, low-parameter tool for a priori hyperparameter selection and architecture design, including a memory-per-parameter metric. The work has implications for designing memory-efficient transformers and Retrieval Augmented Generation systems by linking architecture choices to attainable memorization, with future work extending to denser hyperparameter regimes and natural language data.

Abstract

Large pretrained self-attention neural networks, or transformers, have been very successful in various tasks recently. The performance of a model on a given task depends on its ability to memorize and generalize the training data. Large transformer models, which may have billions of parameters, in theory have a huge capacity to memorize content. However, the current algorithms for the optimization fall short of the theoretical capacity, and the capacity is also highly dependent on the content. In this paper, we focus on the memory capacity of these models obtained using common training algorithms and synthetic training data. Based on the results, we derive an empirical capacity model (ECM) for a generic transformer. The ECM can be used to design task-specific transformer models with an optimal number of parameters in cases where the target memorization capability of the task can be defined.

Empirical Capacity Model for Self-Attention Neural Networks

TL;DR

The paper addresses how much information a self-attention transformer can memorize under common optimization with synthetic data. It introduces an interpretable Empirical Capacity Model (ECM) that predicts memorization capacity as with , capturing a presaturation linear rise in and a saturation bound governed by . Through large-scale experiments varying token-vector size , heads , and sequence length , the authors show that the ECM fits measured capacity better than a high-order polynomial and provides a practical, low-parameter tool for a priori hyperparameter selection and architecture design, including a memory-per-parameter metric. The work has implications for designing memory-efficient transformers and Retrieval Augmented Generation systems by linking architecture choices to attainable memorization, with future work extending to denser hyperparameter regimes and natural language data.

Abstract

Large pretrained self-attention neural networks, or transformers, have been very successful in various tasks recently. The performance of a model on a given task depends on its ability to memorize and generalize the training data. Large transformer models, which may have billions of parameters, in theory have a huge capacity to memorize content. However, the current algorithms for the optimization fall short of the theoretical capacity, and the capacity is also highly dependent on the content. In this paper, we focus on the memory capacity of these models obtained using common training algorithms and synthetic training data. Based on the results, we derive an empirical capacity model (ECM) for a generic transformer. The ECM can be used to design task-specific transformer models with an optimal number of parameters in cases where the target memorization capability of the task can be defined.
Paper Structure (13 sections, 13 equations, 11 figures, 1 table)

This paper contains 13 sections, 13 equations, 11 figures, 1 table.

Figures (11)

  • Figure 1: A self-attention model with multiple layers and multiple self-attention heads.
  • Figure 2: A self-attention model with trained (0) and frozen (1) MLP layers.
  • Figure 3: Total numbers of trainable parameters (millions) for different variants of the transformer network.
  • Figure 4: Comparison of the capacity measurements with $H=4, L=1$ in MSL and MAC methods
  • Figure 5: Number of epochs needed to shutter the entire data set
  • ...and 6 more figures