State-of-Health Estimation for Li-ion Batteries via Enhanced Variational Autoencoder and Transformer Framework

The accurate and reliable estimation of the State-of-Health (SOH) for lithium-ion batteries is a cornerstone for ensuring the safety, longevity, and economic viability of modern energy storage systems, particularly in demanding applications such as electric vehicles and grid-scale storage. SOH, typically defined as the ratio of current maximum capacity to its nominal capacity, provides a critical metric for battery management systems to optimize performance and schedule maintenance. Among various measurable parameters, electrochemical impedance spectroscopy (EIS) offers a rich source of information, probing the internal electrochemical processes that directly correlate with degradation mechanisms like solid electrolyte interface growth and lithium inventory loss. However, practical impedance data acquired in real-world or accelerated testing environments are often contaminated by noise and exhibit complex variations under different operational conditions such as state-of-charge (SOC) and temperature. This presents a significant challenge for data-driven SOH estimation models, which must extract robust, degradation-relevant features from noisy, multi-condition datasets to achieve high estimation accuracy and strong generalization across diverse battery types and usage scenarios.

To address these challenges, this article presents a novel deep learning framework that synergistically combines an Enhanced Variational Autoencoder (EVAE) for robust feature extraction with a Transformer model for precise sequence modeling and regression. The core innovation lies in the EVAE module, which integrates Variational Mode Decomposition (VMD) directly into the latent space processing of a standard Variational Autoencoder (VAE). This integration allows the model to first learn a compressed, informative latent representation of the raw impedance spectra and then adaptively decompose these latent features into intrinsic mode functions, effectively filtering out noise and isolating the underlying trends linked to capacity fade. The purified features are subsequently fed into a Transformer network. Leveraging its self-attention mechanism, the Transformer captures long-range dependencies and complex non-linear mappings between the extracted features and the battery’s SOH trajectory, overcoming limitations of recurrent networks in handling long sequences. This integrated EVAE-Transformer approach is designed to be resilient to noisy data and adaptable to varying operational conditions, providing a powerful tool for accurate li-ion battery prognostics.

Theoretical Foundations of the Proposed Framework

Variational Autoencoder for Latent Feature Learning

The Variational Autoencoder provides a probabilistic framework for learning a deep latent variable model of complex data, such as impedance spectra. Given an input data point \( \mathbf{x} \) (e.g., an impedance curve), the VAE aims to learn its underlying probability distribution \( p(\mathbf{x}) \). It introduces a latent variable \( \mathbf{z} \) and defines a generative process as \( p_{\theta}(\mathbf{x}) = \int p_{\theta}(\mathbf{z}) p_{\theta}(\mathbf{x}|\mathbf{z}) d\mathbf{z} \), where \( \theta \) are model parameters, \( p_{\theta}(\mathbf{z}) \) is a prior (typically a standard normal distribution), and \( p_{\theta}(\mathbf{x}|\mathbf{z}) \) is the conditional likelihood modeled by the decoder. The true posterior \( p_{\theta}(\mathbf{z}|\mathbf{x}) \) is intractable, so an inference model (the encoder) \( q_{\phi}(\mathbf{z}|\mathbf{x}) \), parameterized by \( \phi \), is used to approximate it.

The model is trained by maximizing the Evidence Lower Bound (ELBO), which balances reconstruction accuracy and the conformity of the latent distribution to the prior:

$$ \mathcal{L}(\theta, \phi; \mathbf{x}) = \mathbb{E}_{q_{\phi}(\mathbf{z}|\mathbf{x})}[\log p_{\theta}(\mathbf{x}|\mathbf{z})] – D_{\text{KL}}(q_{\phi}(\mathbf{z}|\mathbf{x}) \| p_{\theta}(\mathbf{z})) $$

Here, the first term is the reconstruction loss, and the second term is the Kullback-Leibler divergence between the approximate posterior and the prior. The encoder outputs parameters (mean \( \mathbf{\mu} \) and log-variance \( \log \mathbf{\sigma}^2 \)) defining a Gaussian distribution for \( \mathbf{z} \). A sample is obtained via the reparameterization trick: \( \mathbf{z} = \mathbf{\mu} + \mathbf{\sigma} \odot \mathbf{\epsilon} \), where \( \mathbf{\epsilon} \sim \mathcal{N}(0, \mathbf{I}) \). This allows gradient-based optimization. In our context for li-ion battery analysis, the VAE encoder learns to compress high-dimensional impedance data into a lower-dimensional latent vector \( \mathbf{z} \) that presumably encapsulates the essential electrochemical “fingerprint” related to the battery’s health state.

Variational Mode Decomposition for Adaptive Noise Filtering

Variational Mode Decomposition is a fully non-recursive signal processing technique that decomposes a real-valued input signal \( x(t) \) into a discrete number of band-limited intrinsic mode functions (IMFs) \( u_k(t) \). The core idea is to look for an ensemble of modes and their respective center frequencies \( \omega_k \) such that the sum of the bandwidths of each mode is minimized, subject to the constraint that the sum of all modes reconstructs the original signal. This leads to a constrained variational problem:

$$ \min_{\{u_k\},\{\omega_k\}} \left\{ \sum_{k} \left\| \partial_t \left[ \left( \delta(t) + \frac{j}{\pi t} \right) * u_k(t) \right] e^{-j\omega_k t} \right\|_2^2 \right\} \quad \text{s.t.} \quad \sum_{k} u_k(t) = x(t) $$

where \( \partial_t \) denotes the partial derivative with respect to time, \( \delta(t) \) is the Dirac distribution, \( * \) is the convolution operator, and \( \{u_k\} \), \( \{\omega_k\} \) are the set of all modes and their center frequencies. This problem is efficiently solved by introducing a quadratic penalty term and a Lagrangian multiplier, leading to an alternating direction method of multipliers (ADMM) approach in the frequency domain. The update equations in the Fourier domain are:

$$ \hat{u}_k^{n+1}(\omega) = \frac{\hat{x}(\omega) – \sum_{i \neq k} \hat{u}_i(\omega) + \frac{\hat{\lambda}(\omega)}{2}}{1 + 2\alpha (\omega – \omega_k)^2} $$

and

$$ \omega_k^{n+1} = \frac{\int_0^\infty \omega |\hat{u}_k(\omega)|^2 d\omega}{\int_0^\infty |\hat{u}_k(\omega)|^2 d\omega} $$

where \( \alpha \) is the balancing parameter, \( \hat{\cdot} \) denotes the Fourier transform, and \( n \) is the iteration number. For SOH estimation of li-ion batteries, VMD is applied not to the raw signal but to the latent features \( \mathbf{z} \) extracted by the VAE. This step adaptively separates the latent representation into a smooth, trend-carrying IMF (highly correlated with capacity fade) and other IMFs containing noise or irrelevant fluctuations.

Transformer Model for Sequential Regression

The Transformer architecture, built on a self-attention mechanism, is particularly effective for modeling sequential data and long-range dependencies without the recurrence found in RNNs or LSTMs. The scaled dot-product attention, the core component, is defined as:

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

where \( Q \) (Query), \( K \) (Key), and \( V \) (Value) are matrices derived from the input embeddings, and \( d_k \) is the dimension of the key vectors. The scaling factor \( \sqrt{d_k} \) prevents extremely small gradients. Multi-head attention extends this by running the attention mechanism in parallel over \( h \) different learned linear projections of \( Q, K, V \), concatenating the results and projecting them again:

$$ \text{MultiHead}(Q, K, V) = \text{Concat}(\text{head}_1, …, \text{head}_h)W^O $$
$$ \text{where head}_i = \text{Attention}(QW_i^Q, KW_i^K, VW_i^V) $$

The Transformer encoder uses this multi-head attention along with position-wise feed-forward networks, residual connections, and layer normalization. For the task of li-ion battery SOH estimation, the sequence of purified feature vectors (output from EVAE over successive cycles) is fed into the Transformer. The model learns to weigh the importance of features across different cycles, effectively capturing the non-linear progression of degradation and mapping the feature sequence to a sequence of SOH values.

The Integrated EVAE-Transformer Architecture

The proposed framework operates in two main stages. In the first stage, raw impedance data \( \mathbf{X} \) (e.g., real and imaginary parts across frequencies) from a li-ion battery under various SOC and temperature conditions is passed through the VAE encoder to obtain the latent distribution parameters \( \mathbf{\mu} \) and \( \mathbf{\sigma} \). A sample \( \mathbf{z} \) is drawn. Instead of directly using \( \mathbf{z} \) for regression, it is processed by VMD. A single latent feature dimension with high variance is typically selected and decomposed. The first IMF \( u_1 \), representing the low-frequency trend, is retained as the denoised health indicator \( \mathbf{h} \). This process is summarized as:

Stage 1: Feature Extraction & Denoising (EVAE)
1. Encode: \( \mathbf{\mu}, \mathbf{\log\sigma^2} = \text{Encoder}_{\phi}(\mathbf{X}) \).
2. Sample: \( \mathbf{z} = \mathbf{\mu} + \mathbf{\sigma} \odot \mathbf{\epsilon} \).
3. Decompose: \( \{u_1, u_2, …\} = \text{VMD}(\mathbf{z}_j) \), where \( \mathbf{z}_j \) is the selected latent dimension.
4. Extract: \( \mathbf{h} = u_1 \).

Stage 2: Sequential Mapping (Transformer)
The sequence of health indicators \( [\mathbf{h}^{(1)}, \mathbf{h}^{(2)}, …, \mathbf{h}^{(T)}] \) across \( T \) cycles is input to the Transformer model. The model employs positional encoding to incorporate cycle order information and uses its stacked encoder/decoder layers (adapted for regression) to output the corresponding sequence of SOH estimates \( [\widehat{SOH}^{(1)}, \widehat{SOH}^{(2)}, …, \widehat{SOH}^{(T)}] \).

The entire model is trained end-to-end. The VAE’s loss ensures meaningful latent representations, the VMD step is non-parametric and fixed during backpropagation, and the Transformer’s loss (Mean Squared Error) drives accurate SOH estimation. This integrated approach allows for robust feature learning directly from noisy, multi-condition impedance data of li-ion batteries.

Experimental Validation and Analysis

The effectiveness of the proposed EVAE-Transformer model is validated using two distinct li-ion battery datasets, encompassing different form factors (coin cell and commercial 18650), chemistries, and operating conditions (temperature, SOC). This rigorous testing demonstrates the model’s generalization capability.

Datasets and Preprocessing

Dataset A: Coin Cells: This dataset comprises 12 commercial 45 mAh LiCoO2/Graphite coin cells cycled at three temperatures (25°C, 35°C, 45°C). EIS measurements were taken at nine specific states (e.g., beginning of charge, 50% SOC, 100% SOC after rest) during cycling. The frequency range was 0.02 Hz to 20 kHz. The capacity degradation curves show temperature-dependent aging rates.

Dataset B: Commercial 18650 Cells: This dataset, from the EMPIR project, includes 18650 cylindrical cells with NMC811-Si/Graphite chemistry. Cells were cycled under specific protocols, and EIS was measured at multiple SOC points (e.g., 20%, 35%, 65%, 100%) during discharge after capacity checks. The frequency range was 0.01 Hz to 10 kHz.

For both datasets, the complex impedance values (real and imaginary parts) at all measured frequencies form the input feature vector \( \mathbf{X} \). The target SOH is calculated as \( SOH = Q_{current} / Q_{initial} \). Data is normalized, and sequences are constructed based on cycle number.

Model Implementation and Training Details

The model components were implemented in Python using PyTorch. Key hyperparameters are summarized in the table below. The VAE encoder and decoder consist of fully connected layers. The VMD step uses a fixed number of modes \( K=3 \) and a penalty parameter \( \alpha=2000 \). The Transformer model uses a single encoder layer with multi-head attention (16 heads) and a feed-forward network dimension of 100. The model is trained using the Adam optimizer with a learning rate of 0.001.

Component Parameter Value/Description
VAE Input Dimension 120 (60 freq. points × 2 components)
Latent Dimension 20
Training Epochs 60
VMD Number of Modes (K) 3
Balancing Parameter (α) 2000
Tolerance 1e-7
Transformer Number of Heads 16
Encoder Layers 1
Feed-forward Dimension 100
Dropout Rate 0.3
Training Epochs 150
Optimizer Type / Learning Rate Adam / 0.001

Performance Metrics

The model’s estimation performance is evaluated using three standard metrics calculated over all test cycles:

  1. Mean Absolute Error (MAE): $$ \text{MAE} = \frac{1}{N} \sum_{i=1}^{N} | y_i – \hat{y}_i | $$
  2. Root Mean Square Error (RMSE): $$ \text{RMSE} = \sqrt{ \frac{1}{N} \sum_{i=1}^{N} (y_i – \hat{y}_i)^2 } $$
  3. Coefficient of Determination (R²): $$ R^2 = 1 – \frac{\sum_{i=1}^{N} (y_i – \hat{y}_i)^2}{\sum_{i=1}^{N} (y_i – \bar{y})^2} $$

where \( y_i \) is the true SOH, \( \hat{y}_i \) is the estimated SOH, \( \bar{y} \) is the mean of true SOH, and \( N \) is the number of samples. Lower MAE/RMSE and an R² value closer to 1 indicate better performance.

Results on Coin Cell Dataset

The model was trained on data from cells at 25°C and tested on unseen cells at the same temperature but under different measurement states (SOC points). The EVAE-Transformer model demonstrated high accuracy across states. The following table shows a subset of the results, highlighting its robustness.

Test Cell Measurement State MAE (%) RMSE (%) R²
25C05 State 2 (SOC 0%) 2.81 3.89 0.97
25C05 State 5 (SOC 100% after rest) 1.95 2.88 0.98
25C06 State 7 (SOC 50% discharge) 1.32 1.62 0.97

A critical ablation study was conducted to validate the contribution of each component. Two baseline models were compared: 1) A standalone Transformer model trained directly on raw impedance data, and 2) An EVAE-LSTM model where the Transformer was replaced by a Long Short-Term Memory network.

Model Test Cell (State) MAE (%) RMSE (%) R²
Transformer (Raw Data) 25C05 (State 2) 6.84 8.24 0.85
25C05 (State 5) 6.26 7.24 0.89
EVAE-LSTM 25C05 (State 2) 5.08 5.33 0.94
25C05 (State 3) 12.12 13.01 0.64
Proposed EVAE-Transformer 25C05 (State 2) 2.81 3.89 0.97
25C05 (State 5) 1.95 2.88 0.98

The results clearly show that the standalone Transformer suffers from noise in the raw data, leading to higher errors. The EVAE-LSTM shows instability and higher errors on some states, indicating LSTM’s potential limitation in capturing very long-term dependencies compared to the self-attention mechanism. The proposed EVAE-Transformer consistently achieves the lowest error and highest R², validating the effectiveness of the integrated denoising and sequence modeling approach for li-ion battery SOH estimation.

Results on Commercial 18650 Cell Dataset and Cross-Type Generalization

A more challenging test involved using the model trained on coin cell data (source domain) to estimate SOH for a completely different type of li-ion battery: commercial 18650 cells (target domain). This tests the model’s ability to extract generalized health features from impedance data. The model was adapted using transfer learning principles, where the EVAE feature extractor pre-trained on coin cells was used to generate features for the 18650 cells, and only the Transformer regressor was fine-tuned on a small amount of 18650 data.

The performance across four different SOC points for two 18650 cells at different temperatures is summarized below:

Cell ID (Temp.) Test SOC (%) MAE (%) RMSE (%) R²
Cell 1-10 (35°C) 20 3.02 3.42 0.98
35 3.22 3.70 0.98
65 2.78 3.19 0.98
100 2.39 2.90 0.98
Cell 1-05 (45°C) 20 3.02 5.86 0.79
35 1.98 3.43 0.92
65 1.86 2.75 0.95
100 2.51 4.03 0.89

The results are highly promising. For the 35°C test, the model achieved an R² of 0.98 across all SOCs with MAE below 3.3%, demonstrating remarkable consistency. Performance at 45°C shows slightly higher variance, particularly at low and high SOC, which may be attributed to more complex thermal effects on impedance that differ from the source domain data. Nevertheless, the MAE remains below 3.1% and RMSE below 5.9% in the worst case, proving the model’s strong cross-type generalization capability for li-ion battery SOH estimation. This suggests that the EVAE learns fundamental electrochemical degradation patterns common across different li-ion battery designs, which are then successfully mapped to capacity fade by the Transformer.

Conclusion and Future Perspectives

This article presented a novel deep learning framework, EVAE-Transformer, for accurate and robust State-of-Health estimation of lithium-ion batteries using electrochemical impedance data. The core innovation is the Enhanced Variational Autoencoder, which integrates Variational Mode Decomposition into the latent feature pipeline of a VAE. This design enables the model to first learn a compressed representation of complex impedance spectra and then adaptively filter out noise, isolating smooth, degradation-relevant health indicators. The subsequent Transformer model, with its powerful self-attention mechanism, effectively captures long-term temporal dependencies in these indicators to produce precise SOH estimates.

Comprehensive experimental validation on both coin-type and commercial 18650 li-ion batteries under various temperatures and states-of-charge confirmed the framework’s superiority. The model consistently achieved high accuracy (MAE generally below 3.3%, RMSE below 5.9%) and demonstrated exceptional generalization ability, successfully transferring knowledge from one battery type to another. The ablation studies conclusively showed that both the EVAE-based denoising and the Transformer-based regression are critical components that outperform alternative configurations like standalone Transformers or EVAE paired with LSTMs.

Looking forward, the proposed methodology opens several promising avenues for advancing li-ion battery management. Future work could focus on: 1) Real-time Embedded Deployment: Optimizing the model for low-latency inference on resource-constrained battery management system hardware. 2) Multi-source Data Fusion: Extending the EVAE-Transformer architecture to incorporate other real-time sensor data (e.g., temperature, voltage curves, fiber optic strain sensing) alongside EIS for a more comprehensive and robust health assessment, especially in cases where full-spectrum EIS is unavailable. 3) Cloud-Edge Collaborative Systems: Implementing a system where complex model training and recalibration occur in the cloud using aggregated fleet data, while lightweight, updated models are deployed at the edge (in vehicles or storage systems) for real-time monitoring. This would leverage the model’s strong feature extraction capability to create personalized, adaptive SOH estimation for every li-ion battery in operation, ultimately enhancing safety, extending lifespan, and optimizing the economic value of energy storage assets.

Scroll to Top