Quantum neural networks with multi-qubit potentials

We propose quantum neural networks that include multi-qubit interactions in the neural potential leading to a reduction of the network depth without losing approximative power. We show that the presence of multi-qubit potentials in the quantum perceptrons enables more efficient information processing tasks such as XOR gate implementation and prime numbers search, while it also provides a depth reduction to construct distinct entangling quantum gates like CNOT, Toffoli, and Fredkin. This simplification in the network architecture paves the way to address the connectivity challenge to scale up a quantum neural network while facilitating its training.


Introduction
Information is a resource due to its advance and expansion in the digitalization and control 1 .However, programing explicit algorithms with good performance may become unfeasible due to the vertiginous growth in (i) the amount of available information with which classical algorithms have to deal 2 , and (ii) the inherent difficulty of finding efficient algorithms for specific problems 3 .All these limit our current capabilities in information processing tasks.Two alternative approaches that would contest these limitations are machine learning and quantum computing 4,5 .
On the one hand, machine learning (ML) is a branch of artificial intelligence that uses statistical techniques to give computers the ability to progressively learn with input data without being explicitly programmed.ML is based on the generation of a hypothesis that is optimized from sample inputs and re-used to generate new predictions 6 .Thus the algorithms can learn from data and overcome the static program instructions by making data-driven decisions from sample inputs.Among the distinct hypothesis models, neural networks 7 are very extended due to the blooming of deep learning 8,9 .Artificial neural networks are organized in layers and each layer learns new behavior patterns 10 .The computational power of artificial neural networks relies on this architecture where neurons in each layer feed signals into other neurons allowing parallel-processed computing 11,12 .In this manner, several calculations can be performed at the same time, and large computational problems can often be divided into smaller ones, which can be then solved simultaneously.The versatility of neural networks to classify complex data relies on the universal approximation theorem, which leads artificial neural networks the capacity to approximate any function 13 .As result, they span a broad range of applications such as speech 14 or object recognition 15 , spam filters 16 , vehicle control 17,18 , trajectory prediction 19 , decision making 20 , game-playing 21 , or automated trading systems 22 .
On the other hand, quantum computing represents a different paradigm from classical information processing.Based on an alternative information encoding that exploits the quantum properties of matter, systems that encompass several quantum bits (qubits) are exponentially hard to simulate with classical devices 5 showing that quantum systems do not seem to obey the Church thesis 23 , and consequently they are not polynomially equivalent to classical systems.Then, quantum systems harnessed as computational devices, might be dramatically more powerful than any other classical system 24 .The universality of quantum computing 25 expands a broad range of applications.Some illustrative examples are linear systems solvers 26 , molecule simulators 27 , combinatorial optimizers 28 , black-box 29 and factorization problems 30 , or Hamiltonian simulations 31 .Although a set of single N = 1 and two-qubit N = 2 gates is a universal approximator 32 , larger multi-qubit (N > 2) gates may offer a computational advantage that reduces complexity in existing algorithms [33][34][35] .
Quantum machine learning [36][37][38][39][40][41][42][43][44] aims for the symbiosis of both paradigms to the mutual reinforcement.To achieve improvements of the machine learning protocols by leveraging quantum resources in comparison to their classical counterparts is the goal for the future.On the other hand, the universality of artificial networks may enhance the accuracy and efficiency of quantum protocols [45][46][47][48][49] .By making analogy to classical neural networks, a quantum neural network (QNN) consists of quantum perceptrons (neurons) possessing nonlinear activation functions in different layers.In the network, the hidden layers in a QNN are the intermediate ones which are composed of quantum perceptrons, each of which is a qubit encoded in an Ising Hamiltonian 44 .By measuring the excitation probability of the reduced eigenstate of such a Hamiltonian, one can get the nonlinear activation function.In this work, we propose an extension of a universal QNN enabling multi-qubit (N > 2) interactions that lead to a reduction of the network depth while keeping the approximation power.As a result, achieving a simplification of existing protocols not only requires shorter operation times, but it may also introduce less accumulation of errors due to the reduction in the amount of requested gates.The article is structured as follows: We firstly define that the quantum perceptron is a single-output quantum neuron with multi-qubit interactions, connecting to several-input quantum neurons without hidden layers.The result of nesting several quantum perceptrons is a QNN.We show that a quantum perceptron with multi-qubit interactions can do an XOR gate and prime number search from 3 to 5 bits, improving the performance of approximation power compared to the classical counterpart, as well as compared to standard QNNs (i.e.QNNs that include nested perceptrons without multi-qubit interactions).Then, we show that quantum gates such as CNOT, Toffoli, and Fredkin can be implemented by QNN involving quantum perceptrons with multi-qubit interactions, thus reducing the circuit depth as it is not needed to add hidden layers.

Quantum perceptrons with multi-qubit potentials
A quantum perceptron, or a quantum neuron, is the basic building block of a QNN.It can be constructed as a qubit that presents a nonlinear response to an input potential x j in the excitation probability.This can be written as the following quantum gate acting on a jth qubit that encodes the quantum perceptron 44,45 : where corresponds to a nonlinear function.The transformation in Eq. ( 1) can be engineered, e.g., by evolving adiabatically the qubit with the Hamiltonian where x j is the potential exerted by other neurons on the perceptron, and the applied external field Ω(t) leads to a tunable energy gap in the dressed-state qubit basis |±⟩, with σ x j |±⟩ = ±|±⟩.Typically, x j = ∑ k i=1 (w ji σ z i ) + b j 44, 45 which implies that the jth perceptron is coupled to a number k of neurons (labelled with i) in the previous/input layer via standard spin-spin interactions.The Hamiltonian in Eq. (3) has the following reduced eigenstate (i.e. when the degrees of freedom of any other neuron are traced-out): with f (x), the excitation probability, in the form of Eq. (2).Specifically, to accomplish Ûj ( x j ; f )|0 j ⟩, one can use a Hadamard gate to firstly get the transformation |0 j ⟩ → |+ j ⟩ and finally obtain |Ψ⟩ = |Φ(x j /Ω(t f ))⟩ at a certain time t f by evolving the system adiabatically with Hamiltonian (3).With the fixed trajectory always along with the instantaneous eigenstate of the Hamiltonian, one can deduce the external driving Ω(t) from the fast quasi-adiabatic passage 44 .In this manner, the nonlinear activation function of the quantum perceptron is encoded in the probability of the excited state P j = f (x j ) = 1 2 (1 + ⟨ σ z j ⟩) during the adiabatic evolution 44 .In order to speed up the operation of this perceptron, one can also use inverse engineering techniques which directly impose conditions in the wave function evolution at the initial and final time instants, resulting in nonlinear response in the quantum perceptron 45 .Correspondingly, a smoother control Ω(t) easily to be implemented experimentally can also be found.In addition, this accelerated activation mechanism by inverse engineering for the quantum neurons would reduce the decoherence and the variation of the input potential induced by neurons in the previous layer leading to enhanced performance.In order to (a) encode an XOR gate and to (b) search prime numbers among the integers from 0 to 7, we show the value of the cost function at different epoches, using a multi-qubit interaction perceptron (solid blue) and a classical perceptron (dotted red).The latter is equivalent to a quantum perceptron with only two-qubit terms, which is shown from the comparison of the weights and bias during the training process, see Eqs. ( 7) -( 9), where the learning rate is η = 1.5.The transfer function in Eq. ( 2) is used for both cases.In the quantum perceptron, this function indicates that the system evolves adiabatically.Now, we introduce a different type of potentials which rely on the possibility to implement multi-qubit interactions.In particular, we consider a potential of the kind

2/11
where w m is a multi-qubit coefficient marked by the subscript m, and l p ∈ [1, 2, ..., k] (namely, the term involving several Pauli matrices includes products of an arbitrary number of neurons in the previous input).For the sake of simplicity in the presentation, there is only a single multi-qubit term in Eq. ( 5).However, this can include several products of distinct neurons in the input layer (i.e.additional multi-qubit terms).Later we will provide specific examples of these interactions associated to definite problems.
In the following, we show that the multi-qubit potential enables tasks such as (i) Constructing XOR gates at the perceptron level (ii) Searching prime numbers and (iii) Encoding quantum gates.All these are implemented without hidden layers and/or ancillary qubits, thus, showing the significant role of multi-qubit potentials in the simplification of QNNs.

XOR gate
As a classical perceptron is a linear separator, a nonlinear logic gate such as the well-known XOR problem (i.e., the exclusive OR boolean function) requires at least one hidden layer to be implemented in classical neural networks 51 .Now we show that a quantum perceptron with multi-qubit interactions in the neural potential is a nonlinear classifier.In particular, we illustrate the construction of an XOR gate by a single quantum perceptron with multi-qubit interactions.We also show that the lack of hidden layers prevents classical neural networks and standard QNNs to achieve the same task.
As the values of the output neuron 0 and 1 cannot be separated linearly, a classical perceptron with two inputs and one output (i.e.without hidden layers) fails to solve the XOR gate.To show this, we use the standard gradient descent algorithm to train this simple classical perceptron with a sigmoidal activation potential f (x), see Eq. ( 2), and x j = ∑ k i=i w i j s i + b j with the classical input s i ∈ {0, 1} whose cost function is in the form of the mean square value However, besides a sigmoid function, neurons in other forms of nonlinear activation functions, such as a ReLu function, can also create a neural network to learn the XOR gate.Here, N = 4 determines the four possible examples 00, 10, 01, 11, while y (n) and t (n) are the output and the target respectively, for the nth example.For simplicity, the subscript j labelling one perceptron will be neglected in the following text.During the training, the parameters of the classical perceptron are updated after each epoch as with the learning rate η.Any other nonlinear function g(x), similar to f (x), can be applied to train this perceptron in order to obtain the same approximation power.As it is shown in Fig. 1 (a), the cost function value of this classical perceptron stucks in C = 0.125 (dotted-red line with superimposed diamonds for a better identification).As a classical perceptron can only converge on linearly separable data, it is not able to imitate the XOR function.In order to complete an XOR, a hidden layer with two neurons is needed.These two neurons can be regarded to perform an OR and a NAND gate.
To implement an XOR gate with a quantum perceptron without the multi-qubit term in Eq. ( 5), this is by using the potential x = w 1 σ z 1 + w 2 σ z 2 + b, one can follow the procedure described in Ref. 44 .To encode an XOR gate, the neural potential is derived from the four basis states |00⟩, |01⟩, |10⟩, |11⟩, which play the role of the four examples of the input in the XOR gate (namely, 00, 10, 01, 11).In this case, as the input values of the XOR gate are bits, one can transform them into the measurement value of σ z of the input qubits for the perceptron, i.e. σ z in = 1 2 (1 + ⟨ σ z ⟩).Therefore, the input values 0 and 1 refer to the input states as the ground state |0⟩ (⟨ σ z ⟩ = −1) and the excited state |1⟩ (⟨ σ z ⟩ = 1), respectively.Such a quantum perceptron without hidden layers and with only two-qubit interactions is equivalent to a classical perceptron, from the point of view of the following training process.Aiming at training it with the gradient descent method, one has to update the weights and bias as wi where and |Ψ⟩ = Û( x, f )|0⟩ is the solution to the Schrödinger equation driven by the Hamiltonian (3) with x = w 1 σ z 1 + w 2 σ z 2 + b.In the previous equations we can see that weights and bias are obtained in the same way as their classical counterparts.For that, one has to compare Eq. ( 7) with Eqs. ( 8) and (9) This indicates that a single quantum perceptron with two-qubit interactions and the basis states |00⟩, |01⟩, |10⟩, |11⟩ as input is equivalent to a classical perceptron.
In order to implement the XOR gate with this quantum perceptron, one would need to perform two adiabatic passages with different controls Ω(t), as well as to use different neural potentials in each passage by appropriately changing the weights and biases 44 .Equivalently, one could also do the XOR gate by including one hidden layer with two additional quantum neurons and the application of a single Ω(t).It is worth mentioning that Eq. ( 9) holds only for a quantum perceptron instead of a QNN with hidden layers.If a QNN has more layers, one only needs to measure the output qubit value instead of the intermediate ones, i.e., |Ψ⟩ = Ûtot |0⟩ with Ûtot = Π M j=1 Ûj where M is the total number of quantum perceptrons in a QNN.Otherwise, shot noise is introduced by measuring the neurons in the hidden layer.
This procedure to do the XOR gate can be simplified when considering a quantum perceptron with multi-qubit interactions.We can find the output of the quantum perceptron by using Eq.(10), where |Ψ⟩ = Û( x; f )|0⟩.In the unitary transformation implemented by the quantum perceptron gate in the Heisenberg picture leads to y = P(x) = f (x), where y = 1, if x > 1/2; and y = 0, if x ≤ 1/2.In particular, we explore the following multi-qubit potential In this case, the weights w 1 , w 2 and b are updated as in Eqs.(8), while the updating formula for the weight of the w m σ z 4/11 (a) Considering the construction of an XOR gate from the equations we find that Eq. ( 15) -( 17) are contradictory, if the mutli-qubit interaction term does not exist.However, one can always find approprint values for w m to satisfy the above inequalities.The existence of w m σ z 1 σ z 2 in the neural potential enables the quantum perceptron to construct an XOR gate as a nonlinear separator.We test the cost function value (see, Eq. ( 6)) for our quantum perceptron and find that C < 1% occurs at epoch = 197 as shown in Fig. 1 (a) (solid-blue line with squares).From the numerical calcluation, we can see that the cost function value continues to decrease.On the contrary the classical and qubit-qubit interaction perceptron are not able to produce an XOR gate, see plateau behavior of the cost function (dotted-red) that remains constant after the epoch ∼ 50.

Searching prime numbers
In Ref. 44 , a specific example of two, three, and four perceptrons per layer was illustrated to detect prime numbers from 0 to 2 i − 1 where i ranges from i = 3 to i = 7 bits.In particular, it was shown that a QNN with two perceptrons -one in the hidden layer and the other one as the output-can classify prime numbers from 0 to 7 (3 bits).This exemplifies the better performance of QNNs compared with classical ones where a hidden layer with two neurons are necessary to accomplish the same task.A scheme of these networks with 3 bits in input is shown figure in Fig. 2 (a) and (b), while details regarding QNN-training to search prime numbers are in Methods.Now, we introduce the multi-qubit term into the neural potential and find that the same task is achieved by a QNN without hidden layers, i.e. at the single quantum perceptron level.To search a prime number for 3 bits (Truth table listed in Fig. 2 (c)) using a single quantum perceptron we consider the potential

5/11
As we demonstrate later, adding the multi-qubit term w m σ z 2 σ z 3 is enough to fulfill the prime numbers searching task.In this respect, one can include additional multi-qubit terms in the neural potential.However, we use the simplest example in Eq. ( 18) to simplify the network and training process.
We note that when the input of a quantum perceptron that presents only two-qubit interactions are the basis states, this is equivalent to the classical perceptron as shown in Eqs. ( 7) - (9).For this reason, now we compare the cost function of a classical perceptron with the cost function of a quantum perceptron using the potential in Eq. ( 18) for the specific purpose of searching prime numbers from 0 to 7. As it is shown in Fig. 1 (b) the quantum perceptron achieves C < 1% at epoch= 667 (solid-blue with squares), while the C value saturates to 0.126 in the classical counterpart (dotted-red with diamonds).This indicates that our perceptron achieves the searching task without hidden layers.We have also verified the ability of the quantum perceptron by minimizing the cost function to an acceptable error for searching prime numbers for 4 bits with the potential and for 5 bits with The multi-qubit terms in the above two neural potentials for 4 and 5 bits are chosen due to the fact that the cost function result in C < 1% at epoch = 1692 for Eq. ( 19) and epoch = 1698 for Eq. ( 20) with the consideration of adopting the minimal number of multi-qubit terms.Further training the above quantum perceptrons presents that the value of C continue to decrease, proving the success to achieve these tasks.

Quantum gates
Now we show that one can use a QNN with multi-qubit interactions to construct quantum gates such as CNOT, Toffoli, and Fredkin gates without the necessity of hidden layers.In comparison, one can demonstrate that a QNN with only two-qubit interactions cannot construct the above mentioned quantum gates in the same conditions.This will be shown later.As quantum gates are reversible, the number of input and output qubits of quantum gates should be equal.Hence, the number of the neurons in the input equals that in the output.Correspondingly, the cost function is changed into where k is the number of quantum perceptrons.
For CNOT gate where k = 2, the truth table and the schematic configuration of the QNN is shown in Fig. 3 (a) and (b) respectively, where each perceptron (output neuron) gives the output value The first perceptron should have the same value as the first input neuron, while the second one aims to achieve the same value as the XOR output of two input neurons, i.e. σ z out,2 = σ z 1 ⊕ σ z 2 52 .The neural potential of the second perceptron is and the first perceptron has two-qubit interaction terms.We find that this is the most concise choice, as it requires least connectivity.We obtain the cost function value (using Eq. ( 21) C < 1% at epoch = 116 and C → 0 at a larger epoch, as shown in Fig. 4 (a) (solid-blue with squares) indicating the satisfaction to train a CNOT gate well.On the contrary, training such a CNOT gate by a QNN with only two-qubit interaction terms leads to a C tending to 0.0625 at large epoch, see Fig. 4 (b).This indicates that a standard QNN cannot encode the CNOT without hidden layers.
A QNN with multi-qubit terms also works for constructing a Toffoli gate without hidden layers.Truth table, and QNN for Toffoli are shown in Fig. 5 (a) and (b).Known as Controlled-Controlled-Not gate, a Toffoli gate has 3-qubit inputs and outputs.In the QNN, the outputs of the first two qubits should be the same value as their inputs σ z out,i = σ z i (i = 1, 2), while the output of the third qubit aims at σ z out,3 = σ z 3 ⊕ σ z 1 σ z 2 52 .In this case, we propose the following neural potential of the third perceptron with a minimal number of multi-qubit terms.Demonstrated in Fig. 4   In particular the solid-blue line is the cost function obtained to construct a CNOT gate, a Toffoli gate (dashed-red line) and a Fredkin gate (dotted-black line).Illustrated in the inset of (a), the cost function values reach C < 1% at 116th, 140th, 162th epoch for the above three quantum gates, respectively, indicating that these gates can be constructed by QNNs with multi-qubit interaction without hidden layers.In contrast, C values go to their respective plateau by quantum perceptrons with two-qubit interactions.
Another example that can be successfully constructed by our QNNs including multi-qubit interactions without hidden layers is the Fredkin gate (also known as Controlled-SWAP gate) whose truth table and schematic configuration are in Fig. 6

Discussions
We have shown different applications of QNNs which possess multi-qubit interactions.Meanwhile, the performance is enhanced compared to the same topology of a QNN without multi-qubit interactions.The multi-qubit interaction terms induce connectivities among quantum perceptrons that deviate from the current network paradigm of additive activations.
It is due to the multi-qubit terms in the potentials that one can avoid the presence of some hidden layer without sacrificing approximative power.Such architecture allows us to address the connectivity challenge in scaling up QNNs.Moreover, the simple configuration helps to control the efficiency of the training processes.During the training process of all the examples shown above, the activation function (Eq.2) based on the adiabatic evolution of the system is used.Instead, one may use shortcuts to adiabaticity to accelerate the formation of the activation function in physical registers 45 .The Hamiltonian of the jth perceptron given by Eqs.(3) where the neural potential expressed by Eq. ( 5) corresponds to the linear Ising Hamiltonian with higher order interactions.Such a model is present in distinct quantum platforms [53][54][55][56][57][58] experimentally and theoretically, although the developments in different platforms vary.An optical Ising machine hosting adjustable four-body interaction with all-to-all connections over a large number of spins was experimentally demonstrated in Ref. 54 .Moreover, the four-body interactions are designed to be realized via superconducting quantum interference devices (SQUIDs) 55 , while a single shot method for executing an i-Toffoli gate which is a three-qubit gate with two control and one target qubits was proposed in Ref. 56 , with the application of currently existing superconducting hardware.Using resonant microwave-mediated interactions between distant electron spins to implement multi-qubit potentials 57 marks an important milestone for all-to-all qubit connectivity and scalability in silicon-based quantum circuits.Quantum evolutions governed by terms involving up to six-qubit interactions has already been implemented in trapped-ion systems 58 where the value of qubit-qubit interactions can be tuned, allowing the same architecture to be used to implement different types of gates and leading to a variety of quantum gates in the system.Each of the examples considered above corresponds to a particular case of multi-qubit interaction and its physical implementation would depend on the specific considered platform.The development in the quantum hardwares highlights the potential for practical implementations of multi-qubit potentials in QNNs.The promotion of quantum hardware and QNN protocols in respective fields will boost mutual developments.

Hamiltonian and training of the neural networks
In the article, we propose a QNN with multi-qubit interactions where the Hamiltonian Eq. (3) of one perceptron has the neural potential expressed in Eq. (5).In preparation for a QNN to demonstrate advantages in comparison with classical counterparts, we need to develop concepts to improve scalability of QNNs where controlling the network depth becomes crucial.One main objective to develop a QNN is to therefore minimize the depth without sacrificing approximative power.To this end, we explore deviations from the current network paradigm of additive activations and include multi-qubit interactions in the neural potential leading to a reduction of the network depth.In all the calculations, we use the standard gradient descent to train the neural networks with the cost function Eq. (21).Correspondingly, the weight of multi-qubit interactions term w m σ z l 1 ... σ z l n in the neural potential Eq. ( 5) should be updated as

8/11
Training for prime numbers search To train a QNN for the task of searching prime numbers, a set of 2 i pairs for i bits containing the input and output values {A (n) , y (n) } 2 i n=1 is taken, where the inputs are binary numbers A (n) = (a 1 , a 2 , ..., a i ) corresponding to the integers belonging to the set ∈ {0, 1, ..., 2 i − 1}.As the targets are t ∈ {0, 1}, the output of the network y n = Q(A (n) ) = 1, if and only if the input number is prime.

Figure 1 .
Figure 1.In order to (a) encode an XOR gate and to (b) search prime numbers among the integers from 0 to 7, we show the value of the cost function at different epoches, using a multi-qubit interaction perceptron (solid blue) and a classical perceptron (dotted red).The latter is equivalent to a quantum perceptron with only two-qubit terms, which is shown from the comparison of the weights and bias during the training process, see Eqs. (7) -(9), where the learning rate is η = 1.5.The transfer function in Eq. (2) is used for both cases.In the quantum perceptron, this function indicates that the system evolves adiabatically.

Figure 2 .
Figure 2. (a) Schematic configuration of a classical neural network with one hidden layer of two neurons for the task to search prime numbers of the input number A = (a 1 , a 2 , a 3 ) ∈ {0, 1, ..., 7} with 3 bits.After well trained, the network gives the output y = Q(A).(b) The same task can be achieved by a QNN which has multi-qubit interactions in the neural potential (red junction involving second and third neurons) without hidden layers.(c) Truth table for prime-number search with 3 input bits for a QNN.The input values A = (a 1 , a 2 , a 3 ) are the binary numbers for the integers from 0 to 7. The output value y = Q(A) is 1 for prime numbers and 0 for non-prime ones.
(a) and (b), the value C < 1% (dashed-red line with crosses) occurs at epoch = 140 and goes to 0 at large epoch during the training of a Toffoli gate.In close similarity with the previous case, a standard QNN without hidden layers fails to achieve the Toffoli gate, as C saturates at 0.0238.

Figure 3 .Figure 4 .
Figure 3. Truth table of a CNOT gate (a) constructed by a QNN illustrated in a schematic configuration (b) with the multi-qubit interaction term w m σ z 1 σ z 2 .
(a) and (b).In this case, the adopted potential of the third perceptron is x3 to the numerical calculation, the cost function value C tends to zero, shown in Fig.4(a) (dotted-black line with asterisks), indicating that these gates can be constructed by quantum perceptrons without hidden layers.Again, C saturates at the value 0.0417 at large epoch for a standard QNN without hidden layers, see Fig. 4 (b).

Figure 5 .Figure 6 .
Figure 5. Truth table of a Toffoli gate (a) constructed by a QNN illustrated in a schematic configuration (b) with the multi-qubit interaction term w m σ z 1 σ z 2 σ z 3 .