Skip to main content

Thank you for visiting You are using a browser version with limited support for CSS. To obtain the best experience, we recommend you use a more up to date browser (or turn off compatibility mode in Internet Explorer). In the meantime, to ensure continued support, we are displaying the site without styles and JavaScript.

  • Article
  • Published:

Machine learning the thermodynamic arrow of time


The asymmetry in the flow of events that is expressed by the phrase ‘time’s arrow’ traces back to the second law of thermodynamics. In the microscopic regime, fluctuations prevent us from discerning the direction of time’s arrow with certainty. Here, we find that a machine learning algorithm that is trained to infer the direction of time’s arrow identifies entropy production as the relevant physical quantity in its decision-making process. Effectively, the algorithm rediscovers the fluctuation theorem as the underlying thermodynamic principle. Our results indicate that machine learning techniques can be used to study systems that are out of equilibrium, and ultimately to answer open questions and uncover physical principles in thermodynamics.

This is a preview of subscription content, access via your institution

Access options

Buy this article

Prices may be subject to local taxes which are calculated during checkout

Fig. 1: Non-equilibrium physics, time’s arrow and machine learning.
Fig. 2: Brownian particle in a moving potential.
Fig. 3: Spin chain in a time-dependent magnetic field.
Fig. 4: Spin chain with a time-dependent coupling.
Fig. 5: Interpreting the neural network’s inner mechanism.
Fig. 6: Mixture of experts (MoE).

Similar content being viewed by others

Code availability

All relevant codes or algorithms are available from the corresponding author upon reasonable request.


  1. Eddington, A. S. The Nature of the Physical World (Macmillan, 1928).

  2. Feng, E. H. & Crooks, G. E. Length of time’s arrow. Phys. Rev. Lett. 101, 090602 (2008).

    Article  ADS  MathSciNet  Google Scholar 

  3. Jarzynski, C. Equalities and inequalities: irreversibility and the second law of thermodynamics at the nanoscale. Annu. Rev. Condens. Matter Phys. 2, 329–351 (2011).

    Article  ADS  Google Scholar 

  4. Roldán, É., Neri, I., Dörpinghaus, M., Meyr, H. & Jülicher, F. Decision making in the arrow of time. Phys. Rev. Lett. 115, 250602 (2015).

  5. Hofmann, A. et al. Heat dissipation and fluctuations in a driven quantum dot. Phys. Status Solidi B 254, 1600546 (2017).

    Article  ADS  Google Scholar 

  6. Crooks, G. E. Nonequilibrium measurements of free energy differences for microscopically reversible Markovian systems. J. Stat. Phys. 90, 1481–1487 (1998).

    Article  ADS  MathSciNet  Google Scholar 

  7. Crooks, G. E. Entropy production fluctuation theorem and the nonequilibrium work relation for free energy differences. Phys. Rev. E 60, 2721–2726 (1999).

    Article  ADS  Google Scholar 

  8. Seifert, U. Stochastic thermodynamics, fluctuation theorems and molecular machines. Rep. Prog. Phys. 75, 126001 (2012).

    Article  ADS  Google Scholar 

  9. Carleo, G. et al. Machine learning and the physical sciences. Rev. Mod. Phys. 91, 045002 (2019).

    Article  ADS  Google Scholar 

  10. Senior, A. W. et al. Improved protein structure prediction using potentials from deep learning. Nature 577, 706–710 (2020).

    Article  ADS  Google Scholar 

  11. Torlai, G. & Melko, R. G. Learning thermodynamics with Boltzmann machines. Phys. Rev. B 94, 165134 (2016).

    Article  ADS  Google Scholar 

  12. Carrasquilla, J. & Melko, R. G. Machine learning phases of matter. Nat. Phys. 13, 431–434 (2017).

    Article  Google Scholar 

  13. van Nieuwenburg, E. P. L., Liu, Y.-H. & Huber, S. D. Learning phase transitions by confusion. Nat. Phys. 13, 435–439 (2017).

    Article  Google Scholar 

  14. Deng, D.-L., Li, X. & Das Sarma, S. Machine learning topological states. Phys. Rev. B 96, 195145 (2017).

    Article  ADS  Google Scholar 

  15. Wetzel, S. J. & Scherzer, M. Machine learning of explicit order parameters: from the Ising model to SU(2) lattice gauge theory. Phys. Rev. B 96, 184410 (2017).

    Article  ADS  Google Scholar 

  16. Wetzel, S. J. Unsupervised learning of phase transitions: from principal component analysis to variational autoencoders. Phys. Rev. E 96, 022140 (2017).

    Article  ADS  Google Scholar 

  17. Ch’ng, K., Carrasquilla, J., Melko, R. G. & Khatami, E. Machine learning phases of strongly correlated fermions. Phys. Rev. X 7, 031038 (2017).

    Google Scholar 

  18. Ch’ng, K., Vazquez, N. & Khatami, E. Unsupervised machine learning account of magnetic transitions in the Hubbard model. Phys. Rev. E 97, 013306 (2018).

    Article  ADS  Google Scholar 

  19. Liu, Y.-H. & van Nieuwenburg, E. P. L. Discriminative cooperative networks for detecting phase transitions. Phys. Rev. Lett. 120, 176401 (2018).

    Article  ADS  Google Scholar 

  20. Schindler, F., Regnault, N. & Neupert, T. Probing many-body localization with neural networks. Phys. Rev. B 95, 245134 (2017).

    Article  ADS  Google Scholar 

  21. Arsenault, L.-F., Lopez-Bezanilla, A., von Lilienfeld, O. A. & Millis, A. J. Machine learning for many-body physics: the case of the Anderson impurity model. Phys. Rev. B 90, 155136 (2014).

    Article  ADS  Google Scholar 

  22. Beach, M. J. S., Golubeva, A. & Melko, R. G. Machine learning vortices at the Kosterlitz–Thouless transition. Phys. Rev. B 97, 045207 (2018).

    Article  ADS  Google Scholar 

  23. van Nieuwenburg, E., Bairey, E. & Refael, G. Learning phase transitions from dynamics. Phys. Rev. B 98, 060301 (2018).

    Article  Google Scholar 

  24. Ponte, P. & Melko, R. G. Kernel methods for interpretable machine learning of order parameters. Phys. Rev. B 96, 205146 (2017).

    Article  ADS  Google Scholar 

  25. Schmidt, M. & Lipson, H. Distilling free-form natural laws from experimental data. Science 324, 81–85 (2009).

    Article  ADS  Google Scholar 

  26. Rudy, S. H., Brunton, S. L., Proctor, J. L. & Kutz, J. N. Data-driven discovery of partial differential equations. Sci. Adv. 3, e1602614 (2017).

    Article  ADS  Google Scholar 

  27. Iten, R., Metger, T., Wilming, H., del Rio, L. & Renner, R. Discovering physical concepts with neural networks. Phys. Rev. Lett. 124, 010508 (2020).

    Article  ADS  Google Scholar 

  28. Berkson, J. Application of the logistic function to bio-assay. J. Am. Stat. Assoc. 39, 357–365 (1944).

    Google Scholar 

  29. Day, N. E. & Kerridge, D. F. A general maximum likelihood discriminant. Biometrics 23, 313–323 (1967).

    Article  Google Scholar 

  30. Jarzynski, C. Nonequilibrium equality for free energy differences. Phys. Rev. Lett. 78, 2690–2693 (1997).

    Article  ADS  Google Scholar 

  31. Jarzynski, C. Equilibrium free-energy differences from nonequilibrium measurements: a master-equation approach. Phys. Rev. E 56, 5018–5035 (1997).

    Article  ADS  Google Scholar 

  32. Hummer, G. & Szabo, A. Free energy reconstruction from nonequilibrium single-molecule pulling experiments. Proc. Natl Acad. Sci. USA 98, 3658–3661 (2001).

    Article  ADS  Google Scholar 

  33. Shirts, M. R., Bair, E., Hooker, G. & Pande, V. S. Equilibrium free energies from nonequilibrium measurements using maximum-likelihood methods. Phys. Rev. Lett. 91, 140601 (2003).

    Article  ADS  Google Scholar 

  34. Maragakis, P., Ritort, F., Bustamante, C., Karplus, M. & Crooks, G. E. Bayesian estimates of free energies from nonequilibrium work data in the presence of instrument noise. J. Chem. Phys. 129, 024102 (2008).

    Article  ADS  Google Scholar 

  35. Jarzynski, C. Rare events and the convergence of exponentially averaged work values. Phys. Rev. E 73, 046105 (2006).

    Article  ADS  Google Scholar 

  36. Goodfellow, I., Bengio, Y. & Courville, A. Deep Learning (MIT Press, 2016).

  37. Caruana, R. Multitask learning. Mach. Learn. 28, 41–75 (1997).

    Article  Google Scholar 

  38. Mordvintsev, A., Olah, C. & Tyka, M. Inceptionism: going deeper into neural networks. Google AI Blog (2015).

  39. Schindler, F., Regnault, N. & Neupert, T. Probing many-body localization with neural networks. Phys. Rev. B 95, 245134 (2017).

    Article  ADS  Google Scholar 

  40. Nowlan, S. J. & Hinton, G. E. in Advances in Neural Information Processing Systems 1st edn, Vol. 3 (eds Lippmann, R. P. et al.) 774–780 (Morgan Kaufmann, 1991).

  41. Wächtler, C. W., Strasberg, P., Klapp, S. H. L., Schaller, G. & Jarzynski, C. Stochastic thermodynamics of self-oscillations: the electron shuttle. New J. Phys. 21, 073009 (2019).

    Article  ADS  MathSciNet  Google Scholar 

  42. Young, J. T., Gorshkov, A. V., Foss-Feig, M. & Maghrebi, M. F. Nonequilibrium fixed points of coupled Ising models. Phys. Rev. X 10, 011039 (2020).

    Google Scholar 

  43. Pickup, L. C. et al. Seeing the arrow of time. In Proc. IEEE Conference on Computer Vision and Pattern Recognition, 2035–2042 (IEEE Computer Society, 2014).

  44. Wei, D., Lim, J. J., Zisserman, A. & Freeman, W. T. Learning and using the arrow of time. In Proc. IEEE Conference on Computer Vision and Pattern Recognition, 8052–8060 (IEEE Computer Society, 2018).

  45. Kingma, D. P. & Ba, J. Adam: a method for stochastic optimization. In Proc. 3rd International Conference for Learning Representations (2015). Preprint of v.9 at (2017).

  46. Srivastava, N., Hinton, G., Krizhevsky, A., Sutskever, I. & Salakhutdinov, R. Dropout: a simple way to prevent neural networks from overfitting. J. Mach. Learn. Res. 15, 1929–1958 (2014).

Download references


A.S. thanks E. van Nieuwenburg, G. Rostkoff and A. Izadi Rad for helpful discussions. We gratefully acknowledge support from the Multidisciplinary University Research Initiative of the Army Research Office (grant no. ARO W911NF-15-1-0397) and the Physics Frontiers Centers of the National Science Foundation at the Joint Quantum Institute (A.S. and M.H.), and from the National Science Foundation under grant no. DMR-1506969 (C.J.).

Author information

Authors and Affiliations



All authors contributed to the design of the research, the analysis of the data, and the writing of the manuscript. A.S. performed the numerical simulations and implemented the machine learning algorithms.

Corresponding author

Correspondence to Alireza Seif.

Ethics declarations

Competing interests

The authors declare no competing interests.

Additional information

Publisher’s note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Supplementary information

Supplementary Information

Supplementary Figs. 1–5, Table 1 and Discussions 1–4.

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Seif, A., Hafezi, M. & Jarzynski, C. Machine learning the thermodynamic arrow of time. Nat. Phys. 17, 105–113 (2021).

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI:

This article is cited by


Quick links

Nature Briefing AI and Robotics

Sign up for the Nature Briefing: AI and Robotics newsletter — what matters in AI and robotics research, free to your inbox weekly.

Get the most important science stories of the day, free in your inbox. Sign up for Nature Briefing: AI and Robotics