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.

Learning interpretable representations of entanglement in quantum optics experiments using deep generative models

A preprint version of the article is available at arXiv.


Quantum physics experiments produce interesting phenomena such as interference or entanglement, which are the core properties of numerous future quantum technologies. The complex relationship between the setup structure of a quantum experiment and its entanglement properties is essential to fundamental research in quantum optics but is difficult to intuitively understand. We present a deep generative model of quantum optics experiments where a variational autoencoder is trained on a dataset of quantum optics experiment setups. In a series of computational experiments, we investigate the learned representation of our quantum optics variational autoencoder (QOVAE) and its internal understanding of the quantum optics world. We demonstrate that QOVAE learns an interpretable representation of quantum optics experiments and the relationship between the experiment structure and entanglement. We show QOVAE is able to generate novel experiments for highly entangled quantum states with specific distributions that match its training data. QOVAE can learn to generate specific entangled states and efficiently search the space of experiments that produce highly entangled quantum states. Importantly, we are able to interpret how QOVAE structures its latent space, finding curious patterns that we can explain in terms of quantum physics. The results demonstrate how we can use and understand the internal representations of deep generative models in a complex scientific domain. QOVAE and the insights from our investigations can be immediately applied to other physical systems.

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

Relevant articles

Open Access articles citing this article.

Access options

Rent or buy this article

Prices vary by article type



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

Fig. 1: Data representation and model.
Fig. 2: Comparison with training data.
Fig. 3: Interpolations.
Fig. 4: QOVAE latent spaces.
Fig. 5: More QOVAE latent spaces.

Data availability

The training data are available via GitHub at (ref. 79).

Code availability

The code is available via GitHub at (ref. 79). The source code for the Melvin algorithm is available via GitHub at


  1. Schrödinger, E. Discussion of probability relations between separated systems. Math. Proc. Camb. Philos. Soc. 31, 555–563 (1935).

    Article  MATH  Google Scholar 

  2. Einstein, A., Podolsky, B. & Rosen, N. Can quantum-mechanical description of physical reality be considered complete? Phys. Rev. 47, 777 (1935).

    Article  MATH  Google Scholar 

  3. Bell, J. S. On the Einstein Podolsky Rosen paradox. Phys. Phys. Fiz. 1, 195–200 (1964).

    MathSciNet  Google Scholar 

  4. Giustina, M. et al. Significant-loophole-free test of Bell’s theorem with entangled photons. Phys. Rev. Lett. 115, 250401 (2015).

    Article  Google Scholar 

  5. Sham, L. K. et al. Strong loophole-free test of local realism. Phys. Rev. Lett. 115, 250402 (2015).

    Article  Google Scholar 

  6. Bong, K.-W. et al. A strong no-go theorem on the Wigner’s friend paradox. Nat. Phys. 16, 1199–1205 (2020).

    Google Scholar 

  7. Yin, J. et al. Satellite-to-ground entanglement-based quantum key distribution. Phys. Rev. Lett. 119, 200501 (2017).

    Article  Google Scholar 

  8. Peruzzo, A. et al. A variational eigenvalue solver on a photonic quantum processor. Nat. Commun. 5, 4213 (2014).

    Article  Google Scholar 

  9. Paesani, S. et al. Generation and sampling of quantum states of light in a silicon chip. Nat. Phys. 15, 925–929 (2019).

    Article  Google Scholar 

  10. Zhong, H.-S. et al. Quantum computational advantage using photons. Science 370, 1460–1463 (2020).

    Google Scholar 

  11. Wang, L., Zou, X. & Mandel, L. Induced coherence without induced emission. Phys. Rev. A 44, 4614 (1991).

    Article  Google Scholar 

  12. Herzog, T., Rarity, J., Weinfurter, H. & Zeilinger, A. Frustrated two-photon creation via interference. Phys. Rev. Lett. 72, 629 (1994).

    Article  Google Scholar 

  13. Menssen, A. J. et al. Distinguishability and many-particle interference. Phys. Rev. Lett. 118, 153603 (2017).

    Article  Google Scholar 

  14. Feng, L.-T. et al. Observation of nonlocal quantum interference between the origins of a four-photon state in a silicon chip. Preprint at (2021).

  15. Krenn, M., Erhard, M. & Zeilinger, A. Computer-inspired quantum experiments. Nat. Rev. Phys. 2, 649 (2020).

    Article  Google Scholar 

  16. Krenn, M., Malik, M., Fickler, R., Lapkiewicz, R. & Zeilinger, A. Automated search for new quantum experiments. Phys. Rev. Lett. 116, 090405 (2016).

  17. Krenn, M., Kottmann, J., Tischler, N. & Aspuru-Guzik, A. Conceptual understanding through efficient automated design of quantum optical experiments. Phys. Rev. X 11, 031044 (2021).

    Google Scholar 

  18. Knott, P. A search algorithm for quantum state engineering and metrology. New J. Phys. 18, 073033 (2016).

    Article  MATH  Google Scholar 

  19. Nichols, R., Mineh, L., Rubio, J., Matthews, J. C. F. & Knott, P. A. Designing quantum experiments with a genetic algorithm. Quantum Sci. Technol. 4, 045012 (2019).

    Article  Google Scholar 

  20. O’Driscoll, L., Nichols, R. & P. A., K. A hybrid machine learning algorithm for designing quantum experiments. Quantum Mach. Intell. 1, 5–15 (2019).

    Article  Google Scholar 

  21. Melnikov, A. A. et al. Active learning machine learns to create new quantum experiments. Proc. Natl Acad. Sci. USA 115, 1221–1226 (2018).

    Article  Google Scholar 

  22. Arrazola, J. M. et al. Machine learning method for state preparation and gate synthesis on photonic quantum computers. Quantum Sci. Technol. 4, 024004 (2019).

    Article  Google Scholar 

  23. Salakhutdinov, R. Learning deep generative models. Annu. Rev. Stat. Appl. 2, 361–385 (2015).

    Article  Google Scholar 

  24. Razavi, A., Oord, A. v. d. & Vinyals, O. Generating diverse high-fidelity images with VQ-VAE-2. In Advances in Neural Information Processing Systems (eds Wallach, H. et al.) 14866–14876 (Curran Associates, 2019).

  25. Bowman, S. R. et al. Generating sentences from a continuous space. In Proc. 20th SIGNLL Conference on Computational Natural Language Learning 10–21 (Association for Computational Linguistics, 2015).

  26. Semeniuta, S., Severyn, A. & Barth, E. A hybrid convolutional variational autoencoder for text generation. In Proc. 2017 Conference on Empirical Methods in Natural Language Processing 627–637 (Association for Computational Linguistics, 2017).

  27. Roberts, A., Engel, J., Raffel, C., Hawthorne, C. & Eck, D. A hierarchical latent vector model for learning long-term structure in music. In International Conference on Machine Learning 4364–4373 (PMLR, 2018).

  28. Sanchez-Lengeling, B. & Aspuru-Guzik, A. Inverse molecular design using machine learning: generative models for matter engineering. Science 361, 360–365 (2018).

    Article  Google Scholar 

  29. Kingma, D. P. & Welling, M. Auto-encoding variational Bayes. In International Conference on Learning Representations 1312–1326 (CoRR, 2014).

  30. Gómez-Bombarelli, R. et al. Automatic chemical design using a data-driven continuous representation of molecules. ACS Cent. Sci. 4, 268–276 (2018).

    Article  Google Scholar 

  31. Samanta, B. et al. Nevae: a deep generative model for molecular graphs. J. Mach. Learn. Res. 21, 1–33 (2020).

  32. Jin, W., Barzilay, R. & Jaakkola, T. Junction tree variational autoencoder for molecular graph generation. In International Conference on Machine Learning 2323–2332 (PMLR, 2018).

  33. Flam-Shepherd, D., Wu, T. C. & Aspuru-Guzik, A. MPGVAE: improved generation of small organic molecules using message passing neural nets. Mach. Learn. Sci. Technol. 2, 045010 (2021).

  34. Jin, W., Barzilay, R. & Jaakkola, T. Hierarchical generation of molecular graphs using structural motifs. In Proc. 37th International Conference on Machine Learning 4839–4848 (PMLR, 2020).

  35. Yao, Z. et al. Inverse design of nanoporous crystalline reticular materials with deep generative models. Nat. Mach. Intell. 3, 76–86 (2021).

    Article  Google Scholar 

  36. Liu, Q., Allamanis, M., Brockschmidt, M. & Gaunt, A. Constrained graph variational autoencoders for molecule design. in Advances in Neural Information Processing Systems 31, 7795–7804 (Curran Associates, 2018).

  37. Bengio, Y., Courville, A. & Vincent, P. Representation learning: a review and new perspectives. IEEE Trans. Pattern Anal. Mach. Intell. 35, 1798–1828 (2013).

    Article  Google Scholar 

  38. Higgins, I. et al. beta-VAE: learning basic visual concepts with a constrained variational framework. In ICLR 2017 1–22 (ICLR, 2016).

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

  40. Bouwmeester, D., J.-W., P., Daniell, M., Weinfurter, H. & Zeilinger, A. Observation of three-photon Greenberger-Horne-Zeilinger entanglement. Phys. Rev. Lett. 82, 1345–1349 (1999).

    Article  MathSciNet  MATH  Google Scholar 

  41. Yao, X.-C. et al. Observation of eight-photon entanglement. Nat. Photon. 6, 225–228 (2012).

    Google Scholar 

  42. Allen, L., Beijersbergen, M. W., Spreeuw, R. J. C. & Woerdman, J. P. Orbital angular momentum of light and the transformation of Laguerre-Gaussian laser modes. Phys. Rev. A 45, 8185–8189 (1992).

    Article  Google Scholar 

  43. Romero, J., Giovannini, D., Franke-Arnold, S., Barnett, S. M. & Padgett, M. J. Increasing the dimension in high-dimensional two-photon orbital angular momentum entanglement. Phys. Rev. A 86, 012334 (2012).

  44. Krenn, M. et al. Generation and confirmation of a (100 x 100)-dimensional entangled quantum system. Proc. Natl Acad. Sci. USA 111, 6243–6247 (2014).

    Article  Google Scholar 

  45. Erhard, M., Malik, M., Krenn, M. & Zeilinger, A. Experimental Greenberger–Horne–Zeilinger entanglement beyond qubits. Nat. Photon. 12, 759–764 (2018).

    Article  Google Scholar 

  46. Y.-H., L. et al. Quantum teleportation in high dimensions. Phys. Rev. Lett. 123, 070505 (2019).

    Article  Google Scholar 

  47. Leach, J., Padgett, M. J., Barnett, S. M., Franke-Arnold, S. & Courtial, J. Measuring the orbital angular momentum of a single photon. Phys. Rev. Lett. 88, 257901 (2002).

  48. Huber, M. & De Vicente, J. I Structure of multidimensional entanglement in multipartite systems. Phys. Rev. Lett. 110, 030501 (2013).

  49. Meurer, A. et al. SymPy: symbolic computing in Python. PeerJ Comput. Sci. 3, e103 (2017).

    Article  Google Scholar 

  50. Hamma, A., Santra, S. & Zanardi, P. Quantum entanglement in random physical states. Phys. Rev. Lett. 109, 040502 (2012).

    Article  Google Scholar 

  51. Adler, T. et al. Quantum optical experiments modeled by long short-term memory. Photonics 8, 535 (2021).

    Article  Google Scholar 

  52. Li, Y., Vinyals, O., Dyer, C., Pascanu, R. & Battaglia, P. Learning deep generative models of graphs. In Proc. 35th International Conference on Machine Learning 1–22 (PMLR, 2018).

  53. Scott, D. W. Multivariate Density Estimation: Theory, Practice, and Visualization (John Wiley & Sons, 2015).

  54. Shoemake, K. Animating rotation with quaternion curves. In Proc. 12th Annual Conference on Computer Graphics and Interactive Techniques 245–254 (ACM, 1985).

  55. Kusner, M. J., Paige, B. & Hernández-Lobato, J. M. Grammar variational autoencoder. In Proc. 34th International Conference on Machine Learning 1945–1954 (PMLR, 2017).

  56. Rudin, C. Stop explaining black box machine learning models for high stakes decisions and use interpretable models instead. Nat. Mach. Intell. 1, 206–215 (2019).

    Article  Google Scholar 

  57. Gilpin, L. H. et al. Explaining explanations: an overview of interpretability of machine learning. In 2018 IEEE 5th International Conference on Data Science and Advanced Analytics (DSAA) 80–89 (IEEE, 2018).

  58. Erhard, M., Krenn, M. & Zeilinger, A. Advances in high-dimensional quantum entanglement. Nat. Rev. Phys. 2, 365–381 (2020).

    Google Scholar 

  59. Pan, J.-W. et al. Multiphoton entanglement and interferometry. Rev. Mod. Phys. 84, 777 (2012).

    Article  Google Scholar 

  60. Krenn, M., Hochrainer, A., Lahiri, M. & Zeilinger, A. Entanglement by path identity. Phys. Rev. Lett. 118, 080401 (2017).

    Article  MathSciNet  Google Scholar 

  61. Malik, M. et al. Multi-photon entanglement in high dimensions. Nat. Photon. 10, 248–252 (2016).

    Article  Google Scholar 

  62. Wang, L., Hong, C. & Friberg, S. Generation of correlated photons via four-wave mixing in optical fibres. J. Opt. B 3, 346 (2001).

    Article  Google Scholar 

  63. Giordmaine, J. A. & Miller, R. C. Tunable coherent parametric oscillation in LiNbO3 at optical frequencies. Phys. Rev. Lett. 14, 973 (1965).

    Article  Google Scholar 

  64. Kingma, D. P., Mohamed, S., Rezende, D. J. & Welling, M. Semi-supervised learning with deep generative models. In Advances in Neural Information Processing Systems 27 (NIPS 2014) 27, 3581–3589 (Curran Associates, 2014).

  65. Sønderby, C. K., Raiko, T., Maaløe, L., Sønderby, S. K. & Winther, O. Ladder variational autoencoders. In Advances in Neural Information Processing Systems 1–9 (NIPS, 2016).

  66. Zhao, S., Song, J. & Ermon, S. Learning hierarchical features from generative models. In Proc. 34th International Conference on Machine Learning 4091–4099 (PMLR, 2017).

  67. Dür, W., Vidal, G. & Cirac, J. I. Three qubits can be entangled in two inequivalent ways. Phys. Rev. A 62, 062314 (2000).

    Article  MathSciNet  Google Scholar 

  68. Cervera-Lierta, A., Latorre, J. I. & Goyeneche, D. Quantum circuits for maximally entangled states. Phys. Rev. A 100, 022342 (2019).

    Article  MathSciNet  Google Scholar 

  69. Helwig, W. and Cui, W. Absolutely maximally entangled states: existence and applications. Preprint at (2013).

  70. Weininger.D. SMILES, a chemical language and information system. 1. Introduction to methodology and encoding rules. J. Chem. Inf. Comput. Sci. 28, 31–36 (1988).

  71. Preskill, J. Quantum computing in the NISQ era and beyond. Quantum 2, 79 (2018).

    Article  Google Scholar 

  72. Cerezo, M. et al. Variational quantum algorithms. Nat. Rev. Phys. 3, 625–644 (2021).

  73. Bharti, K. et al. Noisy intermediate-scale quantum (NISQ) algorithms. Rev. Mod. Phys. 94, 15004–15073 (2022).

    Article  MathSciNet  Google Scholar 

  74. Giraldi, G. A. Portugal, R. & Thess, R. N. Genetic algorithms and quantum computation. Preprint at (2004).

  75. Yabuki, T. & Iba, H. Genetic algorithms for quantum circuit design—evolving a simpler teleportation circuit. In Late Breaking Papers at the 2000 Genetic and Evolutionary Computation Conference 421–425 (Citeseer, 2000).

  76. Anand, A., Degroote, M. & Aspuru-Guzik, A. Natural evolutionary strategies for variational quantum computation. Mach. Learn.: Sci. Technol. 2, 045012 (2021).

  77. Hoffman, M. D., Blei, D. M., Wang, C. & Paisley, J. Stochastic variational inference. J. Mach. Learn. Res. 14, 1303–1347 (2013).

  78. Abadi, M. et al. TensorFlow: a system for large-scale machine learning. In 12th Symposium on Operating Systems Design and Implementation (OSDI 16) 265–283 (USENIX, 2016).

  79. Flam-Shepherd, D. Python code and data for training and sampling from models. Zenodo (2021).

  80. Nogueira, F. Bayesian optimization: open source constrained global optimization tool for Python. GitHub (2014).

Download references


A.A.-G. acknowledges support from the Canada 150 Research Chairs Program, the Canada Industrial Research Chair Program and from Google in the form of a Google Focused Award. M.K. acknowledges support from the FWF (Austrian Science Fund) via Erwin Schrödinger Fellowship no. J4309.

Author information

Authors and Affiliations



D.F.-S. conceived the overall project, developed the approach and wrote the paper. D.F.-S. and T.W. designed and performed the investigations. A.C.-L. provided the technical advice. X.G. provided the technical advice and wrote the entanglement calculation code. M.K. built the dataset, provided technical advice and helped design the interpretability investigation and analysed the experiments. A.A.-G. led the project and provided the overall directions. All the authors participated in preparing the manuscript.

Corresponding authors

Correspondence to Daniel Flam-Shepherd, Mario Krenn or Alán Aspuru-Guzik.

Ethics declarations

Competing interests

The authors declare no competing interests.

Peer review

Peer review information

Nature Machine Intelligence thanks Michael Hartmann, Sohaib Alam and Patrick Huembeli for their contribution to the peer review of this work.

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 Discussion, Table 1 and Figs. 1–8.

Rights and permissions

Reprints and Permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Flam-Shepherd, D., Wu, T.C., Gu, X. et al. Learning interpretable representations of entanglement in quantum optics experiments using deep generative models. Nat Mach Intell 4, 544–554 (2022).

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI:

This article is cited by


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