Skip to main content

A Variational Algorithm for Quantum Single Layer Perceptron

  • Conference paper
  • First Online:
Machine Learning, Optimization, and Data Science (LOD 2022)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 13811))


Hybrid quantum-classical computation represents one of the most promising approaches to deliver novel machine learning models capable of overcoming the limitations imposed by the classical computing paradigm. In this work, we propose a novel variational algorithm for quantum Single Layer Perceptron (qSLP) which allows producing a quantum state equivalent to the output of a classical single-layer neural network. In particular, the proposed qSLP generates an exponentially large number of parametrized linear combinations in superposition that can be learnt using quantum-classical optimization. As a consequence, the number of hidden neurons scales exponentially with the number of qubits and, thanks to the universal approximation theorem, our algorithm opens to the possibility of approximating any function on quantum computers. Thus, the proposed approach produces a model with substantial descriptive power and widens the horizon of potential applications using near-term quantum computation, especially those related to quantum machine learning. Finally, we test the qSLP as a classification model against two different quantum models on two different real-world datasets usually adopted for benchmarking classical algorithms.

A. Macaluso and F. Orazi—Both authors equally contributed to this research.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
USD 79.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 99.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions


  1. 1.

    All code to generate the data, figures and analyses is available at

  2. 2.

    Importantly, the code already allows the embedding of a gate \(\varSigma \) different from the identity gate, as quantum activation function.

  3. 3.

    The QSVM uses a quantum circuit to translate the classical data into quantum states while the classification is performed classically.


  1. Friedman, J., Hastie, T., Tibshirani, R.: The Elements of Statistical Learning, vol. 1. Springer, New York (2001).

  2. Hornik, K., Stinchcombe, M., White, H., et al.: Multilayer feedforward networks are universal approximators. Neural Netw. 2(5), 359–366 (1989)

    Article  MATH  Google Scholar 

  3. Macaluso, A., Clissa, L., Lodi, S., Sartori, C.: Quantum splines for non-linear approximations. In: Proceedings of the 17th ACM International Conference on Computing Frontiers, pp. 249–252 (2020)

    Google Scholar 

  4. Harrow, A.W., Hassidim, A., Lloyd, S.: Quantum algorithm for linear systems of equations. Phys. Rev. Lett. 103(15), 150502 (2009)

    Google Scholar 

  5. Aaronson, S.: Read the fine print. Nat. Phys. 11(4), 291 (2015)

    Article  Google Scholar 

  6. Rumelhart, D.E., Hinton, G.E., Williams, R.J.: Learning representations by back-propagating errors. Nature 323(6088), 533–536 (1986)

    Google Scholar 

  7. Abbas, A., Sutter, D., Zoufal, C., Lucchi, A., Figalli, A., Woerner, S.: The power of quantum neural networks. Nat. Comput. Sci. 1(6), 403–409 (2021)

    Article  Google Scholar 

  8. Tacchino, F., Macchiavello, C., Gerace, D., Bajoni, D.: An artificial neuron implemented on an actual quantum processor, zak1998quantum. NPJ Quantum Inf. 5(1), 26 (2019)

    Google Scholar 

  9. Grant, E., et al.: Hierarchical quantum classifiers. NPJ Quantum Inf. 4(1), 1–8 (2018)

    Google Scholar 

  10. Huggins, W., Patil, P., Mitchell, B., Whaley, K.B., Stoudenmire, E.M.: Towards quantum machine learning with tensor networks. Quantum Sci. Technol. 4(2), 024001 (2019)

    Google Scholar 

  11. Liu, D., et al.: Machine learning by unitary tensor network of hierarchical tree structure. New J. Phys. 21(7), 073059 (2019)

    Google Scholar 

  12. Macaluso, A., Clissa, L., Lodi, S., Sartori, C.: A variational algorithm for quantum neural networks. In: Krzhizhanovskaya, V.V., et al. (eds.) ICCS 2020. LNCS, vol. 12142, pp. 591–604. Springer, Cham (2020).

    Chapter  Google Scholar 

  13. Benedetti, M., Lloyd, E., Sack, S., Fiorentini, M.: Parameterized quantum circuits as machine learning models. Quantum Sci. Technol. 4(4), 043001 (2019)

    Google Scholar 

  14. Havlicek, V., et al.: Supervised learning with quantum enhanced feature spaces. Nature (2018)

    Google Scholar 

  15. Smolin, J.A., DiVincenzo, D.P.: Five two-bit quantum gates are sufficient to implement the quantum Fredkin gate. Phys. Rev. A 53(4), 2855 (1996)

    Google Scholar 

  16. Schuld, M., Bocharov, A., Svore, K.M., Wiebe, N.: Circuit-centric quantum classifiers. arXiv preprint arXiv:1804.00633 (2018)

  17. Goodfellow, I., Bengio, Y., Courville, A.: Deep Learning, vol. 1. MIT Press, Cambridge (2016)

    Google Scholar 

  18. Judd, J.S.: Neural Network Design and the Complexity of Learning. MIT Press, Cambridge (1990)

    Google Scholar 

  19. Havlíček, V., et al.: Supervised learning with quantum-enhanced feature spaces. Nature 567(7747), 209–212 (2019)

    Google Scholar 

  20. Shende, V.V., Prasad, A.K., Markov, I.L., Hayes, J.P.: Synthesis of quantum logic circuits. IEEE Trans. Comput. Aided Des. Integr. Circuits Syst. (2006)

    Google Scholar 

  21. Mottonen, M., Vartiainen, J.J., Bergholm, V., Salomaa, M.M.: Transformation of quantum states using uniformly controlled rotations. arXiv preprint quant-ph/0407010 (2004)

    Google Scholar 

  22. Goto, T., Tran, Q.H., Nakajima, K.: Universal approximation property of quantum feature map. arXiv preprint arXiv:2009.00298 (2020)

Download references


This work has been partially funded by the German Ministry for Education and Research (BMB+F) in the project QAI2-QAICO under grant 13N15586.

Author information

Authors and Affiliations


Corresponding author

Correspondence to Antonio Macaluso .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2023 The Author(s), under exclusive license to Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Macaluso, A., Orazi, F., Klusch, M., Lodi, S., Sartori, C. (2023). A Variational Algorithm for Quantum Single Layer Perceptron. In: Nicosia, G., et al. Machine Learning, Optimization, and Data Science. LOD 2022. Lecture Notes in Computer Science, vol 13811. Springer, Cham.

Download citation

  • DOI:

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-031-25890-9

  • Online ISBN: 978-3-031-25891-6

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics