State of Health Prediction for Lithium-Ion Batteries Using an Ensemble TCN-Transformer Model

In recent years, lithium-ion batteries have become indispensable in modern technology due to their high energy density, long cycle life, and environmental friendliness. They power a wide range of applications, from portable electronics to electric vehicles and grid storage systems. However, the performance of lithium-ion batteries degrades over time due to complex electrochemical processes, such as solid electrolyte interphase growth, lithium plating, and electrode material cracking. This degradation leads to capacity fade, increased internal resistance, and potential safety hazards. Accurate prediction of the State of Health (SOH) is crucial for ensuring the reliability, safety, and longevity of lithium-ion battery systems. SOH is a key metric defined as the ratio of current capacity to nominal capacity, typically expressed as:

$$SOH = \frac{C_{cur}}{C_{rate}}$$

where \(C_{cur}\) represents the current capacity of the lithium-ion battery, and \(C_{rate}\) is the rated capacity. A lithium-ion battery is often considered end-of-life when its SOH falls below 80%. Predicting SOH enables proactive maintenance, optimal charging strategies, and second-life applications, thereby enhancing the overall efficiency of energy storage systems.

Traditional methods for SOH estimation include electrochemical models, equivalent circuit models, and empirical approaches. While these methods provide physical insights, they often require extensive parameter tuning and may not adapt well to dynamic operating conditions. In contrast, data-driven approaches leverage machine learning and deep learning techniques to learn patterns from historical data without explicit physical modeling. Recent advancements have seen the application of neural networks, such as Long Short-Term Memory (LSTM), Convolutional Neural Networks (CNN), and Transformer models, for time-series forecasting of lithium-ion battery health. However, these models often face challenges in capturing both local temporal dependencies and global contextual relationships, which are essential for accurate SOH prediction.

In this research, I propose an ensemble model that combines Temporal Convolutional Networks (TCN) and Transformer architectures to address these limitations. The TCN component excels at extracting local features and long-term dependencies through causal and dilated convolutions, while the Transformer leverages self-attention mechanisms to model global interactions across the time series. By integrating these strengths, the model aims to achieve superior prediction accuracy for lithium-ion battery SOH. This work contributes a novel framework that enhances feature representation from charging data, optimizes input sequences, and provides robust estimations across different lithium-ion battery types and cycling conditions.

The experimental validation involves cycling tests on commercial lithium-ion batteries, where voltage, current, and capacity data are collected. Features such as incremental capacity and voltage profiles are extracted to form input sequences for the model. The performance is evaluated using metrics like Mean Absolute Error (MAE), Mean Squared Error (MSE), and Coefficient of Determination (R²). Results demonstrate that the TCN-Transformer ensemble outperforms standalone models, offering a reliable tool for lithium-ion battery management systems. This approach not only improves prediction precision but also provides insights into degradation patterns, facilitating smarter utilization of lithium-ion batteries in real-world applications.

Experimental Setup and Data Collection

To validate the proposed model, I conducted accelerated aging tests on lithium-ion batteries under controlled laboratory conditions. The lithium-ion batteries used in this study are commercial 18650 cylindrical cells with a lithium iron phosphate (LiFePO₄) cathode and graphite anode. These lithium-ion batteries have a nominal voltage of 3.2 V, a rated capacity of 1.6 Ah, and a charging cutoff voltage of 3.65 V with a discharge cutoff voltage of 2.0 V. The choice of lithium-ion batteries is based on their widespread use in electric vehicles and energy storage, making them representative for SOH prediction research.

The cycling protocol involves repeated charge-discharge cycles to simulate real-world usage. Each cycle consists of a constant current (CC) charge at 1C rate (1.6 A) until the voltage reaches 3.65 V, followed by a constant voltage (CV) phase until the current drops below 30 mA. After a rest period of 30 minutes to allow for electrochemical stabilization, the lithium-ion battery is discharged at 1C rate to 2.0 V, with another rest period. This process is repeated for multiple cycles, with data logged at high frequency. The test spans several weeks, capturing the gradual degradation of the lithium-ion battery. Key parameters monitored include voltage, current, temperature, and capacity, which are essential for deriving SOH-related features.

Data from multiple lithium-ion batteries are collected to ensure robustness. The dataset includes cycles from initial state to end-of-life, with SOH calculated using capacity measurements. To account for variability, batteries are subjected to identical conditions, but natural variations in manufacturing may lead to different degradation trajectories. This diversity helps in training a generalized model. The raw data is preprocessed to remove noise, align time stamps, and compute derived features. For instance, incremental capacity analysis (ICA) is performed by differentiating capacity with respect to voltage, revealing peaks associated with phase transitions in the lithium-ion battery electrodes. These features are critical for capturing degradation mechanisms.

The following table summarizes the specifications of the lithium-ion batteries and test conditions:

Parameter Value
Battery Type 18650 Lithium-Ion
Cathode Material LiFePO₄
Anode Material Graphite
Rated Capacity 1.6 Ah
Charge Cutoff Voltage 3.65 V
Discharge Cutoff Voltage 2.0 V
Cycling Rate 1C (1.6 A)
Rest Period 30 minutes
Number of Batteries 10
Total Cycles Recorded Over 1000 per battery

Feature engineering is a crucial step in preparing the input data for the model. From the raw cycling data, I extract three primary features: charging voltage sequences, incremental capacity (IC) curves, and the ratio of incremental capacity to voltage change. These features are chosen because they correlate strongly with the aging of lithium-ion batteries. The voltage profile during charging reflects internal resistance and polarization effects, while IC curves indicate changes in electrode kinetics. The ratio feature helps normalize variations across cycles. Each feature sequence is windowed into segments of 30 time steps, forming a multi-variate input tensor of shape (30, 3). This sliding window approach ensures the model captures temporal dynamics without losing context.

To illustrate the feature extraction process, consider the incremental capacity \(IC\) calculated as:

$$IC = \frac{dQ}{dV}$$

where \(Q\) is the capacity and \(V\) is the voltage. This derivative highlights inflection points that shift as the lithium-ion battery degrades. Similarly, the voltage sequence \(V(t)\) over time \(t\) is sampled at regular intervals. The input matrix for a given cycle \(i\) is constructed as:

$$X_i = \begin{bmatrix} V_1 & IC_1 & R_1 \\ V_2 & IC_2 & R_2 \\ \vdots & \vdots & \vdots \\ V_{30} & IC_{30} & R_{30} \end{bmatrix}$$

where \(R = \frac{IC}{\Delta V}\) is the ratio feature. These matrices are then fed into the model for training and prediction. The target output is the SOH value corresponding to the end of the input window, enabling the model to learn mapping from temporal patterns to health indicators.

Methodology: Ensemble TCN-Transformer Architecture

The core of this research is the development of an ensemble model that synergizes Temporal Convolutional Networks (TCN) and Transformer modules. This design aims to harness the strengths of both architectures for time-series prediction of lithium-ion battery SOH. Below, I detail the components, mathematical formulations, and integration strategy.

Temporal Convolutional Network (TCN)

TCN is a specialized convolutional neural network for sequence modeling, offering advantages over recurrent networks in terms of parallelization and gradient flow. For lithium-ion battery data, which exhibits long-range dependencies due to gradual degradation, TCN’s ability to capture extended contexts is vital. The key elements of TCN include causal convolutions and dilated convolutions.

Causal convolution ensures that the output at time \(t\) depends only on inputs up to \(t\), preserving temporal order. This is implemented by padding the input sequence appropriately. The dilated convolution expands the receptive field without increasing kernel size, allowing the network to capture multi-scale patterns. The operation for a 1-D sequence input \(x\) with a filter \(f\) of length \(k\) and dilation factor \(d\) is defined as:

$$F(s) = (x *_{d} f)(s) = \sum_{i=0}^{k-1} f(i) \cdot x_{s – d \cdot i}$$

where \(s\) is the time index, and \(*_{d}\) denotes the dilated convolution. When \(d = 1\), it reduces to standard convolution. By stacking layers with increasing dilation factors (e.g., 1, 2, 4, 8, …), the TCN can achieve an exponential receptive field, ideal for modeling the long-term trends in lithium-ion battery aging.

In my implementation, the TCN module consists of multiple residual blocks, each containing two dilated causal convolutional layers, weight normalization, ReLU activations, and dropout for regularization. The output from the TCN is a feature map that encodes local temporal patterns and dependencies from the input sequences of lithium-ion battery data. This output serves as an enriched input to the subsequent Transformer module.

Transformer with Self-Attention Mechanism

The Transformer architecture, originally designed for natural language processing, excels at capturing global relationships through self-attention. For lithium-ion battery SOH prediction, this allows the model to weigh the importance of different time steps across the entire sequence, identifying critical phases in the charging process that correlate with degradation.

The self-attention mechanism computes a weighted sum of values based on queries and keys. Given input matrices \(Q\) (Query), \(K\) (Key), and \(V\) (Value), the attention output is:

$$\text{Attention}(Q, K, V) = \text{softmax}\left(\frac{QK^T}{\sqrt{d_k}}\right) V$$

where \(d_k\) is the dimension of keys, used for scaling to prevent gradient issues. In practice, multi-head attention is employed to capture diverse representations. For \(h\) heads, the operation is:

$$\text{MultiHead}(Q, K, V) = \text{Concat}(\text{head}_1, \dots, \text{head}_h) W^O$$

with each head defined as:

$$\text{head}_i = \text{Attention}(Q W_i^Q, K W_i^K, V W_i^V)$$

Here, \(W_i^Q, W_i^K, W_i^V\) are learnable weight matrices for projection, and \(W^O\) is the output weight matrix. The Transformer module in my model includes an encoder stack with multiple layers of multi-head attention and feed-forward networks. Positional encodings are added to the input to retain sequence order information.

The integration of TCN and Transformer is sequential: the TCN processes the raw input sequences to produce feature maps that emphasize local temporal structures. These features are then passed to the Transformer encoder, which applies self-attention to model global interactions. This hybrid approach ensures that both fine-grained details and overarching trends in lithium-ion battery data are leveraged for SOH prediction.

Model Architecture and Training Details

The complete TCN-Transformer ensemble model is depicted in the following diagram (conceptually): input sequences of shape (30, 3) are fed into the TCN block, which outputs a feature tensor of shape (30, \(d_{model}\)). This tensor is then processed by the Transformer encoder, resulting in a context-aware representation. A global average pooling layer reduces the sequence dimension, followed by fully connected layers to regress the SOH value. The model is trained using the Adam optimizer with a learning rate of 0.003 and a dropout rate of 0.1 to prevent overfitting. The loss function is Mean Squared Error (MSE), and training runs for 200 epochs on a dataset split into 80% training, 10% validation, and 10% testing.

To formalize, let \(X \in \mathbb{R}^{T \times F}\) be the input sequence with \(T=30\) time steps and \(F=3\) features. The TCN transformation can be denoted as:

$$H_{\text{TCN}} = \text{TCN}(X)$$

where \(H_{\text{TCN}} \in \mathbb{R}^{T \times D}\). Then, the Transformer encoder computes:

$$H_{\text{Trans}} = \text{TransformerEncoder}(H_{\text{TCN}})$$

Finally, the SOH prediction \(\hat{y}\) is obtained via:

$$\hat{y} = \sigma(W \cdot \text{Pool}(H_{\text{Trans}}) + b)$$

where \(\sigma\) is a sigmoid activation for output scaling, \(W\) and \(b\) are weights, and Pool denotes global average pooling. This architecture is designed to be robust for various lithium-ion battery datasets.

Evaluation Metrics

To assess model performance, I use three standard metrics: Mean Absolute Error (MAE), Mean Squared Error (MSE), and Coefficient of Determination (R²). These metrics provide a comprehensive view of prediction accuracy and fit. For \(n\) samples, with true SOH values \(y_i\) and predicted values \(\hat{y}_i\), the metrics are defined as:

$$\text{MAE} = \frac{1}{n} \sum_{i=1}^{n} |y_i – \hat{y}_i|$$

$$\text{MSE} = \frac{1}{n} \sum_{i=1}^{n} (y_i – \hat{y}_i)^2$$

$$\text{R}^2 = 1 – \frac{\sum_{i=1}^{n} (y_i – \hat{y}_i)^2}{\sum_{i=1}^{n} (y_i – \bar{y})^2}$$

where \(\bar{y}\) is the mean of true values. Lower MAE and MSE indicate better precision, while R² close to 1 signifies excellent explanatory power. These metrics are computed on unseen test data to ensure unbiased evaluation of the lithium-ion battery SOH prediction model.

Results and Discussion

The experimental results demonstrate the effectiveness of the proposed TCN-Transformer ensemble model for lithium-ion battery SOH prediction. I compare it with two baseline models: a standalone TCN and a Recurrent Neural Network (RNN) with LSTM cells. All models are trained and tested on the same dataset from cycling experiments on lithium-ion batteries. The focus is on predicting SOH over the latter half of battery life, where degradation becomes more pronounced and prediction challenges increase.

The prediction outcomes for two representative lithium-ion batteries (Battery 1 and Battery 2) are shown in the following tables. The tables summarize the performance metrics across models, highlighting the superiority of the ensemble approach.

Table 1: Model Performance Comparison for Battery 1
Model MSE MAE
RNN 1.71734 × 10⁻⁴ 0.00932 0.89152
TCN 4.82074 × 10⁻⁵ 0.00835 0.90875
TCN-Transformer 1.54673 × 10⁻⁵ 0.00376 0.99184
Table 2: Model Performance Comparison for Battery 2
Model MSE MAE
RNN 1.28351 × 10⁻⁴ 0.00608 0.90171
TCN 4.15045 × 10⁻⁵ 0.00428 0.90742
TCN-Transformer 8.21283 × 10⁻⁶ 0.00216 0.99372

From these tables, it is evident that the TCN-Transformer ensemble achieves the lowest MSE and MAE, along with R² values exceeding 0.99 for both lithium-ion batteries. This indicates near-perfect fitting to the true SOH trends. In contrast, the RNN model performs the worst, likely due to its difficulty in capturing long-range dependencies and susceptibility to vanishing gradients. The standalone TCN shows improvement over RNN but still lags behind the ensemble, underscoring the value of integrating global attention mechanisms.

To further analyze, I examine the prediction curves over cycles. The TCN-Transformer predictions closely track the actual SOH decline, with minimal deviation even at later cycles where degradation accelerates. For instance, in Battery 1, the SOH drops from 100% to around 80% over 500 cycles; the ensemble model’s predictions maintain a smooth, accurate trajectory. The RNN and TCN models exhibit higher volatility and larger errors, especially near the end-of-life region. This robustness of the TCN-Transformer can be attributed to its dual capability: TCN’s dilated convolutions capture the gradual capacity fade of the lithium-ion battery, while Transformer’s attention heads focus on critical cycles where voltage or IC features shift abruptly.

Ablation studies confirm the contribution of each component. Removing the Transformer module leads to a significant drop in R² (to ~0.91), while removing TCN reduces the model’s ability to handle local fluctuations. Thus, the synergy is essential. Additionally, feature importance analysis reveals that the incremental capacity ratio is the most influential input, aligning with known electrochemical behaviors in lithium-ion batteries. The model’s attention weights can be visualized to identify which time steps are deemed important; for example, attention peaks often coincide with charge phase transitions, providing interpretability.

The generalization capability is tested on lithium-ion batteries not seen during training. The ensemble model maintains high accuracy, with average R² above 0.98, demonstrating its potential for real-world deployment. This is crucial because lithium-ion batteries in field conditions experience varied usage patterns, and a robust model must adapt. The table below summarizes cross-battery validation results for five additional lithium-ion batteries:

Table 3: Cross-Validation Performance on Unseen Lithium-Ion Batteries
Battery ID MSE (×10⁻⁵) MAE
B3 2.34 0.00412 0.98543
B4 3.01 0.00498 0.98176
B5 1.89 0.00345 0.98921
B6 2.67 0.00433 0.98354
B7 2.12 0.00387 0.98789

These results reinforce that the TCN-Transformer ensemble is highly effective for diverse lithium-ion batteries. Potential limitations include computational cost due to the Transformer’s quadratic complexity with sequence length, but this is mitigated by using a moderate sequence length of 30. Future work could explore adaptive sequence lengths or pruning techniques to enhance efficiency for large-scale lithium-ion battery monitoring systems.

Conclusion

In this research, I have developed and validated an ensemble machine learning model combining Temporal Convolutional Networks and Transformer for predicting the State of Health of lithium-ion batteries. The model addresses key challenges in time-series forecasting by leveraging TCN’s ability to capture local temporal dependencies and Transformer’s strength in modeling global relationships through self-attention. Experimental results from cycling tests on commercial lithium-ion batteries show that the proposed TCN-Transformer ensemble outperforms standalone models like RNN and TCN, achieving superior accuracy with MAE below 0.004 and R² above 0.99. The model accurately tracks SOH degradation trends, even in later cycles where nonlinear aging occurs, making it a reliable tool for lithium-ion battery management systems.

The success of this approach can be attributed to several factors. First, the feature engineering process extracts informative signals from charging data, such as incremental capacity and voltage profiles, which are intrinsically linked to the electrochemical health of lithium-ion batteries. Second, the architectural design enables multi-scale pattern recognition: TCN’s dilated convolutions expand the receptive field to encompass long-term degradation, while Transformer’s attention mechanism dynamically weights critical time steps. This synergy ensures robust predictions across different lithium-ion battery types and cycling conditions. Furthermore, the model offers interpretability through attention visualization, helping identify key degradation phases.

Practical implications are significant. Accurate SOH prediction allows for optimized charging strategies, preventive maintenance, and extended lifespan of lithium-ion batteries, reducing costs and environmental impact. For electric vehicles, this can enhance range estimation and safety. In grid storage, it supports capacity scheduling and replacement planning. The model’s data-driven nature makes it adaptable to various lithium-ion battery chemistries and formats with sufficient training data.

Future research directions include integrating additional sensor data (e.g., temperature, impedance) to enrich feature sets, exploring online learning for real-time adaptation, and extending the model to predict Remaining Useful Life (RUL) alongside SOH. Additionally, efforts can be made to reduce computational overhead for edge deployment on embedded systems. Overall, this work contributes a advanced framework for lithium-ion battery health monitoring, paving the way for smarter and more sustainable energy storage solutions. The consistent emphasis on lithium-ion battery throughout this study underscores its centrality in modern technology, and the proposed model offers a promising path toward enhancing their reliability and performance.

Scroll to Top