{"url":"/method/hopfield-layer","slug":"hopfield-layer","name":"Hopfield Layer","full_name":"Hopfield Layer","full_name_withheld":false,"description_markdown":"A **Hopfield Layer** is a module that enables a network to associate two sets of vectors. This general functionality allows for [transformer](https://paperswithcode.com/method/transformer)-like self-attention, for decoder-encoder attention, for time series prediction (maybe with positional encoding), for sequence analysis, for multiple instance learning, for learning with point sets, for combining data sources by associations, for constructing a memory, for averaging and pooling operations, and for many more. \r\n\r\nIn particular, the Hopfield layer can readily be used as plug-in replacement for existing layers like pooling layers ([max-pooling](https://paperswithcode.com/method/max-pooling) or [average pooling](https://paperswithcode.com/method/average-pooling), permutation equivariant layers, [GRU](https://paperswithcode.com/method/gru) & [LSTM](https://paperswithcode.com/method/lstm) layers, and attention layers. The Hopfield layer is based on modern Hopfield networks with continuous states that have very high storage capacity and converge after one update.","description_state":"present","introduced_year":null,"introduced_by":{"title":"Hopfield Networks is All You Need","paper":"/paper/hopfield-networks-is-all-you-need","first_author":"Hubert Ramsauer","n_authors":16,"url_abs":null,"archive_paper_url":"https://paperswithcode.com/paper/hopfield-networks-is-all-you-need"},"source":{"url":"https://arxiv.org/abs/2008.02217v3","title":"Hopfield Networks is All You Need","url_on_a_paper_host":true},"code_snippet_url":"https://github.com/ml-jku/hopfield-layers/blob/19443f24d0c7bc23bd01249b9a5c9c50f30e2936/modules/activation.py#L16","code_snippet_url_on_a_code_host":true,"categories":[{"area":"General","area_id":"general","collection":"Attention Modules","url":"/methods/category/attention-modules","pwc_aliases":[]},{"area":"Sequential","area_id":"sequential","collection":"Recurrent Neural Networks","url":"/methods/category/recurrent-neural-networks","pwc_aliases":[]},{"area":"Computer Vision","area_id":"computer-vision","collection":"Pooling Operations","url":"/methods/category/pooling-operations","pwc_aliases":["pooling-operation"]}],"n_papers_tagged":3,"archive_num_papers":3,"papers_newest_first":[{"paper":"/paper/hbert-biascorp-fighting-racism-on-the-web","title":"HBert + BiasCorp -- Fighting Racism on the Web","date":"2021-04-06","arxiv_id":"2104.02242","n_code_links":0,"syntology":null},{"paper":null,"title":"HiCOMEX: Facial Action Unit Recognition Based on Hierarchy Intensity Distribution and COMEX Relation Learning","date":"2020-09-23","arxiv_id":"2009.10892","n_code_links":0,"syntology":null},{"paper":"/paper/hopfield-networks-is-all-you-need","title":"Hopfield Networks is All You Need","date":"2020-07-16","arxiv_id":"2008.02217","n_code_links":3,"syntology":{"ran":0,"of":9,"unverified":9,"pointer_only":0}}],"papers_shown":3,"tasks":[{"task":"/task/action-unit-detection","name":"Action Unit Detection","papers":1},{"task":"/task/all","name":"All","papers":1},{"task":"/task/drug-design","name":"Drug Design","papers":1},{"task":"/task/facial-action-unit-detection","name":"Facial Action Unit Detection","papers":1},{"task":"/task/immune-repertoire-classification","name":"Immune Repertoire Classification","papers":1},{"task":"/task/multiple-instance-learning","name":"Multiple Instance Learning","papers":1},{"task":null,"name":"Relation","papers":1},{"task":"/task/representation-learning","name":"Representation Learning","papers":1},{"task":"/task/retrieval","name":"Retrieval","papers":1}],"tasks_shown":9,"n_tasks":9,"usage_by_year":[{"year":"2020","papers":2},{"year":"2021","papers":1}],"row_source":"methods_table","archive":{"source":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","archive_url":"https://paperswithcode.com/method/hopfield-layer"},"syntology_read_at":"2026-09-24T18:15:14+00:00"}