{"id":577,"date":"2022-04-08T13:26:04","date_gmt":"2022-04-08T13:26:04","guid":{"rendered":"https:\/\/blogs.kcl.ac.uk\/kclip\/?p=577"},"modified":"2022-04-30T11:29:58","modified_gmt":"2022-04-30T11:29:58","slug":"learning-in-hybrid-classical-quantum-models","status":"publish","type":"post","link":"https:\/\/blogs.kcl.ac.uk\/kclip\/2022\/04\/08\/learning-in-hybrid-classical-quantum-models\/","title":{"rendered":"There is Plenty of Room at the Bottom (but How do We Learn There?)"},"content":{"rendered":"<p>In 1959 Richard Feynman gave an after-dinner talk at an American Physics Society meeting in Pasadena entitled <em>&#8220;There\u2019s Plenty of Room at the Bottom&#8221;<\/em>,\u00a0 crediting Edward Fredkin for inspiration.\u00a0 In his talk, the transcription of which would later become a landmark paper in quantum computation and simulation [1], he takes some existing ideas \u2014 computation is a physical process, perhaps even a quantum mechanical one \u2014 and makes a particularly famous statement:<\/p>\n<p><em>\u201dI\u2019m not happy with all the analyses that go with just classical theory, because Nature isn\u2019t classical, dammit, and if you want to make a simulation of Nature, you\u2019d better make it quantum mechanical, and by golly it\u2019s a wonderful problem!\u201d<\/em><\/p>\n<p>But how can we simulate the quantum mechanical nature of Nature? This new kind of machine would become the quantum computer, and from then on, quantum computing has been on a journey with many ups and downs. Nowadays, excitement seems to be in the air again as quantum machine learning, a hybrid research discipline that combines machine learning and quantum computing, has emerged as a potential practical use of quantum hardware. Generally, quantum machine learning methods apply classical optimization routines to select parameters that define the operation of a quantum circuit. Alternative approaches, which may be more promising in the short term, involve hybrid quantum-classical models, where classical computation, e.g., for feature extraction, is combined with quantum parametric circuits [2].<\/p>\n<h2>Our Work<\/h2>\n<p>In our latest work, published in the IEEE Signal Processing Letters, we focus on the hybrid classical-quantum two-layer architecture illustrated in Fig. 1.<\/p>\n<div id=\"attachment_595\" style=\"width: 468px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-595\" class=\"wp-image-595\" src=\"https:\/\/blogs.kcl.ac.uk\/kclip\/files\/2022\/04\/model-300x161.png\" alt=\"\" width=\"458\" height=\"246\" srcset=\"https:\/\/blogs.kcl.ac.uk\/kclip\/files\/2022\/04\/model-300x161.png 300w, https:\/\/blogs.kcl.ac.uk\/kclip\/files\/2022\/04\/model-1024x549.png 1024w, https:\/\/blogs.kcl.ac.uk\/kclip\/files\/2022\/04\/model-768x412.png 768w, https:\/\/blogs.kcl.ac.uk\/kclip\/files\/2022\/04\/model-676x363.png 676w, https:\/\/blogs.kcl.ac.uk\/kclip\/files\/2022\/04\/model.png 1448w\" sizes=\"auto, (max-width: 458px) 100vw, 458px\" \/><p id=\"caption-attachment-595\" class=\"wp-caption-text\">Fig. 1. In the studied hybrid classical-quantum classifier, a quantum hidden layer, fed via amplitude encoding and consisting of quantum generalized linear models (QGLMs), is followed by a classical combining output layer with a single classical GLM (CGLM) neuron. All weights and activations are binary.<\/p><\/div>\n<p>In it, a first layer of quantum generalized linear models (QGLMs) is followed by a second classical combining layer. The input to the first, hidden, layer is obtained via amplitude encoding (see, e.g., [3]). Several implementations of QGLM neurons have been proposed in the literature using different quantum circuits. Given a binary input sample\u00a0 <img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-585\" src=\"https:\/\/blogs.kcl.ac.uk\/kclip\/files\/2022\/04\/sample-300x43.png\" alt=\"\" width=\"182\" height=\"26\" srcset=\"https:\/\/blogs.kcl.ac.uk\/kclip\/files\/2022\/04\/sample-300x43.png 300w, https:\/\/blogs.kcl.ac.uk\/kclip\/files\/2022\/04\/sample.png 608w\" sizes=\"auto, (max-width: 182px) 100vw, 182px\" \/> and an N-dimensional vector <img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-584\" src=\"https:\/\/blogs.kcl.ac.uk\/kclip\/files\/2022\/04\/weights-300x36.png\" alt=\"\" width=\"200\" height=\"24\" srcset=\"https:\/\/blogs.kcl.ac.uk\/kclip\/files\/2022\/04\/weights-300x36.png 300w, https:\/\/blogs.kcl.ac.uk\/kclip\/files\/2022\/04\/weights-768x93.png 768w, https:\/\/blogs.kcl.ac.uk\/kclip\/files\/2022\/04\/weights-676x82.png 676w, https:\/\/blogs.kcl.ac.uk\/kclip\/files\/2022\/04\/weights.png 841w\" sizes=\"auto, (max-width: 200px) 100vw, 200px\" \/> of binary weights, the main goal of these circuits is to produce a stochastic binary output with probabilities which are a function of the inner product<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-583 aligncenter\" src=\"https:\/\/blogs.kcl.ac.uk\/kclip\/files\/2022\/04\/prod-300x44.png\" alt=\"\" width=\"177\" height=\"26\" srcset=\"https:\/\/blogs.kcl.ac.uk\/kclip\/files\/2022\/04\/prod-300x44.png 300w, https:\/\/blogs.kcl.ac.uk\/kclip\/files\/2022\/04\/prod.png 600w\" sizes=\"auto, (max-width: 177px) 100vw, 177px\" \/><\/p>\n<p>between the input state <img loading=\"lazy\" decoding=\"async\" class=\"wp-image-582 aligncenter\" src=\"https:\/\/blogs.kcl.ac.uk\/kclip\/files\/2022\/04\/input_state.png\" alt=\"\" width=\"40\" height=\"24\" \/> and the amplitude-encoded binary weight vector<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-581 aligncenter\" src=\"https:\/\/blogs.kcl.ac.uk\/kclip\/files\/2022\/04\/weight_state-300x80.png\" alt=\"\" width=\"211\" height=\"56\" srcset=\"https:\/\/blogs.kcl.ac.uk\/kclip\/files\/2022\/04\/weight_state-300x80.png 300w, https:\/\/blogs.kcl.ac.uk\/kclip\/files\/2022\/04\/weight_state-768x206.png 768w, https:\/\/blogs.kcl.ac.uk\/kclip\/files\/2022\/04\/weight_state-676x181.png 676w, https:\/\/blogs.kcl.ac.uk\/kclip\/files\/2022\/04\/weight_state.png 820w\" sizes=\"auto, (max-width: 211px) 100vw, 211px\" \/><\/p>\n<p>Different solutions, along with the resulting QGLM neuron&#8217;s response functions are given in the paper. For this hybrid model, we introduced a stochastic variational optimization (SVO) approach [4] that enables the joint training of quantum and classical layers via stochastic gradient descent. The proposed SVO-based training strategy operates in a relaxed continuous space of variational classical parameters.<\/p>\n<h2>Some Results<\/h2>\n<p>We show the classification accuracy, which is defined as the ratio of the number of accurate predictions over the total number of predictions made by the model, in Fig. 2 as a function of the training iterations.<\/p>\n<p>&nbsp;<\/p>\n<div id=\"attachment_594\" style=\"width: 452px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-594\" class=\"wp-image-594\" src=\"https:\/\/blogs.kcl.ac.uk\/kclip\/files\/2022\/04\/iter_accuracy_v4-300x215.png\" alt=\"\" width=\"442\" height=\"317\" srcset=\"https:\/\/blogs.kcl.ac.uk\/kclip\/files\/2022\/04\/iter_accuracy_v4-300x215.png 300w, https:\/\/blogs.kcl.ac.uk\/kclip\/files\/2022\/04\/iter_accuracy_v4-1024x733.png 1024w, https:\/\/blogs.kcl.ac.uk\/kclip\/files\/2022\/04\/iter_accuracy_v4-768x549.png 768w, https:\/\/blogs.kcl.ac.uk\/kclip\/files\/2022\/04\/iter_accuracy_v4-676x484.png 676w, https:\/\/blogs.kcl.ac.uk\/kclip\/files\/2022\/04\/iter_accuracy_v4.png 1230w\" sizes=\"auto, (max-width: 442px) 100vw, 442px\" \/><p id=\"caption-attachment-594\" class=\"wp-caption-text\">Fig. 2. Classification accuracy as a function of the training iteration for the benchmark sign-flips scheme [5] and the proposed SVO-based procedure for the BAS data set. The results are averaged over 5 independent trials.<\/p><\/div>\n<p>The proposed SVO scheme is seen to achieve high classification accuracy for all of the considered response functions. In particular, the QGLM using the Quadratic (Q) response function yields fastest convergence and achieves the best performance. Due to the additional bias terms resulting from the swap test routine, the QGLMs relying on the Biased quadratic (BQ) and Biased centered quadratic (BCQ) response functions are slower to learn, but ultimately converge after around 3000 training iterations.<\/p>\n<p>Please see the paper for a more extensive presentation, available <a href=\"https:\/\/arxiv.org\/abs\/2201.08629\">here<\/a><\/p>\n<p>Code, alongside a tutorial, are available <a href=\"https:\/\/github.com\/ikoloska\/Training-Hybrid-Classical-Quantum-Classifiers-via-Stochastic-Variational-Optimization\">here<\/a><\/p>\n<h2>References<\/h2>\n<p><span dir=\"ltr\" role=\"presentation\">[1]<\/span> <span dir=\"ltr\" role=\"presentation\">R. P. Feynman<\/span> <span dir=\"ltr\" role=\"presentation\">et al.<\/span><span dir=\"ltr\" role=\"presentation\">, \u201cSimulating physics with computers,\u201d<\/span> <span dir=\"ltr\" role=\"presentation\">Int. j. Theor. phys<\/span><span dir=\"ltr\" role=\"presentation\">, vol. 21, no. 6\/7, 1982.<\/span><br role=\"presentation\" \/><span dir=\"ltr\" role=\"presentation\">[2]<\/span> <span dir=\"ltr\" role=\"presentation\">A. Mari, T. R. Bromley, J. Izaac, M. Schuld, and N. Killoran, \u201cTransfer learning in hybrid classical-quantum neural networks,\u201d <\/span><span dir=\"ltr\" role=\"presentation\">Quantum<\/span><span dir=\"ltr\" role=\"presentation\">, vol. 4, p. 340, 2020.<\/span><br role=\"presentation\" \/><span dir=\"ltr\" role=\"presentation\">[3]<\/span> <span dir=\"ltr\" role=\"presentation\">M. Schuld and F. Petruccione,<\/span> <span dir=\"ltr\" role=\"presentation\">Machine Learning with Quantum Computers<\/span><span dir=\"ltr\" role=\"presentation\">.<\/span> <span dir=\"ltr\" role=\"presentation\">Springer, 2021.<\/span><br role=\"presentation\" \/><span dir=\"ltr\" role=\"presentation\">[4]<\/span> <span dir=\"ltr\" role=\"presentation\">T. Bird, J. Kunze, and D. Barber, \u201cStochastic variational optimization,\u201d<\/span> <span dir=\"ltr\" role=\"presentation\">arXiv preprint arXiv:1809.04855<\/span><span dir=\"ltr\" role=\"presentation\">, 2018.<\/span><br role=\"presentation\" \/><span dir=\"ltr\" role=\"presentation\">[5]<\/span> <span dir=\"ltr\" role=\"presentation\">F. Tacchino, C. Macchiavello, D. Gerace, and D. Bajoni, \u201cAn artificial neuron implemented on an actual quantum processor,\u201d <\/span><span dir=\"ltr\" role=\"presentation\">npj Quantum Information<\/span><span dir=\"ltr\" role=\"presentation\">, vol. 5, no. 1, pp. 1\u20138, 2019<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In 1959 Richard Feynman gave an after-dinner talk at an American Physics Society meeting in Pasadena entitled &#8220;There\u2019s Plenty of Room at the Bottom&#8221;,\u00a0 crediting Edward Fredkin for inspiration.\u00a0 In his talk, the transcription of which would later become a landmark paper in quantum computation and simulation [1], he takes some existing ideas \u2014 computation [&hellip;]<\/p>\n","protected":false},"author":1042,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-577","post","type-post","status-publish","format-standard","hentry","category-uncategorized","post-preview"],"_links":{"self":[{"href":"https:\/\/blogs.kcl.ac.uk\/kclip\/wp-json\/wp\/v2\/posts\/577","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.kcl.ac.uk\/kclip\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.kcl.ac.uk\/kclip\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.kcl.ac.uk\/kclip\/wp-json\/wp\/v2\/users\/1042"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.kcl.ac.uk\/kclip\/wp-json\/wp\/v2\/comments?post=577"}],"version-history":[{"count":34,"href":"https:\/\/blogs.kcl.ac.uk\/kclip\/wp-json\/wp\/v2\/posts\/577\/revisions"}],"predecessor-version":[{"id":619,"href":"https:\/\/blogs.kcl.ac.uk\/kclip\/wp-json\/wp\/v2\/posts\/577\/revisions\/619"}],"wp:attachment":[{"href":"https:\/\/blogs.kcl.ac.uk\/kclip\/wp-json\/wp\/v2\/media?parent=577"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.kcl.ac.uk\/kclip\/wp-json\/wp\/v2\/categories?post=577"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.kcl.ac.uk\/kclip\/wp-json\/wp\/v2\/tags?post=577"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}