IDEAS home Printed from https://ideas.repec.org/p/arx/papers/2603.06875.html

Stochastic Attention via Langevin Dynamics on the Modern Hopfield Energy

Author

Listed:
  • Abdulrahman Alswaidan
  • Jeffrey D. Varner

Abstract

Attention heads retrieve: given a query, they return a softmax-weighted average of stored values. We show that this computation is one step of gradient descent on a classical energy function, and that Langevin sampling from the corresponding distribution yields stochastic attention: a training-free sampler controlled by a single temperature. Lowering the temperature gives exact retrieval; raising it gives open-ended generation. Because the energy gradient equals the attention map, no score network, training loop, or learned model is required. We derive a closed-form entropy inflection condition that identifies the retrieval-to-generation transition temperature for any memory geometry, with a scaling law $\beta^*\!\sim\!\sqrt{d}$ for random patterns. We validate on five domains (64 to 4,096 dimensions). On MNIST digit images, stochastic attention is $2.6{\times}$ more novel and $2.0{\times}$ more diverse than the best learned baseline (a VAE trained on the same patterns), while matching a Metropolis-corrected gold standard. On protein sequences from the Pfam RRM family, the generation regime achieves $6.9{\times}$ lower amino acid composition divergence than the VAE (KL $= 0.060$ vs.\ $0.416$) at matched novelty, demonstrating that the training-free score function preserves family-level fidelity that learned models lose. A denoising diffusion baseline (DDPM) fails across all memory sizes tested ($K = 100$ to $3{,}500$), producing samples indistinguishable from isotropic noise. The approach requires no architectural changes to the underlying attention mechanism.

Suggested Citation

  • Abdulrahman Alswaidan & Jeffrey D. Varner, 2026. "Stochastic Attention via Langevin Dynamics on the Modern Hopfield Energy," Papers 2603.06875, arXiv.org, revised Mar 2026.
  • Handle: RePEc:arx:papers:2603.06875
    as

    Download full text from publisher

    File URL: http://arxiv.org/pdf/2603.06875
    File Function: Latest version
    Download Restriction: no
    ---><---

    References listed on IDEAS

    as
    1. Arnak S. Dalalyan, 2017. "Theoretical guarantees for approximate sampling from smooth and log-concave densities," Journal of the Royal Statistical Society Series B, Royal Statistical Society, vol. 79(3), pages 651-676, June.
    2. R. Cont, 2001. "Empirical properties of asset returns: stylized facts and statistical issues," Quantitative Finance, Taylor & Francis Journals, vol. 1(2), pages 223-236.
    Full references (including those not matched with items on IDEAS)

    Most related items

    These are the items that most often cite the same works as this one and are cited by the same works as this one.
    1. M. Barkhagen & S. García & J. Gondzio & J. Kalcsics & J. Kroeske & S. Sabanis & A. Staal, 2023. "Optimising portfolio diversification and dimensionality," Journal of Global Optimization, Springer, vol. 85(1), pages 185-234, January.
    2. Chen, Ray-Bing & Chen, Ying & Härdle, Wolfgang K., 2014. "TVICA—Time varying independent component analysis and its application to financial data," Computational Statistics & Data Analysis, Elsevier, vol. 74(C), pages 95-109.
    3. Abduraimova, Kumushoy, 2022. "Contagion and tail risk in complex financial networks," Journal of Banking & Finance, Elsevier, vol. 143(C).
    4. Josselin Garnier & Knut Sølna, 2018. "Option pricing under fast-varying and rough stochastic volatility," Annals of Finance, Springer, vol. 14(4), pages 489-516, November.
    5. Pieter Nel & Renee van Eyden, 2026. "From News to Noise: Does Media Sentiment Drive Stock Market Volatility?," Working Papers 202605, University of Pretoria, Department of Economics.
    6. Jean-Philippe Bouchaud & Julien Kockelkoren & Marc Potters, 2006. "Random walks, liquidity molasses and critical response in financial markets," Quantitative Finance, Taylor & Francis Journals, vol. 6(2), pages 115-123.
    7. Juan C. Henao-Londono & Sebastian M. Krause & Thomas Guhr, 2021. "Price response functions and spread impact in correlated financial markets," The European Physical Journal B: Condensed Matter and Complex Systems, Springer;EDP Sciences, vol. 94(4), pages 1-20, April.
    8. Westerhoff, Frank H. & Dieci, Roberto, 2006. "The effectiveness of Keynes-Tobin transaction taxes when heterogeneous agents can trade in different markets: A behavioral finance approach," Journal of Economic Dynamics and Control, Elsevier, vol. 30(2), pages 293-322, February.
    9. Aït-Youcef, Camille & Joëts, Marc, 2024. "The role of index traders in the financialization of commodity markets: A behavioral finance approach," Energy Economics, Elsevier, vol. 136(C).
    10. Eduardo Abi Jaber, 2022. "The characteristic function of Gaussian stochastic volatility models: an analytic expression," Working Papers hal-02946146, HAL.
    11. Hoang Anh Nguyen & Nhat Hoang Bach, 2026. "QI-HRNN: a quantum-inspired hybrid framework for resilient currency forecasting under extreme market conditions," Digital Finance, Springer, vol. 8(2), pages 1-40, June.
    12. Peter Yegon & W. Brent Lindquist & Svetlozar T. Rachev, 2025. "Asset Pricing in the Presence of Market Microstructure Noise," Papers 2511.00308, arXiv.org.
    13. Zhang, Wei-Guo & Li, Zhe & Liu, Yong-Jun, 2018. "Analytical pricing of geometric Asian power options on an underlying driven by a mixed fractional Brownian motion," Physica A: Statistical Mechanics and its Applications, Elsevier, vol. 490(C), pages 402-418.
    14. Giovanni Bonaccolto & Massimiliano Caporin & Sandra Paterlini, 2018. "Asset allocation strategies based on penalized quantile regression," Computational Management Science, Springer, vol. 15(1), pages 1-32, January.
    15. Hoga, Yannick, 2017. "Monitoring multivariate time series," Journal of Multivariate Analysis, Elsevier, vol. 155(C), pages 105-121.
    16. Eduardo Abi Jaber & Donatien Hainaut & Edouard Motte, 2025. "The Volterra Stein-Stein model with stochastic interest rates," Papers 2503.01716, arXiv.org, revised Jul 2025.
    17. Lallouache, Mehdi & Abergel, Frédéric, 2014. "Tick size reduction and price clustering in a FX order book," Physica A: Statistical Mechanics and its Applications, Elsevier, vol. 416(C), pages 488-498.
    18. Nathan Lassance & Victor DeMiguel & Frédéric Vrins, 2022. "Optimal Portfolio Diversification via Independent Component Analysis," Operations Research, INFORMS, vol. 70(1), pages 55-72, January.
    19. Muchnik, Lev & Bunde, Armin & Havlin, Shlomo, 2009. "Long term memory in extreme returns of financial time series," Physica A: Statistical Mechanics and its Applications, Elsevier, vol. 388(19), pages 4145-4150.
    20. BenSaïda, Ahmed & Slim, Skander, 2016. "Highly flexible distributions to fit multiple frequency financial returns," Physica A: Statistical Mechanics and its Applications, Elsevier, vol. 442(C), pages 203-213.

    More about this item

    Statistics

    Access and download statistics

    Corrections

    All material on this site has been provided by the respective publishers and authors. You can help correct errors and omissions. When requesting a correction, please mention this item's handle: RePEc:arx:papers:2603.06875. See general information about how to correct material in RePEc.

    If you have authored this item and are not yet registered with RePEc, we encourage you to do it here. This allows to link your profile to this item. It also allows you to accept potential citations to this item that we are uncertain about.

    If CitEc recognized a bibliographic reference but did not link an item in RePEc to it, you can help with this form .

    If you know of missing items citing this one, you can help us creating those links by adding the relevant references in the same way as above, for each refering item. If you are a registered author of this item, you may also want to check the "citations" tab in your RePEc Author Service profile, as there may be some citations waiting for confirmation.

    For technical questions regarding this item, or to correct its authors, title, abstract, bibliographic or download information, contact: arXiv administrators (email available below). General contact details of provider: http://arxiv.org/ .

    Please note that corrections may take a couple of weeks to filter through the various RePEc services.

    IDEAS is a RePEc service. RePEc uses bibliographic data supplied by the respective publishers.