Small sample lithium battery remaining life prediction method and device
By constructing a multi-source knowledge transfer strategy based on nearest neighbor selection and a conditional variational autoencoder-xLSTM neural network, the problems of overfitting and prediction uncertainty in small-sample lithium battery health status management are solved, achieving high-precision and robust prediction of lithium battery remaining life, which is applicable to electric vehicles and other fields.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- XIAN UNIV OF POSTS & TELECOMM
- Filing Date
- 2026-03-27
- Publication Date
- 2026-06-12
Smart Images

Figure CN122193937A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of lithium battery remaining useful life (RUL) prediction technology, specifically relating to a method and device for predicting the remaining life of small sample lithium batteries. Background Technology
[0002] Lithium-ion batteries, with their high energy density, relatively stable electrochemical characteristics, low pollution, and long cycle life, have become core energy supply components in various systems and devices, and are widely used in transportation, mobile communications, aerospace, military, consumer electronics, and other fields. Especially in the electric vehicle sector, the health status management of lithium-ion batteries is of great significance for ensuring safe vehicle operation and extending battery life.
[0003] Because the performance of lithium batteries degrades to some extent during the charge and discharge process, and this degradation can lead to system malfunctions or even safety accidents, predicting the state of health (RUL) of lithium batteries is essential. The RUL of a lithium battery is the number of cycles required for its capacity to decline to the failure threshold under charge and discharge conditions. Accurate prediction of the RUL is a crucial aspect of battery health management.
[0004] In recent years, deep learning-based lithium battery health status management has developed rapidly. Convolutional neural networks, recurrent neural networks and their variants such as Long Short-Term Memory (LSTM) networks and Gated Recurrent Units (GRUs) have avoided complex mathematical modeling processes, overcome the limitations of manual feature extraction in data-driven systems, and achieved end-to-end remaining life prediction.
[0005] However, in practical applications, especially in electric vehicle battery swapping scenarios, the challenge of few-shot learning is frequently encountered. Historical data for new batteries is often very limited, and traditional deep learning methods are prone to overfitting and low prediction accuracy in few-shot scenarios. Although techniques such as transfer learning and meta-learning can alleviate the few-shot problem to some extent, they still have the following shortcomings: 1. Insufficient utilization of large sample knowledge: Existing methods often simply pre-train the model on large samples and then fine-tune it on small samples, without making full use of the similarity information between large and small samples; 2. Insufficient quantification of prediction uncertainty: In small sample scenarios, the predictions of the model often have large uncertainties, but existing methods rarely quantify and model this uncertainty; 3. Weak ability to fuse multi-source information: When multiple small training data are available, how to effectively fuse the prior knowledge of these training samples is a challenge; 4. Simple nearest neighbor selection strategy: Existing methods often only consider simple distance metrics when selecting large sample nearest neighbors, without comprehensively considering feature similarity and time series dynamic characteristics. Summary of the Invention
[0006] The purpose of this invention is to provide a method and device for predicting the remaining life of lithium batteries in small sample scenarios, so as to solve the technical problem that existing deep learning-based lithium battery health status management methods are prone to overfitting and low prediction accuracy in small sample scenarios.
[0007] To achieve the above objectives, the present invention adopts the following technical solution: A method for predicting the remaining life of a small sample of lithium batteries includes the following steps: Acquire large-sample lithium battery data and small-sample lithium battery data to be tested; Large sample lithium battery data is input into the pre-trained first prediction model to obtain prediction results for large sample batteries. The first prediction model is then refined, and small sample lithium battery data to be tested is input into the refined first prediction model to obtain preliminary prediction results for small sample batteries. Based on the preliminary prediction results of small sample batteries and the prediction results for large sample batteries, several large sample batteries similar to the small sample batteries are selected as neighbors. The preliminary prediction results of small sample batteries and the prediction results of any large sample battery in the nearest neighbors are input into the pre-trained second prediction model to obtain multiple enhanced prediction results; The final prediction result is obtained by projecting multiple enhanced prediction results together.
[0008] Furthermore, the data of the lithium battery under test includes the terminal voltage, battery output current, and battery casing temperature of the lithium battery under test at each time point during the sampling period.
[0009] Furthermore, multiple large sample batteries similar to the small sample battery are selected as nearest neighbors, including: Extract comprehensive features from a large sample of batteries and standardize these features. The comprehensive features include basic statistical features, decay features, shape features, and predicted quality features. For small sample batteries of the candidate nearest neighbors, their comprehensive features are extracted and standardized. Based on the comprehensive characteristics of the standardized large sample batteries and the comprehensive characteristics of the standardized small sample batteries, the similarity between the small sample batteries and each large sample battery is calculated. The similarity takes into account the Euclidean distance in the feature space and the dynamic time warping (DTW) distance of the time series.
[0010] Furthermore, the formula for calculating the similarity is:
[0011] In the formula, The feature similarity calculated based on Euclidean distance of standardized features is expressed as:
[0012] In the formula, For the feature vector of a small sample battery, For the feature vectors of a large sample of batteries, Denotes the Euclidean norm; The time series similarity calculated based on the DTW algorithm is expressed as:
[0013] in, and These are the sequence lengths of the small and large sample batteries, respectively. The distance between two sequences calculated using the DTW algorithm is expressed as:
[0014] in, and The sequences are the preliminary prediction results of GRU for small and large samples, respectively.
[0015] Furthermore, the first prediction model uses the GRU model, and the second prediction model uses the CVAE-xLSTM model.
[0016] Furthermore, the CVAE-xLSTM model includes: Multi-conditional attention fusion layer: used to perform attention-weighted fusion of the true RUL of all batteries in the small sample training set to obtain the fused conditional information; The encoder of the conditional variational autoencoder is used to receive the prediction results of small sample batteries, the prediction results of training nearest neighbors, and the fused conditional information, and output the mean and log-variance of the latent variables. Reparameterization layer: used to generate latent variables based on the mean and log-variance of latent variables; xLSTM layer: Used to receive latent variables and the true RUL of training nearest neighbors, and output the augmented latent variables through conditional fusion and xLSTM processing; The decoder of the conditional variational autoencoder receives the enhanced latent variables and the fused conditional information, and outputs the enhanced prediction results.
[0017] Furthermore, the multiple enhanced prediction results are projected to obtain the final prediction result, including: Gaussian mixture clustering was performed on the predicted result sequence of the test batteries to determine the battery pack to which each test battery belongs; The initial prediction results of the test battery are aligned with the lengths of the prediction results of multiple nearest neighbors of the most recently trained battery and then weighted and fused to obtain multiple hybrid feature vectors. The real RUL of the most recently trained battery is used as the optimization objective. Multiple mixed feature vectors are input into the projection space, the weight vector is initialized, and the weights are iteratively updated along the gradient direction to obtain the optimal weight coefficients. Repeat the above process for all test cells in the battery pack, and average the learned multiple weight vectors within the group to obtain the average projected weight of the group. The multiple enhanced prediction results of the test battery are weighted and fused, and then linearly weighted and summed using the group average weight to obtain the projected prediction result.
[0018] Secondly, the present invention provides a small-sample lithium battery remaining life prediction system, comprising an acquisition module, a first prediction module, a selection module, a second prediction module, and an output module, wherein: Acquisition module: used to acquire large sample lithium battery data and small sample lithium battery data to be tested; The first prediction module is used to input large sample lithium battery data into the pre-trained first prediction model to obtain prediction results for large sample batteries, refine the first prediction model, and input small sample lithium battery data to be tested into the refined first prediction model to obtain preliminary prediction results for small sample batteries. Selection module: Used for preliminary prediction results based on small sample batteries and prediction results for large sample batteries, selecting multiple large sample batteries similar to the small sample batteries as nearest neighbors; The second prediction module is used to input the preliminary prediction results of small sample batteries and the prediction results of any large sample battery in the nearest neighbors into the pre-trained second prediction model to obtain multiple enhanced prediction results. Output module: Used to project multiple enhanced prediction results to obtain the final prediction result.
[0019] Thirdly, a terminal device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the above-described method.
[0020] Fourthly, a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the above-described method.
[0021] Compared with the prior art, the present invention has the following beneficial technical effects: This invention provides a method for predicting the remaining life of lithium batteries in small sample scenarios. By constructing a multi-source knowledge transfer strategy based on nearest neighbor selection, the preliminary prediction results of small sample batteries and the prediction results of multiple similar neighbors intelligently selected from a large sample database are input into a pre-trained second prediction model to generate multiple enhanced prediction results. The final prediction value is obtained through projection optimization. This effectively alleviates overfitting and prediction uncertainty caused by data scarcity in small sample scenarios, significantly improves the accuracy and robustness of lithium battery remaining life prediction, and realizes the efficient utilization of large sample knowledge and deep integration of multi-source information. It is particularly suitable for health status management under limited data conditions in practical applications such as rapid deployment of new batteries and battery swapping modes.
[0022] This invention employs a neural network architecture combining a conditional variational autoencoder and xLSTM, using a small amount of known real RUL as conditional information to guide model learning and optimize prediction results. It designs an intelligent nearest neighbor selection mechanism that, when constructing reference samples, simultaneously considers the similarity of battery static features and the dynamic evolution of charge-discharge time series, thereby accurately matching the most relevant large-sample nearest neighbors for each small sample battery and efficiently mining and transferring rich prior knowledge from the large sample library. Based on this, for each small sample battery, K sets of enhanced prediction results are generated based on the selected K nearest neighbors. These prediction results are then used to construct a linear subspace consisting of the initial prediction results of the test battery and the K nearest neighbor prediction results of the training battery. The small sample real label information is further mapped to this subspace through orthogonal projection, achieving further optimization of the initial prediction and significantly improving the accuracy and consistency of the prediction. Crucially, this solution is specifically tailored for small-sample learning scenarios, improving prediction performance even with extremely limited training data, effectively overcoming the prediction failure problem caused by insufficient data in traditional methods during rapid deployment of new batteries or battery swapping modes. This invention not only significantly enhances the accuracy and stability of lithium battery remaining life prediction, but also provides solid technical support for real-time assessment and safe scheduling of battery health status in battery swapping systems, demonstrating outstanding engineering practical value and promising prospects for widespread application. Attached Figure Description
[0023] Figure 1 This is a flowchart of a small-sample lithium battery remaining life prediction method in an embodiment of the present invention; Figure 2 This is a schematic diagram illustrating the workflow for acquiring large and small sample lithium battery data in an embodiment of the present invention. Figure 3 This is a schematic diagram of the nearest neighbor selection process in an embodiment of the present invention; Figure 4 This is a schematic diagram of the training and testing process of the CVAE-xLSTM model in an embodiment of the present invention; Figure 5 This is a schematic diagram of the architecture of the CVAE-xLSTM model in an embodiment of the present invention; Figure 6 Figure a shows a comparison between the final results and the initial prediction results of batteries CH17, CH18, CH19, CH20, and CH22 using the method of this invention; Figure 6 Figure b shows a comparison between the final results and the initial prediction results of batteries CH23, CH24, CH25, CH26, and CH27 using the method of this invention; Figure 6 Figure c shows a comparison between the final results and the initial prediction results of batteries CH28, CH29, CH30, CH31, and CH32 using the method of this invention; Figure 6 Figure d shows a comparison between the final results and the initial prediction results of batteries CH33, CH34, CH35, CH36, and CH37 using the method of this invention; Figure 6 Figure e shows a comparison between the final results and the initial prediction results of batteries CH38, CH39, CH40, CH41, and CH42 using the method of this invention; Figure 6 Figure f shows a comparison between the final results and the initial prediction results of batteries CH43, CH44, CH45, CH46, and CH47 using the method of this invention; Figure 7 Figure a shows the performance comparison of batteries CH17, CH18, CH19, CH20, and CH22 using the method of this invention with other methods including AttOmics, COSCO, PBCT, ShotAdpt, TTMs, and UniST. Figure 7 Figure b shows the performance comparison of batteries CH23, CH24, CH25, CH26, and CH27 using the method of this invention with other methods including AttOmics, COSCO, PBCT, ShotAdpt, TTMs, and UniST. Figure 7 Figure c shows the performance comparison of batteries CH28, CH29, CH30, CH31, and CH32 using the method of this invention with other methods including AttOmics, COSCO, PBCT, ShotAdpt, TTMs, and UniST. Figure 7 Figure d shows the performance comparison of batteries CH33, CH34, CH35, CH36, and CH37 using the method of this invention with other methods including AttOmics, COSCO, PBCT, ShotAdpt, TTMs, and UniST. Figure 7 Figure e shows the performance comparison of batteries CH38, CH39, CH40, CH41, and CH42 using the method of this invention with other methods including AttOmics, COSCO, PBCT, ShotAdpt, TTMs, and UniST. Figure 7 Figure f shows the performance comparison of batteries CH43, CH44, CH45, CH46, and CH47 using the method of this invention with other methods including AttOmics, COSCO, PBCT, ShotAdpt, TTMs, and UniST. Detailed Implementation
[0024] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0025] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.
[0026] It should be noted that the terms "first" and "second" in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0027] In electric vehicle battery swapping, the remaining lifespan of the replaced batteries needs to be accurately predicted to ensure safety during future installations. However, new batteries often lack sufficient historical data, creating a typical few-shot learning scenario. While pre-training can utilize data from a large number of existing batteries, individual differences exist between batteries, making simple transfer learning often ineffective.
[0028] The present invention will now be described in further detail with reference to the accompanying drawings: like Figure 1 As shown, a method for predicting the remaining life of a small sample lithium battery includes the following steps: Step 1: Obtain large sample lithium battery data and small sample lithium battery data to be tested; The sample dataset includes sample data from multiple lithium batteries. The sample data for each lithium battery includes the terminal voltage, battery output current, and battery casing temperature of the lithium battery during various sampling periods. The tag information corresponding to one sample data of each lithium battery represents the remaining life of the lithium battery.
[0029] like Figure 2 As shown, step one specifically includes: Step S11: Obtain the large-sample dataset XJTU and the small-sample dataset MIT-ST for lithium batteries; Specifically, in this embodiment of the invention, the lithium battery dataset provided by Xi'an Jiaotong University (XJTU) is used as a large sample, referred to as the XJTU dataset; and the lithium-ion battery capacity degradation dataset provided by the MIT-Stanford-Toyota Research Center (MIT-ST) is used as a small sample, referred to as the MIT-ST dataset.
[0030] Step S12: Filter the battery packs in the large sample and small sample datasets to obtain the filtered large sample and small sample datasets. The XJTU dataset was developed using 18650 nickel-cobalt-manganese lithium-ion batteries manufactured by Lishen. Fifty-five batteries were included, and six different charge-discharge strategies were employed, divided into six batches. The charge-discharge platform used in the experiments was ACTS-5V10A-GGS-D, and all data were sampled at a frequency of 1Hz. Specifically, the first and second batches used a fixed charge-discharge strategy (fully charged and discharged); the third batch used a variable discharge strategy (fully charged and discharged); the fourth batch used a variable discharge strategy (fully charged but not fully discharged); the fifth batch used a random walk discharge strategy (fully charged but not fully discharged); and the sixth batch simulated the charge-discharge strategy of a geostationary satellite. Because the charge-discharge strategies of the fifth and sixth batches differed significantly from the first four batches, 39 batteries from the first four batches were selected as the final XJTU dataset. Using a leave-one-out sampling method, the last battery from each batch was combined into the test set, and the remaining batteries were used as the training set for GRU pre-training. Detailed grouping information is shown in Table 1. Table 1. Grouping of XJTU datasets
[0031] The MIT-ST dataset was collected from 124 sets of commercial lithium iron phosphate / graphite batteries (model APR18650M1A) manufactured by A123 Systems. The batch from June 30, 2017 showed more stable cycle counts than other batches, and this batch of lithium battery data was selected to construct the training and test sets in the experiments of this invention. First, all batteries exhibiting anomalies during data acquisition were removed. The removed batteries included: lithium battery data from channels 1, 2, 3, 5, and 6 of a previous batch of experiments, which had already participated in the experiments on May 12, 2017, and whose performance had degraded; thermocouples from channels 7 and 21 that detached abnormally, resulting in abnormal temperature data; batteries from channel 10 that had inherent defects and experienced extremely rapid capacity decay during the experiments; and thermocouples from channels 15 and 16 that exhibited anomalies. Therefore, 35 groups were selected from the remaining batteries as the filtered MIT-ST dataset. A k-fold crossover experiment was used, with k set to 7, and each fold included 5 training sets and 30 test sets. Detailed grouping information is shown in Table 2.
[0032] Table 2 Grouping of MIT-ST datasets
[0033] Step S13: Based on the selected fields, including the terminal voltage of the lithium battery, the battery output current, and the battery casing temperature, extract the fields from the filtered XJTU and MIT-ST datasets to obtain the extracted XJTU and MIT-ST datasets.
[0034] Step S14: For the extracted dataset, the complete charge-discharge time series data of each lithium battery is divided into multiple samples using a sliding window slicing method. Each sample covers a sampling duration corresponding to the window size, including the terminal voltage, battery output current, and battery casing temperature data of the lithium battery within that time period. Simultaneously, the ratio of the number of cycles remaining until the battery's lifespan is exhausted to the total number of cycles within the sampling duration is normalized and used as the label for that sample to characterize the remaining lifespan of the lithium battery.
[0035] Time series data is typically processed using the sliding window method to generate data in a format suitable for network model input. Sliding windows can be categorized as continuous or discontinuous based on their sliding method, and as fixed or variable based on their window size. In this study, the raw data from the XJTU and MIT-ST datasets consist of continuous charge-discharge records of lithium-ion batteries, covering variables such as terminal voltage, battery output current, and battery casing temperature. Therefore, a fixed-size discontinuous sliding window was used to generate samples, meaning the window slides in fixed steps. The specific process is as follows: First, the charge-discharge data of a single battery are integrated into a complete time series, covering the entire lifespan from the initial state to capacity decay to 75% of the rated capacity. Then, the series is sliced using a sliding window to generate samples. The experiment sets the window size to 100 time steps, meaning each sample contains data from 100 consecutive time points; the sliding step size is also set to 100, indicating the window moves 100 steps at a time. The RUL (Remaining Limit) of each sample for the lithium-ion battery is defined as the number of cycles remaining from the current time until the end of the battery's lifespan.
[0036] Step S15: Summarize all the sample data generated by the lithium batteries to construct a lithium battery sample dataset.
[0037] Step 2: Input large sample lithium battery data into the pre-trained first prediction model to obtain prediction results for the large sample battery. Refine the first prediction model and input small sample lithium battery data to be tested into the refined first prediction model to obtain preliminary prediction results for the small sample battery. Specifically, the first prediction model uses a GRU model. The GRU model is pre-trained using a large sample of battery data to obtain a pre-trained GRU model. The large sample of lithium battery data is first input into the pre-trained first prediction model GRU to obtain prediction results for the large sample of batteries. Then, a small sample of lithium battery data is input into the first prediction model GRU for retraining (this process involves fine-tuning the model parameters, i.e., refinement or fine-tuning), resulting in a refined first prediction model. Finally, a small sample of lithium battery data to be tested is fed into the refined first prediction model to obtain preliminary prediction results for the small sample of batteries to be tested. Details are as follows: The model input dimension was set to 4, including terminal voltage, current, and temperature; the hidden layer was set to 2 layers, each containing 128 units; Dropout with a ratio of 0.2 was used during training, the learning rate of the Adam optimizer was set to 0.001, and the mean squared error (MSE) was used as the loss function, expressed as:
[0038] in, The total number of samples in the large sample. For the first A large sample of true RUL values, For the GRU model for the first RUL prediction values for a large sample.
[0039] During the training phase, a total of 100 training rounds were conducted, with model performance evaluated on the validation set every 10 epochs. To prevent overfitting, an early stopping strategy was adopted, which terminated training when the validation set loss did not decrease for 10 consecutive epochs, and finally saved the model parameters that performed best during training.
[0040] A small sample of lithium-ion battery data is input into a pre-trained GRU model for refinement, yielding preliminary prediction results for this small sample of batteries. Specifically, the small sample training set contains data from five batteries (group training, selecting five batteries from the small sample dataset each time), while the test set uses data from all other batteries. During refinement, the parameters of the GRU model pre-trained on the XJTU dataset are first loaded, and then all parameters are fine-tuned end-to-end while maintaining the overall model architecture. The training phase uses a small sample training set with a learning rate of 0.0001, training for 100 epochs. An early stopping strategy (stopping training when the training loss no longer decreases for five consecutive epochs) and a learning rate decay strategy (halving the learning rate when the loss stagnates) are introduced to prevent overfitting. A 20% validation set is also set to monitor the training process. After training, the refined model is saved. After refinement, the model is applied to both the training and test sets for prediction, yielding detailed prediction results. Although the refined model shows improvement over the pre-trained model on the MIT dataset, the limited amount of small sample data still results in some errors and uncertainties in the predictions.
[0041] Step 3: Based on the preliminary prediction results of small sample batteries and the prediction results for large sample batteries, select multiple large sample batteries that are similar to the small sample batteries as nearest neighbors. For a small sample of batteries, select K most similar large sample batteries from a large sample library as their nearest neighbors, such as... Figure 3 As shown, the specific steps include: Step S31 involves feature extraction from the large sample dataset. For each battery in the large sample database, the system extracts a comprehensive, multi-dimensional feature vector from its predicted RUL sequence. This feature system comprises 23 dimensions, divided into four logically clear categories to comprehensively characterize the battery's degradation state and prediction quality. First, there are the basic statistical features, totaling 7 dimensions. These describe the central tendency and dispersion of the predicted RUL from an overall distribution perspective, specifically including the mean, standard deviation, median, minimum, maximum, and 25th and 75th percentiles of the predicted values. Second, there are the degradation features, totaling 8 dimensions. These features focus on the decreasing trend and dynamic changes in battery capacity, including the slope (representing the average degradation rate) and intercept obtained through linear regression fitting, as well as the mean and standard deviation of the first-order difference sequence. They also quantify the proportion of "decline points" (the proportion of negative difference values) and "plateau points" (the proportion of extremely small absolute difference values) during the degradation process to capture non-linear degradation patterns. The third category is shape features, which are 3-dimensional and describe the geometry of the predicted curve. These include skewness (measuring distribution symmetry), kurtosis (measuring distribution sharpness), and the mean absolute value of the second difference, the latter effectively reflecting the curve's "bending" or "fluctuation." Finally, there are prediction quality features, which are 5-dimensional. These features directly measure the accuracy of the prediction results, but their calculation depends on the actual RUL labels. They include the mean and standard deviation of the prediction error, the mean absolute error, the maximum absolute error, and the root mean square error (RMSE). When battery data is too short or actual labels are missing, features that cannot be calculated are filled with 0 to ensure process stability.
[0042] Step S32 involves standardizing the extracted features. Because different features have vastly different units and numerical ranges, without standardization, metrics such as Euclidean distance will be heavily biased towards features with large numerical ranges, leading to distorted similarity calculation results. To address this issue, StandardScaler is used to standardize the extracted composite features:
[0043] in, For eigenvalues, This is the mean of the feature across all batteries in the large sample library. This represents the standard deviation of the feature.
[0044] Step S33: Calculate the similarity between the small sample and each battery in the large sample library. For the small sample batteries that are the candidates for nearest neighbors, extract their comprehensive features and perform standardization processing, and then calculate the similarity with each battery in the large sample library.
[0045] Similarity calculation takes into account two aspects: (1) Feature space similarity (based on Euclidean distance):
[0046] In the formula, For the feature vector of a small sample battery, For the feature vectors of a large sample of batteries, Denotes the Euclidean norm; For any battery The feature vector is extracted, which includes 21 dimensions, and is represented as follows:
[0047] in, Indicates battery Predict the mean of RUL. Indicates battery Predict the standard deviation of RUL. Indicates battery Predict the median of RUL. and These represent batteries. Predict the minimum and maximum values of RUL. and They represent batteries Predict the 25th and 75th percentiles of RUL. Indicates battery Predict the linear slope of RUL. Indicates battery Predict the linear intercept of RUL. Indicates battery Predict the average rate of change of RUL. Indicates battery Predict the rate of change fluctuation of RUL. Indicates battery Predict the percentage decrease in RUL. Indicates battery Predict the steady-state ratio of RUL. and They represent batteries Predict the skewness and kurtosis of RUL. Indicates battery Predict the mean curvature of RUL. Indicates battery The average error in predicting RUL Indicates battery The standard deviation of the error in predicting RUL Indicates battery The mean absolute error in predicting RUL Indicates battery Predicting the maximum absolute error of RUL Indicates battery Predict the root mean square error of RUL.
[0048] Time series similarity (based on DTW distance): To reduce computational complexity, excessively long sequences are first sampled, limiting the sequence length to within 50. Then, the sequences are normalized, and the DTW algorithm is used to calculate the distance between two normalized sequences, converting the DTW distance into a similarity score.
[0049] in, and These are the sequence lengths of the small and large sample batteries, respectively. The distance between two sequences calculated using the DTW algorithm is expressed as:
[0050] in, and The sequences are the preliminary prediction results of GRU for small and large samples, respectively.
[0051] The final overall similarity is:
[0052] The similarity calculation stage integrates information from both feature space similarity and time series similarity. Feature space similarity is based on Euclidean distance, while time series similarity is measured using the DTW algorithm, which effectively captures morphological differences in battery degradation curves. To balance computational efficiency and accuracy, long sequences are downsampled, and the two similarities are weighted and fused with a weight of 0.5 each to form the final comprehensive similarity.
[0053] Step S34: Select K nearest neighbors based on similarity ranking. During the neighbor selection process, batteries are sorted from high to low based on their overall similarity, and the top K batteries are selected as nearest neighbors. In this embodiment, K=8 is set in both the training and testing phases, and a hierarchical selection strategy is introduced. High-quality nearest neighbors with similarity higher than 0.8 are selected first, and medium-quality and low-quality nearest neighbors are added in turn if insufficient. This ensures both core similarity and flexibility and robustness in the selection process.
[0054] Step four: Input the preliminary prediction results of the small sample batteries and the prediction results of any large sample battery in the nearest neighbors into the pre-trained second prediction model to obtain multiple enhanced prediction results: The second prediction model uses a CVAE-xLSTM model. For each of the K nearest neighbors, the preliminary battery prediction result from a small sample and the prediction result of that neighbor are input into the pre-trained CVAE-xLSTM model to optimize the prediction result, resulting in an enhanced prediction result, such as... Figure 4 As shown, it specifically includes: Step S41: Construct training pairs for each small sample training battery and its K nearest neighbors. For each battery in the small sample training set, select K=8 most similar large sample batteries as training neighbors, and then create a training pair for that small sample battery and each of its training neighbors.
[0055] Each training pair contains the following information: the prediction result of the few-shot battery (from the refined GRU model), the prediction result of the training nearest neighbor (from the pre-trained GRU model), the true RUL of the few-shot battery, the true RUL of the training nearest neighbor, similarity information, and sample weights (determined based on similarity, with a weight of 1.0 for high-quality nearest neighbors and a weight of 0.7 for low-quality nearest neighbors).
[0056] In this embodiment, the small sample training set has 5 batteries, and 8 nearest neighbors are selected for each battery, so a total of 40 training pairs are created.
[0057] Step S42: Build the CVAE-xLSTM model.
[0058] The core components of the CVAE-xLSTM model include a multi-conditional attention fusion layer, a conditional variational autoencoder, and an xLSTM module, such as... Figure 5 As shown.
[0059] The multi-conditional attention fusion layer is designed to enable the model to intelligently utilize the true RUL information of all batteries in the small sample training set to guide the prediction of the current battery. Specifically, it first maps the true RUL sequence of each reference battery to a high-dimensional hidden space through a conditional projection network. Simultaneously, the model generates a query vector based on the prediction results of the current small sample battery to be predicted and its nearest neighbors. By calculating the similarity between this query vector and the projected features of all reference batteries, the model can automatically learn and assign different attention weights, ultimately fusing the conditional information of all reference batteries in a weighted manner. This design allows the model to dynamically identify which historical degradation patterns are more relevant to the current task, thereby achieving effective knowledge transfer.
[0060] After obtaining the fused global conditional information, the model enters the conditional variational autoencoder part. The encoder takes the prediction results of small sample batteries, the prediction results of their nearest neighbors, and the aforementioned fused conditional information as input. These inputs are first pre-processed through their respective linear transformations and nonlinear activations, and then concatenated and fused. The fused features are then encoded through a deep neural network, ultimately outputting two key parameters representing the latent state: the mean. and logarithmic variance To ensure the model is differentiable and can be trained end-to-end, a reparameterization technique is applied. This technique transforms the deterministic latent variable into a learnable random variable z by introducing a random noise ε sampled from a standard normal distribution, thus injecting the necessary randomness and robustness into the model.
[0061] Subsequently, the xLSTM layer receives the latent variable z generated by the encoder and further combines it with the true RUL information of the current nearest neighbor cells. The true RUL is first projected into the latent space and then fused with the latent variable z, serving as the input to the xLSTM. The xLSTM layer employs an advanced hybrid architecture, consisting of a stacked s-LSTM block and an m-LSTM block. The s-LSTM block uses scalar memory units and exponential gating mechanisms to significantly improve the stability of long-term dependency modeling by maximizing normalization of the state update process. The m-LSTM block goes a step further, using matrix-form memory units that can capture complex relationships between internal states through covariance updates and introducing an attention-like mechanism to enhance its memory capacity. The synergistic work of these two LSTM variants enables the model to stably capture dependencies in ultra-long sequences while also finely modeling complex nonlinear state transitions.
[0062] Finally, the decoder restores the latent representation z', enhanced and refined by xLSTM, to the final prediction output. The decoder also receives the previously generated fusion conditional information to ensure the decoding process is guided by the global context. The enhanced latent variable z', fused with the conditional information, is then decoded and reconstructed through a multi-layer feedforward neural network. The network progressively transforms the abstract latent representation into concrete time-series signals through layer-by-layer nonlinear transformations and regularization operations, ultimately generating an optimized estimate of the remaining battery life for a small sample through an output layer. This enhanced prediction result integrates the original prediction, nearest-neighbor patterns, and global attention information, achieving a significant improvement in prediction accuracy.
[0063] Step S43, set the loss function. The loss function of the CVAE-xLSTM model adopts an uncertainty-weighted multi-task learning strategy, which includes two main parts: (1) KL divergence loss (used for regularizing the latent space):
[0064] in, and These are the mean and logarithmic variance of the latent variables output by the encoder, respectively. This loss term encourages the distribution of latent variables to approximate a standard normal distribution, preventing the model from overfitting to the training data.
[0065] (2) Improvement of losses:
[0066] in, To enhance prediction results, This is the true RUL for a small sample of batteries.
[0067] This loss term ensures that the enhanced predictions generated by the model are as close as possible to the true RUL.
[0068] The total loss based on the uncertainty-weighted strategy is:
[0069] in, , which represents the learnable log-variance parameter of the corresponding loss term. The model will automatically learn the optimal weight balance between the two loss terms.
[0070] Step S44: Train the CVAE-xLSTM model using the training pair.
[0071] The training process uses the Adam optimizer with a learning rate of 0.001, along with learning rate scheduling and early stopping strategies, for a maximum of 500 training epochs. The batch size is 1, processing one training pair at a time. After training, the model parameters and training history are saved to provide a foundation for subsequent prediction optimization.
[0072] Step S45: Optimize the prediction results of the test battery using the trained CVAE-xLSTM model. The testing phase is similar to the training phase. First, for each small sample battery, the eight most similar large sample batteries are selected as its nearest neighbors from the large sample database. For each selected nearest neighbor, a series of input data are prepared, including the initial prediction of the test battery (from the refined GRU model), the prediction of the current nearest neighbor (from the pre-trained GRU model), the true RUL of all small sample training set batteries, and the true RUL of the current nearest neighbor. This data is fed into the trained CVAE-xLSTM model for processing, generating enhanced K-nearest neighbor prediction results for the small sample test set. Simultaneously, evaluation metrics are calculated to assess the quality of each nearest neighbor prediction. Finally, all prediction results and evaluation metrics are saved.
[0073] Step 5: Project the multiple enhanced prediction results to obtain the final prediction result: First, load the RUL data from the training and test sets and the K nearest neighbor predictions for each battery (from the CVAE-xLSTM model) to construct the subsequent hybrid projection space.
[0074] To improve prediction performance, GMM similarity clustering is performed on the test batteries, grouping batteries with similar behavioral patterns together. Specifically, for each group of test batteries, the most similar training battery is first found for each test battery in the group. The RUL of the test battery is compared with the RUL of all training batteries using Euclidean distance, and the one with the smallest distance is selected as the "source domain" reference. Then, a hybrid projection space is constructed. By combining the K nearest neighbor predictions of the test battery and the K nearest neighbor predictions of its corresponding training battery, K "hybrid vectors" are generated through weighted averaging. These vectors, together with the real training RUL, constitute the projection space. Next, the projection weights are learned. The projection algorithm is used to iteratively optimize the weights using gradient ascent, so that the weighted hybrid vectors approximate the real training RUL as closely as possible. Finally, the average weight within the group is calculated. The weights learned by all test batteries in the group are averaged to serve as the general projection weight for the group, which is used for subsequent unified post-processing.
[0075] Finally, projection is applied and the results are evaluated. Using the obtained group average weights, a final prediction is performed for each test cell within the group. The test cell's predictions are then mixed again with the nearest neighbor predictions of its corresponding training cell, aligned to the length of the test RUL; a weighted sum using the average weights is obtained to obtain the projected RUL prediction; an evaluation metric is calculated and compared with the original GRU prediction and the K nearest neighbor predictions.
[0076] Experimental verification: Figure 6 This figure shows the performance comparison results of the method of this invention based on the test set (including 30 batteries) of the MIT dataset (a small sample dataset) and the initial prediction results. Figure 6 As shown in Figures a-f, for all batteries in the test set, the RMSE values after applying the method of this invention were significantly lower than the initial prediction results. This result strongly verifies the effectiveness and robustness of the method of this invention in improving the accuracy of remaining life prediction for lithium-ion batteries.
[0077] Figure 7 This figure shows the performance comparison results of the method of this invention on the test set of the MIT dataset (including 30 batteries) and other methods including AttOmics, COSCO, PBCT, ShotAdpt, TTMs, and UniST. From... Figure 7As shown in Figures a-f, for the vast majority of batteries in the test set, the RMSE values obtained by the method of this invention are superior to other control methods, demonstrating the best performance among all methods. This proves that the method of this invention has higher prediction accuracy and also reflects its excellent robustness and generalization ability when handling multiple samples, fully verifying the overall superiority of the method of this invention.
[0078] The innovation of this invention lies in: By combining a conditional variational autoencoder (CDAE) with an xLSTM, the model is trained using the initial prediction results of a pre-trained model. The trained model can generate K better predictions than the initial predictions, and then a projection operator is used to obtain the final prediction. This invention proposes a novel neural network model that combines a CDAE and an xLSTM to generate more optimized predictions based on the initial predictions. Then, using the projection theorem, the label information is projected onto a linear subspace consisting of the initial prediction of the test battery and the K nearest neighbor predictions of the most recently trained battery, thus obtaining the optimal prediction. Compared to traditional methods, the prediction accuracy of the proposed model is significantly improved. In terms of knowledge utilization, it fully utilizes both small and large sample data to achieve effective fusion of multi-source knowledge. The model employs a nearest neighbor selection strategy that combines feature similarity and the dynamic characteristics of time series data to intelligently select the optimal nearest neighbor samples, ensuring the accuracy of knowledge transfer. Furthermore, for each test sample, the system can generate multiple predictions and obtain the best prediction through projection, significantly improving the stability of the prediction. Most importantly, this method exhibits excellent performance in small sample scenarios, maintaining high-precision predictions even with scarce training data. Therefore, it has significant practical value in data-scarce application scenarios such as new battery development and battery swapping.
[0079] In another embodiment of the present invention, a small-sample lithium battery remaining life prediction system is provided, comprising an acquisition module, a first prediction module, a selection module, a second prediction module, and an output module, wherein: Acquisition module: used to acquire large sample lithium battery data and small sample lithium battery data to be tested; The first prediction module is used to input small sample lithium battery data and large sample lithium battery data into the pre-trained first prediction model to obtain preliminary prediction results for small sample batteries and prediction results for large sample batteries. Selection module: Used for preliminary prediction results based on small sample batteries and prediction results for large sample batteries, selecting multiple large sample batteries similar to the small sample batteries as nearest neighbors; The second prediction module is used to input the preliminary prediction results of small sample batteries and the prediction results of any large sample battery in the nearest neighbors into the pre-trained second prediction model to obtain multiple enhanced prediction results. Output module: Used to project multiple enhanced prediction results to obtain the final prediction result.
[0080] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can be implemented in one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROMs) containing computer-usable program code. The form of a computer program product implemented on ROM (optical memory, etc.).
[0081] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0082] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0083] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0084] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit its scope of protection. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that after reading the present invention, they can still make various changes, modifications or substitutions to the specific implementation of the invention, but these changes, modifications or substitutions are all within the scope of protection of the pending claims of the invention.
Claims
1. A method for predicting the remaining life of a small-sample lithium battery, characterized in that, Includes the following steps: Acquire large-sample lithium battery data and small-sample lithium battery data to be tested; Large sample lithium battery data is input into the pre-trained first prediction model to obtain prediction results for large sample batteries. The first prediction model is then refined, and small sample lithium battery data to be tested is input into the refined first prediction model to obtain preliminary prediction results for small sample batteries. Based on the preliminary prediction results of small sample batteries and the prediction results for large sample batteries, several large sample batteries similar to the small sample batteries are selected as neighbors. The preliminary prediction results of small sample batteries and the prediction results of any large sample battery in the nearest neighbors are input into the pre-trained second prediction model to obtain multiple enhanced prediction results; The final prediction result is obtained by projecting multiple enhanced prediction results together.
2. The method for predicting the remaining life of a small-sample lithium battery according to claim 1, characterized in that, The data of the lithium battery under test includes the terminal voltage, battery output current, and battery casing temperature of the lithium battery under test at each time point within the sampling period.
3. The method for predicting the remaining life of a small-sample lithium battery according to claim 1, characterized in that, Select multiple large sample batteries similar to the small sample battery as nearest neighbors, including: Extract comprehensive features from a large sample of batteries and standardize these features. The comprehensive features include basic statistical features, decay features, shape features, and predicted quality features. For small sample batteries of the candidate nearest neighbors, their comprehensive features are extracted and standardized. Based on the comprehensive characteristics of the large sample batteries after standardization and the comprehensive characteristics of the small sample batteries after standardization, the similarity between the small sample batteries and each large sample battery is calculated. The similarity takes into account the Euclidean distance in the feature space and the dynamic time warping distance of the time series.
4. The method for predicting the remaining life of a small-sample lithium battery according to claim 3, characterized in that, The formula for calculating the similarity is: In the formula, The feature similarity calculated based on Euclidean distance of standardized features is expressed as: In the formula, For the feature vector of a small sample battery, For the feature vectors of a large sample of batteries, Denotes the Euclidean norm; The time series similarity calculated based on the dynamic time warping algorithm is expressed as: in, and These are the sequence lengths of the small and large sample batteries, respectively. The distance between two sequences calculated using the dynamic time warping algorithm is expressed as: in, and The sequences are the preliminary prediction results of GRU for small and large samples, respectively.
5. The method for predicting the remaining life of a small-sample lithium battery according to claim 1, characterized in that, The first prediction model uses the GRU model, and the second prediction model uses the CVAE-xLSTM model.
6. The method for predicting the remaining life of a small-sample lithium battery according to claim 5, characterized in that, The CVAE-xLSTM model includes: Multi-condition attention fusion layer: used to perform attention-weighted fusion of the actual remaining lifespan of all batteries in the small sample training set to obtain fused conditional information; The encoder of the conditional variational autoencoder is used to receive the prediction results of small sample batteries, the prediction results of training nearest neighbors, and the fused conditional information, and output the mean and log-variance of the latent variables. Reparameterization layer: used to generate latent variables based on the mean and log-variance of latent variables; xLSTM layer: Used to receive latent variables and the true remaining lifetime of training nearest neighbors, and outputs the augmented latent variables through conditional fusion and xLSTM processing; The decoder of the conditional variational autoencoder receives the enhanced latent variables and the fused conditional information, and outputs the enhanced prediction results.
7. The method for predicting the remaining life of a small-sample lithium battery according to claim 1, characterized in that, The multiple enhanced prediction results are projected to obtain the final prediction result, including: Gaussian mixture clustering was performed on the predicted result sequence of the test batteries to determine the battery pack to which each test battery belongs; The initial prediction results of the test battery are aligned with the lengths of the prediction results of multiple nearest neighbors of the most recently trained battery and then weighted and fused to obtain multiple hybrid feature vectors. The actual remaining lifespan of the recently trained battery is used as the optimization objective. Multiple mixed feature vectors are input into the projection space, the weight vector is initialized, and the weights are iteratively updated along the gradient direction to obtain the optimal weight coefficients. Repeat the above process for all test cells in the battery pack, and average the learned multiple weight vectors within the group to obtain the average projected weight of the group. The multiple enhanced prediction results of the test battery are weighted and fused, and then linearly weighted and summed using the group average weight to obtain the projected prediction result.
8. A small-sample lithium battery remaining life prediction system, characterized in that, It includes an acquisition module, a first prediction module, a selection module, a second prediction module, and an output module, wherein: Acquisition module: used to acquire large sample lithium battery data and small sample lithium battery data to be tested; The first prediction module is used to input large sample lithium battery data into the pre-trained first prediction model to obtain prediction results for large sample batteries, refine the first prediction model, and input small sample lithium battery data to be tested into the refined first prediction model to obtain preliminary prediction results for small sample batteries. Selection module: Used for preliminary prediction results based on small sample batteries and prediction results for large sample batteries, selecting multiple large sample batteries similar to the small sample batteries as nearest neighbors; The second prediction module is used to input the preliminary prediction results of small sample batteries and the prediction results of any large sample battery in the nearest neighbors into the pre-trained second prediction model to obtain multiple enhanced prediction results. Output module: Used to project multiple enhanced prediction results to obtain the final prediction result.
9. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements as claimed in claim 1.
7. The steps of any of the methods described.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements as described in claim 1.
7. The steps of any of the methods described.