KanFormer: A Hybrid KAN-Transformer Network for Lithium-Ion Battery State-of-Health Prediction

The precise prediction of the State of Health (SOH) for lithium-ion batteries is a cornerstone of reliable and safe Battery Management Systems (BMS) in electric vehicles and energy storage systems. SOH, typically defined as the ratio of current maximum capacity to nominal capacity, quantifies the degree of battery degradation. Accurate SOH estimation is critical for performance assessment, remaining useful life (RUL) prediction, thermal management, and ensuring operational safety by preventing over-charge or over-discharge. As lithium-ion batteries undergo repeated charge-discharge cycles, complex electrochemical aging mechanisms—such as solid electrolyte interface (SEI) layer growth, lithium plating, active material loss, and electrode structural changes—lead to irreversible capacity fade and power decline. Accurately capturing these nonlinear and often non-stationary degradation patterns from operational data remains a significant challenge.

Traditional SOH prediction approaches can be broadly categorized into model-based and data-driven methods. Model-based methods rely on electrochemical or equivalent circuit models to describe the internal dynamics of the lithium-ion battery. While physically interpretable, their accuracy is often hampered by the complexity of battery chemistry, difficulty in parameter identification, and limited generalization across diverse operating conditions and battery types. In contrast, data-driven methods, empowered by machine learning and deep learning, have gained prominence due to their ability to learn complex mapping relationships directly from historical data without requiring explicit physical models. Techniques such as Convolutional Neural Networks (CNNs), Long Short-Term Memory (LSTM) networks, Gated Recurrent Units (GRUs), and more recently, Transformer architectures, have been extensively applied to lithium-ion battery SOH prediction. These models typically take handcrafted health indicators (HIs)—features extracted from voltage, current, and capacity curves—as input to predict future SOH values.

Despite their successes, prevailing data-driven methods face two persistent challenges. First, there is a common reliance on a large number of HIs (often ten or more) to ensure prediction accuracy. This not only introduces information redundancy and increases computational complexity but also prolongs feature extraction time, reducing the overall efficiency of the prediction system, especially for real-time BMS applications. Second, the SOH degradation trajectory of a lithium-ion battery exhibits strong nonlinearity and non-stationarity. The aging rate can change abruptly due to different stress factors and internal reaction dynamics. Conventional neural network architectures, which use fixed activation functions (e.g., ReLU, sigmoid) on network nodes, often struggle to model such complex temporal dynamics adaptively. This can lead to prediction drift (systematic bias over time) and trend oscillation (unstable fluctuations), particularly during later stages of battery life or under varying operational profiles.

To address these limitations, this paper proposes a novel hybrid neural network architecture named KanFormer for high-accuracy and robust lithium-ion battery SOH prediction. The core innovation lies in the integration of the recently proposed Kolmogorov-Arnold (KAN) representation theory into a deep learning framework. Unlike Multi-Layer Perceptrons (MLPs) that apply fixed nonlinear activation functions on nodes, KANs place learnable activation functions on edges (weights), parameterized by spline functions. This allows KANs to achieve more flexible and adaptive nonlinear mapping, offering superior capabilities in smooth interpolation and fitting complex functions with fewer parameters. The proposed KanFormer synergistically combines the local fine-grained feature extraction prowess of KAN with the global long-range dependency modeling strength of the Transformer encoder. Furthermore, we introduce a lightweight health feature selection mechanism based on Incremental Capacity Analysis (ICA) and correlation analysis, which identifies a minimal set of four highly indicative features, thereby enhancing model efficiency without compromising accuracy.

The main contributions of this work are threefold:

  1. Lightweight Health Feature Selection: We present a streamlined process to select a compact yet highly predictive set of four health indicators from charge voltage curves, effectively reducing data redundancy and computational burden while maintaining high prediction fidelity.
  2. KAN-Transformer Hybrid Architecture (KanFormer): We design a novel network that leverages KAN-based convolutional layers for local temporal feature extraction and KAN-based fully connected layers for final nonlinear regression, coupled with a Transformer encoder for capturing global aging trends. This design effectively mitigates prediction drift and oscillation.
  3. Comprehensive Validation: We rigorously evaluate KanFormer on multiple public lithium-ion battery aging datasets (Michigan Formation, HNEI, and NASA). Results demonstrate that our model outperforms state-of-the-art baselines in key metrics like Mean Squared Error (MSE), Mean Absolute Error (MAE), and Coefficient of Determination (R²), showcasing its superior accuracy and strong generalization ability.

Battery Data Description and Feature Selection

Dataset Description

To validate the proposed method, experiments are conducted on two publicly available lithium-ion battery cycling datasets. A summary is provided in Table 1.

Table 1: Summary of Lithium-Ion Battery Aging Datasets Used
Dataset Battery Type Key Test Conditions Aging Characteristic
Michigan Formation NMC111/Graphite Pouch 25°C & 45°C; Different Formation Protocols Capacity fade rate depends heavily on formation protocol; nonlinear decay.
HNEI Commercial 18650 Cylindrical Constant Temperature; CC-CV Charge, CC Discharge Approximately linear decay initially, with increased nonlinearity and noise towards end-of-life.

The Michigan Formation dataset investigates the impact of formation protocols on long-term cycling performance. It includes batteries subjected to Baseline Formation (BLForm) and Modified Formation (MCForm) processes. A clear divergence in aging trajectories is observed, where MCForm cells generally exhibit slower capacity fade compared to BLForm cells, highlighting the critical role of initial conditioning in lithium-ion battery longevity.

The HNEI dataset comprises aging tests on commercial 18650 cylindrical cells. The capacity fade curves typically show a near-linear decline in the early and middle stages, followed by accelerated and more volatile degradation as the battery approaches its end-of-life. This dataset presents challenges due to its inherent measurement noise and the non-stationary shift in degradation rate.

Feature Engineering and Selection

Instead of relying on a multitude of features, we employ a targeted feature extraction strategy based on Incremental Capacity Analysis (ICA). The ICA curve, derived from charge data, is highly sensitive to internal electrochemical changes within the lithium-ion battery and is a powerful tool for aging characterization. The Incremental Capacity (IC) is calculated as:
$$ IC = \frac{dQ}{dV} = \frac{I \cdot dt}{dV} = I \cdot \frac{dt}{dV} $$
where \( I \) is the charge current, \( t \) is time, and \( V \) is the cell voltage.

As the lithium-ion battery ages, its ICA curve shifts and the peak amplitude diminishes, indicating loss of active material and increased polarization. We segment the voltage range corresponding to the major ICA peak and compute the charging time or the area under the voltage-time curve within these segments as candidate Health Indicators (HIs).

To select the most informative and compact feature set, we perform a dual correlation analysis between each candidate HI and the actual battery capacity (SOH). We use both Pearson correlation (for linear relationships) and Spearman correlation (for monotonic relationships). The formulas are:
$$ \text{Pearson} = \frac{\sum_{i=1}^{n}(X_i – \bar{X})(Y_i – \bar{Y})}{\sqrt{\sum_{i=1}^{n}(X_i – \bar{X})^2 \sum_{i=1}^{n}(Y_i – \bar{Y})^2}} $$
$$ \text{Spearman} = 1 – \frac{6 \sum_{i=1}^{n} d_i^2}{n(n^2 – 1)} $$
where \( X_i \) and \( Y_i \) are the samples, \( \bar{X} \) and \( \bar{Y} \) are the means, and \( d_i \) is the difference between ranks.

For the Michigan dataset, the voltage intervals 3.55–3.65 V and 3.70–3.75 V showed the highest correlation. For the HNEI dataset, intervals 3.85–3.95 V and 3.90–4.00 V were most correlated. From the larger candidate pool, we select the four features with the highest average correlation for each dataset. This selection is validated empirically; using more than four features leads to diminishing returns in accuracy while increasing model complexity and training time. As shown in subsequent experiments, this four-feature set achieves an optimal balance between performance and efficiency for the lithium-ion battery SOH prediction task.

Methodology: The KanFormer Architecture

The proposed KanFormer network is designed to model the complex, nonlinear degradation of lithium-ion batteries accurately. It consists of three sequential modules: 1) a Local Feature Extraction module based on KAN convolution, 2) a Global Feature Extraction module using a Transformer encoder, and 3) a Prediction Output module with KAN fully-connected layers. This structure leverages KAN’s superior local function fitting and Transformer’s global context modeling.

Local Feature Extraction Module (KAN-Conv)

This module replaces standard convolutional layers with KAN-based convolutions to capture fine-grained, local temporal patterns in the sequence of health indicators. In a traditional CNN, a convolution operation applies a linear filter followed by a fixed nonlinear activation. In a KAN-Conv layer, the linear weights on the edges are replaced by learnable nonlinear functions, implemented using splines.

We use B-splines of order 3 as the basis functions. For an input element \( x_{\text{conv}} \), the operation on a single “weight” is defined as a learnable combination of basis functions plus a residual activation function:
$$ \phi_{\text{conv}}(x_{\text{conv}}) = w \cdot \left( \sum_{j=1}^{J} c_j B_j(x_{\text{conv}}) \right) + \text{SiLU}(x_{\text{conv}}) $$
where \( B_j \) are the B-spline basis functions, \( c_j \) are learnable coefficients, \( w \) is a learnable scaling factor, and \( J \) is the number of basis functions (determined by grid size \( G=10 \) and spline order \( k=3 \), resulting in \( J = G + k = 13 \)). The SiLU function serves as a smooth baseline activation. The output for a local patch is the sum of these transformed elements across the patch. The process is summarized in Table 2.

Table 2: KAN-Conv Layer Operation
Step Operation
1 Extract local patches from the input sequence using a sliding kernel.
2 For each element \( x_{\text{conv}} \) in a patch, evaluate the B-spline basis functions \( B_j(x_{\text{conv}}) \).
3 Compute the weighted sum \( b_{\text{conv}}(x_{\text{conv}}) = \sum_{j} c_j B_j(x_{\text{conv}}) \).
4 Compute the nonlinear edge output \( f_{\text{conv}}(x_{\text{conv}}) = w \cdot b_{\text{conv}}(x_{\text{conv}}) + \text{SiLU}(x_{\text{conv}}) \).
5 Sum \( f_{\text{conv}}(x_{\text{conv}}) \) for all elements in the patch to get the patch’s feature \( F_{\text{conv}} \).
6 Assemble outputs from all patches to form the feature map.

Global Feature Extraction Module (Transformer Encoder)

The local features are then passed to a Transformer encoder to model long-range dependencies across the entire sequence, which is crucial for understanding the overall aging trend of the lithium-ion battery. The input is first added with sinusoidal positional encodings \( PE_{(pos, 2i)} = \sin(pos / 10000^{2i/d}) \) and \( PE_{(pos, 2i+1)} = \cos(pos / 10000^{2i/d}) \) to retain order information.

The core of the encoder is the multi-head self-attention mechanism. For an input \( z \), it is projected into Query (Q), Key (K), and Value (V) matrices. The attention for a single head is computed as:
$$ \text{Attention}(Q, K, V) = \text{softmax}\left(\frac{QK^T}{\sqrt{d_k}}\right)V $$
Multi-head attention concatenates outputs from \( h \) parallel heads:
$$ \text{MultiHead}(Q,K,V) = \text{Concat}(\text{head}_1, …, \text{head}_h)W^O $$
where \( \text{head}_i = \text{Attention}(QW_i^Q, KW_i^K, VW_i^V) \).

The Transformer encoder also includes feed-forward networks, layer normalization, and residual connections, which stabilize training and enhance representation power.

Prediction Output Module (KAN-FC)

The final module maps the globally contextualized features to the SOH prediction value. It consists of a pooling layer (to collapse the time dimension), a dropout layer for regularization, and two fully-connected layers implemented as KAN layers. A KAN fully-connected layer operates similarly to the KAN-Conv layer but without spatial convolution. For an input element \( x_{\text{fc}} \), the transformation for one connection is:
$$ f_{\text{fc}}(x_{\text{fc}}) = w \cdot \left( \sum_{j=1}^{J} c_j B_j(x_{\text{fc}}) \right) + \text{SiLU}(x_{\text{fc}}) $$
The final layer’s outputs are linearly combined to produce the predicted SOH value for the target cycle. The SOH is defined as:
$$ \text{SOH} = \frac{C_{\text{max}}}{C_{\text{nominal}}} $$
where \( C_{\text{max}} \) is the predicted maximum capacity and \( C_{\text{nominal}} \) is the nominal capacity. The operation is outlined in Table 3.

Table 3: KAN Fully-Connected Layer Operation
Step Operation
1 For each input element \( x_{\text{fc}} \), evaluate B-spline basis functions \( B_j(x_{\text{fc}}) \).
2 Compute \( b_{\text{fc}}(x_{\text{fc}}) = \sum_{j} c_j B_j(x_{\text{fc}}) \).
3 Compute the nonlinear output \( f_{\text{fc}}(x_{\text{fc}}) = w \cdot b_{\text{fc}}(x_{\text{fc}}) + \text{SiLU}(x_{\text{fc}}) \).
4 For the output neuron \( m \), compute \( F_{\text{fc}, m} = \sum_{n} W_{mn} f_{\text{fc}}(x_{\text{fc},n}) \), where \( W_{mn} \) are final linear combination weights.

The synergy between the adaptive nonlinear fitting of KAN layers and the global temporal modeling of the Transformer allows KanFormer to accurately track the lithium-ion battery’s SOH trajectory while minimizing drift and oscillation.

Experimental Setup and Results Analysis

Experimental Settings

We evaluate KanFormer on the Michigan Formation and HNEI lithium-ion battery datasets. For Michigan, we use 8 cells for training and 2 for testing per formation group. For HNEI, 12 cells are used for training and 2 for testing. The model predicts future SOH values in a rolling, multi-step-ahead fashion. Key hyperparameters are listed in Table 4.

Table 4: Model Hyperparameters and Structure
Hyperparameter Value Layer Output Shape
Spline Grid Size (G) 10 Input [64, 100, 4]
B-Spline Order (k) 3 KAN-Conv1 [64, 100, 32]
Transformer Layers 4 KAN-Conv2 [64, 100, 64]
Attention Heads 4 Transformer [64, 100, 64]
Learning Rate 0.001 Pooling [64, 64]
Dropout Rate 0.1 KAN-FC1 [64, 512]
Optimizer Adam KAN-FC2 / Output [64, 50]
Training Epochs 100 – –

We employ four standard evaluation metrics: Mean Squared Error (MSE), Mean Absolute Error (MAE), Coefficient of Determination (R²), and End-of-Life (EOL) cycle error.
$$ \text{MSE} = \frac{1}{n}\sum_{i=1}^{n}(y_i – \hat{y}_i)^2 $$
$$ \text{MAE} = \frac{1}{n}\sum_{i=1}^{n}|y_i – \hat{y}_i| $$
$$ R^2 = 1 – \frac{\sum_{i=1}^{n}(y_i – \hat{y}_i)^2}{\sum_{i=1}^{n}(y_i – \bar{y})^2} $$
$$ \text{EOL Error} = \hat{N}_{\text{EOL}} – N_{\text{EOL}} $$
where \( y_i \) is the true SOH, \( \hat{y}_i \) is the predicted SOH, \( \bar{y} \) is the mean true SOH, \( \hat{N}_{\text{EOL}} \) is the predicted EOL cycle, and \( N_{\text{EOL}} \) is the true EOL cycle.

Comparison with State-of-the-Art Methods

We compare KanFormer against several prominent data-driven methods for lithium-ion battery SOH prediction from recent literature, including models based on CNN, GRU, BiLSTM, and hybrid CNN-Transformer architectures. The prediction results on sample cells from both datasets are visualized, showing the predicted SOH curve versus the ground truth, along with the error distribution histogram.

On the Michigan Formation dataset, all models perform well in the early, slow-degradation phase. However, as the lithium-ion battery enters an accelerated aging phase, most baseline models exhibit significant prediction drift (consistently over- or under-predicting) and increased instability. In contrast, KanFormer’s predictions adhere closely to the true degradation trajectory throughout the battery’s life. The error histogram for KanFormer is sharply peaked near zero, indicating a lower bias and tighter error distribution.

On the noisier HNEI dataset, some baseline models produce predictions with severe oscillations, poorly reflecting the actual smooth degradation trend of the lithium-ion battery. KanFormer, benefiting from the smooth interpolation of KANs and the contextual awareness of the Transformer, generates a much more stable and accurate prediction curve, effectively suppressing noise-induced fluctuations.

The quantitative comparison of average performance metrics across test cells is presented in Table 5. KanFormer achieves the lowest MSE and MAE and the highest R² on both datasets, demonstrating its superior accuracy.

Table 5: Performance Comparison of Different SOH Prediction Methods
Method Michigan Formation (Avg.) HNEI (Avg.)
MSE (×10⁻³) MAE R² MSE (×10⁻⁴) MAE R²
CNN [18] 9.85 0.078 0.938 1.52 0.0289 0.989
GRU [19] 7.33 0.067 0.954 1.08 0.0243 0.992
BiLSTM [20] 6.91 0.065 0.957 0.98 0.0231 0.993
CNN-LSTM [21] 6.24 0.061 0.961 0.87 0.0218 0.994
CNN-Transformer [22] 5.58 0.056 0.965 0.79 0.0205 0.994
BiLSTM-Transformer [23] 5.12 0.052 0.968 0.72 0.0196 0.995
KanFormer (Ours) 4.50 0.041 0.978 0.55 0.0175 0.996

Ablation Studies and Feature Analysis

To validate the contribution of each component in KanFormer, we conduct ablation studies on the Michigan dataset, as shown in Table 6.

Table 6: Ablation Study Results (Average on Michigan Test Set)
Model Variant Description MSE (×10⁻³) MAE R²
KanFormer (Full) Proposed complete model 4.50 0.041 0.978
w/o KAN-Conv Replace KAN-Conv with standard Conv 6.88 0.064 0.958
w/o KAN-FC Replace KAN-FC layers with MLP 7.21 0.066 0.956
Transformer Only Remove all KAN layers, use MLP blocks 8.95 0.075 0.945
KAN Only Remove Transformer, use stacked KAN layers 5.93 0.058 0.963

The results clearly show that removing either the KAN-Conv or KAN-FC modules leads to a noticeable drop in performance, confirming their importance in modeling the lithium-ion battery’s nonlinear aging. The “Transformer Only” model performs the worst, highlighting the limitation of standard MLPs in this task. The “KAN Only” model performs reasonably well but is outperformed by the full KanFormer, underscoring the value of integrating global temporal modeling via the Transformer.

We also investigate the impact of the number of selected health features. Training speed and prediction accuracy are evaluated as the number of HIs increases from 4 to 16. The results, summarized in Table 7, indicate that using our selected 4 HIs yields the best trade-off: it achieves the highest training speed (an average improvement of 15.32% over using more features) while maintaining top-tier prediction accuracy (MSE=0.45%, MAE=4.10%, R²=0.978). Adding more features introduces redundancy and noise, slightly degrading performance while increasing computational cost.

Table 7: Impact of Number of Health Indicators (HIs) on Model Performance and Efficiency
Number of HIs Training Speed (Relative) MSE (%) MAE (%) R²
4 (Ours) 1.00 (Baseline) 0.45 4.10 0.978
8 0.89 0.48 4.25 0.976
12 0.82 0.52 4.40 0.974
16 0.75 0.55 4.55 0.972

Robustness Validation on NASA Dataset

To further assess generalization, we test KanFormer on the well-known NASA lithium-ion battery dataset under a noise-injection scenario. We train on batteries B0006, B0007, B0018 and test on B0005. Gaussian noise with a relative amplitude of 0.5% is added to the test data to simulate measurement perturbations. Results are shown in Table 8.

Table 8: KanFormer Performance on NASA Dataset with and without Noise
Condition MSE (%) MAE (%) R²
Without Noise 0.056 1.684 0.984
With 0.5% Gaussian Noise 0.064 1.903 0.981

The performance degradation is minimal (MSE increase ~14%, R² decrease only 0.003), demonstrating the model’s strong robustness. The local smoothing property of KAN’s spline functions and the global context from the Transformer help the model filter out noise and maintain an accurate prediction of the underlying lithium-ion battery degradation trend.

Conclusion

This paper presents KanFormer, a novel hybrid neural network that integrates the Kolmogorov-Arnold Network (KAN) representation theory with a Transformer architecture for accurate and robust State-of-Health (SOH) prediction of lithium-ion batteries. The model addresses key limitations of existing methods: dependency on numerous health features and difficulty in modeling nonlinear, non-stationary degradation dynamics. By employing a lightweight feature selection strategy and replacing standard linear+activation blocks with adaptive KAN layers, KanFormer achieves superior prediction accuracy with improved computational efficiency. Extensive experiments on multiple public lithium-ion battery aging datasets demonstrate that KanFormer consistently outperforms state-of-the-art baselines in terms of MSE, MAE, and R². Furthermore, it effectively mitigates common issues like prediction drift and trend oscillation. The ablation studies confirm the critical roles of both the KAN-based components and the Transformer encoder. The model also shows promising robustness against data noise. Future work will focus on extending the validation to more complex real-world operating conditions involving dynamic temperatures, varying C-rates, and cell-to-cell variations within packs, further enhancing the model’s practicality for advanced BMS applications.

Scroll to Top