A Quantum Neural Network Regression for Modeling Lithium-ion Battery
  Capacity Degradation
Given the high power density low discharge rate and decreasing cost
rechargeable lithium-ion batteries LiBs have found a wide range of applications
such as power grid level storage systems electric vehicles and mobile devices.
Developing a framework to accurately model the nonlinear degradation process of
LiBs which is indeed a supervised learning problem becomes an important
research topic. This paper presents a classical-quantum hybrid machine learning
approach to capture the LiB degradation model that assesses battery cell life
loss from operating profiles. Our work is motivated by recent advances in
quantum computers as well as the similarity between neural networks and quantum
circuits. Similar to adjusting weight parameters in conventional neural
networks the parameters of the quantum circuit namely the qubits degree of
freedom can be tuned to learn a nonlinear function in a supervised learning
fashion. As a proof of concept paper our obtained numerical results with the
battery dataset provided by NASA demonstrate the ability of the quantum neural
networks in modeling the nonlinear relationship between the degraded capacity
and the operating cycles. We also discuss the potential advantage of the
quantum approach compared to conventional neural networks in classical
computers in dealing with massive data especially in the context of future
penetration of EVs and energy storage.
Anh Phuong Ngo, Nhat Le, Hieu T. Nguyen, Abdullah Eroglu, Duong T. Nguyen
# A Quantum Neural Network Regression for Modeling Lithium-ion Battery Capacity Degradation

###### Abstract

Given the high power density, low discharge rate, and decreasing cost, rechargeable lithium-ion batteries (LiBs) have found a wide range of applications such as power grid-level storage systems, electric vehicles, and mobile devices. Developing a framework to accurately model the nonlinear degradation process of LiBs, which is indeed a supervised learning problem, becomes an important research topic. This paper presents a classical-quantum hybrid machine learning approach to capture the LiB degradation model that assesses battery cell life loss from operating profiles. Our work is motivated by recent advances in quantum computers as well as the similarity between neural networks and quantum circuits. Similar to adjusting weight parameters in conventional neural networks, the parameters of the quantum circuit, namely the qubits' degree of freedom, can be tuned to learn a nonlinear function in a supervised learning fashion. As a proof of concept paper, our obtained numerical results with the battery dataset provided by NASA demonstrate the ability of the quantum neural networks in modeling the nonlinear relationship between the degraded capacity and the operating cycles. We also discuss the potential advantage of the quantum approach compared to conventional neural networks in classical computers in dealing with massive data, especially in the context of future penetration of EVs and energy storage.

 Quantum neural network, Lithium-ion battery, battery degradation, battery life estimation.

## I Introduction

Lithium-ion batteries (LiBs) are the dominant player in the battery market for electric vehicles (EVs), energy storage, and mobile devices thanks to their high energy densities, low cost, and long life cycle. However, LiBs pose a concern about their capacity degradation which has a negative impact on the safety and reliability of these applications. As a result, the estimation of battery cycling capacity is essential for the utilization of battery management system operation, economical and safety aspects, and life cycle assessment. Fundamentally, the battery capacity degradation estimation approaches are classified into two groups: model-based and data-driven approaches [1].

On the one hand, the model-based approaches adopt parametric electrochemical processes to investigate the relationship between the cell capacity and cyclic aging of a lithium-ion battery [2]. However, mathematical modeling and parametric identification of the chemical properties of the elements in a LiB are irreversible and highly complex [3]. Consequently, a comprehensive result is difficult to be obtained with the model-based approaches. Furthermore, every model-based technique is specifically developed for a certain type of LiB. Therefore, its extensibility to another composition other than its origin is very limited [4]. On the other hand, the data-driven approaches are non-parametric. They are based on the extraction of empirical observations of battery operation, such as voltage, current, temperature, and capacity measurements. Hence, they are scalable and extensible to adapt to the variations in batteries' size and type. Furthermore, the rapid development of data collection techniques and computational processors has facilitated the practical application of data-driven methods. Numerous data-based analytical methods have been applied in practice for the prediction of LiBs degradation are support vector machine, relevance vector machine, Gaussian process functional regressions, and neural networks [5]. Among data-driven methods, artificial neural network (ANN) is a powerful machine learning tool with the capability to handle big data involving complex nonlinear systems [1, 6].

With demand for EVs and electronic devices on the rise, LiBs as one of the essential components required for this mobility and connectivity boom has been formulating a big challenge of managing a huge amount of data. Meanwhile, classical machine learning models usually run into a performance bottleneck trained on such kind of heavy tasks. Recent advances in quantum computing have further enabled quantum machine learning (QML) models for potentially achieving promising performance [7, 8]. In other words, QML models use quantum computers to boost up the power of machine learning [9]. Quantum neural network (QNN) is a widely-used QML model that composes of parameterized learnable quantum circuits [10]. In a QNN, the classical features are encoded into quantum states by using angle encoding. Quantum states are then used as input for a QNN model composed by layers of the learnable quantum circuit [11, 12]. The quantum circuit is constructed by a series of parameterized rotation gates along axes and the measurements of qubits are decoded into classical values in the output layer. This work develops a QNN regression model to predict the deterioration of battery capacity with the purpose of assessing potential quantum advantage in such kind of learning tasks for batteries.

This paper is organized as follows. Section II presents the basics of how a Lithium-ion battery works and its capacity degradation model. We will explain carefully the similarities and differences between QNN and ANN models in Section III. The numerical results for the QNN model are given in the Section IV. Finally, Section V concludes the paper and discusses possible future research.
## II Battery capacity degradation

### _Basics of Lithium-ion Battery Model_

LiB is a type of energy storage technology constructed of an anode, cathode, separator, electrolyte, and two current collectors, one positive and other negatives. LiB utilizes insertion reactions for the cathode and anode with lithium ions as the charge carriers. The anode delivers lithium ions to the cathode, which initiates a flow of electrons between the two components. In simple words, a LiB employs its \(Li^{+}\) ions as a key component of its electrochemistry [2]. An example of this type of electrochemical reaction is Lithium Manganese Oxide spinel \(LiMnO_{2}\) illustrated as follows [13]:

\[\begin{cases}LiMn\to Li_{1-x}MnO_{2}+xLi^{+}+xe^{-},&\text{at electrode}^{+}\\ mC+xLi^{+}+xe^{-}\to Li_{x}C_{m},&\text{at electrode}^{-}\end{cases}\]

### _Li-ion Battery Capacity Degradation Behavior_

The capacity degradation phenomenon is constituted by various factors: (i) formation property of the solid-electrolyte interface (SEI) layer and (ii) irreversible absorption of \(Li^{+}\) ion at the host material. As such, the thickness of the SEI layer keeps increasing over time, because it passively absorbs \(Li^{+}\) ion during the charging and discharging processes along the battery life span. A LiB will become dead when its capacity degradation drops to a failure threshold defined by its manufacturer [2]. While the degradation of LiB can be theoretically explained by the loss of lithium ions and other active materials, it is difficult to link such molecular-level degradation processes to the operational pattern of energy storage, particularly the charging and discharging cycles [3]. Machine learning with empirical datasets becomes a promising approach for estimating the LiB capacity deterioration

### _Regression models for the Li-ion Battery Capacity Degradation Estimation_

The problem of modeling the degraded battery capacity induced by operational cycles can be considered as a regression problem in the field of supervised learning. Let \(Y=(y_{1},y_{2},\cdots,y_{n})^{\top}\in\mathbb{R}^{n}\) is historical capacity measurements of a LiB over a cycle \(X=(x_{1},x_{2},\cdots,x_{n})^{\top}\). We need to construct a nonlinear mapping function \(y=f_{\theta}(x)\) that corresponds the operational cycles \(x\) to the remained capacity \(y\) where \(\theta\) is the vector of parameters in the hypothetical function \(f_{\theta}(x)\). The problem boils into finding the optimal \(\theta^{*}\) that minimizes the loss function between the estimated \(\hat{y}=f_{\theta}(x)\) and the measured capacity \(y\) of the battery. Two popular loss functions are Root Mean Square Error (RMSE) and Mean Absolute Percentage Error (MAPE):

\[RMSE=\sqrt{\frac{1}{N}\sum_{i=1}^{N}\left(y_{i}-\hat{y}_{i}\right)^{2}} \tag{1}\]

\[MAPE(\%)=\frac{1}{N}\sum_{i=1}^{N}\frac{|y_{i}-\hat{y}_{i}|}{y_{i}}\times 100 \tag{2}\]

where \(y_{i}\) is the real measured capacity and \(\hat{y}_{i}\) is the predicted capacity at cycle \(i\in N\).

Figure 1 presents a typical neural network used for regression in classical computers. The dataset, e.g., the empirical data of battery, can be first fed to the feature embedded layer \(\mathcal{F}(.)\), which consists of a sequence of operations & combination (e.g., convolution and attention) to be mapped to the feature space. Then the hidden layer \(W_{l}(.)\), typically \(l\)-fully connected, takes featured data and produces the estimation results. The regression problem boils down to the problem of tuning weight factors of neurons in \(W_{l}(.)\) such that the loss function (e.g., RMSE or MAPE) is minimized. This can be addressed by several effective numerical algorithms developed in the literature such as BFGS (Broyden-Fletcher-Goldfarb-Shannon algorithm), ADAM (Adaptive Movement Estimation algorithm), and Nelder-Mead [6].

## III Quantum neural network regression

### _Overview of Quantum Neural Network_

Quantum neural networks are motivated by (i) the huge success of neural networks, particularly deep learning, in solving a real-world problem and (ii) the recent advances in quantum computing [11, 12]. It emerges following the similarity between the quantum circuit and the neural network architecture as illustrated in Figure 2.

#### Iii-A1 Quantum bit

QNN utilizes a quantum bit (qubit) as a neuron in the classical neural network. Unlike a binary digit in classical computers, a single qubit can be in a superposition of two basis states \(|0\rangle\) and \(|1\rangle\)[9], i.e., it can be represented in a two-dimensional complex vector space as follows:

\[|\psi\rangle=\alpha|0\rangle+\beta|1\rangle:\alpha,\beta\in\mathbb{C}\wedge| \alpha|^{2}+|\beta|^{2}=1. \tag{3}\]

Consequently, the state of a qubit can be invinventionted as a point on a complex sphere with radius 1, i.e., the Bloch sphere as in Figure 2(a). In other words, its state can be represented by two angles \(\theta\) and \(\varphi\), which are called two degrees of freedom, and tuning \(\theta\) can alternate the state of the qubit.

#### Iii-A2 Quantum Circuit

A quantum circuit is a simple sequence of quantum gates, measurements, initialization of qubits to known values, and other actions which are represented to a quantum computation. On a circuit, a sequence of qubits is encoded as \(q_{0},q_{1},\ldots,q_{n-1}\), in which \(n\) is the number of qubits. The qubit can be a result rotated along \(x-y-z\) axes for the probability distributions of \(|0\rangle\) and \(|1\rangle\). The probability depends on the internal state of the qubit,

Fig. 1: Classical neural network model
but more specifically, on the angle \(\theta\) between state vector \(|\psi\rangle\) and the measured axis. Therefore, a numerical feature can be approximated into a qubit by \(f:\mathrm{R}\rightarrow[0,\pi]\). The states of the qubit can be modulated by the quantum gates, such as a single qubit gate (e.g, Pauli-X gate) or multiple-qubit gate (e.g, two-qubit CNOT gate). Quantum gates are unitary operators and are illustrated as unitary matrices represented on some computational basis. Here, \(R_{X}\), \(R_{Y}\), and \(R_{Z}\) gates are rotation operators representing a single-qubit rotation through angle \(\theta\) (radians) around the \(x\)-axis, \(y\)-axis, and \(z\)-axis, respectively:

\[R_{X}(\theta) =\begin{bmatrix}\cos\frac{\theta}{2}&-i\sin\frac{\theta}{2}\\ i\sin\frac{\theta}{2}&cos\frac{\theta}{2}\end{bmatrix} \tag{4}\] \[R_{Y}(\theta) =\begin{bmatrix}\cos\frac{\theta}{2}&-\sin\frac{\theta}{2}\\ sin\frac{\theta}{2}&cos\frac{\theta}{2}\end{bmatrix}\] (5) \[R_{Z}(\theta) =\begin{bmatrix}e^{-i\frac{\theta}{2}}&0\\ 0&e^{i\frac{\theta}{2}}\end{bmatrix} \tag{6}\]

A digital error model (DeM) is used to control the quantum gates, and readout errors and characterizes circuit performance by a set of Pauli errors [8]. Finally, a measurement component is compulsory to read out the result of the quantum computation. The output of the measurement component is a classical variable value retrieved from a probability distribution governed by the Born rule of the quantum theory [9].

### _QNN Implementation and training procedure_

The structure of QNN represented in Figure 2(b) follows the typical structure of the neural network shown in Figure 1. The first stage, which resembles the feature-embedded layer in the classical neural network, is _the encoding quantum circuit_\(U(X)\). It is used to encode classical data to be used in the quantum computer. This stage plays a vital role in adopting quantum algorithms to solve classical problems, particularly in quantum deep learning tasks. _The trainable quantum circuit_ resembles the classical counterpart's hidden layer where tuning circuit parameters \(\theta\) results in the change of the output in the quantum measurement. _The quantum measurement_, in turn, acts like the output layer in the classical neural network, i.e., its output after decoding represents the prediction result.

The quantum circuit of the QNN model can be run in a quantum simulator or actual quantum hardware (e.g., IBM Quantum servers, Amazon Braket, Rigetti Computing, D-Wave, and Strawberry Fields) [14, 15]. However, the availability of quantum hardware is currently limited, e.g., the IBM server only allows 7 qubits for free application [16, 17]. The computer simulator back-end for quantum circuit become useful for proof-of-concept research. This paper uses the quantum simulator back-end provided by Qulacs [18] and trains the QNN using the hybrid classical-quantum procedure with BFGS optimizer [11]:

* Prepare training data and encode the training data into the quantum state vectors \(|\psi_{in}\rangle\) using angle encoding. The input state is obtained as \(|\psi_{in}\rangle=U(x)\).
* \(\theta\)-parameterized unitary \(U(\theta)\) is applied to the input state and generates an output state \(|\psi_{out}\rangle\).
* Measure the expectation values of some chosen observable. For instance, \(Z\) expectation of the second qubit is denoted as \(\langle Z_{2}\rangle=\langle\psi_{out}|Z_{2}|\psi_{out}\rangle\).
* Minimize the cost function \(L\) of between the real measured capacity \(y_{i}\) and the prediction \(\hat{y}_{i}\) by tuning the quantum circuit parameter \(\theta\) iterative until \(\theta=\theta^{*}\). In which, \(y(x,\theta^{*})\) is the desired prediction model.
* Evaluate the accuracy of the QNN regression model by validating the cost function with a testing data set.

### _Potential advantages of the quantum neural network over classical neural network_

Although quantum neural networks (QNN) and their classical counterparts have similar features, there are some differences, resulting in the possible QNN advantages [10]. In order to construct a complex model for high-precision prediction, classical neural networks require the use of nonlinear basis functions or the use of kernel tricks, leading to a significant increase in computational cost. In contrast, leveraging quantum

Fig. 2: Estimate Lithium-ion battery degradation using Quantum Neural Network
mechanics, QNN can directly employ the exponential number of functions with respect to the number of qubits, thus capturing non-linearity without using nonlinear activation functions. Indeed, the trainable quantum circuit \(U(\theta)\) already has strong expressive power, which potentially enables a wide range of applications in capturing nonlinearity that are intractable on classical counterparts [19].

## IV Numerical results

### _Li-ion battery data pre-processing_

The datasets used in this research are collected from the NASA Prognostics Center of Excellence Data Set Repository [20]. There are 34 different batteries in the datasets that comprise more than 6 profiles in charging and discharging states conducted on Lithium Nickel Manganese Cobalt Oxide batteries. Batteries were charged and discharged at different temperatures, and the impedance was measured at every cycle. The batteries have 18650 Lithium-ion cells with 2-Ah capacity for B05, B06 and B18, and 1.35-Ah capacity for B56, for which the charging and discharging cycle experiments were conducted repeatedly to achieve accelerated aging. A battery with state of health (SoH) reducing below \(70\%\) is considered to be discarded because its operational performance is not reliable [5]. In other words, the experiments are stopped when the battery loses over \(30\%\) of its rated capacity.

### _QNN Regression Model_

We chose the batteries B05, B06, B18, and B56 to validate the quantum regression model and the quantum circuit. Here, data of B05, B06, and B18 are quite clustered while data of B56 has a lot of noise. The train size was chosen at 80% of the original data for the first experiments on B05, B06, B18, and B56. We conduct the experiments on the quantum simulator powered by a classical computer with a configuration of 32 GB RAM and an Intel Xeon processor. Capacity aging prediction patterns and the original capacity measurements from the four LiBs demonstrated in Figure 3 are positively correlated. The QNN model works well with various data with different characteristics, neither over-fitted nor under-fitted with good RMSE and MAPE metrics

We examine the impacts of training data size on the performance of QNN. Figure 4 shows results for cross-validation of the accuracy of capacity degradation estimation based on the QNN for several different sizes (i.e., 60%, 70%, 80% and 90%) of the training sample. The obtained RMSE and MAPE are quite small, which highlights the ability of the neural network empowered by the quantum circuit in capturing the nonlinear relationship of battery capacity on the operational cycle. As different kinds of capacity degradation paths are shown in the figure, we can see that the larger data size also influences on the prediction results. In detail, the larger size of the training data set leads to a more coherent prediction.

Figure 5 shows the correlation between the depth and the number of qubits with the accuracy of the QNN model. In particular, the depth and the number of qubits are considered as hypo-parameters of QNN since they control the architecture or

Fig. 3: Estimation of Lithium-ion batteries’ degradation using QNN
topology of the QNN. The obtained results show that the qubits and depth quantities increase to a certain amount, and the RMSE and MAPE indicators drop insignificantly. Meanwhile, a quantum circuit with a large number of qubits and depth is computationally expensive. In other words, similar to the classical neural network, there is a trade-off in the complexity of the QNN and the obtained performance, which should be considered carefully in the design phase.

## V Conclusion

This paper studied the quantum neural network regression model for the predicting battery life in which the qubit can resemble the neuron in classical machine learning. The QNN inherits the principle and structure of the classical neural network and the training of QNN boils into tuning the parameters of qubits in the quantum circuits, which is similar to tuning weights of classical neurons. The QNN's expression ability can be empowered thanks to the capability of a qubit in capturing complex nonlinearity. Similar to the classical neural network, the performance of QNN also depends on design parameters such as the number of qubits and depth of the quantum circuit. Numerical results show that QNN can be a very promising approach for modeling battery usage, especially for the future penetration of EVs and energy storage under the decarbonization policy.
