Hybrid LSTM+Mamba Network for Li-ion Battery RUL and SOH Prediction

Li-ion battery degradation is a highly nonlinear and multi-physics coupled process. In practical applications such as electric vehicles, grid energy storage, and portable electronics, the accurate estimation of remaining useful life (RUL) and state of health (SOH) is essential for safe operation, maintenance scheduling, and lifecycle management. I propose a hybrid network that combines long short-term memory (LSTM), multi-head attention (MA), and Mamba to improve the accuracy and robustness of Li-ion battery RUL and SOH prediction. The proposed method first standardizes degradation data, then extracts temporal dependencies through LSTM, dynamically weights informative features via MA, and finally captures complex nonlinear patterns using Mamba. A combined weighted loss function is designed to enhance robustness against outliers and to emphasize late-life degradation behavior. I evaluate the method on a nickel-manganese-cobalt (NMC) Li-ion battery degradation dataset and compare it with several ablated variants and alternative loss functions.

Introduction

Li-ion battery performance deteriorates gradually due to electrolyte decomposition, solid electrolyte interphase growth, active material loss, and lithium inventory reduction. These mechanisms lead to capacity fade and internal resistance growth, which are reflected in voltage, current, temperature, and charge-discharge time series. Because the degradation trajectory differs across life stages, a single fixed model often fails to generalize. Data-driven methods can learn degradation patterns directly from historical measurements without explicitly modeling electrochemical reaction equations. However, many existing approaches still struggle with long-range dependencies, local nonlinearity, and noisy measurements.

RUL is defined as the number of remaining charge-discharge cycles before the Li-ion battery capacity reaches a failure threshold. SOH is defined as the ratio of current capacity to initial capacity. Both tasks require the model to capture slow aging trends and abrupt changes. Recurrent networks such as LSTM are effective for temporal dependencies, but their sequential computation can limit the modeling of complex cross-feature interactions. Attention mechanisms can reweight features, yet they may lack a selective state-space mechanism for efficient long-sequence processing. Mamba introduces a selective state-space model (SSM) that scales linearly with sequence length and dynamically adjusts its parameters according to the input. I therefore combine LSTM, MA, and Mamba to exploit their complementary strengths.

Data Preprocessing

The raw degradation data contain features with different scales and units, such as voltage, current, temperature, internal resistance, charge time, and capacity variation rates. Directly feeding these heterogeneous values into a neural network can slow convergence and bias feature learning. I apply z-score normalization to each feature so that the transformed data have zero mean and unit variance:

$$ z_i = \frac{x_i – \mu}{\sigma} $$

where \(x_i\) is the original value, \(\mu\) is the mean, and \(\sigma\) is the standard deviation. This transformation preserves the shape of the distribution while removing scale differences. For Li-ion battery degradation data collected under different temperatures and load conditions, z-score normalization provides a consistent numerical range and improves the stability of gradient-based training.

After normalization, I construct sliding windows from the time series. Each window contains historical measurements and is associated with the current cycle number. The target for RUL is the remaining number of cycles, while the target for SOH is the normalized capacity ratio. This windowing strategy allows the hybrid network to learn both short-term fluctuations and long-term degradation trends.

Hybrid Network Architecture

The proposed architecture consists of three main stages: LSTM for temporal feature extraction, MA for feature reweighting, and Mamba for deep nonlinear pattern recognition. The output is passed through a fully connected layer to produce RUL or SOH estimates. Table 1 summarizes the role of each module in the Li-ion battery prediction pipeline.

Module Primary Function Benefit for Li-ion Battery Prediction
LSTM Captures temporal dependencies and sequential memory Models gradual capacity fade and charge-discharge dynamics
Multi-head attention Dynamically weights important features Emphasizes voltage, current, temperature, and internal resistance patterns
Mamba Selective state-space sequence modeling Extracts complex nonlinear degradation patterns with linear complexity
Combined weighted loss Robust optimization with late-life emphasis Improves accuracy in accelerated aging and outlier-prone stages

LSTM Module

LSTM maintains a cell state and three gates to control information flow. The forget gate decides how much previous information to discard, the input gate controls new information, and the output gate produces the hidden state. For a Li-ion battery sequence, the input at time step \(t\) is the normalized feature vector \(x_t\), and the previous hidden state is \(h_{t-1}\). The LSTM equations are:

$$ f_t = \sigma(W_f [h_{t-1}, x_t] + b_f) $$

$$ i_t = \sigma(W_i [h_{t-1}, x_t] + b_i) $$

$$ \tilde{C}_t = \tanh(W_C [h_{t-1}, x_t] + b_C) $$

$$ C_t = f_t \odot C_{t-1} + i_t \odot \tilde{C}_t $$

$$ o_t = \sigma(W_o [h_{t-1}, x_t] + b_o) $$

$$ h_t = o_t \odot \tanh(C_t) $$

where \(\sigma\) is the sigmoid function, \(\odot\) denotes element-wise multiplication, \(W_f, W_i, W_C, W_o\) are weight matrices, and \(b_f, b_i, b_C, b_o\) are bias vectors. The LSTM layer outputs a sequence of hidden states that encode the temporal evolution of the Li-ion battery. This is particularly useful for RUL prediction because the remaining life depends on the accumulated degradation history.

Multi-Head Attention Module

After LSTM, the hidden states are passed to a multi-head attention module. Standard attention computes a weighted sum of values based on query-key similarity. Multi-head attention runs several attention heads in parallel, allowing the model to attend to different representation subspaces. For Li-ion battery data, different heads can focus on voltage relaxation, temperature rise, internal resistance growth, and charge time elongation.

Given an input sequence \(X = [x_1, x_2, \ldots, x_n]\), the query, key, and value matrices are computed as:

$$ Q = XW_q, \quad K = XW_k, \quad V = XW_v $$

where \(W_q, W_k, W_v\) are learnable projection matrices. The scaled dot-product attention score is:

$$ A = \frac{QK^T}{\sqrt{d_k}} $$

where \(d_k\) is the dimension of the key vectors. The attention weights are obtained by applying softmax:

$$ A’ = \mathrm{softmax}(A) $$

For each head \(i\), the attention output is:

$$ \mathrm{Head}_i = \mathrm{Attention}(QW_q^i, KW_k^i, VW_v^i) $$

The outputs of all heads are concatenated and linearly transformed:

$$ \mathrm{MH} = \mathrm{Concat}(\mathrm{Head}_1, \ldots, \mathrm{Head}_n)W_o $$

where \(n\) is the number of heads and \(W_o\) is the output projection. I use four parallel heads. This design allows the model to dynamically emphasize informative features and suppress noise. For a Li-ion battery, early cycles may be dominated by formation and SEI growth, while later cycles may be dominated by lithium plating and active material loss. Multi-head attention provides the flexibility to shift focus across life stages.

Mamba Module

Mamba is a selective state-space sequence model that processes long sequences with linear complexity. It builds on continuous-time state-space models, which describe the evolution of a hidden state \(h(t)\) and output \(y(t)\):

$$ h'(t) = A h(t) + B x(t) $$

$$ y(t) = C h(t) + D x(t) $$

where \(A\) is the state matrix, \(B\) is the input matrix, \(C\) is the output matrix, and \(D\) is the feedthrough matrix. For discrete sequences, the continuous system is discretized using a step size \(\Delta\). The discretized matrices are:

$$ \bar{A} = \exp(\Delta A) $$

$$ \bar{B} = (\Delta A)^{-1}(\exp(\Delta A) – I) \cdot \Delta B $$

The recurrence then becomes:

$$ h_t = \bar{A} h_{t-1} + \bar{B} x_t $$

$$ y_t = C h_t + D x_t $$

Mamba introduces a selection mechanism that makes \(B\), \(C\), and \(\Delta\) input-dependent. This allows the model to selectively remember or forget information based on the current Li-ion battery state. The selection mechanism is implemented as:

$$ B = \mathrm{Linear}(X), \quad C = \mathrm{Linear}(X), \quad \Delta = \mathrm{softplus}(\mathrm{Linear}(X)) $$

The softplus function ensures that the step size remains positive. The selective mechanism enables Mamba to focus on critical degradation events, such as sudden capacity drops or internal resistance spikes. The scan module then processes the sequence in a parallel-friendly manner, combining local convolution with state-space recurrence. This is especially beneficial for Li-ion battery degradation data, where long-range dependencies and local fluctuations coexist.

Combined Weighted Loss Function

To improve robustness against outliers and to emphasize late-life degradation, I design a combined weighted loss function. It consists of a smooth L1 loss and a weighted mean squared error (WMSE) loss. Smooth L1 behaves like a quadratic loss for small errors and like a linear loss for large errors, which reduces sensitivity to outliers. WMSE assigns higher weights to samples in the later stage of the Li-ion battery life cycle.

The smooth L1 loss is defined as:

$$ L_{\mathrm{SL1}} = \begin{cases} 0.5(y_i – \hat{y}_i)^2, & |y_i – \hat{y}_i| < 1 \\ |y_i – \hat{y}_i| – 0.5, & \text{otherwise} \end{cases} $$

where \(y_i\) is the true value and \(\hat{y}_i\) is the predicted value. The WMSE loss is:

$$ L_{\mathrm{WMSE}} = \sum_{i=1}^{n} \omega_i (y_i – \hat{y}_i)^2 $$

The sample weight \(\omega_i\) depends on the cycle number. When the cycle number exceeds a threshold, the weight increases linearly:

$$ \omega_i = \begin{cases} 1 + \tau \cdot \frac{C_{\mathrm{cycle}} – 0.7 C_{\mathrm{max}}}{C_{\mathrm{max}}}, & C_{\mathrm{cycle}} \ge 0.7 C_{\mathrm{max}} \\ 1, & \text{otherwise} \end{cases} $$

where \(C_{\mathrm{max}}\) is the maximum cycle number, \(C_{\mathrm{cycle}}\) is the current cycle number, and \(\tau\) is a scaling factor. I set \(\tau = 0.5\) to control the weight increase and avoid overfitting. The final combined loss is:

$$ L_C = \alpha L_{\mathrm{SL1}} + \beta L_{\mathrm{WMSE}} $$

where \(\alpha\) and \(\beta\) are weighting coefficients satisfying \(\alpha + \beta = 1\). The smooth L1 component ensures stable training and outlier robustness, while the WMSE component forces the model to pay more attention to the accelerated degradation stage. For Li-ion battery RUL and SOH prediction, this combined loss improves both overall accuracy and late-life fitting.

Experimental Setup

I use an NMC Li-ion battery degradation dataset containing full charge-discharge cycles. The temperature range is 10 °C to 40 °C, and the load range is 1C to 3C. The dataset includes cycle number, average temperature, internal resistance, charge time, and capacity variation features such as dQdV maximum, dQdV minimum, and dQdV variance. These features reflect different aging mechanisms. For example, internal resistance growth indicates active material loss and electrolyte degradation, while charge time elongation reflects lithium inventory loss.

Table 2 lists the input features and their physical relevance to Li-ion battery degradation.

Feature Description Degradation Relevance
Cycle Charge-discharge cycle index Quantifies cumulative aging
TemperatureAvg Average temperature per cycle High temperature accelerates SEI growth and electrolyte decomposition
InternalResistance Internal resistance Reflects active material loss and impedance rise
ChargeTime Charging duration Indicates lithium inventory loss
dQdV_max Maximum capacity variation rate Related to electrode phase transition balance
dQdV_min Minimum capacity variation rate Reflects structural degradation
dQdV_var Variance of capacity variation rate Captures nonlinearity in degradation

The dataset is split into 70% training and 30% testing. I run four independent experiments with different random splits to evaluate generalization. The model is trained for 2000 epochs using the Adam optimizer with a learning rate of \(1 \times 10^{-4}\) and weight decay of \(1 \times 10^{-5}\). The hidden dimension is 16, and the number of attention heads is 4. The combined loss uses \(\alpha = 0.7\) and \(\beta = 0.3\). Table 3 summarizes the hyperparameters.

Hyperparameter Value
Epochs 2000
Optimizer Adam
Learning rate \(1 \times 10^{-4}\)
Weight decay \(1 \times 10^{-5}\)
Hidden dimension 16
Attention heads 4
\(\alpha\) 0.7
\(\beta\) 0.3

I use mean squared error (MSE), root mean squared error (RMSE), mean absolute error (MAE), and the coefficient of determination \(R^2\) as evaluation metrics. Their formulas are:

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

$$ \mathrm{RMSE} = \sqrt{\frac{1}{n}\sum_{i=1}^{n} (y_i – \hat{y}_i)^2} $$

$$ \mathrm{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} $$

where \(\bar{y}\) is the mean of the true values. A higher \(R^2\) indicates better explanatory power. For uncertainty quantification, I apply Monte Carlo dropout with a dropout rate of 10% and 100 stochastic forward passes. The predictive uncertainty is estimated as:

$$ \sigma = \sqrt{\frac{1}{N}\sum_{i=1}^{N} (y_i – \mu)^2} $$

where \(N\) is the number of Monte Carlo samples, \(y_i\) is the prediction from the \(i\)-th pass, and \(\mu\) is the mean prediction. This provides a confidence interval for the Li-ion battery RUL and SOH estimates.

Results and Analysis

I first evaluate RUL prediction. Table 4 reports the MSE, RMSE, MAE, and \(R^2\) for four test splits.

Experiment MSE RMSE MAE \(R^2\)
1 324.4839 18.0134 12.4354 0.9988
2 236.3104 15.3724 11.7613 0.9979
3 162.4385 12.7451 9.5713 0.9985
4 288.5141 16.9857 14.0929 0.9990

The MSE ranges from 162.44 to 324.48, and the RMSE ranges from 12.75 to 18.01. The MAE ranges from 9.57 to 14.09. These variations reflect the difficulty of predicting local fluctuations, especially when the Li-ion battery enters the accelerated degradation stage after approximately 1300 cycles. The \(R^2\) values remain between 0.9979 and 0.9990, indicating that the model captures the overall degradation trend very well. The slight increase in error during late-life periods is consistent with the nonlinear and abrupt capacity fade of Li-ion battery cells.

Table 5 reports SOH prediction results for four test splits. The MSE is on the order of \(10^{-2}\), and the RMSE and MAE are very small. The \(R^2\) values range from 0.9742 to 0.9932. These results show that the proposed hybrid network accurately tracks the SOH evolution of Li-ion battery cells.

Experiment MSE (\(10^{-2}\)) RMSE MAE \(R^2\)
1 0.0012 0.0034 0.0025 0.9932
2 0.0036 0.0060 0.0054 0.9769
3 0.0040 0.0063 0.0040 0.9742
4 0.0013 0.0036 0.0025 0.9923

The SOH prediction results are extremely accurate. The low MSE, RMSE, and MAE indicate that the hybrid network learns the capacity fade dynamics of Li-ion battery cells with high precision. The LSTM component captures the sequential dependency, the attention mechanism emphasizes the most relevant degradation features, and the Mamba module extracts hidden nonlinear patterns. The combination is particularly effective when the Li-ion battery transitions from gradual aging to accelerated aging.

I also compare different loss functions to verify the effectiveness of the combined weighted loss. Table 6 summarizes the comparison. The combined loss achieves the best RUL-MSE and SOH-MSE among the tested options.

Loss Function RUL-MSE SOH-MSE (\(10^{-2}\))
Smooth L1 only 335.7 0.0038
WMSE only 312.4 0.0029
Combined weighted loss 288.5 0.0013

The combined loss performs better because smooth L1 reduces the influence of outliers, while WMSE increases the penalty for late-life errors. For Li-ion battery degradation, late-life errors are especially important because they directly affect remaining life estimation and safety warnings. The weighted term ensures that the model does not underfit the accelerated aging phase.

To determine the optimal weighting coefficients, I test several combinations of \(\alpha\) and \(\beta\). Table 7 shows the results. The configuration \(\alpha = 0.7\) and \(\beta = 0.3\) achieves the lowest RUL-MSE and SOH-MSE.

Experiment \(\alpha\) \(\beta\) RUL-MSE SOH-MSE (\(10^{-2}\))
1 0.4 0.6 298.6 0.0042
2 0.5 0.5 310.2 0.0024
3 0.7 0.3 288.5 0.0013
4 0.9 0.1 342.7 0.0056

The results indicate that a moderate emphasis on the weighted MSE term is beneficial, but too much weight on late-life samples can lead to overfitting and degraded early-life prediction. The combination \(\alpha = 0.7\) and \(\beta = 0.3\) provides a balanced trade-off for both RUL and SOH estimation of Li-ion battery cells.

Ablation Study

I conduct ablation experiments to quantify the contribution of each module. I compare LSTM only, MA only, LSTM+MA, LSTM+Mamba, MA+Mamba, and the full LSTM+MA+Mamba model. Table 8 reports the SOH prediction metrics.

LSTM MA Mamba MSE (\(10^{-2}\)) RMSE MAE \(R^2\)
✓ 0.0106 0.0103 0.0083 0.9381
✓ 0.0190 0.0138 0.0100 0.8886
✓ ✓ 0.0027 0.0052 0.0038 0.9840
✓ ✓ 0.0014 0.0038 0.0030 0.9912
✓ ✓ 0.0018 0.0043 0.0032 0.9895
✓ ✓ ✓ 0.0012 0.0034 0.0025 0.9932

The LSTM-only model achieves an RMSE of 0.0103 and an \(R^2\) of 0.9381. The MA-only model is weaker, with an RMSE of 0.0138 and an \(R^2\) of 0.8886. When LSTM and MA are combined, the RMSE drops to 0.0052 and the \(R^2\) rises to 0.9840. Adding Mamba further improves performance. The full model achieves the lowest RMSE (0.0034) and MAE (0.0025) and the highest \(R^2\) (0.9932). These results confirm that each module contributes to the final accuracy. LSTM provides temporal memory, MA provides feature selection, and Mamba provides selective state-space modeling for complex nonlinearities.

I also visualize the RMSE and MAE comparison. The full model outperforms all ablated variants. The improvement is especially noticeable in the later cycles, where the Li-ion battery degradation accelerates. The Mamba module helps the model capture the rapid capacity drop, while the attention mechanism ensures that the most relevant features are not overwhelmed by noise.

Discussion

The proposed hybrid network addresses several challenges in Li-ion battery RUL and SOH prediction. First, the z-score normalization ensures that heterogeneous features are treated fairly. Second, the LSTM layer captures the sequential nature of charge-discharge cycles. Third, the multi-head attention mechanism dynamically reweights features, which is important because the relative importance of voltage, current, temperature, and internal resistance changes over the Li-ion battery lifecycle. Fourth, the Mamba module provides a selective state-space mechanism that can focus on critical degradation events while maintaining linear computational complexity. Fifth, the combined weighted loss improves robustness to outliers and emphasizes late-life behavior.

Compared with a single LSTM or a single attention model, the hybrid architecture achieves lower MSE, RMSE, and MAE, and higher \(R^2\). The ablation study shows that removing any module degrades performance. This indicates that the modules are complementary rather than redundant. The LSTM encodes temporal dependencies, the attention mechanism performs dynamic feature selection, and Mamba models long-range nonlinear interactions. The combined weighted loss further improves the fit in the accelerated degradation stage.

For practical Li-ion battery management, the proposed method can be used to estimate RUL and SOH from routine charge-discharge data. This supports predictive maintenance, second-life assessment, and safety risk warning. The uncertainty quantification via Monte Carlo dropout provides a confidence interval that can be used to trigger conservative decisions when the prediction uncertainty is high. For example, if the Li-ion battery RUL prediction has a wide confidence interval, the battery management system can schedule additional diagnostics or reduce the load.

Conclusion

I propose a hybrid LSTM+Mamba network for Li-ion battery RUL and SOH prediction. The method combines LSTM for temporal feature extraction, multi-head attention for dynamic feature weighting, and Mamba for selective state-space modeling. A combined weighted loss function with smooth L1 and weighted MSE improves robustness to outliers and emphasizes late-life degradation. Experimental results on an NMC Li-ion battery dataset show high accuracy and robustness. The full model achieves an \(R^2\) of up to 0.9990 for RUL and 0.9932 for SOH. Ablation studies confirm that LSTM, MA, and Mamba each contribute to the final performance. The proposed method provides a promising approach for Li-ion battery health management and remaining life prediction.

Future work can extend the method to other Li-ion battery chemistries, such as lithium iron phosphate and solid-state batteries. Transfer learning can be used to adapt the model across different operating conditions and cell types. Bayesian uncertainty quantification can further improve risk-aware decision making. By combining accurate RUL and SOH prediction with uncertainty estimation, the proposed framework can support safer and more reliable Li-ion battery deployment in electric vehicles, energy storage systems, and portable electronics.

Scroll to Top