Saved in:
Bibliographic Details
Main Authors: Masumura, Tsubasa, Taki, Masato
Format: Preprint
Published: 2025
Subjects:
Online Access:https://arxiv.org/abs/2511.20698
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866917104941268992
author Masumura, Tsubasa
Taki, Masato
author_facet Masumura, Tsubasa
Taki, Masato
contents Associative memory models based on Hopfield networks and self-attention based on key-value mechanisms have been popular approaches in the study of memory mechanisms in deep learning. It has been pointed out that the state update rule of the modern Hopfield network (MHN) in the adiabatic approximation is in agreement with the self-attention layer of Transformer. In this paper, we go beyond this approximation and investigate the relationship between MHN and self-attention. Our results show that the correspondence between Hopfield networks and Transformers can be established in a more generalized form by adding a new variable, the hidden state derived from the MHN, to self-attention. This new attention mechanism, modern Hopfield attention (MHA), allows the inheritance of attention scores from the input layer of the Transformer to the output layer, which greatly improves the nature of attention weights. In particular, we show both theoretically and empirically that MHA hidden states significantly improve serious problem of deep Transformers known as rank collapse and token uniformity. We also confirm that MHA can systematically improve accuracy without adding training parameters to the Vision Transformer or GPT. Our results provide a new case in which Hopfield networks can be a useful perspective for improving the Transformer architecture.
format Preprint
id arxiv_https___arxiv_org_abs_2511_20698
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle On the Role of Hidden States of Modern Hopfield Network in Transformer
Masumura, Tsubasa
Taki, Masato
Machine Learning
Artificial Intelligence
Associative memory models based on Hopfield networks and self-attention based on key-value mechanisms have been popular approaches in the study of memory mechanisms in deep learning. It has been pointed out that the state update rule of the modern Hopfield network (MHN) in the adiabatic approximation is in agreement with the self-attention layer of Transformer. In this paper, we go beyond this approximation and investigate the relationship between MHN and self-attention. Our results show that the correspondence between Hopfield networks and Transformers can be established in a more generalized form by adding a new variable, the hidden state derived from the MHN, to self-attention. This new attention mechanism, modern Hopfield attention (MHA), allows the inheritance of attention scores from the input layer of the Transformer to the output layer, which greatly improves the nature of attention weights. In particular, we show both theoretically and empirically that MHA hidden states significantly improve serious problem of deep Transformers known as rank collapse and token uniformity. We also confirm that MHA can systematically improve accuracy without adding training parameters to the Vision Transformer or GPT. Our results provide a new case in which Hopfield networks can be a useful perspective for improving the Transformer architecture.
title On the Role of Hidden States of Modern Hopfield Network in Transformer
topic Machine Learning
Artificial Intelligence
url https://arxiv.org/abs/2511.20698