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.

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.

Access options

Rent or Buy article

Get time limited or full article access on ReadCube.


All prices are NET prices.

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).

Code availability

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


  1. 1.

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

  2. 2.

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

    ADS  MathSciNet  Article  Google Scholar 

  3. 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).

    ADS  Article  Google Scholar 

  4. 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. 5.

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

    ADS  Article  Google Scholar 

  6. 6.

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

    ADS  MathSciNet  Article  Google Scholar 

  7. 7.

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

    ADS  Article  Google Scholar 

  8. 8.

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

    ADS  Article  Google Scholar 

  9. 9.

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

    ADS  Article  Google Scholar 

  10. 10.

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

    ADS  Article  Google Scholar 

  11. 11.

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

    ADS  Article  Google Scholar 

  12. 12.

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

    Article  Google Scholar 

  13. 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. 14.

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

    ADS  Article  Google Scholar 

  15. 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).

    ADS  Article  Google Scholar 

  16. 16.

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

    ADS  Article  Google Scholar 

  17. 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. 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).

    ADS  Article  Google Scholar 

  19. 19.

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

    ADS  Article  Google Scholar 

  20. 20.

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

    ADS  Article  Google Scholar 

  21. 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).

    ADS  Article  Google Scholar 

  22. 22.

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

    ADS  Article  Google Scholar 

  23. 23.

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

    Article  Google Scholar 

  24. 24.

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

    ADS  Article  Google Scholar 

  25. 25.

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

    ADS  Article  Google Scholar 

  26. 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).

    ADS  Article  Google Scholar 

  27. 27.

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

    ADS  Article  Google Scholar 

  28. 28.

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

    Google Scholar 

  29. 29.

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

    Article  Google Scholar 

  30. 30.

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

    ADS  Article  Google Scholar 

  31. 31.

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

    ADS  Article  Google Scholar 

  32. 32.

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

    ADS  Article  Google Scholar 

  33. 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).

    ADS  Article  Google Scholar 

  34. 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).

    ADS  Article  Google Scholar 

  35. 35.

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

    ADS  Article  Google Scholar 

  36. 36.

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

  37. 37.

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

    Article  Google Scholar 

  38. 38.

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

  39. 39.

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

    ADS  Article  Google Scholar 

  40. 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. 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).

    ADS  MathSciNet  Article  Google Scholar 

  42. 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. 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. 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. 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. 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




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

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


Quick links

Nature Briefing

Sign up for the Nature Briefing newsletter — what matters in science, free to your inbox daily.

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