In-context denoising with one-layer transformers: connections between attention and associative memory retrieval

Fuente: arXiv
Gespeichert in:
Bibliographische Detailangaben
Hauptverfasser: Smart, Matthew, Bietti, Alberto, Sengupta, Anirvan M.
Format: Preprint
Veröffentlicht: 2025
Schlagworte:
Online-Zugang:
Tags: Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
_version_ 1866915329798569984
author Smart, Matthew
Bietti, Alberto
Sengupta, Anirvan M.
author_facet Smart, Matthew
Bietti, Alberto
Sengupta, Anirvan M.
contents We introduce in-context denoising, a task that refines the connection between attention-based architectures and dense associative memory (DAM) networks, also known as modern Hopfield networks. Using a Bayesian framework, we show theoretically and empirically that certain restricted denoising problems can be solved optimally even by a single-layer transformer. We demonstrate that a trained attention layer processes each denoising prompt by performing a single gradient descent update on a context-aware DAM energy landscape, where context tokens serve as associative memories and the query token acts as an initial state. This one-step update yields better solutions than exact retrieval of either a context token or a spurious local minimum, providing a concrete example of DAM networks extending beyond the standard retrieval paradigm. Overall, this work solidifies the link between associative memory and attention mechanisms first identified by Ramsauer et al., and demonstrates the relevance of associative memory models in the study of in-context learning.
format Preprint
id arxiv_https___arxiv_org_abs_2502_05164
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle In-context denoising with one-layer transformers: connections between attention and associative memory retrieval
Smart, Matthew
Bietti, Alberto
Sengupta, Anirvan M.
Machine Learning
Disordered Systems and Neural Networks
We introduce in-context denoising, a task that refines the connection between attention-based architectures and dense associative memory (DAM) networks, also known as modern Hopfield networks. Using a Bayesian framework, we show theoretically and empirically that certain restricted denoising problems can be solved optimally even by a single-layer transformer. We demonstrate that a trained attention layer processes each denoising prompt by performing a single gradient descent update on a context-aware DAM energy landscape, where context tokens serve as associative memories and the query token acts as an initial state. This one-step update yields better solutions than exact retrieval of either a context token or a spurious local minimum, providing a concrete example of DAM networks extending beyond the standard retrieval paradigm. Overall, this work solidifies the link between associative memory and attention mechanisms first identified by Ramsauer et al., and demonstrates the relevance of associative memory models in the study of in-context learning.
title In-context denoising with one-layer transformers: connections between attention and associative memory retrieval
topic Machine Learning
Disordered Systems and Neural Networks
url https://arxiv.org/abs/2502.05164