Transformers are one of the most successful architectures of modern neural networks. At their core there is the so-called attention mechanism, which recently interested the physics community as it can be written as the derivative of an energy function in certain cases: while it is possible to write the cross-attention layer as a modern Hopfield network, the same is not possible for the self-attention, which is used in the GPT architectures and other autoregressive models. In this work we show that it is possible to obtain the self-attention layer as the derivative of local energy terms, which resemble a pseudo-likelihood. We leverage the analogy with pseudo-likelihood to design a recurrent model that can be trained without backpropagation: the dynamics shows transient states that are strongly correlated with both train and test examples. Overall we present a novel framework to interpret self-attention as an attractor network, potentially paving the way for new theoretical approaches inspired from physics to understand transformers.
Learning Sequence Attractors in Recurrent Networks with Hidden Neurons
Peking University(北京大学);School of Psychological and Cognitive Sciences(心理与认知科学学院);IDG/McGovern Institute for Brain Research(IDG/麦戈文脑研究所);Academy for Advanced Interdisciplinary Studies(前沿交叉学科研究院)
Cyclic Denoising Reveals Ultrastable Memories in Diffusion Models
Simons Center for Computational Physical Chemistry, New York University(纽约大学西蒙斯计算物理化学中心);Center for Soft Matter Research, Department of Physics, New York University(纽约大学物理系软物质研究中心);Center for Neural Science, New York University(纽约大学神经科学中心);Courant Institute of Mathematical Sciences, New York University(纽约大学库朗数学科学研究所)
Pseudo-likelihood produces associative memories able to generalize, even for asymmetric couplings
Physics Department, Sapienza University of Rome(罗马大学物理系);Institute of Nanotechnology, National Research Council of Italy, CNR-NANOTEC, Rome Unit(意大利国家研究委员会纳米技术研究所,CNR-NANOTEC,罗马分部)
Modern Hopfield Networks with Continuous-Time Memories
Instituto de Telecomunicações(电信研究所);Instituto Superior Técnico(高等技术学院);Universidade de Lisboa(里斯本大学);Champalimaud Research(尚帕利莫研究中心);Unbabel(昂巴贝尔公司);ELLIS Unit Lisbon(欧洲学习与智能系统研究所里斯本分部)