UNIVERSITY OF STUTTGART MASTER THESIS Quantum Machine Learning for Time Series Prediction Author: Tobias Fellner Supervisors: Dr. David Kreplin Samuel Tovey First Examiner: Prof. Dr. Christian Holm Second Examiner: Prof. Dr. Jörg Main A thesis submitted in fulfillment of the requirements for the degree of Master of Science in the Institute for Computational Physics October 13, 2024 https://www.uni-stuttgart.de/ https://www.icp.uni-stuttgart.de/institute/team/Fellner/ https://scholar.google.com/citations?user=ku_YP64AAAAJ&hl=de https://www.icp.uni-stuttgart.de/institute/team/Tovey/ https://www.icp.uni-stuttgart.de/institute/team/Holm-00005/ https://www.itp1.uni-stuttgart.de/de/institut/team/Main/ https://www.icp.uni-stuttgart.de/ iii Declaration of Authorship I, Tobias Fellner, declare that this thesis titled, “Quantum Machine Learning for Time Series Prediction” and the work presented in it are my own. I confirm that: • I have written my thesis independently. • I have not used any sources other than those indicated and have marked all statements taken verbatim or in spirit from other works as such. • The thesis submitted has not been the subject of another examination proce- dure either in full or in substantial parts. • I have not already published the thesis either in full or in part, unless the ex- aminer has previously approved the publication. • The electronic copy corresponds to the other copies. • When using IT/AI-supported writing tools, I have listed these tools in full as aids used with their product name, my source of supply and an overview of the range of functions used in this thesis. • In the preparation of this thesis, I have worked independently throughout and have controlled the use of IT/AI-supported writing tools. In this work the following AI-tools were used: • For spellchecking, paraphrasing and ensuring an easy to understand tone GPT- 4o mini as well as GPT-4o (openai.com) in the versions released after July 18, 2024 are used. A section, written by myself, is improved by these models by a prompt similar to the following: "Please correct grammar and spelling errors, paraphrase when necessary to avoid redundant words and ensure readability." • Furthermore, DeepL Write (deepl.com) is used for paraphrasing. • When writing the code to implement the models, the training procedure and creating the plots, GitHub Co-Pilot (github.com) was used for code improve- ment and filling out redundant lines of code. Date: Signed: v UNIVERSITY OF STUTTGART Abstract Institute for Computational Physics Master of Science Quantum Machine Learning for Time Series Prediction by Tobias Fellner Time series prediction is an essential task in various fields, such as meteorology, fi- nance and healthcare. Traditional approaches to time series prediction have primar- ily relied on regression and moving average methods, but recent advancements have seen a growing interest in applying machine learning techniques. With the rise of quantum computing, it is of interest to explore whether quantum machine learning can offer advantages over classical methods for time series forecasting. This thesis presents the first large-scale systematic benchmark comparing classical and quan- tum models for time series prediction. A variety of quantum models are evaluated against classical counterparts on different datasets. A novel quantum reservoir com- puting architecture is proposed, demonstrating promising results in handling non- linear prediction tasks. The findings suggest that, for simpler time series prediction tasks, quantum models achieve accuracy comparable to classical methods. How- ever, for more complex tasks, such as long-term forecasting, certain quantum mod- els show improved performance. While current quantum machine learning models do not consistently outperform classical approaches, the results point to specific con- texts where quantum methods may be beneficial. HTTPS://WWW.UNI-STUTTGART.DE/ https://www.icp.uni-stuttgart.de/ vii Summary in German Zeitreihenanalysen sind in vielen Bereichen von zentraler Bedeutung, darunter Me- teorologie, Finanzen und Medizin, da präzise Vorhersagen auf Basis historischer Daten wertvolle Einblicke und Prognosen ermöglichen. Während herkömmliche Methoden wie Regression und Moving Average lange Zeit für die Zeitreihenvorher- sage verwendet wurden, haben maschinelle Lernverfahren in den letzten Jahrzehn- ten zunehmend an Bedeutung gewonnen. Mit der Entwicklung der Quantencom- puter stellt sich die Frage, ob Quantum Machine Learning (QML) einen Vorteil gegen- über klassischen Modellen bieten kann, insbesondere bei der Vorhersage von Zeitrei- hen. Diese Arbeit präsentiert die erste umfassende Benchmark-Studie, die verschiedene Quanten- und klassische Modelle für die Vorhersage von Zeitreihen systematisch miteinander vergleicht. Untersucht werden unterschiedliche Quantenmodelle, da- runter Variational Quantum Circuits (VQC), Quantum Long Short-Term Memory (QLSTM) und Quantum Reservoir Computing (QRC). Besonders berücksichtigt wird dabei die Rolle der Quantenverschränkung, die als potenzielle Quelle eines Quanten- Vorteils gilt. Im Rahmen der Arbeit wird eine neuartige QRC-Architektur entwick- elt, die vielversprechende Ergebnisse insbesondere für nicht-lineare Vorhersageauf- gaben liefert. Die Ergebnisse der Benchmark-Studie zeigen, dass Quantenmodelle bei einfachen Vorhersagen ähnlich gute Ergebnisse wie klassische Modelle erzielen. Für kom- plexere Aufgaben, wie die Vorhersage von bis zu 100 Zeitschritten im Mackey-Glass- Datensatz, können einige Quantenmodelle jedoch eine signifikant höhere Genauigkeit erreichen, insbesondere eine VQC-Architektur und eine QRC-Architektur. Diese Ergebnisse deuten darauf hin, dass QML in spezifischen Szenarien Vorteile gegenüber klassischen Methoden bieten kann. Gleichzeitig zeigt die Arbeit auf, dass in bestimmten Fällen klassische Modelle in der Vorhersagegenauigkeit überlegen sind, insbesondere bei Vorhersagen über kürzere Zeiträume. Zukünftige Forschung sollte sich darauf konzentrieren, die spez- ifischen Klassen von Zeitreihenproblemen zu identifizieren, in denen Quantenmod- elle überlegen sind, und dabei tiefergehende Untersuchungen zu Quantenmecha- nischen Eigenschaften wie der Verschränkungsentropie und der Quantum Fisher Information durchführen. Darüber hinaus eröffnet die Arbeit neue Forschungsrichtungen, insbesondere im Hinblick auf das Lernen mit quantenmechanischen Daten. Während der Schwer- punkt dieser Arbeit auf klassischen Daten lag, könnten Quantenmodelle durch ihre intrinsische Quantenstruktur Vorteile bei der Verarbeitung von quantenmechanis- chen Daten bieten, beispielsweise bei der Klassifikation von Quantenphasen oder der Rekonstruktion von Quantenzuständen. Diese Ansätze könnten das Verständ- nis der praktischen Anwendbarkeit von QML weiter vertiefen und zukünftig zu konkreten Anwendungen von Quantencomputern führen. ix Acknowledgements I would like to begin by expressing my sincerest gratitude to Professor Christian Holm for his guidance and support throughout the process of completing this Mas- ter’s thesis. His experience and physical intuition ensured that I remained on track. I’m extremely grateful to David Kreplin, who first piqued my interest in quan- tum machine learning and provided invaluable guidance throughout the past year, drawing on his extensive experience in the field. Our numerous discussions were instrumental in enhancing the quality of my work and will undoubtedly prove in- valuable as I embark on my future endeavors. I would like to express my gratitude to Daniel Fink for providing me with the opportunity to work on this thesis and for ensuring a smooth start. Special thanks to Samuel Tovey for sharing his expertise on machine learning and quantum reservoir computing and for guiding me through the process of publishing research. I would also like to express my gratitude to the en- tire quantum computing group at the Fraunhofer IPA for their invaluable feedback and support. I am particularly indebted to Simone Blümlein and Frank Huber for their administrative and technical assistance, as well as the entire Institute for Com- putational Physics for welcoming me so warmly. I am excited to continue learning and working with you all throughout my Ph.D. xi Contents Declaration of Authorship iii Abstract v Summary in German vii Acknowledgements ix 1 Introduction 1 2 Theory and Literature Review 3 2.1 Machine Learning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 2.1.1 Supervised Machine Learning . . . . . . . . . . . . . . . . . . . 3 2.1.2 Training a Machine Learning Model . . . . . . . . . . . . . . . . 4 2.1.3 Methods in Machine Learning . . . . . . . . . . . . . . . . . . . 6 2.2 Quantum Computing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2.2.1 Qubits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.2.2 Quantum Gates . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2.2.3 Quantum Measurements . . . . . . . . . . . . . . . . . . . . . . 11 2.2.4 Quantum Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 2.3 Quantum Machine Learning . . . . . . . . . . . . . . . . . . . . . . . . . 13 2.3.1 Variational Quantum Algorithms . . . . . . . . . . . . . . . . . . 13 2.3.2 Data Encoding Strategies . . . . . . . . . . . . . . . . . . . . . . 15 2.3.3 Current Challenges in Quantum Machine Learning . . . . . . . 17 2.4 Reservoir Computing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 2.4.1 Principles of Reservoir Computing . . . . . . . . . . . . . . . . . 19 2.4.2 Quantum Reservoir Computing . . . . . . . . . . . . . . . . . . 20 3 Methodology of Benchmarking Time Series (Quantum) Models 21 3.1 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 3.2 Concept of Time Series Prediction . . . . . . . . . . . . . . . . . . . . . . 21 3.3 Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 3.3.1 Mackey-Glass Equation . . . . . . . . . . . . . . . . . . . . . . . 23 3.3.2 Lorenz Attractor . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 3.4 Classical Machine Learning Models for Time Series Prediction . . . . . 24 3.4.1 Multi-Layer Perceptron . . . . . . . . . . . . . . . . . . . . . . . 25 3.4.2 Recurrent Neural Network . . . . . . . . . . . . . . . . . . . . . 25 3.4.3 Long Short-Term Memory . . . . . . . . . . . . . . . . . . . . . . 26 3.4.4 Extreme Learning Machine . . . . . . . . . . . . . . . . . . . . . 28 3.5 Quantum Machine Learning Models for Time Series Prediction . . . . 28 3.5.1 Variational Quantum Circuit . . . . . . . . . . . . . . . . . . . . 29 3.5.2 Quantum Recurrent Neural Network . . . . . . . . . . . . . . . 32 3.5.3 Quantum Long-Short Term Memory . . . . . . . . . . . . . . . . 34 xii 3.5.4 Quantum Reservoir Computing . . . . . . . . . . . . . . . . . . 36 3.6 Technicalities of Benchmarking . . . . . . . . . . . . . . . . . . . . . . . 38 3.6.1 Hyperparameters and Setup . . . . . . . . . . . . . . . . . . . . 38 3.6.2 Data Preprocessing and Training . . . . . . . . . . . . . . . . . . 41 3.6.3 Measures for Prediction Accuracy . . . . . . . . . . . . . . . . . 41 4 Results and Discussion 43 4.1 Evaluation of Quantum Machine Learning Models . . . . . . . . . . . . 43 4.1.1 Variational Quantum Circuit . . . . . . . . . . . . . . . . . . . . 43 4.1.2 Quantum Recurrent Neural Network . . . . . . . . . . . . . . . 48 4.1.3 Quantum Long Short-Term Memory . . . . . . . . . . . . . . . . 50 4.2 Evaluation of the Quantum Reservoir Computing Architecture . . . . 51 4.3 Comprehensive Benchmark Study . . . . . . . . . . . . . . . . . . . . . 55 5 Conclusion and Outlook 63 A Additional Results 65 A.1 Variational Quantum Circuits . . . . . . . . . . . . . . . . . . . . . . . . 65 A.2 Quantum Recurrent Neural Network . . . . . . . . . . . . . . . . . . . 68 A.3 Quantum Long Short-Term Memory . . . . . . . . . . . . . . . . . . . . 69 A.4 Quantum Reservoir Computing . . . . . . . . . . . . . . . . . . . . . . . 70 A.5 Benchmark . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 Bibliography 73 xiii List of Abbreviations MSE Mean Squared Error MAE Mean Absolute Error MLP Multi Layer Perceptron QML Quantum Machine Learning VQA Variational Quantum Algorithm VQC Variational Quantum Circuit PQC Parameterized Quantum Circuit QNN Quantum Neural Network ELM Extreme Learning Machine RC Reservoir Computing QRC Quantum Reservoir Computing RNN Recurrent Neural Network LSTM Long Short-Term Memory DVQC Dressed Variational Quantum Circuit QRNN Quantum Recurrent Neural Network QLSTM Quantum Long Short-Term Memory LE-QLSTM Linear Enhanced Quantum Long Short-Term Memory MAD Median Absolute Deviation PCC Pearson Correlation Coefficient 1 Chapter 1 Introduction In our daily lives, we frequently encounter sequential data across various domains. Examples include meteorological data, such as weekly temperature trends, financial data, such as annual index values, and medical or sports data, such as heart rate measurements over the duration of training sessions. Over the last century, signif- icant efforts have been dedicated to developing methods for analyzing sequential data. A primary objective is to predict future values in a time series based on his- torical data [1, 2]. Accurate extrapolation from time series can provide substantial benefits across diverse fields, including the natural and social sciences. Initially, models for time series prediction predominantly utilized regression and moving averages [3]. However, in the past two decades, there has been a notable shift towards the exploration of machine learning techniques [4–6]. These approaches involve optimizing the parameters of artificial neural networks, enabling them to learn from the provided data and subsequently extrapolate to forecast future data points. Given the importance of time series prediction, investigating novel methodolo- gies is warranted. Research in quantum computing suggests that quantum comput- ers may surpass classical computers in specific tasks, such as integer factorization [7] and unstructured database searches [8]. Leveraging quantum mechanical properties like superposition and entanglement, quantum computing has the potential to offer computational advantages in handling vast datasets [9, 10]. The last decade has seen the emergence of quantum machine learning (QML), which extends the principles of machine learning to the quantum domain [11, 12]. A core concept involves iterative optimization of parameters within a variational quantum circuit (VQC) to learn a given task. Recent years have witnessed the pro- posal of various QML models for time series analysis [13–17]. However, it remains unclear whether and in which contexts QML methods offer an advantage over clas- sical approaches [18]. Furthermore, a comprehensive comparison between proposed predictive time series quantum models and its classical counterparts is lacking. In this work, we present the first large-scale systematic benchmark study com- paring different quantum and classical models for time series prediction. The bench- mark encompasses a diverse range of learning tasks across different datasets for a wide variety of model architectures. We examine the role of entanglement in the learning processes of quantum models, as this property is often considered the source of potential quantum advantage. Additionally, we propose a novel quantum reservoir computing architecture for time series prediction and demonstrate its po- tential benefits for quantum hardware computations compared to other proposed models. For time series prediction tasks that involve forecasting a small number time steps ahead, our results indicate that quantum models, at best, match the prediction accuracy of classical methods. In such cases, classical approaches seem to be better 2 Chapter 1. Introduction suited for time series forecasting. However, for more complex prediction challenges, certain quantum machine learning models as well as the proposed quantum reser- voir computing architecture, demonstrate promising performance and suggesting potential benefits. This thesis is organized as follows. Chapter 2 establishes the theoretical foun- dation, introducing fundamental concepts in machine learning and quantum com- puting. We provide an introduction to quantum machine learning and an overview of quantum reservoir computing. In Chapter 3, we discuss the methodology of the benchmark study, including the mathematical framework for time series prediction employed in this work. We also cover the classical and quantum models utilized, along with details regarding the benchmark setup, hyperparameter choices, and datasets. Chapter 4 presents an in-depth analysis of the results and their implica- tions, along with arguments supporting our quantum reservoir approach. Finally, Chapter 5 concludes the work and offers an outlook for future research directions. 3 Chapter 2 Theory and Literature Review 2.1 Machine Learning Over the last few decades, substantial research efforts have been dedicated to the study of machine learning (ML). With the increasing volume of available data, it is becoming ever more critical to develop algorithms capable of generalizing from data patterns and making predictions in situations with limited information. ML has proven to be an effective tool for tasks such as classifying labeled datasets of images [19–21] or learning patterns in multi-dimensional time series [22, 23]. Such a learning strategy is called supervised learning [24]. We also want to mention the unsupervised learning task [25], where the goal is to learn the probability distribution of a dataset D = {x1, . . . , xM} to generate new samples from it. However, since this thesis focuses on supervised learning, we will only cover supervised ML in the following. In this chapter, we introduce the fundamentals of ML relevant to this thesis, fol- lowing chapter two of the textbook "Machine Learning with Quantum Computers" by Maria Schuld [26]. We begin by defining the supervised learning problem and explaining the training process before introducing different machine learning meth- ods. 2.1.1 Supervised Machine Learning In a supervised learning task, the objective is to establish a relationship between an input domain X and an output domain Y . Let D = {(x1, y1), . . . , (xM, yM)} be a dataset of pairs (xm, ym) ∈ X × Y with inputs xm and target outputs ym. The goal is to learn the underlying probability distribution between inputs and target outputs to predict the outputs y ∈ Y for unseen inputs x ∈ X . We can categorize learning tasks into classification and regression problems, dis- tinguished by the nature of their output domain Y . In classification tasks, Y is a set of D discrete class labels {l1, . . . , lD}. For instance, in a task involving the classifica- tion of images of cats and dogs, each with n × m pixels, the input domain might be a matrix in Rn × Rm. The output domain on the other hand would be Y = {−1, 1}, where -1 represents a cat and 1 represents a dog, allowing for exchanged labeling configurations. Conversely, in regression tasks, the output domain Y is continuous. For example, in predicting a stock index based on n economic measures, the input domain could be a vector in Rn, and the output domain would be a continuous value in R representing the stock index’s value on the following day. Since time se- ries prediction is a regression problem, this thesis will primarily focus on regression tasks. 4 Chapter 2. Theory and Literature Review To map from the input domain X to the output domain Y , we define a model as a function f : X → Y , f (xm) = ym, xm ∈ X , ym ∈ Y , (2.1) that replicates the characteristics of data samples (xm, ym) of a dataset D = {(x1, y1), . . . , (xM, yM)} . (2.2) The model can depend on parameters θ, thereby defining a model family { fθ}. To select the model out of the model family that reproduces the probability distribution of the dataset D best, we require a measure for the accuracy of the model. This measure can be formalized by defining a loss. For classification tasks this can be based on the accuracy of classifying elements correctly, accuracy = number of correctly classified elements total number of elements . (2.3) The corresponding loss, representing the error rate, is error = 1 − accuracy . (2.4) In scenarios with a continuously-valued output domain, a continuous-valued mea- sure is necessary. A widely adopted loss function for regression tasks is the Mean- Squared-Error (MSE) L( fθ(x), y) = ( fθ(x)− y)2 . (2.5) Alternatively, the Mean-Absolute-Error (MAE) provides another approach, L( fθ(x), y) = | fθ(x)− y| . (2.6) Various other loss functions like the Root-Mean-Square-Error, the Mean-Bias-Error or the Relative-Absolute-Error have been introduced, each suited to different ob- jectives. The choice of the most suitable loss depends on the specific goals of the task at hand. For example, mean-squared-error is more sensitive to large deviations between predicted and actual values compared to mean-absolute-error. 2.1.2 Training a Machine Learning Model Training a supervised machine learning model entails identifying the optimal model f ∗θ within the model family { fθ} that minimizes the cost function L( fθ∗(x), y) θ∗ = argmin θ L( fθ∗(x), y) = argmin θ 1 M M ∑ m=1 L( fθ(xm), ym) (2.7) for a chosen loss L over M data samples (xm, ym) in a dataset D. This process is equivalent to optimizing the parameter set θ∗ for the parameterized model fam- ily. To determine the optimal solution, the parameters of the cost function L(θ) ≡ L( fθ(x), y) can be iteratively updated by θ(t+1) = θ(t) − η∇L(θ(t)) . (2.8) In this method known as gradient descent, the parameters are updated in each itera- tion t by a term that includes the learning rate η and the gradient of the cost function ∇L(θ(t)). This approach drives the cost function towards a minimum L(θ∗) within 2.1. Machine Learning 5 FIGURE 2.1: Training updates within the cost landscape of a one- dimensional parameter space. Gradient descent algorithms may be- come trapped in local minima, and convergence at saddle points can be slow. This figure is adapted from Figure 2.14 in [26]. the landscape defined by L(θ). In order to efficiently compute the gradient of the cost function with respect to each parameter, a method known as backpropagation is typically employed. However, gradient descent can result in the cost function be- coming stuck in a local minimum or experiencing slow convergence at saddle points, as shown in Figure 2.1. To mitigate these issues, one can extend the concept of gradient descent to stochas- tic gradient descent. This method introduces stochastic, or dynamic, elements into the parameter update process. For example, by selecting a subset of randomly sam- pled data to perform a single parameter update, the algorithm can potentially es- cape local minima due to the inherent stochasticity of the data sampling process [27]. These subsets of data are referred to as batches, and a full cycle of parameter updates for all data in training is called an epoch. A related and widely used optimization algorithm is the Adam optimizer [28], which dynamically adjusts the learning rate and bases the update of individual parameters on changes made in previous steps. The Adam optimizer will be predominantly utilized throughout this thesis. One fundamental problem that can occur during training is overfitting, where a model captures the data used in training but fails to generalize to new data from the underlying probability distribution. This phenomenon is demonstrated in Fig- ure 2.2 (a) for a regression task. To address overfitting, the dataset is typically split into three distinct sets: training data used for model parameter updates, validation data used to monitor performance during training, and test data used to evaluate the final model’s generalizability. A common strategy is to halt training when the vali- dation error begins to rise, as illustrated in Figure 2.2 (b), indicating that the model is overfitting to the training data and losing its ability to generalize effectively. 6 Chapter 2. Theory and Literature Review FIGURE 2.2: (a): Overfitting in a regression task. The data points highlighted in green are used for training. The trained model (red line) fits the training data perfectly but fails to generalize to unseen data. The entire dataset is better represented by the linear trend (blue line) than by the trained model. (b): Training, validation, and test costs over the epochs of training. In the event of overfitting, the train- ing loss decreases further while the validation loss begins to increase. When this occurs, training should be stopped to prevent further over- fitting. These figures are adapted from Figures 2.11 and 2.15 in [26]. 2.1.3 Methods in Machine Learning Having established how supervised machine learning models are trained, we now shift our attention to understanding the underlying structures of these models. A linear model fw is a simple parameterized function mapping an input domain X to an output domain Y . In the context of real-valued vectors, this model takes an input x ∈ RN and transforms it using a weight vector w ∈ RN by fw(x) = wTx . (2.9) We note that the linear model can also incorporate a scalar bias b ∈ R. However, this bias can be absorbed into the notation by extending w with an additional dimension and adding an additional value x0 = 1 to x. The weight vector w is optimized during training to minimize the associated cost. However, linear models can only capture linear dependence in the data. For many problems, however, a nonlinear de- scription is relevant. A commonly used nonlinear model is a neural network. They offer greater flexibility and complexity by combining multiple perceptrons, denoted as ϕ(a). Each perceptron receives a weighted input a = wTx and then applies an activation function ϕ. The concept of a perceptron is illustrated in Figure 2.3 (a). Dif- ferent activation functions can be used, the most common ones include the sigmoid function ϕ(a) = 1 1 + e−a , (2.10) the hyperbolic tangent ϕ(a) = tanh a (2.11) or the rectified linear units ϕ(a) = { a if a > 0 0 else. (2.12) 2.2. Quantum Computing 7 FIGURE 2.3: (a): Graphical representation of a perceptron. The per- ceptron receives a weighted input, denoted as wTx, and outputs a value y. (b): By stacking multiple perceptrons, a neural network with layered perceptrons can be constructed. In this configuration, the out- put of perceptrons in one layer serves as the input for the perceptrons in the subsequent layer. The figures are adapted from Figures 2.17 and 2.18 in [26]. These activation functions add nonlinearity to the model. By stacking multiple perceptrons in a layered structure, we construct a neural network, with the output of multiple perceptrons serving as the weighted input for the next. The set of perceptrons within layer i is denoted as ϕi in the following. A prime example is the feed-forward neural network, represented as fW1,W2,...,WL(x) = ϕL(WL · · ·ϕ2(W2ϕ1(W1x)) · · · ) . (2.13) Here, the input vector x ∈ RN is processed through L layers l = 1, . . . , L. Each layer contains Jl perceptrons with weights Wl summarized in RJl×Jl matrices. The layered structure has led to the alternative name "Multi-Layer Perceptron" (MLP). As shown in Figure 2.3 (b), data from the input domain is passed through hidden layers of perceptrons hl 1, · · · , hl Jl before reaching the output domain Y . The MLP, being a fundamental architecture, has paved the way for a wide range of neural network architectures tailored to specific tasks. For sequential data processing, prominent examples include Recurrent Neural Networks (RNNs) [29, 30] and Long Short-Term Memory (LSTM) networks [22], which are discussed in Chapter 3. 2.2 Quantum Computing In the following, we introduce the fundamental elements of quantum computing. We begin with the computational unit of quantum computing, the qubit, and move on to basic quantum operations known as quantum gates. Next, we discuss quan- tum measurements as well as the quantum circuit, which is the computational unit for describing quantum algorithms. The following sections present a general intro- duction to quantum computing and its commonly used notations. A more detailed 8 Chapter 2. Theory and Literature Review FIGURE 2.4: The Bloch sphere representation of the qubit state |Ψ⟩ illustrates the state as a unit vector on the sphere, defined by two angles, θ and ϕ. The computational states |0⟩ and |1⟩ are located at the north and south pole of the sphere, respectively. This figure is inspired by Figure 1.3 in [31]. introduction can be found in the textbook “Quantum Computation and Quantum Information” by Nielsen and Chuang [31] from which we adapted our notation. 2.2.1 Qubits The fundamental computational unit in classical computation is a bit, which can ei- ther be in state 0 or 1. In the context of quantum computing, this fundamental unit is extended to the quantum bit, or qubit for short. A qubit can be understood as a physical quantum two-level system, such as a spin, which can be in a spin-up or spin-down state. Utilizing bra-ket notation, we can, without loss of generality, des- ignate the state with lower energy as |0⟩ and the state with higher energy as |1⟩. In the quantum-classical analogy, these states correspond to the classical computational states 0 and 1. In contrast to classical states, quantum states allow for superposition, whereby a qubit can exist simultaneously in states |0⟩ and |1⟩: |Ψ⟩ = α |0⟩+ β |1⟩ , (2.14) where α, β ∈ C and |α|2 + |β|2 = 1. This property is a fundamental feature for a potential advantage of quantum computing over classical computing. The normal- ization condition must be considered because α and β can be interpreted as proba- bility amplitudes. Measuring the quantum state |Ψ⟩ results in |0⟩ with probability 2.2. Quantum Computing 9 |α|2 and |1⟩ with probability |β|2. Consequently, the qubit state is mathematically represented as a unit vector in the two-dimensional complex Hilbert space H2. An illustrative representation of a qubit is achieved by interpreting its quantum state as a unit vector on the Bloch sphere, as depicted in Figure 2.4. The state can be expressed in terms of spherical coordinates: |Ψ⟩ = cos θ 2 |0⟩+ eiϕ sin θ 2 |1⟩ . (2.15) Here, the overall phase of the state is chosen in a way that the amplitude of |0⟩ is real. A unit vector aligned along the z-axis corresponds to the |0⟩ state, while a unit vector pointing in the opposite z-direction corresponds to the |1⟩ state. States where the unit vector aligns with other axes are commonly referred to in the literature as: |+⟩ = 1√ 2 (|0⟩+ |1⟩) , |−⟩ = 1√ 2 (|0⟩ − |1⟩) , |i⟩ = 1√ 2 (|0⟩+ i |1⟩) , |−i⟩ = 1√ 2 (|0⟩ − i |1⟩). (2.16) 2.2.2 Quantum Gates In order to perform computations on the qubits, we have to define operations on the quantum state. Such operations are called quantum gates. We first discuss the mathematical formalism for gates on only one qubit before moving on the multi- qubit gates. As the quantum state of a single qubit can mathematically be described as a unit- vector in the complex two dimensional Hilbert space H2, operations on the state have to be unitary in order to preserve the norm. The single-qubit Pauli gates X = |0⟩ ⟨1|+ |1⟩ ⟨0| Y = −i |0⟩ ⟨1|+ i |1⟩ ⟨0| Z = |0⟩ ⟨0| − |1⟩ ⟨1| (2.17) can be understood as π rotations of the quantum state around the corresponding axis in the Bloch sphere picture up to a phase. Following Dirac-Notation, ⟨·| is the conjugate transpose of |·⟩. The X gate is the analog to the classical NOT operation to the states |0⟩ and |1⟩: X(α |0⟩+ β |1⟩) = β |0⟩+ α |1⟩ . (2.18) The Z gate adds a phase to the state |1⟩: Z(α |0⟩+ β |1⟩) = α |0⟩ − β |1⟩ . (2.19) Finally, the Y gate flips the amplitudes of |0⟩ and |1⟩ and adds a phase: Y(α |0⟩+ β |1⟩) = −iβ |0⟩+ iα |1⟩ . (2.20) 10 Chapter 2. Theory and Literature Review Another important single-qubit gate is the Hadamard gate H, which creates equal superpositions when applied to the states |0⟩ and |1⟩: H |0⟩ = 1√ 2 (|0⟩+ |1⟩) = |+⟩ , H |1⟩ = 1√ 2 (|0⟩ − |1⟩) = |−⟩ . (2.21) Furthermore, rotations with an arbitrary angle θ on the Bloch sphere around a Carte- sian axis can be archived by applying the rotation gates Rx(θ) = exp ( −i θ 2 X ) = cos θ 2 |0⟩ ⟨0| − i sin θ 2 |0⟩ ⟨1| − i sin θ 2 |1⟩ ⟨0|+ cos θ 2 |1⟩ ⟨1| , Ry(θ) = exp ( −i θ 2 Y ) = cos θ 2 |0⟩ ⟨0| − sin θ 2 |0⟩ ⟨1| + sin θ 2 |1⟩ ⟨0|+ cos θ 2 |1⟩ ⟨1| , Rz(θ) = exp ( −i θ 2 Z ) = ei θ 2 |0⟩ ⟨0|+ ei θ 2 |1⟩ ⟨1| . (2.22) To let different qubits in the same computational process interact with each other, one needs to introduce multi-qubit gates. The quantum state of a n-qubit system is described by a unit-vector in the 2n dimensional Hilbert space H2n . For example for n = 2, let |Ψ1⟩ and |Ψ2⟩ be the quantum state of two single qubits: |Ψ1⟩ = α |0⟩+ β |1⟩ , |Ψ2⟩ = γ |0⟩+ δ |1⟩ . (2.23) In this case, the quantum state of the two qubit system |Ψ⟩ consisting of the two qubits in states |Ψ1⟩ and |Ψ2⟩ can be constructed by the tensor product of the single- qubits states |Ψ⟩ = |Ψ1⟩ ⊗ |Ψ2⟩ = αγ |0⟩ ⊗ |0⟩+ αδ |0⟩ ⊗ |1⟩+ βγ |1⟩ ⊗ |0⟩+ βδ |1⟩ |1⟩ . (2.24) To simplify the notation, the tensor product symbol ⊗ is omitted in the following: |i⟩ ⊗ |j⟩ = |ij⟩ . Multi-qubit gates are unitary operations on H2n . They play a crucial role in quantum computing as they can lead to entangled quantum states. We call a n-qubit quantum system in state |Ψ⟩ entangled if the quantum state can not be expressed as a product of single-qubit states |Ψi⟩ |Ψ⟩ = |Ψi⟩ ⊗ |Ψ2⟩ ⊗ · · · ⊗ |Ψn⟩ . (2.25) Entanglement is a crucial element in the field of quantum computing, as it gives ac- cess to all possible normalized state configurations within the Hilbert space. Along- side superposition, it is a fundamental property for a potential computational ad- vantage of quantum algorithms over their classical counterparts. An important two- qubit gate is the quantum controlled NOT (CNOT) gate: CNOT = |00⟩ ⟨00|+ |01⟩ ⟨01|+ |10⟩ ⟨11|+ |11⟩ ⟨10| . (2.26) 2.2. Quantum Computing 11 It is the quantum counterpart to the classical CNOT gate. The first qubit is called the control qubit, the second qubit is called the target qubit. Only if the control qubit is in state |1⟩, the target qubit is flipped: CNOT |00⟩ = |00⟩ , CNOT |01⟩ = |01⟩ , CNOT |10⟩ = |11⟩ , CNOT |11⟩ = |10⟩ . (2.27) Based on the state of the control qubit, a Pauli-X rotation on the target qubit is per- formed. Thus, the CNOT gate is also called the controlled X-gate (CX). In general, we can define a controlled two qubit gates CU for an arbitrary unitary operation U on the target qubit. We want to finalize our discussion of quantum gates by demonstrating that con- trolled multi-qubit gates can lead to entangled states. We consider a two qubit sys- tem and a CNOT gate. Let the first qubit be initially in state |+⟩ and the second qubit is in state |0⟩. The quantum state of the two qubit system is |Ψ⟩ = |+⟩ ⊗ |0⟩ = 1√ 2 (|0⟩+ |1⟩)⊗ |0⟩ = 1√ 2 (|00⟩+ |10⟩) . (2.28) Applying the CNOT gate to the state gives |Ψ′⟩ = CNOT |Ψ⟩ = 1√ 2 (|00⟩+ |11⟩) . (2.29) It is impossible to write the state |Ψ′⟩ as a product of single-qubit states |Ψ1⟩ ⊗ |Ψ2⟩. Therefore the state |Ψ′⟩ is entangled. 2.2.3 Quantum Measurements To obtain information about an n-qubit quantum state, one must perform quantum measurements, which are defined as a set {Mm} of measurement operators acting on the complex Hilbert space H2n . The index m denotes the different possible outcomes of the quantum measurement. Given a quantum state |Ψ⟩ prior to measurement, the probability of observing outcome m is expressed as p(m) = ⟨Ψ| M† m Mm |Ψ⟩ . (2.30) The measurement operators Mm must satisfy the completeness relation ∑ m M† m Mm = I , (2.31) ensuring that the probabilities of all possible outcomes sum to one: 1 = ∑ m p(m) = ∑ m ⟨Ψ| M† m Mm |Ψ⟩ . (2.32) A special case of quantum measurements are projective measurements. They are defined by a hermitian operator M acting on H2n . This operator can be decomposed as M = ∑ λ Pλ , (2.33) 12 Chapter 2. Theory and Literature Review where Pλ is the projector onto the eigenspace of M with eigenvalue λ. The probabil- ity of obtaining the result λ is given by p(λ) = ⟨Ψ| Pλ |Ψ⟩ . (2.34) Let λ be the outcome of a measurement, the state of the quantum system after measuring M is given by Pλ |Ψ⟩√ p(λ) (2.35) In general, measuring causes the wavefunction corresponding to the quantum state before measurement to collapse, reducing the quantum state |Ψ⟩ to the eigenstate associated with the measured eigenvalue λ. The advantageous property of projective measurements is that it is easy to calcu- late the average value of a measurement, called the expectation value E|Ψ⟩(M) = ∑ λ λp(λ) = ∑ λ λ ⟨Ψ| Pλ |Ψ⟩ = ⟨Ψ| ( ∑ λ λPλ ) |Ψ⟩ = ⟨Ψ| M |Ψ⟩ . (2.36) In quantum computing, a crucial set of measurements involves the Pauli opera- tors X, Y, and Z, as defined in Equation (2.17). The eigenvalues of these operators are λ ∈ {−1, 1}, thus the expectation value is constrained within the interval [−1, 1]. For multi-qubit systems, it is feasible to measure an operator that is the tensor prod- uct of multiple Pauli operators. For instance, in a three-qubit system, one might measure Z ⊗ X ⊗ Z ≡ ZXZ , (2.37) where ZXZ is referred to as the Pauli string representation of the measurement. 2.2.4 Quantum Circuit Combining the elements explored in the previous sections, we arrive at quantum circuits, the fundamental building blocks of quantum computation. A quantum cir- cuit consists of multiple qubits, typically initialized in their ground state |0⟩. Various quantum gates can be applied to manipulate this multi-qubit state. Finally one can perform measurements on the resulting quantum state. This process can be illus- trated by a circuit diagram as shown in Figure 2.5 (a). Each qubit is represented by a horizontal line. The corresponding circuit diagram symbols for the quantum gates introduced above are shown in Figure 2.5 (b). For single-qubit gates, the operation is indicated within a box. For two-qubit gates, a dot marks the control qubit, while the operation applied to the target qubit is shown in the connected box. This visual representation provides a clear overview of the operations within the circuit. 2.3. Quantum Machine Learning 13 FIGURE 2.5: The circuit diagram of a quantum circuit is shown in (a). Single qubits are represented by horizontal lines. Quantum gates cor- respond to boxes on and between different lines. Different quantum single and two qubit gates are drawn in (b). Measurements are indi- cated by a measurement symbol. 2.3 Quantum Machine Learning In the previous two chapters, we introduced the research areas of machine learn- ing and quantum computing. Each of these fields has the potential to solve spe- cific problems efficiently. Combining them, therefore, presents an opportunity to leverage the strengths of both. This emerging interdisciplinary field is known as quantum machine learning (QML). The fundamental concept in this area of research is to utilize quantum circuits for specific learning tasks. Over the past few years, various QML algorithms have been proposed, including variational quantum algo- rithms (VQAs) [32] and quantum kernel methods [33]. In this thesis, we focus on the former, as they provide a general framework for solving various tasks including time series analysis. In this chapter, we present the foundational concepts of VQAs, discuss methods for encoding data into quantum states, and explain how to train VQAs. Unless otherwise specified, we follow chapters three and five of the textbook "Machine Learning with Quantum Computers" by Maria Schuld [26]. 2.3.1 Variational Quantum Algorithms The concept of a VQA involves using a parameterized quantum system to execute a learning task. When the quantum system is a quantum circuit, these algorithms are referred to as variational quantum circuits (VQCs) or parameterized quantum circuits (PQCs). These can be viewed as quantum analogs to classical neural net- works, as discussed previously in 2.1, and are thus also often called quantum neural networks (QNNs). The idea of using a VQC for a learning task is illustrated in Fig- ure 2.6. The central component is a quantum circuit U(x, θ), where data x can be encoded, and it contains parameters θ. In the analogy between neural networks and VQCs, these parameters correspond to weights in a classical neural network. The parameters can be realized on a quantum circuit by parameterized rotation gates as introduced in Equation (2.22). Let |Ψ(x, θ)⟩ represent the quantum state prepared by applying U(x, θ) to |0⟩. We can measure the expectation value of some chosen observable M to gain insights into the prepared quantum state. This process defines a function fθ(x) = ⟨Ψ(x, θ)| M |Ψ(x, θ)⟩ (2.38) 14 Chapter 2. Theory and Literature Review FIGURE 2.6: Variational quantum circuits involve encoding data into a parameterized quantum circuit. By measuring the expectation val- ues of observables on the quantum state, one can calculate a cost func- tion. The objective of the learning task is to minimize this cost by ad- justing the parameters of the quantum circuit accordingly. This figure is inspired by Figure 1 in [32]. which characterizes a variational quantum model. Similar to classical supervised machine learning, the outputs for different input data are used to compute a cost function. This cost function can be minimized by updating the parameters θ using optimization techniques, as in classical ML described in Section 2.1. For the quantum circuit U(x, θ) itself, various architectures have been proposed. A specific arrangement of quantum gates on the quantum circuit is called an ansatz. Choosing an appropriate ansatz is a complex task and depends heavily on the learn- ing task at hand. Nevertheless, we aim to provide an overview of the fundamen- tal building blocks of quantum circuits used in VQAs. One can distinguish be- tween data encoding blocks E(x) and variational blocks V(θ), as illustrated in Fig- ure 2.7 (a). The former is responsible for encoding data into a quantum state. We will discuss different encoding strategies in the subsequent section. The variational block, on the other hand, contains the parameters that can be optimized during the training process. It has been demonstrated that a layered structure, repeating these two blocks, enhances the model’s expressivity [34]. This approach is known as data re-uploading and is depicted in Figure 2.7 (b). For the structure of the variational blocks V(θ), one can distinguish between single-qubit gate blocks and entangling blocks. Single-qubit gate blocks introduce trainable parameters through parameter- ized single-qubit rotations. For instance, one could employ a block of Pauli rotation gates as defined in Equation (2.22). An example of such a structure is shown in Figure 2.7 (c). The purpose of an entangling block is to connect individual qubits using multi-qubit gates. This approach allows the quantum circuit’s quantum state to explore the full n-qubit Hilbert space of dimension dim(H2n) = 2n, rather than being confined to the product space of n single-qubit Hilbert spaces of dimension dim(nH2) = 2n. An example of an entangling block is shown in Figure 2.7 (d), where CNOT gates, as defined in Equation (2.26), are applied to all qubits in a nearest-neighbor fashion. However, various entangling architectures and gates can 2.3. Quantum Machine Learning 15 FIGURE 2.7: (a): Basic structure of a variational quantum circuit. In a data encoding block, E(x), data is encoded into a quantum state, whereas a variational block, V(θ), includes trainable parameters. (b): The data re-uploading scheme. It has been shown that quantum mod- els with this ansatz exhibit higher expressivity [34]. (c): Example of a single-qubit gate block featuring Pauli rotation gates. The optimiza- tion of the rotation gate angles occurs during the training process. (d): Entangling Block, where individual qubits are coupled via CNOT gates between nearest neighbors. be employed. For example, controlled rotation gates can be used, making the en- tangling block explicitly parameter-dependent. While these architectures are widely used in the literature, it is important to emphasize that selecting a specific ansatz is a nontrivial task, with many variations available [35, 36]. Nevertheless, throughout this thesis, we will primarily adhere to the structures presented in Figure 2.7. 2.3.2 Data Encoding Strategies Efficiently encoding data into a quantum state is of crucial importance for success- fully employing quantum models for learning tasks and are seen as a key bottleneck for QML [34, 37]. In the following we introduce the most important encoding strate- gies and discuss their individual advantages and disadvantages. Basis Encoding One straightforward way to encode data into a quantum state is by assigning an n- bit representation of a number to a computational basis state of an n-qubit quantum system; for example, |5⟩ = |0101⟩. Similar to classical computers, binary representa- tions can be defined for all numbers x ∈ C. However, the bit length scales with the precision required to represent the number. Therefore, encoding can require a large number of qubits, which is infeasible for most quantum machine learning tasks. 16 Chapter 2. Theory and Literature Review Amplitude Encoding A different encoding strategy assigns classical data to quantum amplitudes in some basis. For example, a normalized vector x ∈ C2n , where ∑k |xk|2 = 1, can be ex- pressed by the amplitudes of a quantum state x =  x1 ... x2n ↔ |ψx⟩ = 2n−1 ∑ j=0 xj |j⟩ , (2.39) where the states |j⟩ form a basis. For instance, a normalized vector x = (x1, x2, x3, x4) can be represented by a two-qubit system as |Ψx⟩ = x1 |00⟩+ x2 |01⟩+ x3 |10⟩+ x4 |11⟩ . (2.40) Note that the number of qubits needed to encode n complex values scales with log2(n), making this method more efficient in terms of qubit usage compared to basis encoding. However, there are limitations to this encoding strategy. First, due to the required normalization condition, vectors u and v that are scalar multiples of each other, u = αv with α ∈ C, are effectively mapped to the same normalized vector. Thus, an additional dimension is needed to capture the normalization fac- tor to retain information about the actual length of the vector. Second, and more severe, preparing a quantum state according to the amplitude vectors can be very complex and require many quantum gates on actual quantum hardware. While this encoding strategy has been explored in the context of quantum machine learning tasks [38, 39], a more hardware-efficient strategy is widely studied and applied in quantum machine learning tasks. We will introduce this concept in the following section. Angle Encoding In angle encoding, a scalar value x ∈ R corresponds to the time t of a unitary evolu- tion governed by a Hamiltonian H U(x) = e−ixH . (2.41) The resulting quantum state after applying the unitary transformation is |Ψ(x)⟩ = U(x) |Ψ0⟩. This state depends on the value of x, with the dependence determined by the Hamiltonian H. To encode a single value onto one qubit, a common choice for the Hamiltonian is H = 1 2O, where O ∈ {X, Y, Z} represents one of the Pauli gates, as described in Equation (2.17). With Equation (2.21), the unitary encoding becomes identical to the single-qubit rotation gates Rx(x), Ry(x), and Rz(x). These gates rotate the single-qubit quantum state by an angle x on the Bloch sphere around the respective axis. In this scheme, all values must be scaled into the interval x ∈ [0, 2π[ due to the 2π periodicity of the rotation. For example, using Rx rotation gates to encode a vector x = (x1, x2, x3, x4) into a quantum state leads to |Ψx⟩ = ( cos x1 2 |0⟩ − i sin x1 2 |1⟩ ) ⊗ ( cos x2 2 |0⟩ − i sin x2 2 |1⟩ ) ⊗ ( cos x3 2 |0⟩ − i sin x3 2 |1⟩ ) ⊗ ( cos x4 2 |0⟩ − i sin x4 2 |1⟩ ) . (2.42) 2.3. Quantum Machine Learning 17 FIGURE 2.8: (a): Pauli rotations gates Rx are used to encode a vec- tor x ∈ R4. (b): By employing a layered structure as in the data re-uploading scheme, different values can be encoded onto the same qubit. The circuit diagram for this encoding is shown in Figure 2.8 (a). The number of qubits involved equals the number of values to be encoded. However, by using a data re-uploading structure, as introduced in the previous section, multiple values can be encoded onto the same qubit in a layered structure, as shown in Figure 2.8 (b). For a fixed layered structure, the number of qubits required scales linearly with the number of values to be encoded. Due to the efficient scaling of qubits and the ease of implementing this encoding strategy on real quantum hardware, this design is favored by many quantum machine learning researchers [34, 40]. In this thesis, we will predominantly employ this encoding strategy. 2.3.3 Current Challenges in Quantum Machine Learning After introducing the core concepts of QML, we conclude this section with a sum- mary of the current challenges in the field [40]. First, we address the challenge of selecting appropriate architectures for VQAs. We then examine the limitations of implementing QML methods on current quantum hardware. Finally, we provide an overview of the phenomenon of barren plateaus. Architecture design of Variational Quantum Algorithms As previously indicated in Figure 2.7, there is a massive number of potential config- urations for the ansatz of VQAs. The arrangement of single and multi-qubit gates is arbitrary. Identifying the optimal ansatz is a highly challenging process that de- pends on the specific problem being considered [35, 36]. In light of the vast number of potential configurations, identifying an optimal one may necessitate exponen- tially increasing resources, which could ultimately impede the potential for quan- tum acceleration. It is therefore imperative to investigate the impact of the ansatz on the model capabilities. The strategies that have been investigated thus far are predominantly based on classical machine learning methods. For instance, in the work [41, 42] reinforcement learning to identify an optimal ansatz for a given prob- lem is utilized. In [43] , a supervised learning technique was employed to identify an appropriate ansatz. However, it should be noted that these methods still necessi- tate additional resources, as the architecture of a quantum model must be optimized even before training the model itself. The theoretical investigation of the influence of ansatz design on model performance remains an ongoing research question. 18 Chapter 2. Theory and Literature Review Computation on Quantum Hardware The training of VQAs on quantum computers presents a series of challenges. It is notable that the current generation of quantum computers exhibits hardware noise, which refers to the corruption of gate operations or the quantum state itself by ex- ternal sources such as electromagnetic influences or thermal fluctuations [44]. While considerable effort has been dedicated to minimizing errors and developing error- correcting schemes [45, 46], it is imperative to consider the constraints imposed by hardware when evaluating the current capabilities of quantum machine learning models. On the one hand, noise does impact the accuracy of quantum machine learning models. On the other hand, it can impact the trainability of the model as well, [47]. When the loss landscape spanned by the trainable parameters θ and de- fined by the loss function L(θ) gets noisy, it becomes more challenging to navigate through the loss landscape to a minimum. Secondly, as quantum mechanical measurements are a statistical process, it is necessary to execute a quantum circuit with subsequent measurement multiple times and then to average the resulting measurement data in order to obtain an estimate of the property being measured. Each run is referred to as a shot. Due to the depen- dence on multiple circuit evaluations, noise resulting from finite sampling is intro- duced. The uncertainty of a measured expectation value scales with 1/ √ N, where N is the number of shots used to estimate the expectation value [48]. Therefore, a sufficient number of shots must be performed to estimate an expectation value with sufficient accuracy, in order to enable the training of a quantum machine learning model. A further challenge in applying quantum machine learning models to quantum hardware is the calculation of the gradients of the trainable parameters during the training procedure. In contrast to classical ML, it is not feasible to directly calculate the gradient of each trainable parameter via backpropagation. In order to calculate the gradient of parameters in VQCs, the parameter shift rule can be applied [49, 50]. This method allows for the calculation of the gradient of the expectation value f (x, θ) with respect to each parameter θi within the set of parameters θ. When a parameter θi is shifted by some value h ∈ R, the gradient in direction êi can be determined by ∂ f (x, θ) ∂θi = f (x, θ + êih)− f (x, θ − êih) 2 sin(h) . (2.43) It should be noted that in order to train a quantum machine learning model, it is necessary to determine the expectation values f (x, θ + êih) and f (x, θ − êih) for each parameter in the set of parameters, which requires the use of quantum computing resources that scale linearly with the number of parameters in the model. Barren Plateaus Barren plateaus are a phenomenon observed in VQAs, where the loss landscape, defined by the loss function L(θ) and spanned by the quantum parameters θ, be- comes exponentially flat as the system size increases [51]. This presents a chal- lenge, as exponentially more resources, like exponentially more shots due to noise of finite sampling, are required during training to find an optimal solution. Since large system sizes with many qubits, and consequently with an exponentially large Hilbert spaces, are of interest, barren plateaus could undermine the potential quan- tum speedup. In recent years, significant research has been conducted on the causes 2.4. Reservoir Computing 19 leading to barren plateaus [52–54]. For instance, a relationship between model ex- pressivity and the occurrence of barren plateaus has been established [55]. Addi- tionally, a algorithm has been developed to identify architectures that avoid barren plateaus [56]. However, recent findings, published during the course of this thesis, suggest that models processing classical data and avoiding barren plateaus are clas- sically simulable [57]. This implies that such quantum models can be simulated with classical resources in polynomial time, challenging the advantage of using VQAs for classical data learning. This insight encourages exploration of quantum models be- yond VQAs, such as quantum reservoirs, which will be introduced in the following section. 2.4 Reservoir Computing In the previous chapters, we introduced the concepts of ML and its advanced quan- tum variant. Training these models can become computationally expensive, partic- ularly when they involve a large number of trainable parameters. This challenge is especially true for VQAs, where numerous iterations are required to calculate weight updates. To mitigate these computational demands, one can, in appropriate cases, employ methods such as extreme learning machines (ELMs) [58] or reservoir com- puting (RC) [59, 60]. These approaches aim to map data x into a high-dimensional representation, where a readout layer is trained to associate this high-dimensional state with the corresponding labels y. Reservoir computing is a subset of extreme learning machines and involves an internal reservoir that can process sequential in- put. The dimension of the quantum state of a quantum circuit scales exponentially with the number of qubits, making it reasonable to use quantum circuits as reser- voirs. This allows data to be projected into a system with inherently large dimen- sionality. This concept is known as quantum reservoir computing (QRC). In the following, we begin by formally introducing the concept of RC and ex- plore potential physical systems that can function as reservoirs. We then proceed to outline the principles of QRC, positioning this approach within the broader context of QML, as introduced in the previous section. Notation und Introduction in the following section adhere to the textbook "Reservoir Computing: Theory, Physical Implementations and Applications" by Nakajima and Fischer [61]. 2.4.1 Principles of Reservoir Computing Reservoir computing is a framework designed to process sequential input data x = {xt}l t=1 with corresponding target outputs y = {yt}l t=1. The input data is fed into a high-dimensional representation in a recurrent manner. The evolution of the reser- voir state st at time t is governed by the function F . The progression of the reservoir state is expressed as st = F (st−1, xt) . (2.44) To map the reservoir state to the target output {yt}l t=1, measurements of the reservoir state m(st) are first conducted. These measurements are then processed by a neural network, which often is just a simple linear layer. In the case of a linear neural network with weights WT out, this results in ŷt = WT outm(st) . (2.45) 20 Chapter 2. Theory and Literature Review The neural network is trained such that that the outputs ŷt approximate the target outputs yt. Applications for reservoir computing range from pattern classification and gen- eration over sequence filtering and control to time series forecasting [62]. Reservoir computing can be implemented on classical computers, where the high-dimensional reservoir is represented by a large vector. However, the pursuit of more powerful or energy-efficient computing resources has led to the exploration of physical systems as reservoirs. In recent decades, systems such as electronic cir- cuits [63, 64], particle swarms [65, 66], and photonic systems like lasers [67, 68] have been investigated as potential candidates for physical reservoirs. In this context, QRC has been proposed [69, 70], which we will explore in the following. 2.4.2 Quantum Reservoir Computing In the context of QRC, sequential input data x = {xt}l t=1 with corresponding target outputs y = {yt}l t=1 is encoded into a quantum state. This encoding can be achieved using methods such as amplitude or angle encoding, as explained in the previous section. The quantum reservoir evolves according to a unitary operation U(xt) |Ψt⟩ = U(xt) |Φt−1⟩ , (2.46) where |Ψt⟩ represents the quantum state of the reservoir at time t. To map this state to the target outputs y = {yt}l t=1, measurements m(|Ψt⟩) are performed on the quantum state. Similar to general RC, these measurements are passed through a neural network. In the case of a linear layer with weights WT out this leads to ŷt = WT outm(|Ψt⟩) . (2.47) The neural network is trained to ensure that the outputs ŷt approximate the tar- get outputs yt. Due to the exponential scaling of the quantum state |Ψt⟩ with the number of qubits, quantum systems are inherently promising candidates for phys- ical reservoirs. Even with a small number of qubits, data can be projected into a high-dimensional state, allowing the readout layer to extract complex features. Unlike quantum machine learning algorithms such as VQAs discussed in the previous section, QRC does not involve optimizing weights within the quantum system itself. This significantly accelerates the training process, as the quantum sys- tem is only engaged in the encoding and processing of data, and is subsequently measured. Training a quantum reservoir requires only the measurement results of the reservoir state. The optimization of weights requires classical resources, mak- ing it computational efficient. In contrast, VQAs necessitate numerous preparations and executions of the quantum system to update quantum weights. Furthermore, QRC may avoid the issue of barren plateaus, as no parameters in the quantum cir- cuit need optimization, preventing the emergence of an exponentially vanishing loss landscape. These practical advantages justify the further exploration of QRC, as undertaken in this thesis. 21 Chapter 3 Methodology of Benchmarking Time Series (Quantum) Models 3.1 Motivation Over recent years, a variety of quantum machine learning models for time series analysis have been introduced [13–17]. These models are often inspired by classical ML methods and typically have a classical counterpart. While it has been demon- strated that these approaches can successfully predict time series data, a compre- hensive comparison of these models against each other is still lacking. Moreover, an extensive benchmark of these models is particularly important for evaluating the capabilities of quantum models relative to classical methods. Such a benchmark is valuable as it can reveal potential advantages of employing quantum models over classical ones. In this work, we align with the recent trend in quantum machine learning re- search, where existing models are systematically compared with their classical coun- terparts. While such comparisons have been conducted for classification tasks [71], this work aims to benchmark the time series prediction capabilities of quantum ma- chine learning models. This chapter is structured as follows: We begin by introducing the method of time series prediction employed in this thesis. Second, we review the datasets uti- lized for the benchmark. Next, we present the classical and quantum models for time series prediction under investigation. Finally, we discuss the technical aspects of the benchmark, including the measures of prediction accuracy and the hyperpa- rameters used. 3.2 Concept of Time Series Prediction In the following we introduce the method of time series prediction employed in this thesis. Throughout this work, we address discrete time series datasets of length n {xi}, i = 1, 2, . . . , n. (3.1) The values at each point in time are generally d-dimensional, xi ∈ Rd. To train a supervised machine learning model, as introduced in Chapter 2, we divide the dataset into sequences of length l consisting of consecutive data points {[x1, . . . , xl−1], [x2, . . . , xl ], . . . , [xn−l+1, . . . , xn]} . (3.2) This approach is also known as sliding window method [72]. The models are trained to learn the mapping f of these sequences [xt−l+1, . . . , xt] onto a data point xt+k, 22 Chapter 3. Methodology of Benchmarking Time Series (Quantum) Models which is k steps ahead in the sequence f ([xt−l+1, . . . , xt]) = xt+k . (3.3) It is important to note that the difficulty of the learning task can be adjusted by varying the prediction step k. For small values of k, the function to be learned is typically highly linear. Increasing k introduces more nonlinearity into the problem, thereby increasing the complexity, which is crucial for finding a adequate difficulty for benchmarking different models. Introducing a prediction step requires truncat- ing the sequences at the end of the consecutive sequences in Equation (3.2), as other- wise, the data point to be predicted would fall outside the dataset. For training and evaluating the machine learning models, we ultimately obtain tuples consisting of sequences as inputs and their corresponding labels as outputs of the model X̂ = {([x1, . . . , xl−1], xl−1+k), . . . , ([xn−k−l+1, . . . , xn−k], xn)} . (3.4) 3.3 Data A critical component of conducting a representative and informative benchmark study is the selection of appropriate datasets. These datasets must exhibit sufficient complexity to allow models to learn advanced features beyond simple linear map- pings or periodic correlations. Therefore, this benchmark utilizes datasets derived from dynamical systems that display chaotic behavior. A dynamical system is clas- sified as chaotic if it exhibits extreme sensitivity to even minor changes in its initial conditions [73]. In such systems, small perturbations can result in vastly different dynamical outcomes. Consequently, these systems are characterized by high nonpe- riodicity and nonlinearity, making them ideal for benchmarking time series machine learning models. To quantify the complexity of chaotic time series, a measure of chaoticity is es- sential. One such measure is the Lyapunov exponent [74], which quantifies the rate at which trajectories with two neighboring initial conditions, x0 and x0 + ϵ, diverge. Consider a one-dimensional map describing the dynamical system as xn+1 = f (xn). Applying the map N times gives x0 → f N(x0) and x0 + ϵ → f N(x0 + ϵ). The Lya- punov exponent λ is then defined as lim N→∞ eNλ = lim N→∞ | f N(x0 + ϵ)− f N(x0)| ϵ . (3.5) The Lyapunov time τ, defined as the inverse of the Lyapunov exponent, τ = 1 λ (3.6) provides a characteristic time scale over which a dynamical system exhibits chaotic behavior. Examples of chaotic systems include the Mackey-Glass equation [75], the Lorenz Attractor [76], the Rössler Attractor [77], and the Hénon Attractor [78]. In this benchmark, we will focus on the one-dimensional Mackey-Glass equation and the Lorenz Attractor. In the following, we will introduce these chaotic systems. 3.3. Data 23 0 200 400 600 800 1000 t 0.4 0.6 0.8 1.0 1.2 x( t) Mackey-Glass time series data 0.4 0.6 0.8 1.0 1.2 x(t) 0.4 0.6 0.8 1.0 1.2 x( t 1 7 ) Attractor of the Mackey-Glass system FIGURE 3.1: (a): Attractor trajectory (x(t), x(t − 17) of the Mackey- Glass system. The trajectory does dot follow stable paths and which implies chaotic behavior. (b): Mackey-Glass time series dataset as it us used throughout this thesis plotted over the time steps t. 3.3.1 Mackey-Glass Equation The Mackey-Glass Equation [75] is a one-dimensional delayed differential equation given by dx(t) dt = αx(t − t̃) 1 + P(t − t̃)n − γx(t) . (3.7) In this equation, α, γ, n, and t̃ are system parameters. The solution x(t) describes the Mackey-Glass time series. Chaotic behavior can emerge by selecting appropriate parameters. This is the case for α = 0.2, γ = 0.1, n = 10, and t̃ = 17. We set the initial condition to x(t = 0) = 1.2. To solve Equation (3.7), we use the fourth-order Runge-Kutta method [79, 80] with a step size of 1. Unless stated otherwise, we use the first 1000 data points from the time series for the experiments in this thesis. We limit the dataset to this size due to the com- putational expense of simulating the quantum machine learning models employed. To ensure that this number of data points is sufficient for meaningful feature learn- ing, we compute the Lyapunov time τ of the dataset. Using the method of Eckmann et al. [81], we find a minimal Lyapunov time of approximately τ = 20 time steps between distinct data points. This value is relatively small compared to the length of the entire dataset, indicating that chaotic behavior, as well as nonlinearity and nonperiodicity, is present throughout the dataset. This chaotic behavior is illustrated by plotting the attractor trajectory (x(t), x(t− 17)) in Figure 3.1 (a). The trajectory does not follow stable paths, indicating chaotic behavior. Additionally, Figure 3.1 (b) shows the data x(t) plotted against the time steps t. 3.3.2 Lorenz Attractor The second dataset in the benchmark study presented in this thesis is the Lorenz Attractor dataset [76]. This three-dimensional system is governed by a set of three 24 Chapter 3. Methodology of Benchmarking Time Series (Quantum) Models 0 200 400 600 800 1000 10 0 10 x( t) 0 200 400 600 800 1000 25 0y( t) 0 200 400 600 800 1000 t 20 40 z( t) Lorenz Time Series Data 10 0 10x(t) 20 10 0 10 20 y( t) 10 20 30 40 z( t) Lorenz Attractor FIGURE 3.2: (a): Attractor trajectory (x(t), y(t), z(t)) of the Lorenz system. The unstable trajectory shows the chaoticity of the data. (b): Plots of the single coordinate functions x(t), y(t), and z(t) of the Lorenz Attractor dataset used in this thesis. ordinary coupled differential equations dx(t) dt = σ(y − x) , dy(t) dt = x(ρ − z)− y , dz(t) dt = xy − βz . (3.8) Here, σ, ρ, and β are parameters, and (x(t), y(t), z(t)) describe the system’s trajec- tory. For σ = 10, ρ = 28, and β = 8/3, the system exhibits chaotic behavior. We use initial conditions (x(t = 0), y(t = 0), z(t = 0)) = (4,−8, 10) and numerically solve the differential equations using the fourth-order Runge-Kutta method [79, 80] with a step size of 0.02. As for the Mackey-Glass dataset, we use the first 1000 data points from the time series throughout this thesis unless specified otherwise. The minimal Lyapunov time for this dataset is calculated using the method of Eckmann et al. [81] and is approximately τ = 10 in units of time steps between data points. This indicates that the dataset is sufficiently large to capture the timescale of chaotic behavior through- out the series. The attractor trajectory (x(t), y(t), z(t)) for the dataset is shown in Figure 3.2 (a). The unstable trajectory demonstrates the chaotic nature of the data. The functions x(t), y(t), and z(t) for the individual coordinates are plotted in Figure 3.2 (b). 3.4 Classical Machine Learning Models for Time Series Pre- diction In this section, we introduce the classical machine learning models used in the bench- mark study of this thesis. They are of crucial importance for the benchmark study as they set a baseline for the capabilities of the quantum machine learning models. 3.4. Classical Machine Learning Models for Time Series Prediction 25 FIGURE 3.3: Sketch of the Multi-Layer Perceptron framework. An input vector of size l · d is mapped by the input layer into a hidden state. The state is passed through hidden layers of flexible sizes Ji and depth L before it is mapped to the dimension of the value in the time series that is being predicted. 3.4.1 Multi-Layer Perceptron A simple classical machine learning model is the Multi-Layer Perceptron (MLP), introduced in Chapter 2 and illustrated in Figure 2.3 (b). To perform time series predictions, a time sequence [xt−l+1, . . . , xt] of length l is fed into the input layer. In the case of a multidimensional time series with d ≥ 2, the input vector is flattened. Generally, the input layer maps a vector of size l · d to the size of the first hidden layer. As indicated in Figure 3.3, there is considerable flexibility in constructing the hidden layers. The number of hidden layers L and the size of each hidden layer Ji are hyperparameters of the model. In the benchmark, we typically evaluate a range of hidden layer configurations to identify regions in the hyperparameter space where the model performs well for a given problem. The sigmoid function and the hyperbolic tangent are used as activation functions between layers throughout this thesis. The output layer maps the last hidden state to the dimension d of the data point in the time series that is being predicted. Note that this architecture does not inherently account for the temporal structure of the data. However, it provides an initial baseline for the capabilities of classical neural networks, against which quantum models can be compared in the benchmark study. 3.4.2 Recurrent Neural Network In contrast to the MLP, the Recurrent Neural Network (RNN) [29, 30] does account for sequential structure of data. Over the past decades, various RNN variants, such as Stacked RNNs and Bidirectional RNNs, have been developed [82]. However, since the goal of introducing RNNs in this thesis is to establish a baseline for com- parison with quantum models, we will start with the simplest RNN structure as originally introduced. The concept of an RNN is illustrated in Figure 3.4. The time sequence [xt−l+1, . . . , xt] is fed sequential through a linear input layer into a hidden cell. This cell consists of a neural network with a variable number of layers and a variable hidden size. The hidden state hi is passed forward to the next time step. The weights and bias of the input layer Wih and bih, as well as those of the hidden cell,Whh and bhh, are shared across all hidden cells of all time steps. In this work, we use the hyperbolic tangent activation function. Based on the previous hidden state 26 Chapter 3. Methodology of Benchmarking Time Series (Quantum) Models FIGURE 3.4: Illustration of the Recurrent Neural Network architec- ture. Time sequences are fed into hidden cells sequentially. The hid- den state propagates throughout the sequence. To ensure compatibil- ity with the dimensions required for time series prediction, the final hidden state undergoes a mapping process in an output layer. vector ht−1 and the input xt at time t, the output of the cell is given by ht = tanh ( xtWT ih + bih + ht−1WT hh + bhh ) . (3.9) After the final time step of the sequence has been processed by the last cell, a linear output layer maps the last hidden state ht to the time series data point that needs to be predicted, xt+k. 3.4.3 Long Short-Term Memory The Long Short-Term Memory (LSTM) network is an advanced version of a Recur- rent Neural Network (RNN) [22], specifically designed to capture longer-range de- pendencies in sequential data. It represents a state-of-the-art model for tasks such as pattern classification, sequence generation, and time series prediction [83]. Similar to the RNN illustration in Figure 3.4, data is sequentially fed into the LSTM cells. The architecture of an LSTM cell is depicted in Figure 3.5. A key addition in the LSTM is the cell state ct, which is propagated along the sequence. While the hidden state ht is designed to track short-term dependencies in the sequence, the cell state ct captures long-term dependencies. This distinction is the basis for the name Long Short-Term Memory. At each time step, the input sequence element xt is concatenated with the hid- den state from the previous cell, ht−1, forming a vector vt. The cell contains several gates, which are linear neural networks with specific activation functions, each ful- filling a distinct role within the LSTM architecture. The forget gate, parameterized by weights W f , processes the input vt to determine how much of the cell state ct should be retained. The input gate with weights Wi and the input node with weights Wg together modulate the updates to the cell state at the current time step. Finally, the output gate with weights Wo processes the input vector vt to update the hidden state ht. The following equations describe these operations mathematically, where 3.4. Classical Machine Learning Models for Time Series Prediction 27 FIGURE 3.5: The structure of a Long Short-Term Memory cell. A hid- den state ht and a cell state ct are propagated through a sequence. Within the cell, four gates update these two states based on the con- catenated input of the current data point xt and the previous hidden state ht−1. A prediction for a future data point can be made by apply- ing a linear layer to the hidden state of the final cell in the sequence. b f , bi, bg, and bo represent the biases of the respective linear layers: ft = σ ( vtWT f + b f ) it = σ ( vtWT i + bi ) gt = tanh ( vtWT g + bg ) ct = ft × ct−1 + it × gt ot = σ ( vtWT o + bo ) ht = ot × tanh (ct) (3.10) Note that the symbol × denotes element-wise multiplication. As with the RNN introduced earlier, the weights of an LSTM cell are shared across all cells in the se- quence. To make a prediction from a given sequence [xt−l+1, . . . , xt] for a future data point xt+k, the hidden state of the last cell can be mapped to the dimension of xt+k using a linear layer. The initial choice of the hidden states ht and ct can be arbitrary, typically one sets these vectors initially to zero. The architecture can be extended by introducing a layered structure within each cell, where multiple cells with different weights are stacked for a single data point in the sequence. This approach enhances the model’s expressiveness. In the lay- ered architecture, the number of layers is consistent across all data points, and the weights remain shared across the sequence. The number of layers is a hyperparam- eter of the model, as is the size of the hidden states ht and ct. In the benchmark, we perform a parameter scan over these two hyperparameters to identify regions in the hyperparameter space where the model achieves optimal performance for a given problem. 28 Chapter 3. Methodology of Benchmarking Time Series (Quantum) Models Classical Model Quantum Model Multi-Layer Perceptron (MLP) Variational Quantum Circuit (VQC) Recurrent Neural Network (RNN) Quantum Recurrent Neural Network (QRNN) Long Short-Term Memory (LSTM) Quantum Long Short-Term Memory (QLSTM) Extreme Learning Machine (ELM) Quantum Reservoir Computing (QRC) TABLE 3.1: Quantum machine learning models employed in the benchmark of this thesis with their corresponding classical counter- part. 3.4.4 Extreme Learning Machine We include an extreme learning machine (ELM) model [58] in our benchmark as a comparison to the quantum reservoir computing approach introduced at the end of the next section. The core idea of ELM is to project the input data into a higher dimensional space to obtain a transformed representation. An output layer is then trained to map this high-dimensional representation to the target dimension for a given learning task. For sequential data, we map the l · d values of a sequence [xt − l + 1, . . . , xt] of length l and dimension d into a higher dimensional space via a linear layer followed by a hyperbolic tangent activation function. This linear layer is fixed after initialisation and does not undergo any further training. The dimension- ality of the higher dimensional space is a model hyperparameter. In the next section, when discussing the QRC approach, we will clarify that the process involves measuring a set of random observables on the reservoir. To ensure comparability with the quantum model, the higher-dimensional state is projected to a dimension corresponding to the number of measurements made on the reservoir in the quantum case. This is again done by a randomly initialised but fixed linear layer. The number of measurements acts as another hyperparameter of the model. Finally, the measured values are used to train a separate linear layer that maps the output from the number of measurements to the dimension d, allowing the model to predict the values in the time series being learned. 3.5 Quantum Machine Learning Models for Time Series Pre- diction Having introduced the classical machine learning models used in this thesis bench- mark, we now shift our focus to their quantum counterparts. Each classical model is chosen to correspond to a specific quantum machine learning model, with these pairings shown in Table 3.1. We note here, that a VQC differentiates from a MLP as a VQC doesn’t have any perceptron like structure. However, the two models are similar in how they are trained and what they are used for. The first three quantum models and their internal architectures are based on the works of [13–17]. Through- out the benchmark, both the original architectures proposed in these papers and well-justified modifications are employed. Here, we present the original architec- tures as described in the papers, along with the modifications applied in the bench- mark. Additionally, we introduce a quantum reservoir computing approach devel- oped specifically for time series forecasting and compare it to a classical extreme learning machine. 3.5. Quantum Machine Learning Models for Time Series Prediction 29 FIGURE 3.6: (a): Structure of the VQC employed in this thesis. A time sequence is encoded in an encoding layer E(x), while m vari- ational layers incorporate trainable weights into the model. The ex- pectation values of Pauli-Z observables on all qubits are measured, and the results are passed through a classical linear layer to map the number of qubits to the dimension of the data point to be predicted. (b): Circuit of the encoding block E(x). Data points in the sequence are encoded onto individual qubits using angle encoding. (c): For three-dimensional data, three rotation gates are used to encode the three dimensions of a data point onto a single qubit. (d): Circuit of a variational layer V(θ). Each layer has independent weights θm i,j. 3.5.1 Variational Quantum Circuit We introduced the concept of VQCs in Chapter 2. In the following section, we illus- trate how these circuits can be employed for time series forecasting tasks. Within the scope of our benchmark, we primarily reference the work of Rivera-Ruiz et al. [13], which compares the time series prediction accuracy of specific VQC architectures to that of classical models such as MLPs and LSTMs. To ensure comparability between our benchmark results and those presented in [13], we use identical architectures, which we will discuss, along with justified modifications to these models. Although the referenced paper overlaps with our work in evaluating the time series prediction capabilities of VQCs, this thesis extends the benchmark by incorporating additional quantum models and more advanced versions of the VQC. The overall structure of the VQC is depicted in Figure 3.6 (a). As discussed in Chapter 2, an encoding block E(x) is responsible for mapping data into a quantum state, while a variational circuit contains parameters that are iteratively optimized during the training process. To encode a sequence of time series data into a quantum state, the paper utilizes angle encoding, where each data point in the sequence is mapped onto an individual qubit. Specifically, for one-dimensional data, a sequence [xt−l+1, . . . , xt] of length l is encoded onto l qubits, with each data point xi encoded onto qubit i through an Ry rotation Ry(πxi) . (3.11) As will be discussed at the end of this chapter, all data is scaled to the interval [0, 1]. Therefore, we multiply the encoded value by π to ensure the encoding corresponds 30 Chapter 3. Methodology of Benchmarking Time Series (Quantum) Models FIGURE 3.7: Architecture of the variational quantum circuit with a classical linear input layer. Each data point in the sequence is passed through the input layer and mapped to an n-dimensional representa- tion, which is then encoded onto n qubits. This approach decouples the number of qubits from the sequence length, making them inde- pendent parameters. to a [0, π] rotation on the Bloch sphere. The encoding circuit diagram is illustrated in Figure 3.6 (b). Since we are dealing with not only one-dimensional data but also three-dimensional data throughout the benchmark, this encoding strategy must be adapted. The angle encoding is extended to encode all three dimensions of a data point xi = (x1 i , x2 i , x3 i ) onto qubit i using three rotations around the orthogonal axes on the Bloch sphere Rz(πx3 i )Ry(πx2 i )Rx(πx1 i ) . (3.12) The three-dimensional sequence encoding is shown in Figure 3.6 (c). It is worth not- ing that this type of encoding is similar to the strategies employed by other quantum models discussed in this thesis. Once the sequence is encoded into a quantum state, the variational layer V(θ) is applied. As suggested in [13], the structure consists of m such layers, where each layer includes rotation gates with weights θm i,j followed by nearest-neighbor entangling CNOT gates, as depicted in Figure 3.6 (d). On qubit i and in layer m, the rotation gates are given by Rz(θ m i,3)Ry(θ m i,2)Rx(θ m i,1) . (3.13) Before training, the weights θm i,j are randomly sampled from a uniform distribution in [0, 2π]. After the application of the variational layers V(θ), the quantum state is measured, and the expectation values of the Pauli-Z observable are obtained for all qubits. Unlike the approach in [13], where only the Pauli-Z expectation value of the first qubit is measured to predict the next data point, we measure the expectation values of all qubits. These results are then fed into a classical linear layer, which maps the measurements to the dimensionality of the data point to be predicted. This ensures an equal and therefore more comparable treatment of datasets with different dimensions. One limitation of the encoding architecture discussed above is that the required number of qubits scales with the sequence length. To increase flexibility in choos- ing the sequence length and the number of qubits, one approach is to pass the sequence [xt−l+1, . . . , xt] through a classical linear layer prior to encoding. This method, known as a dressed variational quantum circuit (DVQC) [84], is also uti- lized in [13]. The concept is illustrated in Figure 3.7. The sequence of length l and dimension d is mapped from the input dimension l · d to the target dimension n, which corresponds to the number of qubits. Each element in the target dimension is then encoded as a rotation around the y-axis in the Bloch sphere representation. 3.5. Quantum Machine Learning Models for Time Series Prediction 31 FIGURE 3.8: (a): Data re-uploading architecture of a VQC. The data points in a sequence are recurrently encoded, with each point be- ing applied blockwise across all qubits. These encoding blocks are interspersed with variational layers V(θ). This approach decouples the number of qubits from the sequence length, allowing them to be treated as independent parameters. Furthermore, the data re- uploading structure enhances the expressivity of the circuit. (b): En- coding block for one-dimensional data. (c): Encoding block for three- dimensional data. The subsequent variational layers and measurements are identical to those shown in Figure 3.6. An alternative approach to addressing the issue of the increasing number of re- quired qubits with sequence length is to encode the sequence in a recurrent manner. Instead of mapping each data point in the sequence to a separate qubit, we utilize a data re-uploading structure as introduced in 2.3 and depicted in Figure 2.7 (b). his method not only provides greater flexibility in selecting hyperparameters such as sequence length and number of qubits, but also enhances the expressivity of the quantum model [34]. The architecture is illustrated in Figure 3.8 (a). Data points xi in the sequence [xt−l+1, . . . , xt] are individually encoded in an encoding layer E(xi) using Ry rotations that correspond to the value of the data point across all qubits. These encoding layers alternate with variational layers V(θ) until all data points in the sequence are encoded. The encoding layers are constructed similarly to those shown in Figure 3.6 and are displayed in Figure 3.8 (b) and (c) for one-dimensional and three-dimensional data, respectively. The m variational layers V(θ) are identical to the one shown in Figure 3.6 (d) and each has independent weights. The subse- quent measurements and classical post-processing are identical to those shown in Figure 3.6. These three VQC architectures discussed above are part of the benchmark anal- ysis presented in this thesis. In general, hyperparameters of the VQC models are the number of qubits n and the number of layers of the variational layer V(θ). All quantum machine learning models presented in this section, as well as the ones in the following sections are realized and simulated using the Python library Penny- Lane [85]. We conclude this section with a few final remarks. First, by introducing classical 32 Chapter 3. Methodology of Benchmarking Time Series (Quantum) Models linear layers, we transform the models from purely quantum machine learning mod- els to quantum-classical hybrid models. Nonetheless, we continue to refer to them as quantum models because the number of trainable classical parameters is kept small relative to the number of trainable quantum parameters. Furthermore, as previously discussed in 2.3, the choice of architecture is highly non-trivial. As demonstrated in this section, there is a wide range of methods for encoding sequential data onto a VQC. The variety of possible ansätze for the variational layer is even greater. Unless stated otherwise, we consistently use the ansatz shown in Figure 3.6 (d) for VQC architectures throughout this thesis. This choice provides a baseline for comparing our results with those of [13] and adopts concepts popular in the literature [34]. The search for an optimal ansatz for a given learning problem is a research area in its own right [41–43] and is beyond the scope of this thesis. 3.5.2 Quantum Recurrent Neural Network While the VQC can be considered a quantum counterpart to a classical neural net- work like a MLP, we now introduce the quantum equivalent of a classical Recurrent Neural Network. The Quantum Recurrent Neural Network (QRNN) was first pro- posed in [14]. The fundamental idea is to extend the concept of sequential learning in a VQC by allocating d qubits to a data register and h qubits to a hidden register. In this setup, a sequence of data points is encoded onto the data register in a recur- rent manner. The hidden register is inspired by the classical RNN, where a hidden state is transferred from one data point to the next. In the QRNN, the quantum state of the qubits in the hidden register serves as the state that is passed along the se- quence. Throughout this work, we adopt the specific architecture presented in [15], in which also numerical experiments on classical sequential data were conducted. The QRNN architecture is depicted in Figure 3.9 (a). Similar to a classical RNN, the QRNN employs a block-wise recurrent structure. In each block, a data point xi from the sequence [xt−l+1, . . . , xt] is encoded onto the data register. We again distinguish between one- and three-dimensional data. For one-dimensional data, a data point xi is encoded via angle encoding using a Pauli-Y rotation gate Ry(arccos(xi)) (3.14) on all d qubits of the data register. The corresponding circuit diagram is shown in Figure 3.9 (b). To ensure comparability, we scale the input using the arc cosine function as proposed in [15]. Since the data is scaled to the interval [0, 1], the rotation angle lies within [0, π/2]. In the case of three-dimensional data, the three dimensions of a data point are encoded sequentially with rotation gates on each qubit by Rx(arccos(x3 i ))Ry(arccos(x2 i )Rx(arccos(x1 i )) . (3.15) The circuit diagram for this encoding is shown in Figure 3.9 (c). After encoding the data point into the data register, a variational layer is applied. This layer incorpo- rates trainable weights θi,j and entangles qubits from the data register with those in the hidden register. This entanglement allows the model to learn how to transfer the quantum representation of the data into the hidden state, facilitating the extraction of relevant features from the sequence. The specific ansatz used in [15] and through- out the thesis is depicted in Figure 3.9 (d). After a layer of three parameterized rotation gates, a layer of nearest-neighbor entangling elements is applied. Each ele- ment consists of a parameterized Pauli-Z rotation gate placed between two CNOT gates. It is important to note that the weights of the variational layers are shared 3.5. Quantum Machine Learning Models for Time Series Prediction 33 FIGURE 3.9: (a): Architecture of the Quantum Recurrent Neural Net- work. The circuit is divided into a data register and a hidden register. The sequence is encoded into the data register in a recurrent manner. After each encoding block, a variational layer is applied to facilitate the model’s learning of the mapping from the quantum state in the data register to the hidden register. Once the final point in the se- quence is encoded, the data register is measured, and the result is passed through a classical linear layer to predict the subsequent data point. (b): Encoding circuit for one-dimensional data. (c): Encoding circuit for three-dimensional data. (d): Ansatz of the variational layer used throughout the thesis. across all cells of each time step, similar to the RNN ansatz. After each of the first l − 1 blocks, the quantum state of the data register is reset to the ground state |0⟩ to prepare for the initialization of the subsequent data point. Following the block that encodes the last data point of a sequence, the data register is measured. As with the VQC, the Pauli-Z expectation values of all d qubits are passed into a classical linear layer to map to the dimension of the data point xt+k that is to be predicted. The hyperparameters of the architecture include the number of qubits in the data register and the number of qubits in the hidden register. It is important noting that, for the Python library PennyLane [85] used in this thesis for simulating the training of the quantum circuits, resetting qubits is computationally expensive. Therefore, throughout the benchmark of the QRNN, both the sequence length and the number of data qubits have to be kept small to make the simulation possible. Despite these limitations, it is still possible to benchmark the QRNN against other classical and quantum models. However, for longer sequence lengths, the QRNN is excluded 34 Chapter 3. Methodology of Benchmarking Time Series (Quantum) Models from the benchmark study. 3.5.3 Quantum Long-Short Term Memory We now introduce the quantum analogue of the LSTM, known as the Quantum Long Short-Term Memory (QLSTM), first proposed in [16]. The core idea is to replace the classical neural network layers, with weights W f , Wi, Wg, and Wo from the classical LSTM as shown in Figure 3.5, with VQCs. The architecture of a QLSTM cell, as proposed in [16], is depicted in Figure 3.10 (a). In this architecture, the four classical neural networks are substituted by VQC1 through VQC4. As in the classical LSTM, the previous hidden state ht−1 and the current data point xt of the sequence with dimension d are concatenated into a vector vt. The dimension of this vector is equal to the number of qubits n in all VQCs. Thus, the hidden state dimension is defined as h = n − d. The vector vt is processed through VQC1 to VQC4, where the expectation value of the Pauli-Z observable is measured on each qubit of each VQC. The outputs of these VQCs are then fed into the internal QLSTM structure, which mirrors the classical LSTM architecture. Since the outputs of VQC1 to VQC4 are multiplied element-wise with the cell state ct, the dimension of ct is also equal to the number of qubits n. To pass a hidden state ht to the next cell, the dimension must be reduced from n to h. This is accomplished by introducing an additional VQC5. Although its ansatz is identical to the other VQCs, only the expectation values of the first h qubits are measured and passed on to the next QLSTM cell. As in the classical LSTM, these cells are stacked, allowing the hidden state ht and cell state ct to propagate through the sequence. When the last data point in the sequence is reached, an additional VQC6 is applied. The internal n-dimensional state is passed through VQC6, where the expectation values of all qubits are measured. Similar to the other QML models, linear layer then maps the measurement results to the dimension of the predicted data point xt+k. The circuit architecture of all VQCs is identical and shown in Figure 3.10 (b) as it was introduced in [16] and implemented throughout the benchmark of this thesis. Initially, a Hadamard gate H is applied to all qubits, followed by encoding the i-th element of the input vector vt onto the i-th qubit via Rz(arctan(v2 i ))Ry(arctan(vi)) . (3.16) Since the data is scaled to the interval [0, 1], the rotation angles for encoding lie within [0, π/4] for VQC1. After the encoding layer, a series of m variational lay- ers is applied. Each layer consists of nearest-neighbor and second-nearest-neighbor CNOT entanglements, followed by parameterized rotation gates defined as R(θm i,1, θm i,2, θm i,3) = Rz(θ m i,3)Rx(θ m i,2)Rz(θ m i,1) (3.17) for each qubit i. The weights θm i,j are initialized by uniformly sampling from [0, 2π] before training. These parameters are independent across different VQCi, but re- main identical for the same VQCi across different QLSTM cells. Therefore, the total number of trainable quantum parameters is 6 · 3 · n · m. A limitation of this architecture is that the size of the hidden state h = n − d and the cell state c = n both scale with the number of qubits n. Since the hidden and cell states are meant to store information about the sequence, it would be advan- tageous to have more flexibility in choosing these sizes. However, a large hidden 3.5. Quantum Machine Learning Models for Time Series Prediction 35 FIGURE 3.10: (a): Architecture of a QLSTM cell. In this design, the classical neural networks used in a traditional LSTM cell are replaced by VQCs. Two additional VQCs are incorporated: one to match the dimensionality of the hidden state and another to process the cell output, ensuring it is mapped appropriately to the data point that needs to be predicted. (b): Circuit diagram of the VQCs. The input vector vt is encoded using angle encoding, scaled by an arc tangent function. This is followed by the application of a layered variational block. Each layer consists of entangling operations between nearest and second-nearest neighbors using CNOT gates, followed by a set of parameterized single-qubit rotation gates. state requires a correspondingly large number of qubits, which can exceed the hard- ware capabilities of current quantum computers. Additionally, classical simulation of quantum circuits demands resources that scale exponentially with the number of qubits. Consequently, we are forced to limit the number of qubits to the single-digit range in many parts of the benchmark. To decouple the hidden state size from the number of qubits, an advanced ver- sion of the QLSTM was proposed in [17]. This variant, called the Linear Enhanced Quantum Long Short-Term Memory (LE-QLSTM), incorporates classical linear lay- ers into the architecture, as shown in Figure 3.11. A linear input layer maps the input vector vt to the number of qubits n in VQC1-VQC4. After processing through these VQCs, additional linear layers map the qubit count n to the hidden and cell state size h = c. This eliminates the need of a VQC5 as in the other QLSTM architecture. Similarly, VQC6 is replaced by a linear layer that maps the hidden state size h to the dimension d of the predicted data point. In [17], as well as in the benchmarks con- ducted, the circuit design remains identical to that shown in Figure 3.10 (b). While this approach effectively decouples the number of qubits n from the dimensions of the hidden and cell states h and c, it also increases the number parameters beside the quantum circuit relative to the quantum parameters. This makes it challenging 36 Chapter 3. Methodology of Benchmarking Time Series (Quantum) Models FIGURE 3.11: Structure of the Linear Enhanced Quantum Long Short- Term Memory Cell. To decouple the dimensions of the hidden and cell states from the number of qubits in