Beyond Scaling Laws: Understanding Transformer Performance with Associative Memory

Xueyan Niu, Bo Bai, Lei Deng, Wei Han
5/14/2024
cs.LG

No confident code implementation found for this paper. 1 possible match can be shown below.

Abstract

Increasing the size of a Transformer does not always lead to enhanced performance. This phenomenon cannot be explained by the empirical scaling laws. Furthermore, the model's enhanced performance is closely associated with its memorization of the training samples. We present a theoretical framework that sheds light on the memorization during pre-training of transformer-based language models. We model the behavior of Transformers with associative memories using Hopfield networks, such that each transformer block effectively conducts an approximate nearest-neighbor search. In particular, the energy function in modern continuous Hopfield networks serves as an explanation for the attention mechanism, which we approximate with a distance-based energy function. By observing that the softmax function corresponds to the gradient of the LogSumExp function in the energy, and employing the majorization-minimization technique, we construct a global energy function designed to capture the layered architecture. We demonstrate a dependency between the model size and the dataset size for the model to achieve optimal performance, and we show that the achievable cross-entropy loss is bounded from below.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. 1 weaker match is hidden by default — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{niu2024beyond,
  title  = {Beyond Scaling Laws: Understanding Transformer Performance with Associative Memory},
  author = {Xueyan Niu and Bo Bai and Lei Deng and Wei Han},
  year   = {2024},
  eprint = {2405.08707},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2405.08707v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2405.08707.svg)](https://codeofpaper.com/paper/2405.08707)

Discussion