Uncovering the mechanisms behind long-term memory is one of the mostfascinating open problems in neuroscience and artificial intelligence.Artificial associative memory networks have been used to formalize importantaspects of biological memory. Generative diffusion models are a type ofgenerative machine learning techniques that have shown great performance inmany tasks. Like associative memory systems, these networks define a dynamicalsystem that converges to a set of target states. In this work we show thatgenerative diffusion models can be interpreted as energy-based models and that,when trained on discrete patterns, their energy function is (asymptotically)identical to that of modern Hopfield networks. This equivalence allows us tointerpret the supervised training of diffusion models as a synaptic learningprocess that encodes the associative dynamics of a modern Hopfield network inthe weight structure of a deep neural network. Leveraging this connection, weformulate a generalized framework for understanding the formation of long-termmemory, where creative generation and memory recall can be seen as parts of aunified continuum.