Papers › Hopfield Networks is All You Need

Hopfield Networks is All You Need

16 Jul 2020ICLR 2021 1arXiv:2008.02217archive 2025-07-28

Hubert Ramsauer, Bernhard Schäfl, Johannes Lehner, Philipp Seidl, Michael Widrich, Thomas Adler, Lukas Gruber, Markus Holzleitner, Milena Pavlović, Geir Kjetil Sandve, Victor Greiff, David Kreil, Michael Kopp, Günter Klambauer, Johannes Brandstetter, Sepp Hochreiter

We introduce a modern Hopfield network with continuous states and a corresponding update rule. The new Hopfield network can store exponentially (with the dimension of the associative space) many patterns, retrieves the pattern with one update, and has exponentially small retrieval errors. It has three types of energy minima (fixed points of the update): (1) global fixed point averaging over all patterns, (2) metastable states averaging over a subset of patterns, and (3) fixed points which store a single pattern. The new update rule is equivalent to the attention mechanism used in transformers. This equivalence enables a characterization of the heads of transformer models. These heads perform in the first layers preferably global averaging and in higher layers partial averaging via metastable states. The new modern Hopfield network can be integrated into deep learning architectures as layers to allow the storage of and access to raw input data, intermediate results, or learned prototypes. These Hopfield layers enable new ways of deep learning, beyond fully-connected, convolutional, or recurrent networks, and provide pooling, memory, association, and attention mechanisms. We demonstrate the broad applicability of the Hopfield layers across various domains. Hopfield layers improved state-of-the-art on three out of four considered multiple instance learning problems as well as on immune repertoire classification with several hundreds of thousands of instances. On the UCI benchmark collections of small classification tasks, where deep learning methods typically struggle, Hopfield layers yielded a new state-of-the-art when compared to different machine learning methods. Finally, Hopfield layers achieved state-of-the-art on two drug design datasets. The implementation is available at: https://github.com/ml-jku/hopfield-layers

PaperPDFConference PDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2008.02217")

Code

Syntology Ran 0 of 9 code samples harvested from 1 repository linked to this paper; 9 have no recorded run.

By repository: community (archive-listed): 9 samples from 1 repository, 0 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

ml-jku/hopfield-layers officialmentioned in papermentioned on GitHubpytorch report
ml-jku/mhn-react mentioned on GitHubpytorchNOASSERTION report
ppsp-team/pyhkbs mentioned on GitHubpytorchBSD-3-Clause report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

9 samples harvested; 0 ran; 0 honoured the contract we drafted; 9 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

9unverified

Licence: 0 of the 9 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from ppsp-team/pyhkbs. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

HKBextended ppsp-team/pyhkbs/basicHKB.py community (archive-listed) unverified BSD-3-Clause (permissive) · 7d6c1bc2b71b84af · report
HKBextended_torch ppsp-team/pyhkbs/basicHKB.py community (archive-listed) unverified BSD-3-Clause (permissive) · d192a8b31ecb58fb · report
calculate_KOP ppsp-team/pyhkbs/grid_search_evaluation.py community (archive-listed) unverified BSD-3-Clause (permissive) · 30b782ad6c30dce4 · report
calculate_average_wPLI ppsp-team/pyhkbs/grid_search_evaluation.py community (archive-listed) unverified BSD-3-Clause (permissive) · ce92b635cbc158a0 · report
calculate_inter_agent_PLV ppsp-team/pyhkbs/grid_search_social_evaluation.py community (archive-listed) unverified BSD-3-Clause (permissive) · d5712474eaf7a180 · report
calculate_movement_KOP ppsp-team/pyhkbs/grid_search_social_evaluation.py community (archive-listed) unverified BSD-3-Clause (permissive) · 7015688342676943 · report
calculate_wPLI ppsp-team/pyhkbs/grid_search_evaluation.py community (archive-listed) unverified BSD-3-Clause (permissive) · 64cac94b69ef1b11 · report
complementary_connection ppsp-team/pyhkbs/grid_search_social.py community (archive-listed) unverified BSD-3-Clause (permissive) · d470117f2f37e57d · report
single_simulation ppsp-team/pyhkbs/simulations.py community (archive-listed) unverified BSD-3-Clause (permissive) · ec31ea2fe93a67b9 · report

Tasks

AllDrug DesignImmune Repertoire ClassificationMultiple Instance LearningRetrieval

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

Introduced by this paper: Hopfield Layer

Absolute Position EncodingsAdamAttentionAttention DropoutBERTBPEDense ConnectionsDropoutHopfield LayerLabel SmoothingLayer NormalizationLinear LayerLinear Warmup With Linear DecayMulti-Head AttentionPosition-Wise Feed-Forward LayerResidual ConnectionSoftmaxTransformerWeight DecayWordPiece

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections