Next Article in Journal
Online Internal Temperature Estimation Method for Prismatic Li-Ion Battery Using Embedded Physics-Informed Neural Networks
Next Article in Special Issue
Impact of State of Charge on Gas Generation Characteristics During Thermal Runaway of Lithium-Ion Batteries and Early Warning Strategy Research
Previous Article in Journal
State-of-Health and Remaining-Useful-Life Estimation of Lithium-Ion Batteries Using Axial-Embedding Transformer–Bidirectional Long Short-Term Memory Optimized by an Improved Newton–Raphson-Based Optimizer
Previous Article in Special Issue
Thermally Aware Design of Large-Format Batteries Driven by an Equivalent Circuit Network-Based Electro-Thermal Model
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Rapid Detection of Mixed Gases from Lithium Battery Thermal Runaway Based on ISA-LSTM-TCN

1
The State and Local Joint Engineering Laboratory of Perception Mine, China University of Mining and Technology, Xuzhou 221116, China
2
School of Information and Control Engineering, China University of Mining and Technology, Xuzhou 221116, China
*
Authors to whom correspondence should be addressed.
Batteries 2026, 12(6), 188; https://doi.org/10.3390/batteries12060188
Submission received: 3 April 2026 / Revised: 19 May 2026 / Accepted: 20 May 2026 / Published: 23 May 2026
(This article belongs to the Special Issue Advances in Lithium-Ion Battery Safety and Fire: 2nd Edition)

Abstract

As new energy vehicles and energy storage systems become more common, safety accidents caused by lithium-ion batteries overheating have become more of a concern. Early detection based on distinctive gases (such as H2 and CO) can give an earlier warning than typical monitoring methods like temperature, voltage, or impedance. Nonetheless, attaining high-precision identification in intricate mixed-gas settings continues to be difficult because of the considerable cross-sensitivity of metal oxide semiconductor (MOS) gas sensors. This research presents an ISA-LSTM-TCN multi-task learning model utilizing an enhanced spatial attention mechanism for the swift identification and concentration forecasting of distinctive gases during lithium-ion battery thermal runaway. The model improves key feature extraction and anti-noise performance by combining the long-term temporal modeling ability of the Long Short-Term Memory (LSTM) network with the multi-scale feature extraction ability of the Temporal Convolutional Network (TCN). It also adds an Improved Spatial Attention (ISA) module with a residual multiplication structure. Moreover, in a multi-task learning framework, joint optimization of gas categorization and concentration regression is facilitated using a hard parameter-sharing method. Tests using a built MOS sensor array dataset show that the model is 99.23% accurate at classifying gases and that the R 2 values for predicting H2 and CO concentrations are 0.9510 and 0.8400, respectively. Tests on public datasets and in different noisy environments show that the model is even better at generalizing and is more robust. The results show that the suggested method allows for quick, accurate detection of thermal runaway gases. This makes it an effective and smart way to monitor battery safety warning systems.

1. Introduction

With the rapid development of new energy vehicles and energy storage systems, safety accidents caused by lithium-ion battery (LIB) thermal runaway have become a critical concern in the industry [1]. Compared with traditional schemes such as temperature, voltage, or impedance monitoring, monitoring characteristic gases (e.g., H2, CO) released during the early stages of thermal runaway offers significant advantages [2,3,4]. Studies indicate that the rapid detection of characteristic gas signals can secure precious early-warning time for safe evacuation and fault disposal [5]. Among numerous gas detection technologies, metal-oxide semiconductor (MOS) sensors—characterized by high sensitivity [6], rapid response, low cost, and ease of integration—are more suitable for long-term online monitoring than electrochemical or optical sensors [7,8]. Because the gases generated during thermal runaway are complex mixtures, a single sensor struggles to identify them accurately. Therefore, constructing a sensor array to simulate a biological olfactory system [9,10], thereby generating multidimensional response signals, has become an inevitable choice for precisely identifying characteristic gases in complex environments.
However, the inherent cross-sensitivity of MOS sensors presents a significant difficulty for the early and accurate identification of distinctive gases from battery thermal runaway [11,12]. The cross-sensitivity behavior of MOS gas sensors mainly originates from the competitive adsorption and surface reaction processes of different gas molecules on the sensing materials. During lithium-ion battery thermal runaway, multiple gases such as H2, CO, and hydrocarbons are released simultaneously, and these gases may interact with the same active sites on the sensor surface, resulting in overlapping response patterns and reduced selectivity. In addition, the sensing characteristics of MOS sensors are strongly affected by environmental factors, including humidity, ambient temperature fluctuation, and long-term sensor aging. Variations in humidity can alter the adsorption state of oxygen species on the sensor surface, while temperature fluctuations may influence reaction kinetics and carrier transport behavior. Moreover, prolonged operation may gradually change the surface morphology and catalytic activity of sensing materials, causing response drift and degradation of sensor stability. These factors further increase the complexity of early thermal runaway gas detection and highlight the necessity of developing robust intelligent recognition algorithms for practical applications. Multiple components (such as H2, CO, and hydrocarbon gases) are released concurrently during the thermal runaway process, and their signals strongly overlap on the sensors. This causes ambiguity in both the quantitative concentration analysis and the qualitative classification of various thermal runaway stages. Effective pattern-recognition algorithms are essential to overcoming this obstacle and achieving quick early warning [13]. In order to effectively extract the compositional and concentration information of the distinctive gases amid complicated background interference, these algorithms must thoroughly mine the high-dimensional nonlinear data produced by the array [14].
Initially, researchers relied on classic machine learning techniques like random forest (RF) and support vector machine (SVM) to solve static response feature extraction and simple gas categorization problems for sensor arrays [15]. Although these models are resilient in small-sample tasks [16,17,18], they fail to reflect the complex, dynamic evolutionary linkages in multi-sensor sequences when confronted with transitory response signals during the early phases of lithium-ion battery thermal runaway [19]. Deep learning, on the other hand, has more significant algorithmic advantages, allowing for the accurate resolution of transient development patterns in the early stages of thermal runaway [20].
Through gated recurrent units (GRUs), Long Short-Term Memory (LSTM) networks capture long-term temporal trends in characteristic gas generation, allowing the model to precisely detect the continuous accumulation patterns of gas concentrations under difficult settings [21,22]. In the meantime, the Self-Attention (SA) mechanism greatly improves identification sensitivity by allowing the model to precisely focus on the important gas features that contribute most to early warning amid the nonlinear signals resulting from multi-sensor cross-sensitivity through dynamic weight allocation [23,24]. In order to achieve highly sensitive identification of nine representative volatile organic compounds (VOCs) with a classification accuracy of 98.89%, Mao et al. [25] proposed a nanoconfined-structure sensor array based on atomic layer deposition (ALD) technology and combined it with a CNN-LSTM-Attention hybrid deep learning model. By building a heterogeneous sensor array, Li et al. [26] successfully eliminated H2 interference and accomplished continuous monitoring of mixed gases (H2, SO2, CO) using a CNN-Transformer-LSTM model based on Time2Vec encoding. Its mean R 2 for quantitative concentration prediction was 97.6%, while its qualitative identification accuracy was 97.0% In order to provide a wide receptive field and capture local mutation features produced by the sensor array during the violent reaction stage of thermal runaway, Temporal Convolutional Networks (TCNs) employ dilated convolutions. In order to obtain second-level early warnings, it is essential to capture the sudden spikes in the concentrations of distinctive gases like CO and H2 [27,28]. By adding temporal attention and gating methods, Jia et al. [29] suggested an enhanced attention-gated temporal convolutional network (AGT-TCN) to improve long-term prediction performance. Its root mean square error (RMSE) for predicting CO and CH4 concentrations was as low as 0.138 and 0.170, respectively, according to experiments, greatly surpassing conventional TCN models. In order to accomplish high-precision monitoring of CO, ethylene, and methane mixtures, Liu et al. [30] presented a LoRA-TCN pre-training/fine-tuning paradigm using low-rank adaptation technology. In the gas identification challenge, its classification accuracy was 98.24%, and the RMSE of its concentration prediction was as low as 0.113 A multi-head attention temporal convolutional network based on the PReLU activation function (PMH-TCN) was proposed by Zhuo et al. [31] to predict mixed gas concentrations. According to the experimental data, the model’s prediction accuracy for CO and C2H4 was 98.71% and 98.81%, respectively, with a very high prediction speed. A progressive prediction algorithm (PPA) that combines a TCN-GRU multi-task learning network with temporal correction and multi-interval data sampling was proposed by Fu et al. [32]. This achieved quick qualitative identification (99.3% accuracy) and quantitative concentration prediction ( R 2 of 0.927) for gases like CO, NH3, NO2, and toluene during the early stages of sensor response, resolving the problem of existing models struggling to balance detection accuracy and response speed.
Nevertheless, current research continues to demonstrate inadequacies in meeting the urgent response demands associated with lithium-ion battery thermal runaway. In practical gas-sensing scenarios, gas classification and concentration prediction are inherently correlated rather than completely independent tasks. The gas category determines the overall response pattern of the sensor array, while the gas concentration further affects the dynamic amplitude and temporal evolution characteristics of the response signals. Therefore, both tasks share substantial low-level temporal and spatial feature representations. Traditional single-task learning frameworks usually optimize each task independently, which may lead to redundant feature extraction, insufficient use of shared information, and reduced generalization under limited-sample conditions [32,33]. In contrast, the multi-task learning framework enables multiple tasks to collaboratively optimize the shared backbone network, allowing the model to learn more discriminative and robust feature representations. Moreover, the shared-parameter mechanism introduces an implicit regularization effect, which can effectively alleviate overfitting and improve the robustness of the model under noisy environments. [34,35]. Also, parallel multi-task processing cuts down on the amount of computing power needed for repetitive feature extraction by a huge amount, which ensures that the detection system responds quickly in real time. Based on this backdrop, this study presents a new deep learning network framework that combines ISA-LSTM-TCN.
The primary innovations of this study are as follows: First, an improved Self-Attention (ISA) module is proposed to achieve the efficient extraction of complex gas features. Unlike image data with relatively stable spatial distributions, MOS gas-sensing signals usually exhibit strong temporal fluctuation, response drift, and noise interference caused by environmental variation and sensor cross-sensitivity. Therefore, directly applying conventional self-attention mechanisms may lead to unstable feature extraction and reduced robustness under limited-sample conditions. To address these issues, the proposed ISA module introduces residual-enhanced feature propagation and cosine-similarity-based attention calculation to improve temporal feature discrimination while reducing sensitivity to amplitude variations and noise disturbance. In addition, normalization operations are incorporated to stabilize the feature distribution during training, thereby enhancing convergence stability and improving the robustness of temporal representation learning for gas-sensing applications. Second, TCN and LSTM are integrated to synergistically capture the multi-scale spatiotemporal features of the data. Finally, an ISA-LSTM-TCN multi-task learning (MTL-ILT) model is constructed using a hard parameter-sharing mechanism, aiming to achieve parallel outputs for gas classification and concentration regression via the task-complementary effect of the shared feature layer.

2. Algorithm Model and Theory

The overall logical structure of the model is illustrated in Figure 1a. Using a parallel architecture based on a hard parameter-sharing mechanism, the suggested model uses the synergistic operation of LSTM and TCN to deeply mine the multi-scale spatiotemporal aspects of the gas-sensing signals. In particular, the LSTM branch employs its recurrent structure to mimic long-term temporal trends in the response curves, whereas the TCN branch uses dilated convolutions to precisely capture local transient distortions in the signals. To ensure the compatibility of features from heterogeneous architectures, a 1 × 1 convolutional projection layer is employed to map the outputs of both LSTM and TCN into a unified feature dimension. In the feature integration stage, a Gated Fusion mechanism is designed. After concatenating the projected features, a learnable gating weight is computed to adaptively adjust the contribution ratios of each branch. This mechanism enables the model to dynamically balance global sequence context and local transient information, achieving a complementary fusion that enhances the overall representation capability of the network.
Based on this, the model incorporates the ISA module, which is improved by a residual multiplication method. This module improves feature-screening accuracy, convergence speed, and noise robustness by recalibrating the channel using cosine similarity. This study thoroughly validates the high performance and superiority of the suggested architecture in complex gas pattern recognition tasks from the perspectives of module design, feature mining, and model robustness through multi-dimensional ablation experiments on gas classification and concentration detection.

2.1. Temporal Modeling Networks

The LSTM network is frequently used in temporal modeling tasks and uses gating techniques to selectively store important information. Figure 1b shows the usual structure of an LSTM cell. To increase the receptive field while rigorously maintaining temporal causality, the TCN architecture combines causal convolutions with dilated convolutions, as seen in Figure 1c. This architecture has several benefits, including parallel computing and structural stability, and makes it possible to handle long-term dependencies in time-series data well.

2.2. Improved Self-Attention Mechanism

To enhance the representational capacity of the network and enable the model to better learn the mapping relationships between features and output labels, a novel improved self-attention (ISA) mechanism is proposed in this study, building upon the standard self-attention (SA) and residual self-attention (RSA) mechanisms, as depicted in Figure 1d.
Deep learning technologies, such as attention mechanisms, are frequently employed in sequential data domains (e.g., natural language processing, time-series analysis, and computer vision). By dynamically designating weights, they allow the model to concentrate on data segments that make a substantial contribution to the output, while selectively discarding trivial redundant information [36]. In the context of multi-sensor time-series data, the SA mechanism can also be implemented to quantify the correlation information between various gas components and concentrations, thereby extracting the high self-attention values present in the gas temporal data [37].
The SA mechanism, a prominent variety of attention mechanisms, converts its input matrix X into three components—Query ( Q ), Key ( K ), and Value ( V )—through weighted linear projections. The Query identifies the target items of focus, the Key is employed to calculate similarity relative to the Query, and the Value signifies the actual information to be consolidated.
Q = W q X
K = W k X
V = W v X
Here, W q , W k , W v represent the weight matrices, while Q ,   K ,   V denote the Query, Key, and Value matrices, respectively. The dot product of Q and K is computed to generate a similarity matrix, which is then divided by a scaling factor and transformed into a probability distribution via the softmax function. Finally, the dot product between this probability distribution and the V is calculated to yield the final output, SA.
S A = s o f t m a x ( Q · K | Q | · | | K | | ) V
However, despite its effectiveness in modeling long-range temporal dependencies, the conventional SA mechanism still exhibits certain limitations when processing heterogeneous MOS gas-sensing sequences. Specifically, the attention score in standard SA is computed based on dot-product similarity, making the attention distribution highly sensitive to feature magnitude variations. In practical gas-sensing scenarios, sensor responses are often influenced by concentration fluctuation, environmental disturbance, sensor drift, and cross-sensitivity effects, which may lead to substantial amplitude inconsistency among temporal features. Under such conditions, high-magnitude responses may dominate the attention weights, while weak but informative transient features can be suppressed.
RSA mechanisms partially alleviate gradient degradation by introducing residual pathways. However, in most RSA structures, the residual connection is applied only after the attention aggregation stage, while the attention score itself still relies on conventional dot-product similarity. Consequently, the sensitivity of attention weights to feature magnitude remains fundamentally unchanged.
Motivated by these limitations, the proposed ISA mechanism introduces cosine-similarity-based attention together with residual-enhanced feature interaction, aiming to improve scale robustness and stabilize temporal feature propagation under complex multi-sensor gas-sensing conditions.
Expanding on the conventional SA, the ISA mechanism incorporates a new connecting pathway that multiplies the input data and the self-attention output element-wise. With this design, we hope to emphasize important characteristics even more while dampening the noise of less important ones. Effectively suppressing noise and boosting the model’s overall robustness, this multiplicative operation compresses or amplifies the input signals, smoothing the model’s response to specific features and mitigating needless oscillations. The risk of numerical instability is something to keep in mind when performing multiplication operations. This problem is solved by applying batch normalization (BN) to the data just after the multiplicative connection, which gives rise to the final ISA form.
I S A = B N ( S A · X )
Compared with conventional dot-product self-attention mechanisms, the proposed cosine-similarity-based attention calculation focuses more on the directional consistency between temporal feature vectors rather than absolute magnitude differences. This characteristic is particularly suitable for MOS gas-sensing signals, whose response amplitudes may vary significantly due to gas concentration fluctuation, environmental disturbance, and sensor drift. Meanwhile, the residual-enhanced structure facilitates stable gradient propagation and alleviates feature degradation in deep temporal feature extraction. Consequently, the proposed ISA module can effectively improve noise robustness and temporal feature representation capability under complex gas-sensing conditions.
Specifically, the adoption of cosine similarity instead of the classical scaled dot-product is a deliberate design choice for two reasons. First, from a mathematical perspective, normalizing Q and K vectors constrains similarity scores to a bounded interval, and cosine similarity further enforces this by restricting the scores within a fixed range ([−1, 1]), thereby avoiding the “vanishing gradient” problem caused by softmax saturation when processing high-dimensional feature vectors. This ensures a more stable convergence rate and reliable weight distribution during multi-task optimization. Second, from a computational perspective, the normalization process introduces only a marginal linear increase in FLOPs, which does not alter the model’s overall complexity class. This modification allows the ISA module to prioritize directional correlations in sensor transients, making the network inherently more robust to baseline drift common in MOS sensors.

2.3. Model Principles and Multi-Task Learning Mechanism

In this study, the classification and concentration regression tasks share training data within a multi-task learning (MTL) framework that employs a hard parameter-sharing mechanism. By jointly learning classification and regression tasks within a unified framework, the model can exploit the intrinsic correlation between gas category information and concentration-dependent temporal characteristics, thereby improving feature utilization efficiency and enhancing the overall representation capability of the network. Let X = { x 1 , x 2 , , x n } denote the input sequence, where x i represents the sensor response vector at the i -th time step. The shared feature extraction layer consists of parallel LSTM and TCN branches, which are designed to simultaneously capture the long-term dependencies and multi-scale dynamic features of the sequences. In the LSTM branch, the hidden state is updated as follows:
h i = o i tanh f i c i 1 + i i c ~ i
Here, h i denotes the hidden state at time step i, c i 1 represents the cell state at the previous time step, and i i , f i , o i are the input gate, forget gate, and output gate, respectively. Additionally, c ~ i stands for the candidate cell state, and the symbol denotes element-wise multiplication. These gating mechanisms ensure that the network can effectively retain crucial historical information within the sequence.
Meanwhile, the TCN branch extracts local dynamic features through dilated causal convolutions and expands the receptive field to capture long-term temporal dependencies. Given an input sequence x R n and a convolutional filter f of size k , the convolution output at position s is expressed as follows:
F ( s ) = i = 0 k 1 f ( i )   x s d i
Here, d denotes the dilation factor, which dictates the sampling interval of the convolution. As the network depth increases, the receptive field expands exponentially, thereby facilitating the modeling of long-term temporal features.
Upon extracting the feature representations from both branches, they are concatenated and adaptively fused via a gating mechanism, which is expressed as follows:
Z = σ ( W [ H LSTM ; H TCN ] + b ) H LSTM + ( 1 σ ( W [ H LSTM ; H TCN ] + b ) ) H TCN
Here, H LSTM and H TCN denote the feature representations extracted by the two branches, respectively. The operator [;] represents feature concatenation, and σ ( ) is the sigmoid activation function. This mechanism dynamically adjusts the contribution ratio of both information sources based on feature importance, thereby achieving the highly efficient fusion of sequential features. Subsequently, the integrated features are fed into the ISA module.
Within the multi-task learning framework, the model simultaneously performs the gas classification and concentration prediction tasks, sharing an identical feature representation z .
For the concentration prediction task, a linear regression layer is employed to obtain the continuous output, which is formulated as follows:
y r = W r z + b r
Here, W r and b r denote the weight matrix and bias vector of the regression layer, respectively.
For the gas classification task, a softmax function is applied to yield the class probability distribution, which is expressed as follows:
y c = S o f t m a x   W c z b c
Here, W c and b c denote the weight matrix and bias vector of the classification layer, respectively.
To achieve the synergistic optimization of both tasks, a weighted multi-task loss function is employed for joint training, and L 2 regularization is incorporated to enhance the generalization capability of the model.
L total = λ 1 L r + λ 2 L c + α     Θ   2 2
Here, L r and L c denote the mean squared error (MSE) loss for the regression task and the cross-entropy loss for the classification task, respectively. λ 1 and λ 2 are the task weight coefficients, α is the regularization coefficient, and Θ represents all learnable parameters of the model. By jointly optimizing the aforementioned loss function, concentration prediction performance can be improved while maintaining classification accuracy, thereby mitigating model overfitting.
To determine the optimal balance between the gas classification task and the concentration regression task, a sensitivity analysis of the loss function coefficients λ 1 and λ 2 was performed. As summarized in Table 1, various combinations of weights were evaluated using the validation set. It is observed that the model performance is sensitive to these parameters; an excessive weight on the classification task ( λ 1 > 0.6) leads to a decline in R 2 for CO concentration, while prioritizing regression ( λ 2 > 0.8) results in a slight drop in classification accuracy. The optimal performance was achieved at λ 1 = 0.4 and λ 2 = 0.6, yielding a classification accuracy of 99.23% and R 2 values of 0.9510 and 0.8400 for H2 and CO, respectively. This configuration ensures that the ISA-LSTM-TCN model extracts features that are robust for both gas identification and precise concentration quantification.

3. Data Acquisition and Processing

3.1. Construction of Self-Tested Dataset

Because MOS gas sensors generally have a selectivity problem, it is hard for one sensor to accurately identify mixed gases. This work builds a sensor array out of three commercial MOS sensors—HGS1000, HGS1001, and HGS1002, all purchased from Micro-Nano Sensing Co., Ltd. (Hefei, China)—and then combines them with a data-processing model to recognize different gases. Table 2 shows the target gases and detection ranges for each sensor. The research focused on H2, CO, and their mixes, with different concentration combinations set up for testing (see Table 3 for further information).
Moreover, the dataset was divided into training and testing subsets prior to data augmentation to avoid information leakage between different subsets. Unlike conventional fixed-pattern gas classification datasets, the constructed dataset contains multiple concentration gradients for each gas category. Consequently, the model is required to simultaneously capture gas-type-dependent response patterns and concentration-related temporal evolution characteristics. This multi-concentration setting increases the complexity of the recognition task and improves the evaluation of the model’s generalization capability under varying gas-response conditions.
For the single-gas conditions, hydrogen concentrations were set to 20, 50, 100, 150, and 200 ppm, while carbon monoxide concentrations were set to 2, 5, 10, 15, and 20 ppm. For mixed-gas conditions (CO, H2), the concentration pairs were configured as (18 ppm, 200 ppm), (10 ppm, 1000 ppm), and (2 ppm, 1800 ppm). The experimental dataset used in this study was adopted from our previously published work in Ref. [15]. Specifically, each gas concentration level was independently tested ten times to improve experimental repeatability and reduce random measurement fluctuations, resulting in 130 temporal response samples covering multiple gas categories and concentration gradients. The present study mainly focuses on the development and validation of the proposed ISA-LSTM-TCN framework for simultaneous gas classification and concentration regression based on the existing dataset.
Although the nominal detection range of the employed sensors is 0–500 ppm, higher gas concentrations were intentionally introduced to simulate severe thermal runaway scenarios, in which characteristic gas emissions may exceed conventional sensing limits. Meanwhile, narrow-range sensors were selected to ensure high sensitivity toward trace gas detection at the early warning stage. Accordingly, the concentration range of this dataset was designed to cover the wide range of evolution processes of gas release during thermal runaway, spanning from early-stage leakage to extreme runaway conditions.
While partial saturation can occur at elevated concentrations, the sensor signals still preserve rich transient dynamic information, including response and recovery kinetics, which can be effectively exploited by the deep learning model. Therefore, these partially saturated responses not only represent realistic extreme operating conditions but also do not compromise the reliability of the dataset for model training and evaluation. This design enables robust model assessment under both normal sensing conditions and safety-critical extreme scenarios.
During the thermal runaway process of lithium-ion batteries, a variety of gases are generated, including H2, CO2, CO, CH4, and HF [5]. However, not all gas species are equally suitable for early-warning applications. Previous studies have demonstrated that H2 and CO are generated at relatively early stages of thermal runaway and exhibit a strong correlation with the onset of critical reactions [38]. In particular, these gases can reach detectable concentrations prior to full thermal runaway, making them effective indicators for early-stage fault detection.
In contrast, although CO2 is often the dominant component, it lacks specificity as it can be produced under non-critical conditions, while hydrocarbons and other byproducts are typically associated with more advanced stages of decomposition. Therefore, focusing on H2 and CO enables reliable and efficient early-warning monitoring while maintaining low system complexity and cost. This strategy is also consistent with existing studies on thermal runaway diagnosis and gas evolution behavior [14].
This study used a feature-alignment and zero-padding technique for labeling raw signals in the development of the multi-task learning architecture: a single-component gas is regarded as a distinct mixed state with the concentration of the other component at 0 ppm. This method maps both H2 and CO concentration regression tasks at the same time in a single feature space. The trials were performed at room temperature, atmospheric pressure, and a relative humidity of (60 ± 10)%. Although the experiments were conducted under controlled laboratory conditions to ensure measurement consistency, practical battery operating environments may involve more complex humidity fluctuations, temperature variations, and long-term sensor drift effects, which will be further investigated in future studies. At a sampling frequency of 10 Hz, the sensor array’s temporal response signals were captured.
Figure 2 shows that the sensor response and recovery processes show that the array has strong response characteristics and different cross-sensitivity levels for all three gases. This provides a solid dataset for employing pattern recognition methods to classify and identify gases subsequently.

3.2. Data Augmentation

Data augmentation is used to enhance the model’s generalization capability and prevent overfitting. This work employs the same data augmentation as proposed by Wang et al. [39], based on sample weighting, to expand the training set. Based on the self-tested dataset, an arbitrary initial sample X c 0 = x c 0 1 ,     x c 0 2 ,     ,     x c 0 n is selected as the object for augmentation, where c denotes the class index, 0 represents the initial state, and n is the number of sensors in the E-nose array. For all samples X i = x i 1 ,     x i 2 ,     ,     x i n within the same class, the Euclidean distance between the time-series data of each sensor in the current sample and the corresponding sensor in sample X i = x i 1 ,     x i 2 ,     ,     x i n is calculated. The average of these sensor-level distances is then defined as the overall distance between the two samples.
d = 1 n i = 1 n x c 0 i x c j i 2 ,   j = 1 , 2 , ,   z 1
Here, i represents the sensor index, j denotes the j -th sample within the same class as the initial sample, and z signifies the total number of samples in that class.
The samples are ranked according to their distances from the initial sample, and the five nearest neighbors are selected. A new sample is then constructed by assigning weights to each: the weight of the initial sample is set to 0.5, two randomly selected samples are assigned a weight of 0.15 each, and the remaining three samples share a combined weight of 0.2. The final augmented sample is obtained by a weighted calculation using these assigned values. Consequently, each original sample can yield C 5 2 new samples. In this study, the deep learning model is trained and evaluated based on these augmented samples. Meanwhile, to prevent model overfitting induced by an excessive volume of augmented data, the weighting scheme of this method is adjusted and reallocated. Specifically, the initial sample is assigned a weight of 0.5, one randomly selected sample is assigned a weight of 0.2, and the remaining three samples are each assigned a weight of 0.1. Under this configuration, each original sample yields C 5 1 new augmented samples.
To further improve the robustness of model training under limited-sample conditions, data augmentation techniques were applied exclusively to the training dataset after the training-testing split procedure, thereby avoiding information leakage between the training and testing subsets. After augmentation, the total number of training samples was expanded to 650. It should be noted that the testing dataset remained completely independent and was not involved in any augmentation process. This strategy ensures that the evaluation results more accurately reflect the generalization capability of the proposed framework rather than potential memorization caused by duplicated or highly correlated samples.
Furthermore, due to the multi-concentration dynamic response characteristics of the dataset, the proposed framework is required to simultaneously learn gas-category-related response patterns and concentration-dependent temporal evolution features, which substantially increases the complexity of the recognition task and reduces the likelihood of simple memorization-based overfitting.

3.3. Model Training and Evaluation Metrics

To comprehensively evaluate the model’s performance within the multi-task learning framework, specific evaluation metrics are defined for both the classification and regression sub-tasks in this study. For the gas classification task, accuracy is selected as a performance metric to comprehensively assess the model’s precision and stability in class identification. For the concentration prediction (regression) task, RMSE and R 2 are used for evaluation. Specifically, RMSE is used to quantify the deviation between predicted and true values, while R 2 is used to characterize the model’s goodness-of-fit to the underlying data fluctuation patterns.
To achieve synergistic learning between the classification and regression tasks, this study adopts a joint optimization strategy. By linearly weighting and combining the classification loss and the regression loss, the overall loss function is defined as follows:
L o s s = λ c l s L o s s c l s + λ r e g L o s s r e g
For the gas classification task, the cross-entropy loss function is employed, which is formulated as follows:
L o s s c l s = i = 0 N j = 0 K y i , k log y ^ i , k  
Here, N denotes the total number of samples,   K represents the number of classes, y i is the ground-truth label, and y ^ i signifies the predicted probability of the model.
For the concentration regression task, a mask matrix M i is introduced to filter out invalid labels, ensuring that the mean squared error is computed exclusively at valid positions. This regression loss is defined as follows:
L o s s r e g = 1 i = 1 N M i i = 1 N M i ( y i y ^ i ) 2
To ensure the model evaluation’s objectivity and impartiality, the original dataset is rigorously divided into a training set and an independent test set at an 8:2 ratio. During the entire process of developing the model, the test set is kept fully separate and is only used to see how well the model can generalize. During the hyperparameter optimization step, the training set is tested five times using cross-validation. The best setup is the one that gives the best results on the validation set when multiple parameter combinations are used. We calculate the classification cross-entropy loss and the regression mean squared error (MSE) loss for each batch of data during training. The regression loss has a masking technique that makes sure it is only calculated for genuine observations. To balance the training goals of both the classification and regression tasks, these two loss components are merged in a linear way using weight coefficients. To stop the gradient from exploding, gradient clipping is also used on the model parameters during training.
Since the classification task tends to reach its limit early in training, the model selection criterion mainly leverages R 2 for H2 and CO concentration predictions as the main parameter, putting more weight on regression accuracy. During the hyperparameter optimization phase, we ran a search for critical parameters, including lstm_hidden_size, tcn_channel, tcn_kernel_size, and tcn_dropout, for 200 iterations. The AdamW optimizer is used to change the weights, and both the learning rate and weight decay coefficient are set at 0.001. After finding the best combination of hyperparameters, the model is trained again on the whole training set. Also, a cosine annealing approach is used in the last 250 epochs to improve the quality of convergence. The model’s capacity to generalize across both regression and classification tasks is conclusively validated by its extensive performance on the independent test set.
The key hyperparameter settings of the proposed ISA-LSTM-TCN framework are summarized in Table 4, including the LSTM hidden dimension, TCN kernel size, channel configuration, dropout ratio, feature projection dimension, batch size, and learning rate.
To further evaluate the computational efficiency of the proposed framework, the model complexity and inference latency are summarized in Table 5. The proposed model achieves relatively lightweight computational characteristics while maintaining high recognition and regression performance. The proposed model contains 647.68 K parameters and has a model size of 2.47 MB while achieving inference latencies of 1.0 ms on GPU and 18.6 ms on CPU, respectively. These results indicate that the proposed ISA-LSTM-TCN framework has relatively low computational overhead compared with conventional deep temporal learning architectures.

4. Results and Discussion

4.1. Results of MTL-ILT on Self-Made Dataset

To verify the practical efficacy of the proposed ISA-LSTM-TCN multi-task learning model in detecting characteristic gases of lithium-ion battery thermal runaway, the model is systematically evaluated using the constructed self-collected dataset. The experimental results demonstrate that the model exhibits outstanding performance in the lithium-ion battery safety early-warning task (Figure 3). In the classification task, the model achieves an accuracy of 99.23%, providing a reliable criterion for triggering the rapid early-warning logic. In the concentration regression task, the R 2 for the H2 and CO predictions reach as high as 0.9510 and 0.8400, respectively. Regarding the error analysis, the RMSE for H2 and CO are 129.404 ppm and 2.641 ppm, respectively. Although the absolute error value for H2 is relatively high, this is primarily attributed to the discrepancy in the experimental gas concentration ranges: the detection concentration of H2 covers a broad span of 0–2000 ppm, whereas the detection range for CO is merely 0–100 ppm.
The loss curves show that both the training loss and the test loss drop quickly from a high value of about 450,000 during the first 50 epochs of training. The test loss changes a lot at first, but as training goes on, the size of these changes becomes smaller. The two trends tend to level off and come together around 50 to 100 epochs. After 100 epochs, they pretty much stay the same at a low level close to 0, and the training and test losses are very close to each other, which shows that there is no overfitting.
The prediction accuracies for both gases are still very high when it comes to relative error and goodness of fit. The scatter plots (Figure 3d) show that the observation points are very close to the y = x identity line. This shows that the model has very high prediction fidelity, even in the high-concentration intervals that happen when thermal runaway causes a lot of gas to be generated. By using inter-task information complementarity, this hard parameter-sharing design greatly improves generalization and stops overfitting. Experimental results show that this approach strikes the best balance between accuracy in monitoring and timeliness in giving warnings. It is an efficient and reliable way to keep an eye on lithium-ion battery thermal runaway online.
To further evaluate the robustness and reproducibility of the proposed framework, repeated experiments under multiple random seeds were conducted. The statistical comparison results are summarized in Table 6. In addition to the performance metrics obtained under different random seeds, the mean and standard deviation (Std) values of all evaluation metrics are also provided to quantitatively assess the stability of the proposed framework. The results show that the proposed model achieves relatively small performance fluctuations across different random seeds, particularly for the regression R2 metrics, whose standard deviations remain below 0.01. Although slight variations exist due to stochastic parameter initialization and optimization processes, the overall classification and regression performances remain relatively consistent, indicating good training stability and generalization capability.
Figure 4 illustrates the representative convergence behavior of the proposed ISA-LSTM-TCN framework under the selected experimental random seed (Seed = 3407). Both the classification accuracy and regression R 2 curves exhibit stable convergence trends without obvious oscillation divergence or severe performance degradation. Combined with the statistical results obtained under multiple random seeds, these observations further indicate that the proposed framework possesses good training stability and does not suffer from significant overfitting under the current experimental conditions.
To further evaluate the generalization capability of the proposed model and investigate the potential risk of overfitting under limited data conditions, a five-fold cross-validation experiment was conducted on the original dataset. Specifically, the dataset was first randomly shuffled and divided into five equally sized subsets (folds). For each iteration, four folds were used for model training, while the remaining fold was used for testing. This process was repeated five times until each fold had been used once as the test set. The evaluation metrics included classification accuracy as well as the R 2 for H2 and CO concentration regression tasks.
The fold-wise experimental results are presented in Figure 5. It can be observed that the proposed model maintains highly consistent performance across different data partitions, with only minor fluctuations in all evaluation metrics. No significant degradation was observed in any individual fold, indicating that the model does not depend on a specific training-validation split and exhibits stable predictive capability under different sampling conditions.
Furthermore, the standard deviations of classification accuracy, H2  R 2 , and CO R 2 across the five folds are only 0.00688, 0.03183, and 0.00612, respectively. Such low variances further demonstrate the stability and robustness of the proposed framework. The cross-validation results indicate that the model complexity is well matched to the current dataset scale and that no noticeable overfitting phenomenon is observed.
To further verify the superiority of the model, its performance on both the classification and regression tasks is quantitatively evaluated against various mainstream algorithms (Table 7). The results indicate that the ISA-LSTM-TCN model exhibits a prominent leading advantage across all evaluation dimensions. This performance enhancement fully demonstrates the innovativeness of the proposed model: by introducing the ISA module to precisely capture key feature weights and integrating the dual advantages of LSTM and TCN in long-term temporal modeling and parallel feature extraction, the model successfully overcomes the inherent drawback of insufficient accuracy in conventional models during mixed gas prediction.
This provides a solid dataset for employing pattern recognition methods to classify and identify gases subsequently.

4.2. Results of MTL-LT of Different SA Units

First, using LSTM-TCN as the backbone architecture, this section investigates the impact of various attention mechanisms on the model’s representational capacity. As shown in Table 8, although the standard self-attention (SA) and residual self-attention (RSA) mechanisms exhibit certain feature-extraction capabilities for processing multi-sensor sequences, the proposed ISA-LSTM-TCN achieves an average R 2 of 0.8955, significantly outperforming the traditional architectures. In specific task evaluations, the model initially achieves a remarkable leap in classification performance. Its gas-component recognition accuracy increases significantly from 77.69% (with the backbone architecture) to 99.23%, greatly enhancing the discriminative reliability of the early-warning system. In the concentration regression task, the model also demonstrates exceedingly high prediction accuracy: for H2 detection, its R 2 reaches as high as 0.9510—an improvement of approximately 9.7% compared to the backbone architecture—with the RMSE decreasing to 129.404 ppm; for CO detection, its R 2 reaches 0.8400, with an RMSE of merely 2.641 ppm.
This confirms that the ISA module can better boost important characteristics while reducing noise over time by multiplying input signals and attention weights. The ISA module also works better with BN, which makes predictions more accurate and stable while keeping the number of parameters minimal.
Upon establishing the ISA as the optimal attention module, the second phase of the ablation study aims to verify the necessity of the synergistic operation among the ISA, LSTM, and TCN modules. Table 9 compares the performance of various component combinations in terms of classification accuracy and multi-task regression for H2 and CO. It is noteworthy that the LSTM-TCN model exhibits slightly lower classification accuracy compared to the standalone TCN in the ablation experiments. This architectural behavior can be attributed to the feature distribution mismatch between the two branches. While the TCN is adept at extracting high-frequency local transient features from sensor signals, the LSTM focuses on long-term global trends. In the absence of the ISA and Gated Fusion modules, the simple integration of these heterogeneous features leads to increased dimensionality and potential feature redundancy. Without the selective weighting provided by the ISA module, the less discriminative global features from the LSTM branch may act as noise, interfering with the precise local features captured by the TCN, thus complicating the optimization process and resulting in a performance dip. This result further highlights the critical role of the ISA module and Gated Fusion mechanism in synergizing multi-scale temporal information and suppressing inter-branch interference. Furthermore, the five-fold cross-validation error plots for the models are shown in Figure 6. The results in Figure 6 demonstrate that the MTL-ILT model exhibits exceptional predictive stability across multiple cross-validation folds. Its error distribution interval is significantly narrower than those of other comparative architectures, demonstrating that the proposed model design exhibits strong robustness to sample fluctuations. This further confirms the reliability of the proposed architecture for lithium-ion battery thermal-runaway monitoring.
With the introduction of ISA enhancement, ISA-TCN significantly outperforms the baseline TCN. Notably, in the CO regression task, the R 2 increased from 0.6555 to 0.7390, demonstrating the critical role of ISA in local feature mining. A comparison between ISA-TCN and ISA-LSTM reveals that the convolution-based TCN structure has superior feature-mapping capabilities compared to a standalone LSTM when processing such gaseous temporal data. Although LSTM-TCN combines long-term memory with local feature extraction, its performance remains inferior to the full model due to the lack of dynamic enhancement for key features. The MTL-ILT model proposed in this study achieved a classification accuracy of 99.23% after integrating the ISA module and reached the highest R 2 (0.9510) for H2 prediction.
Experimental data show that MTL-ILT achieves the best results in multi-task learning by combining the global temporal modeling capacity of LSTM, the parallel feature-extraction benefits of TCN, and the dynamic feature-enhancement features of ISA. These components collaborate to ensure the model operates effectively and accurately, especially in the presence of complex sensor data.

4.3. Results of MTL-ILT Using Public Datasets

While ablation experiments have confirmed the effectiveness of the proposed modules on the self-tested dataset, verifying the model’s adaptability across different sensor arrays and varying environments is crucial for evaluating its robustness. Therefore, this section introduces the widely recognized UCI Twin Gas Sensor Arrays dataset for cross-scenario validation. The objective is to quantitatively evaluate the generalization capability and prediction accuracy of the ISA-LSTM-TCN model when processing other sensor data. The gas response curves of this dataset are illustrated in Figure 7.
To further verify the generalization capability of the proposed ISA-LSTM-TCN framework, the public Twin Gas Sensor Array dataset from the UCI repository was additionally employed for external validation. To adapt the dataset for the multi-task learning framework, several preprocessing procedures were conducted.
First, the original 100 Hz sensor signals were downsampled to 20 Hz to reduce temporal redundancy and suppress high-frequency noise interference while preserving the primary dynamic response characteristics. Subsequently, a 40 s effective response segment after gas injection was extracted from each sample to ensure temporal consistency during model training and evaluation. Considering that the original dataset contains only 16 samples for each gas category, data augmentation techniques were further applied to alleviate the small-sample limitation. Finally, normalization and Z-score standardization were performed to minimize the influence of baseline drift and unit discrepancies among different sensor arrays, thereby improving the robustness and generalization capability of the proposed framework.
Compared with our proprietary dataset, the UCI dataset presents greater challenges due to differences in sensor types and concentration distributions, thereby providing a more rigorous evaluation of the architectural stability and cross-dataset robustness of the proposed model.
Figure 8 illustrates the fitting results of the model for the concentration prediction of four gases: CO, ethanol, ethylene, and methane. The experimental results demonstrate that the model exhibits exceptional generalization performance in multi-component gas concentration prediction. Specifically, the R 2 values for all target gases exceeded 0.97 (with CO and methane reaching as high as 0.9804 and 0.9818, respectively), proving that the model possesses superior linear fitting precision. Meanwhile, the extremely low RMSE metrics (e.g., only 5.440 ppm for ethanol) and the prediction points closely distributed along both sides of the diagonal line strongly validate the effectiveness of the ISA module. Through its element-wise multiplication mechanism, the ISA module performs smoothing on input signals, which effectively suppresses sensor noise and accurately captures the nonlinear evolutionary characteristics of gas concentrations.

4.4. Noise Robustness and Time Window Investigation

Even though the ISA-LSTM-TCN model does a great job of generalizing on public datasets, real-world uses of lithium-ion battery thermal-runaway detection need better real-time early-warning and anti-interference features. Sensors always make random noise in complicated surroundings, and the length of the detection window directly affects how quickly the warning system responds.
To further evaluate the reliability of the model in real-world environments, this section first conducts a robustness analysis against noise to verify its detection stability under varying signal-to-noise ratios (SNRs). As summarized in Table 10, the MTL-ILT model exhibits significant anti-noise advantages across various interference levels. Compared to the baseline architectures, the proposed model shows the minimum performance degradation under different SNR environments, maintaining high levels of both classification accuracy and regression goodness-of-fit. This is primarily attributed to the ISA module, which performs precise recalibration of feature channels using cosine similarity. Combined with the deep extraction of multi-scale temporal features by TCN and LSTM, the model effectively filters out the random fluctuations of noise signals.
Subsequently, this study conducted comparative experiments to investigate the influence of different sampling window lengths (5 s, 10 s, 20 s, and 40 s) on detection performance, aiming to explore the model’s potential for rapid detection response. As summarized in Table 11, the experimental results demonstrate a significant advantage in early warning speed: even when the detection window is shortened to 10 s, the model maintains a classification accuracy of 96.15%, with R 2 values for H2 and CO regression reaching as high as 0.9226 and 0.8288, respectively. It should be noted that a longer temporal window does not necessarily guarantee higher prediction accuracy for MOS gas-sensing signals. In the proposed task, the early transient response stage of the sensor contains rich dynamic kinetic information related to gas adsorption and reaction processes, which provides strong discriminative features for concentration prediction. As the response gradually approaches a steady state, the temporal variation becomes weaker, while redundant information, baseline drift, and accumulated noise may increase. Consequently, excessively long temporal windows may introduce additional interference and slightly reduce regression stability under limited-sample conditions. Furthermore, the relatively high prediction performance achieved under short temporal windows demonstrates the capability of the proposed framework for rapid thermal runaway early-warning applications. Figure 9 illustrates the performance evaluation comparison under various time windows. These results strongly validate the capability of the ISA-LSTM-TCN architecture to capture the initial characteristics of thermal-runaway gases within an extremely short time frame. This not only ensures high detection precision but also significantly reduces response latency, securing critical “golden time” for the early suppression of lithium-ion battery fires.

4.5. Error Analysis and Discussion of Potential Failure Cases

Although the proposed ISA-LSTM-TCN framework achieves high overall classification and regression performance, several error characteristics and practical limitations should still be discussed.
According to the confusion matrix results, a small number of misclassification cases can still be observed between H2 and CO samples. Specifically, approximately 2% of CO samples are incorrectly recognized as H2. This phenomenon is mainly attributed to the intrinsic cross-sensitivity characteristics of MOS gas sensors and the partial overlap of transient response features under low-concentration conditions. Nevertheless, the overall classification accuracy remains above 98%, indicating that the proposed framework can still effectively distinguish the major gas categories.
For concentration regression tasks, the proposed framework still exhibits non-negligible prediction deviations, particularly in the H2 regression task (RMSE = 129.404 ppm). Larger prediction errors are mainly concentrated in high-concentration regions, which may be related to sensor response nonlinearity, uneven sample distribution, and stochastic optimization sensitivity. In comparison, the CO regression task achieves relatively smaller prediction errors due to its narrower concentration range and lower response variance.
Furthermore, the multi-task optimization process also affects the error characteristics of the proposed framework. Sensitivity analysis of the loss coefficients λ 1 and λ 2 indicates that the balance between classification and regression objectives significantly influences model performance. Excessively emphasizing the classification task improves category discrimination capability but increases concentration prediction errors, particularly for the CO regression task. In contrast, assigning overly large weights to the regression task slightly weakens classification accuracy and feature separability. These observations suggest that improper task balancing may lead to optimization bias and unstable feature learning, thereby affecting the overall robustness of the framework. Therefore, appropriate selection of the multi-task loss coefficients is essential for maintaining stable classification and concentration prediction performance simultaneously.
In addition, although missing and invalid samples were removed during data preprocessing, the overall dataset scale remains relatively limited for deep learning-based regression tasks. Environmental noise, sensor baseline drift, and temporal fluctuations may also introduce uncertainties into feature extraction and concentration prediction. Repeated experiments under multiple random seeds further demonstrate that the proposed framework maintains relatively stable convergence behavior and consistent overall performance, although the regression task remains more sensitive to initialization conditions and noise perturbations than the classification task.
Overall, these results indicate that the proposed ISA-LSTM-TCN framework possesses good robustness and generalization capability for early-stage gas detection applications, while further improvements in dataset scale, noise suppression, and sensor selectivity may help reduce prediction uncertainty in future work.

5. Conclusions

This paper suggests a multi-task learning prediction model based on ISA-LSTM-TCN to deal with the difficulty of monitoring characteristic gases to give early warning of lithium-ion battery thermal runaway. Validations were performed with a self-constructed dataset derived from a self-developed gas-sensing experimental setup, resulting in the following principal conclusions:
(1)
Superiority of the Model Architecture: The proposed model integrates an ISA mechanism, LSTM, and TCN. It achieves parallel processing of gas classification and concentration regression through a hard parameter-sharing mechanism. Experimental results demonstrate that this architecture effectively extracts multi-scale features from gas signals, significantly enhancing the model’s generalization capability.
(2)
High-Precision Monitoring Performance: The model exhibits exceptional performance on the self-tested dataset. The accuracy for the classification task reached 99.23%, while in the concentration regression tasks, the coefficients of determination R 2 for H2 and CO reached 0.9510 and 0.8400, respectively.
(3)
Validation through Ablation Studies: Experiments that compare different versions of the model show that adding the ISA module makes it better at focusing on important aspects. The LSTM and TCN modules work together to handle both long-term and short-term sequential dependencies. The model can find the best balance between accuracy in monitoring and the ability to send alerts in real time by combining these parts.
In summary, this research provides an efficient and reliable deep learning solution for monitoring characteristic gases of lithium-ion battery thermal runaway. Future work will further investigate lightweight optimization and the practical deployment feasibility of the proposed framework under real-world battery management scenarios.

Author Contributions

Conceptualization, R.G. and M.J.; methodology, Q.Y.; software, Z.P.; validation, Q.Y. and Z.P.; formal analysis, H.L.; investigation, H.L.; resources, M.J.; data curation, R.G.; writing—original draft preparation, R.G. and Q.Y.; writing—review and editing, M.J.; visualization, Q.Y.; supervision, M.J.; project administration, M.J.; funding acquisition, M.J. All authors have read and agreed to the published version of the manuscript.

Funding

This work was supported in part by the National Natural Science Foundation of China under Grant 62204260 and in part by the Department of Science and Technology of Anhui Province, China, under Grant 2022CSJGG0703.

Data Availability Statement

Data can be shared upon request.

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. Cao, Y.; Peng, Y.; Tao, Z.; Yang, R.; Li, W.; Wolski, L.; Capek, T.; Zhang, H. Comprehensive Investigation of Early Gas Detection in Lithium Iron Phosphate Pouch Batteries under Overheating. J. Power Sources 2025, 653, 237601. [Google Scholar] [CrossRef] [Scilit]
  2. Deng, J.; Yu, X.; Pang, D.; Fei, B.; Mo, J. Cutting-Edge Gas Sensor Design for Monitoring Thermal Runaway in Lithium-Ion Batteries: A Critical Review. J. Energy Chem. 2025, 109, 769–785. [Google Scholar] [CrossRef] [Scilit]
  3. Song, Y.; Jiang, X.; Lyu, N.; Lu, H.; Zhang, D.; Li, H.; Jin, Y. Early Warning of Lithium-Ion Battery Thermal Runaway Based on Gas Sensors. eTransportation 2025, 26, 100502. [Google Scholar] [CrossRef] [Scilit]
  4. Cheng, Z.; Ju, L.; Li, J.; Qin, P.; Zhao, Z.; Mei, W.; Bao, H.; Jin, K.; Meng, X.; Wang, Q. Early Warning of Thermal Runaway for Larger-Format Lithium Iron-Phosphate Battery by Coupling Internal Pressure and Temperature. Appl. Energy 2025, 383, 125396. [Google Scholar] [CrossRef] [Scilit]
  5. Shao, X.; Zhang, D.; Zhou, L.; Ding, Z.; Xiong, H.; Zhang, H.; Jia, P.; Zhai, J.; Jiao, G. Recent Advances in Semiconductor Gas Sensors for Thermal Runaway Early-Warning Monitoring of Lithium-Ion Batteries. Coord. Chem. Rev. 2025, 535, 216624. [Google Scholar] [CrossRef] [Scilit]
  6. Wang, Y.-T.; Zou, Q.-K.; Wang, Z.-X.; Jin, T.; Guo, X. Intelligent Early Detection of Lithium-Ion Battery Thermal Runaway via H2/CO Sensor Arrays and Signal Processing Algorithms. Sens. Actuators B Chem. 2026, 451, 139337. [Google Scholar] [CrossRef] [Scilit]
  7. Wang, X.; Zhou, Y.; Zhao, Z.; Feng, X.; Wang, Z.; Jiao, M. Advanced Algorithms for Low Dimensional Metal Oxides-Based Electronic Nose Application: A Review. Crystals 2023, 13, 615. [Google Scholar] [CrossRef] [Scilit]
  8. Fu, Y.; Chen, L.; Ma, W.; Wang, K.; Chi, H.; Tu, N.; Mao, J.; Guo, Y.; Zhang, L.; Ye, Z.; et al. Facet-Engineered Epitaxial TiO2 for Early Hydrogen Detection in Lithium-Ion Battery Thermal Runaway. Chem. Eng. J. 2026, 529, 172575. [Google Scholar] [CrossRef] [Scilit]
  9. Rabehi, A.; Helal, H.; Zappa, D.; Comini, E. Advancements and Prospects of Electronic Nose in Various Applications: A Comprehensive Review. Appl. Sci. 2024, 14, 4506. [Google Scholar] [CrossRef] [Scilit]
  10. Zhu, H.; Cheng, Z.; Liu, W.; Zhang, L.; Sun, D.; Jiang, Z.; Yuan, Z.; Shen, Y.; Meng, F. PPb-Level In2O3 Composite EMC Sensor with Amorphous LaSnO3−x Interface Barrier Regulation and Its Bimetallic Synergistic Catalysis for Thermal Runaway Detection in Lithium Batteries. Sens. Actuators B Chem. 2026, 447, 138843. [Google Scholar] [CrossRef] [Scilit]
  11. Huang, J.; Zhu, G.; Guo, D.; Huang, J.; Xiao, P.; Liu, T. Study on the Extreme Early Warning Method of Thermal Runaway Utilizing Li-Ion Battery Strain. Appl. Energy 2025, 384, 125494. [Google Scholar] [CrossRef] [Scilit]
  12. Wang, H.; Chen, Z.; Li, X.; Liu, Y.; Xiao, Y.; Yang, L.; Wang, P. The Study on Thermal Runaway Gas Adsorption and Health State Estimation of Lithium-Ion Battery. Comput. Theor. Chem. 2025, 1253, 115390. [Google Scholar] [CrossRef] [Scilit]
  13. Tran, M.-K.; Mevawalla, A.; Aziz, A.; Panchal, S.; Xie, Y.; Fowler, M. A Review of Lithium-Ion Battery Thermal Runaway Modeling and Diagnosis Approaches. Processes 2022, 10, 1192. [Google Scholar] [CrossRef] [Scilit]
  14. Zhang, J.; Jiao, M.; Duan, L.; Zheng, L.; Nguyen, V.; Hung, C.M.; Nguyen, D. Gas Classification System Based on Hybrid Waveform Modulation Technology on FPGA. Sens. Actuators B Chem. 2025, 435, 137637. [Google Scholar] [CrossRef] [Scilit]
  15. Pu, Z.; Yang, M.; Jiao, M.; Zhao, D.; Huo, Y.; Wang, Z. Thermal Runaway Warning of Lithium Battery Based on Electronic Nose and Machine Learning Algorithms. Batteries 2024, 10, 390. [Google Scholar] [CrossRef] [Scilit]
  16. Tang, M.; Zhang, X.; Zhang, C.; Chen, T.; Yan, X.; Zou, J.; Gao, W.; Jin, Q.; Jian, J. An Intelligent Sensing Array for Thermal Runaway Characteristic Gas Concentration Prediction Based on SACNN-Mamba. Sens. Actuators B Chem. 2025, 431, 137368. [Google Scholar] [CrossRef] [Scilit]
  17. Wang, S.; Bi, Y.; Shi, J.; Wu, Q.; Zhang, C.; Huang, S.; Gao, W.; Bi, M. Deep Learning-Based Hydrogen Leakage Localization Prediction Considering Sensor Layout Optimization in Hydrogen Refueling Stations. Process Saf. Environ. Prot. 2024, 189, 549–560. [Google Scholar] [CrossRef] [Scilit]
  18. Li, L.; Zhou, L.; Chen, Y.; Chen, X.; Guo, L.; Zhang, W.; Deng, Y.; Li, T.; Chen, B.; Li, H.-Y.; et al. Precision Hydrogen Detection in Mixed Atmospheres Using Temperature-Modulated PdAu-In2O3 Sensor Arrays and Machine Learning Algorithms. Chem. Eng. J. 2025, 520, 165633. [Google Scholar] [CrossRef] [Scilit]
  19. Zhou, Y.; Heng, Y.; Zhu, J.; Qian, C.; Wang, T.; Nguyen, D.H.; Jiao, M. Enhanced Gas Recognition of Electronic Nose Using 1-D Convolutional Neural Network with Savitzky–Golay Filter. IEEE Sens. J. 2024, 24, 10769–10778. [Google Scholar] [CrossRef] [Scilit]
  20. Wang, X.; Qian, C.; Zhao, Z.; Li, J.; Jiao, M. A Novel Gas Recognition Algorithm for Gas Sensor Array Combining Savitzky–Golay Smooth and Image Conversion Route. Chemosensors 2023, 11, 96. [Google Scholar] [CrossRef] [Scilit]
  21. Yan, L.; Li, Q.; Ullah, Z.; Liang, Z.; Han, L.; Zhang, G.; Wei, J.; Hasanien, H.M. Transfer Learning-Enabled Deep Learning Framework for Early Thermal Runaway Prediction in Lithium-Ion Energy Storage Batteries. J. Energy Storage 2026, 148, 120305. [Google Scholar] [CrossRef] [Scilit]
  22. Choi, H.J.; Kim, S.A.; Kim, C.H.; Shin, B.S. Machine Learning—Based on Analysis of EV Battery Thermal Runaway Simulation. J. Mech. Sci. Technol. 2025, 39, 3667–3677. [Google Scholar] [CrossRef] [Scilit]
  23. Han, J.; Li, H.; Cheng, J.; Ma, X.; Fu, Y. Advances in Metal Oxide Semiconductor Gas Sensor Arrays Based on Machine Learning Algorithms. J. Mater. Chem. C 2025, 13, 4285–4303. [Google Scholar] [CrossRef] [Scilit]
  24. Li, J.; Yuan, Z.; Wang, Y.; Meng, F. Enhancing Subtle Features of Gas Detection Signals Using MFD_attention Mechanism for Improved Detection in Complex Environments. Sens. Actuators B Chem. 2025, 434, 137597. [Google Scholar] [CrossRef] [Scilit]
  25. Mao, L.; Jiang, H.; Dong, Z.; Huang, P.; Gao, T.; Pan, J.; Xiao, X.; Du, Y.; Ren, X.; Hu, Q.; et al. An Artificial Olfactory System with Confined Structures Enhanced Gas Classification and Potential Esophageal Cancer Diagnosis. Sens. Actuators B Chem. 2026, 447, 138775. [Google Scholar] [CrossRef] [Scilit]
  26. Li, T.; Zhang, Y.; Sun, H.; Zhang, Z.; Zhang, C.; Sun, J.; Wang, H. Durative Monitoring of Sulfur Hexafluoride Characteristic Gases under Hydrogen Interference Using a Time2Vec-Encoded CNN–Transformer–LSTM Model Based on a Heterogeneous Gas Sensor Array. ACS Sens. 2025, 10, 8809–8820. [Google Scholar] [CrossRef] [Scilit]
  27. Zhu, Z.; Jiang, Q.; Wang, M.; Xu, M.; Zhang, Y.; Shuang, F.; Jia, P. A CO Concentration Prediction Method for Electronic Nose Based on TrellisNet with Gated Recurrent Unit and Dilated Convolution. Microchem. J. 2024, 199, 110014. [Google Scholar] [CrossRef] [Scilit]
  28. Ma, X.; Wu, F.; Yue, J.; Feng, P.; Peng, X.; Chu, J. MSE-TCN: Multi-Scale Temporal Convolutional Network with Channel Attention for Open-Set Gas Classification. Microchem. J. 2024, 207, 111814. [Google Scholar] [CrossRef] [Scilit]
  29. Jia, P.; Chen, Z.; Mao, G.; Zhang, Y.; Liu, J.; Xu, M. Gas Concentration Prediction Based on Temporal Attention Mechanism in Temporal Convolutional Networks. Sens. Actuators B Chem. 2025, 433, 137562. [Google Scholar] [CrossRef] [Scilit]
  30. Liu, Z.; Liu, Z.; Feng, R.; Feng, P.; Chu, J.; Peng, X. LoRA-TCN: A Pre-Trained/Fine-Tuning Learning Paradigm for Drift Adaptation. Sens. Actuators B Chem. 2026, 446, 138644. [Google Scholar] [CrossRef] [Scilit]
  31. Zhuo, J.; Chen, X.; Zhang, H.; Wang, X.; Wu, P.; Yue, J.; Xia, X.; Lyu, Z.; Chu, J. Rapid and High-Accuracy Concentration Prediction of Gas Mixtures Based on PMH-TCN. Measurement 2025, 242, 116003. [Google Scholar] [CrossRef] [Scilit]
  32. Fu, C.; Zhang, K.; Guan, H.; Deng, S.; Sun, Y.; Ding, Y.; Wang, J.; Liu, J. Progressive Prediction Algorithm by Multi-Interval Data Sampling in Multi-Task Learning for Real-Time Gas Identification. Sens. Actuators B Chem. 2024, 418, 136271. [Google Scholar] [CrossRef] [Scilit]
  33. Cheng, H.; Zhao, W.; Duan, X.; Yan, R.; Yu, T.; Xiao, Y.; Hu, Z.; Ge, Z.; Chen, Y.; Xu, D.; et al. Application of Multi-Task Learning with Gramian Angular Difference Field Features from Temperature Modulation Sensor Arrays for off-Gas Detection in Lithium-Ion Batteries. Sens. Actuators B Chem. 2026, 449, 139142. [Google Scholar] [CrossRef] [Scilit]
  34. Mei, H.; Yang, R.; Peng, J.; Meng, K.; Wang, T.; Wang, L. Research on Binary Mixed VOCs Gas Identification Method Based on Multi-Task Learning. Sensors 2025, 25, 2355. [Google Scholar] [CrossRef] [Scilit]
  35. Mei, H.; Peng, J.; Wang, T.; Zhang, B.; Xuan, F.; Wang, L.; Zeng, M.; Yang, Z. Smart VOCs Recognition System Based on Single Gas Sensor and Multi-Task Deep Learning Model. Sens. Actuators B Chem. 2025, 439, 137853. [Google Scholar] [CrossRef] [Scilit]
  36. Vaswani, A.; Shazeer, N.; Parmar, N.; Uszkoreit, J.; Jones, L.; Gomez, A.N.; Kaiser, L.; Polosukhin, I. Attention Is All You Need. arXiv 2023, arXiv:1706.03762v7. [Google Scholar]
  37. Wang, Y.; Yu, Y.; Zhao, H.; Yin, C.; Shi, Y.; Men, H. A Self-Developed Electronic Nose System Combines Data Enhancement and Multi-Branch Kernels Channel Attention to Identify the Gas Information of Industrial Polypropylene. Sens. Actuators A Phys. 2024, 366, 115005. [Google Scholar] [CrossRef] [Scilit]
  38. Rong, D.; Zhang, G.; Sun, Q.; Hu, X. Experimental Study on Gas Production Characteristics of Electrolyte of Lithium-Ion Battery under Pyrolysis Conditions. J. Energy Storage 2023, 74, 109367. [Google Scholar] [CrossRef] [Scilit]
  39. Wang, N.; Li, S.; Ye, T.T. Exploiting the Self-Attention Mechanism in Gas Sensor Array (GSA) Data with Neural Networks. IEEE Sens. J. 2023, 23, 5988–5996. [Google Scholar] [CrossRef] [Scilit]
Figure 1. Structure diagram of (a) ISA-LSTM-TCN; (b) LSTM unit; (c) TCN unit; (d) ISA unit.
Figure 1. Structure diagram of (a) ISA-LSTM-TCN; (b) LSTM unit; (c) TCN unit; (d) ISA unit.
Batteries 12 00188 g001
Figure 2. Dynamic response curves of the sensor array to three gases. (a) H2 (b) CO (c) H2 and CO gas mixtures [17].
Figure 2. Dynamic response curves of the sensor array to three gases. (a) H2 (b) CO (c) H2 and CO gas mixtures [17].
Batteries 12 00188 g002
Figure 3. Training results of the model on the self-collected dataset: (a) Variation curves of model accuracy and R 2 ; (b) Loss curves of the training and test sets; (c) Confusion matrix; (d) Linear fitting between the true and predicted concentrations (green dots represent the distribution of individual samples, and the pink shaded area denotes the 95% prediction interval).
Figure 3. Training results of the model on the self-collected dataset: (a) Variation curves of model accuracy and R 2 ; (b) Loss curves of the training and test sets; (c) Confusion matrix; (d) Linear fitting between the true and predicted concentrations (green dots represent the distribution of individual samples, and the pink shaded area denotes the 95% prediction interval).
Batteries 12 00188 g003
Figure 4. Representative convergence behavior of the proposed ISA-LSTM-TCN framework under the selected experimental random seed (Seed = 3407): (a) training and test loss curves; (b) classification accuracy and regression R 2 curves.
Figure 4. Representative convergence behavior of the proposed ISA-LSTM-TCN framework under the selected experimental random seed (Seed = 3407): (a) training and test loss curves; (b) classification accuracy and regression R 2 curves.
Batteries 12 00188 g004
Figure 5. Five-fold cross-validation results of the proposed ISA-LSTM-TCN.
Figure 5. Five-fold cross-validation results of the proposed ISA-LSTM-TCN.
Batteries 12 00188 g005
Figure 6. Five-fold cross-validation error plots for the MTL-ILT model components.
Figure 6. Five-fold cross-validation error plots for the MTL-ILT model components.
Batteries 12 00188 g006
Figure 7. Gas response curves for the UCI Twin Gas Sensor Arrays dataset.
Figure 7. Gas response curves for the UCI Twin Gas Sensor Arrays dataset.
Batteries 12 00188 g007
Figure 8. Training and validation results of the model on the public dataset: (a) Curves of model accuracy and R 2 ; (b) confusion matrix; (c) loss curves for the training and testing sets; (d) linear fitting of actual versus predicted concentrations (green dots represent the distribution of individual samples, and the pink area indicates the 95% prediction interval).
Figure 8. Training and validation results of the model on the public dataset: (a) Curves of model accuracy and R 2 ; (b) confusion matrix; (c) loss curves for the training and testing sets; (d) linear fitting of actual versus predicted concentrations (green dots represent the distribution of individual samples, and the pink area indicates the 95% prediction interval).
Batteries 12 00188 g008
Figure 9. Comparison of model performance under different time windows.
Figure 9. Comparison of model performance under different time windows.
Batteries 12 00188 g009
Table 1. Performance of the model with different loss weight coefficients.
Table 1. Performance of the model with different loss weight coefficients.
Classification
Loss Weight
Regression
Loss Weight
Experimental Tasks
ClassificationH2 RegressionCO Regression
Accuracy R 2 RMSE (ppm) R 2 RMSE (ppm)
0.40.699.23%0.9510129.4040.84002.641
0.10.998.46%0.9563122.1920.76733.185
0.20.8100%0.9472134.3080.78563.058
0.30.7100%0.9593117.9920.81692.826
0.50.598.46%0.9515128.8320.81192.864
0.60.499.23%0.9603116.5690.78943.030
0.70.399.23%0.9618114.2840.80622.907
0.80.298.46%0.9473134.2380.80002.953
0.90.198.46%0.9499130.8200.81692.825
Table 2. The parameters of the selected MOS sensors.
Table 2. The parameters of the selected MOS sensors.
Sensor TypeTarget GasMeasurement Range
HGS1000VOC, smog, etc.1~500 ppm
HGS1001ethanol, acetone, hydrogen, hydrogen sulfide, etc.0.1~500 ppm
HGS1002Ethanol, acetone, hydrogen, hydrogen sulfide, etc.0.05~300 ppm
Table 3. Concentration settings of the characteristic gases.
Table 3. Concentration settings of the characteristic gases.
Setting No.H2 (ppm)CO (ppm)Total Gas (ppm)
120020
250050
31000100
41500150
52000200
6022
7055
801010
901515
1002020
1120018218
121000101010
13180021802
Table 4. Hyperparameters of the proposed ISA-LSTM-TCN model.
Table 4. Hyperparameters of the proposed ISA-LSTM-TCN model.
ParameterValueDescription
LSTM hidden size64Number of hidden units in the LSTM layer
TCN kernel size10Kernel size of the TCN layer
TCN channels(128,128)Number of channels in each TCN block
TCN dropout0.10Dropout rate applied in the TCN layers
Feature Projection Dimension128Feature dimension for the dual-branch alignment module
Batch size32Training batch size
Learning rate0.001Initial learning rate of the AdamW optimizer
Table 5. Efficiency metrics of the proposed model.
Table 5. Efficiency metrics of the proposed model.
MetricsValue
Params647.68 K
MACs514.61 M
Model Size2.47 MB
GPU Latency1.0 ms
CPU Latency18.6 ms
Table 6. Performance comparison under different random seeds.
Table 6. Performance comparison under different random seeds.
Random SeedExperimental Tasks
ClassificationH2 RegressionCO Regression
Accuracy R 2 RMSE (ppm) R 2 RMSE (ppm)
340799.23%0.9510129.4040.84002.641
098.46%0.9568121.5480.82182.788
4297.69%0.9555123.3040.83952.645
123494.62%0.9381145.4170.83662.669
202699.08%0.9524127.5100.83122.713
Mean98.02%0.9507129.4360.83382.6912
Std2.09%0.00749.47260.00750.0612
Table 7. Evaluation metrics of different models.
Table 7. Evaluation metrics of different models.
ModelExperimental Tasks
ClassificationH2 RegressionCO Regression
Accuracy R 2 RMSE (ppm) R 2 RMSE (ppm)
MTL-ILT (Ours)99.23%0.9510129.4040.84002.641
LSTM38.46%0.3846542.6480.22557.310
TCN90.00%0.8497226.7030.65553.876
1D-CNN81.54%0.8982186.5260.70333.597
MLP93.08%0.3679464.8750.42005.029
SVM/SVR95.38%0.3130469.1120.16305.924
RF99.23%0.8100246.7770.73703.320
Table 8. Parameters and performance of different models with various self-attention mechanisms.
Table 8. Parameters and performance of different models with various self-attention mechanisms.
ModelExperimental Tasks
ClassificationH2 RegressionCO Regression
Accuracy R 2 RMSE (ppm) R 2 RMSE (ppm)
ISA-LSTM-TCN99.23%0.9510129.4040.84002.641
RSA-LSTM-TCN66.92%0.8423232.2120.60934.128
SA-LSTM-TCN69.23%0.3479472.1660.29005.564
LSTM-TCN77.69%0.8523224.7360.65473.881
Table 9. Comparison of the component ablation study for the MTL-ILT model.
Table 9. Comparison of the component ablation study for the MTL-ILT model.
ModelExperimental Tasks
ClassificationH2 RegressionCO Regression
Accuracy R 2 RMSE (ppm) R 2 RMSE (ppm)
MTL-ILT (Ours)99.23%0.9510129.4040.84002.641
TCN90.00%0.8497226.7030.65553.876
ISA-TCN90.77%0.9358148.1480.73903.374
ISA-LSTM84.62%0.8838199.2830.48924.720
LSTM-TCN70.00%0.8667213.4870.64593.930
Table 10. Comparison of performance evaluation metrics for different models under various SNRs.
Table 10. Comparison of performance evaluation metrics for different models under various SNRs.
ModelExperimental Tasks
Classification
Accuracy
H2 RegressionCO Regression
R 2 RMSE (ppm) R 2 RMSE (ppm)
MTL-ILT (Ours)0 db99.23%0.9510129.4040.84002.641
30 db98.46%0.9414141.5210.81692.826
20 db94.62%0.8811201.5840.72903.437
TCN0 db90.00%0.8497226.7030.65553.876
30 db90.00%0.8308240.5120.64563.931
20 db86.92%0.0001584.6540.28265.593
ISA-TCN0 db90.77%0.9358148.1480.73903.374
30 db92.31%0.8436231.2310.68933.681
20 db84.62%0.3619467.0750.34655.339
ISA-LSTM0 db84.62%0.8838199.2830.48924.720
30 db84.62%0.8812201.4980.48700.4730
20 db86.15%0.8779204.3030.47694.776
LSTM-TCN0 db70.00%0.8667213.4870.64593.930
30 db70.00%0.7988262.2710.55754.393
20 db60.00%−0.2305648.5930.20415.891
Table 11. Comparison of model performance across different time window lengths.
Table 11. Comparison of model performance across different time window lengths.
TimeExperimental Tasks
ClassificationH2 RegressionCO Regression
Accuracy R 2 RMSE (ppm) R 2 RMSE (ppm)
5 s87.69%0.9582119.5250.85652.502
10 s96.15%0.9226162.7150.82882.732
20 s96.92%0.9233161.9390.75813.248
40 s99.23%0.9510129.4040.84002.641
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Guo, R.; Yu, Q.; Li, H.; Pu, Z.; Jiao, M. Rapid Detection of Mixed Gases from Lithium Battery Thermal Runaway Based on ISA-LSTM-TCN. Batteries 2026, 12, 188. https://doi.org/10.3390/batteries12060188

AMA Style

Guo R, Yu Q, Li H, Pu Z, Jiao M. Rapid Detection of Mixed Gases from Lithium Battery Thermal Runaway Based on ISA-LSTM-TCN. Batteries. 2026; 12(6):188. https://doi.org/10.3390/batteries12060188

Chicago/Turabian Style

Guo, Ruqi, Qian Yu, Hao Li, Zilong Pu, and Mingzhi Jiao. 2026. "Rapid Detection of Mixed Gases from Lithium Battery Thermal Runaway Based on ISA-LSTM-TCN" Batteries 12, no. 6: 188. https://doi.org/10.3390/batteries12060188

APA Style

Guo, R., Yu, Q., Li, H., Pu, Z., & Jiao, M. (2026). Rapid Detection of Mixed Gases from Lithium Battery Thermal Runaway Based on ISA-LSTM-TCN. Batteries, 12(6), 188. https://doi.org/10.3390/batteries12060188

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop