Solving the time-complexity problem and tuning the performance of quantum reservoir computing by artificial memory restriction

Quantum reservoir computing is a computing approach which aims at utilising the complexity and high-dimensionality of small quantum systems, together with the fast trainability of reservoir computing, in order to solve complex tasks. The suitability of quantum reservoir computing for solving temporal tasks is hindered by the collapse of the quantum system when measurements are made. This leads to the erasure of the memory of the reservoir. Hence, for every output, the entire input signal is needed to reinitialise the reservoir, leading to quadratic time complexity. Overcoming this issue is critical to the hardware implementation of quantum reservoir computing. We propose artificially restricting the memory of the quantum reservoir by only using a small number inputs to reinitialise the reservoir after measurements are performed, leading to linear time complexity. This not only substantially reduces the number of quantum operations needed to perform timeseries prediction tasks, it also provides a means of tuning the nonlinearity of the response of the reservoir, which can lead to significant performance improvement. We numerically study the linear and quadratic algorithms for a fully connected transverse Ising model and a quantum processor model. We find that our proposed linear algorithm not only significantly reduces the computational cost but also provides an experimental accessible means to optimise the task specific reservoir computing performance.


INTRODUCTION
The field of quantum computation promises a significant computational speedup over classical computation for certain sets of problems [1].Machine learning is one such fields where it is know that quantum computers can offer an advantage [2].Several machine learning tasks have been experimentally realised on quantum systems, some examples are [3][4][5][6], but broad applicability of machine learning on quantum devices is still hindered by the limitations of current quantum processing devices.One of these limitations is the inevitable noise these devices experience.For reservoir computing, a sub-field of machine learning, this noise does not pose a hindrance and could even be a resource [7][8][9].
Reservoir computing is a machine learning approach wherein only the output layer is trained [10][11][12][13].Due to this simple training scheme it is well suited for hardware implementation, meaning that an input signal is fed into a physical system and the dynamics of that physical "reservoir" are utilised to project the data into a high dimensional latent space.The responses of the reservoir are then sent through a readout layer, which is trained in order to approximate the desired function.
There are two main avenues of research into quantum reservoirs, either quantum systems whose dynamics are generated by a Hamiltonian H or quantum circuits con-sisting of several qubits on which unitary operations can be performed.For the former, several studies have been dedicated to the Ising model [14][15][16][17][18], showing its viability as a reservoir for several benchmark tasks.The authors of [7,8,19] devised schemes for reservoir computing on a quantum circuit and implemented them on IBM quantum processors.A promising avenue of use for quantum reservoir computing is to aid in the measurement of quantum states [20,21].
The output of both types of quantum reservoirs are typically time series of one or two qubit observables.For each output, quantum measurements have to be performed, which poses a significant problem for the physical implementation of quantum reservoir computing [22].With each measurement, the quantum system state collapses and all information about the input signal is lost.Therefore, for each time step of the output, the entire signal up to that point is needed to reinitialise the reservoir.This procedure leads to a time complexity quadratic in the length of the input signal.The authors of [14] propose as a solution to perform reservoir computing with nuclear-magnetic-resonance spin ensemble systems [23,24].These large ensembles have the advantage that all copies of the ensemble can be simultaneously controlled such that they all follow the same dynamics.In this way expectation values can be measured with barely any backaction.The authors of [25] investigate the in-fluence of weak measurements and additionally make the observation that due to the fading memory of the reservoir it is not necessary to reset the reservoir using the entire sequence of previous inputs.This can be understood as follows.Typically, information is encoded in the system state of some elements and then letting the closed system evolve in time.Due to the successive over-writing of elements of the quantum reservoir, memory of past inputs is gradually lost.This means that the response of the reservoir is independent of inputs from the distant past and only a finite number of past inputs are needed to reinitialise the reservoir after each measurement.
In this paper we study the influence of artificially restricting the amount of signal inputs after the reservoir is reset by a system measurement.Not only does it reduce the time complexity of the reservoir computing algorithm [25] but also find that it is possible to tune the task-specific computing performance.Our proposed approach simultaneously provides an experimentally viable method of tuning the nonlinearity of the quantum reservoir response which addresses the need for task dependent hyperparameter optimisation.Task dependent hyperparameter optimisation is not an issue specific to QRC, but a general issue for reservoir computing, particularly for hardware implemented reservoir computing where the accessible hyperparameters can be restricted and difficult or cumbersome to tune.
We demonstrate our approach on two simulated quantum reservoirs: a transverse field Ising Hamiltonian and a quantum circuit.In both cases we analyze their performance on the information processing capacity [26] and the Lorenz chaotic attractor.Our proposed algorithm not only addresses the problem of measurement for time series tasks, but also improves the performance for these tasks.

QUANTUM MEASUREMENT FOR TIME SERIES PREDICTIONS
The usual procedure to experimentally implement time series tasks in quantum reservoirs involves reinitialising the reservoir with the entire input history.The inputs to this algorithm include a unitary operation U , the set of observables to be measured {O o } o , the initial state |Ψ I , an input series u = {u i } M i=1 of length M and a scheme which encodes the input into a state |Ψ E (u i ) .For each time step i, the system is initialised to |Ψ I and the signal up until u i is fed into the reservoir.Afterwards the measurement of the set of observables {O o } o is performed.Since the i-th input requires i unitary operations, the complexity of this algorithm for a time series of length M is determined by For large or continuous time-series (M → ∞), this approach therefore becomes unfeasible.Current literature on Quantum Reservoir Computing for time-series tasks analyzes the properties of the reservoir using this scheme with quadratic time complexity [7,8,14,15,17].We propose a new scheme for reservoir computing.The scheme is based on the fading memory property usually assumed for reservoir computers [10,11], and the memory-nonlinearity trade-off which is known to occur in reservoir computing [27][28][29].Qualitatively the fading memory property states that the reservoir forgets inputs far into the past.It can be characterised by the linear contribution to the information processing capacity IPC 1 .The information processing capacity is a generalization of the linear memory capacity [26] which quantifies the ability of the reservoir to construct nonlinear transforms of all possible combinations of past inputs into the reservoir (see the supplemental material for details) and can be used to predict the performance on certain tasks [30,31].
The scheme we propose here is to only insert the previous m = n−1 inputs for each output step of the reservoir i, rather than the last i − 1 inputs.This results in a total of n unitary operation per input u i and leads to a total of unitary operations.This approach is computationally feasible for continuous or large time-series (M → ∞), as at any given input u i only n + 1 unitary operation are required and thus can be computed in real-time.
In the following section we compare the quadratic (QCQA) and the linear complexity quantum algorithms (LCQA) as a function of the reset length n.We study two different systems: an Ising model and a quantum circuit.For both systems, we encode our input series in the first qubit |Ψ 1 and set the initial state of the reservoir Ψ I and the encoding state Ψ E (u i ) depending on an input u i to

ISING MODEL
The dynamics of the fully-connected-transverse field Ising model are described by the Hamiltonian X i , Y i and Z i are the Pauli matrices of the i-th particle and are given by where σ x,y,z are the 1-qubit Pauli matrices and I 2 the 1-qubit identity operator.The J ij are the coupling strengths between two particles in the x-direction and are sampled from a uniform distribution on the interval [0.25, 0.75], while h = 0.5 is the coupling strength to an external magnetic field in the z-direction.
We numerically study the Ising model with four qubits N S = 4.The outputs of the reservoir are the expectation values , where Z i is the z Pauli matrix for the i-th qubit.Additionally we perform time multiplexing: each input signal is fed into the reservoir for an evolution time T , during which we perform N V = 30 measurements, see supplemental material for more details on time-multiplexing.This leads to a total of 4 × 30 = 120 observables or readout nodes for each input step i.The unitary time evolution operation is given by with an evolution time (clock cycle) of T = 20.For the Ising model, the linear memory capacity as a function of the steps into the past is shown in Fig. 1a.Using the entire history to reset the system, i.e. the QCQA, the memory of this Ising model reservoir fades to zero after approximately 15 steps into the past (black line), meaning that a reset length of n = 15 should be sufficient to emulate the QCQA.To demonstrate the influence of the reset length in a general and task-independent manner we calculate the information processing capacities as a funciton of n. Figure 1b-c shows the summed IPCs of polynomial order one to six and Fig. 1d shows the total IPC summed over all polynomial orders.In each case the QCQA limit (dashed lines) is reached as n approaches the maximum memory of the reservoir (n ≈ 15).For very small n the IPCs are decreased due to the artificial memory restriction that is being imposed on the reservoir.However, there is an intermediate range for the reset length n where the total IPC and the IPCs above first order are increased compared with the QCQA limit.This is a new insight, which can be used to substantially reduce the number of quantum operations needed for time series tasks, while simultaneously optimizing the performance.
To gain more insight into this effect, in Fig. 1a the linear memory (linear IPCs) is plotted for n = 5, 6.Here it can be seen that the distribution of the linear IPCs is changed compared with the QCQA case.Although the summed linear IPC (IPC 1 ) is decreased for n = 5, 6, the capacities for the past inputs which can be reconstructed are higher.This increase in the memory is related to the state of the reservoir, which is initially the pure state (3) and becomes mixed after inputting data.In the supplementary material we show that the data encoded as (4) in a pure state is better remembered than in a mixed state.This explains the increase in the summed higher order IPCs, since the high order IPCs are composed of inputs from fewer steps into the past, as can be inferred by the small reset lengths n needed to reach the QCQA limit as the polynomial order is increased (see Fig. 1c).To demonstrate that the observed increases in the IPCs can translate to improved performance for a time series prediction task, we also calculate two tasks related to the Lorenz chaotic attractor [32].In both tasks the x variable of the Lorenz system is inserted into the reservoir.The first task (LXX) is to predict the x variable one step ahead.The second task (LXZ) is to cross-predict the z variable one step ahead.(See the supplemental material for details on the tasks.) Figure 2a shows the normalised root-mean-squared error (NRMSE) (as defined in the supplemental material) for the LXX and LXZ tasks in dependence of the reset length n.For both tasks, compared with the QCQA limit (dashed lines), a lower NRMSE is achieved for small n.For this particular reservoir, the minimum NRMSE for both tasks is achieved at n = 3, which corresponds to the reset length at which IPC 5 and IPC 6 exhibit a maximum (see Fig. 1c).

QUANTUM CIRCUIT
To demonstrate the universality of our restricted memory approach, the second type of quantum reservoir we consider is an N -qubit circuit.Each layer of the circuit consists of two sub-layers of 2-qubit unitary operators W j and V j acting on neighbouring qubits.The unitaries W j and V j are of the form with where the u j,k,l and g j,k,l are single qubit unitaries drawn from the Haar measure [33] and a i , ... , f j are uniformly drawn from the interval [−k, h].The two sublayers are then defined by Recently, the authors of [34] showed that if the single qubit unitaries w, v are drawn from the Haar distribution, see e.g.[35] (Sec.58), and k = h, then by changing h the system undergoes a transition between a localised and an ergodic phase.In our case, we draw the parameters randomly from the interval We implement both the QCQA and the LCQA scheme, where the unitary operation U is given by repeating the sublayers W and V , N W = 10 times and where we time-multiplex by performing an additional measurement after the application of each V and W layer individually.We use N = 4 qubits, thus, in total, there are 8 × 10 = 80 outputs of the reservoir for each input.Figure 3 shows the various components of the IPC as a function of the reset length n.Here we find the same qualitative results as in the Ising model case (see Fig. 1).The IPCs above first order can be increased with respect to the QCQA limit and for sufficiently large n the QCQA limit is reached.The exact influence of the reset length on the distribution of the IPCs depends on the dynamics of the reservoir, as can be seen by the differences between Fig. 1 and Fig. 3.
For the quantum circuit, optimisation of the reset length also leads to an improvement in the performance of the LXX and LXZ tasks, as shown in Fig. 2b.Here the best performances occur for n = 4, which corresponds to the maximum IPC 5 and IPC 6 for the quantum circuit.

CONCLUSION
In this work, we presented the Linear Complexity Quantum Algorithm (LCQA), for quantum reservoir computing.The algorithm successfully reduces the timecomplexity of quantum reservoir computing for time series tasks from quadratic to linear, thus making physical implementations for long time series feasible.Beyond this, we have demonstrated that by artificially restricting the memory of the reservoir, the nonlinear response can be tuned and a further reduction in the required number of quantum operations can be achieved.
We have compared our new LCQA approach to the established QCQA on a fully connected Ising chain and a quantum processor reservoir computer.We found that LCQA outperforms the currently utilized QCQA scheme both in the information processing capacity and in Lorenz time series prediction tasks.
The proposed approach allows the nonlinearity of the reservoir response to be tuned at the expense of the linear memory.For tasks requiring greater memory, the LCQA can be supplemented with memory augmentation methods on the input or the output of the reservoir, such as those presented in [36][37][38][39].
Our findings from the evaluation of the LCQA scheme using the quantum circuit indicate that this algorithm shows great potential for the hardware implementation of quantum reservoir computing.Not only to reduce the time needed to perform computations, but to improve the performance.The proposed LCQA algorithm presents a promising avenue for further research and development in the field of quantum computing, quantum reservoir computing, and quantum machine learning.L. J. acknowledges funding from the Deutsche Forschungsgemeinschaft (DFG), grant number LU 1729/3-1.

FIG. 1 .
FIG.1.Ising model: a) Linear IPCs as a function of the steps into the past d for the LCQA with n = 5, 6 (greys) and for the QCQA (black).Summed IPCs of polynomial orders b) 1 to 3 and c) 4 to 6, and d) the total summed IPC, in dependence of the reset length n using the LCQA.The corresponding QCQA limits are indicated by the dashed lines.We have calculated the standard deviation for ten different realizations of Ising Hamiltonians, where Jij were sampled randomly.

FIG. 2 .
FIG. 2.Lorenz tasks: NRSME of the LXX (green) and LXZ (orange) tasks for the LCQA as a function of the reset length n using a) the Ising Reservoir and b) the quantum circuit.The QCQA limit is indicated by the dashed lines.

FIG. 3 .
FIG.3.Quantum Circuit: a) Linear IPCs as a function of the steps into the past d for the LCQA with n = 7, 15 (greys) and for the QCQA (black).Summed IPCs of polynomial orders b) 1 to 3 and c) 4 to 6, and d) the total summed IPC, in dependence of the reset length n using the LCQA.The corresponding QCQA limits are indicated by the dashed lines.We have calculated the standard deviation for ten different realizations of the input signal and different random parameters aj, . . .fj and single qubit unitaries w, v in(8).