Adaptive power management in Electric Vehicles (EVs) requires accurate power prediction. Although deep learning models have emerged as highly effective for time-series forecasting in this domain, their performance is prone to degradation when exposed to data with distributions different from the training data. We introduce a novel approach that enables on-device learning in resource-constrained EV systems to continuously adapt pretrained battery prediction models to new, unseen data. We leverage existing pretrained models by transforming them into adaptable versions that retain critical hyperparameter knowledge from their initial training. We comprehensively investigate both online and offline model adaptation strategies. Our results demonstrate significant improvements in forecasting performance across various models and time horizons, achieving mean absolute error reductions of up to 7.49% and 14.88% with online and offline adaptation techniques, respectively. This study highlights the substantial benefit of on-device adaptation, resulting in enhanced battery power predictions than unadapted model deployments in real-world EV scenarios.
Time-series forecasting, Deep learning, Data distribution shift, Model adaptation, On-device learning, Resource-constrained systems.
Time-series signals, which are ubiquitous in daily life, are data recorded at regular intervals. Examples include financial market data, environmental measurements, and medical sensor data. Analyzing historical values to predict future trends offers significant benefits for proactive planning, operational optimization, and risk management. Advancements in deep learning have popularized its techniques for time-series forecasting applications [1]. Architectures such as Multi-layer Perceptrons (MLP), Convolutional Neural Networks (CNN), and Recurrent Neural Networks (RNN) demonstrate superior accuracy in future value prediction compared to conventional statistical methods [2]. These neural networks implicitly learn temporal features from input signals and predict single or multiple future time steps from the previous time steps [3].
Deep learning techniques have also been successfully applied in time series forecasting for Electric Vehicles (EVs), including predicting charging demand [4]–[6], estimating the battery State of Charge (SOC) and residual capacity [7], [8]. Our study extends the application of deep learning to the instantaneous battery power prediction. While existing studies cover forecasting granularities from minutes to months, we predicted future battery power consumption values for a very short-term horizon (1–3 seconds) using deep-learning models. This proactive prediction can support Battery Management System (BMS) operations, optimize the vehicle battery power supply, and prevent sudden power surge or drop peaks through load management schemes [9].
However, practical battery power prediction faces challenges due to dynamically changing data distributions. Environmental factors (e.g., weather and elevation) and user behavior significantly influence the electrical power demand of EVs [10]. Driver actions, particularly driving style, directly impact the overall electrical power requirements for the propulsion and auxiliary systems. Aggressive acceleration increases battery current demand, while rapid braking reduces regenerative braking energy recovery. Furthermore, electrical suspension system is affected, as aggressive maneuvers require more frequent adjustments, which consume additional energy. In addition, features such as climate control, heated seats, and phone chargers contribute to energy consumption and offer a means of balancing energy demand. Given the significant influence of environmental factors and user behavior on EVs’ electrical power demand, our approach employs deep-learning models capable of adapting to these dynamic conditions. By implementing real-time inference and continuous learning on resource-constrained in-vehicle embedded systems, our method offers enhanced data protection and reduced infrastructure costs compared to cloud-based solutions.
In recent years, there has been a notable increase in research efforts towards continual learning for time-series forecasting models, with existing research predominantly employing replay memory-based techniques to store crucial learned patterns. This enables the models to continuously adapt to recent data without forgetting previously acquired knowledge, thereby minimizing forecasting errors. For instance, FSNet [11] updates itself with new data by augmenting each layer in the model backbone with adapters and memory units. SOLID [12] uses test samples alongside contextually similar training samples to update the model’s prediction layer. Another approach, OneNet [13], employs an ensemble of forecasting networks that adapt by updating both the ensemble weights and the model parameters. However, compared with a single-forecasting model, OneNet’s higher computational demands make it less suitable for edge forecasting systems.
These existing frameworks are not designed for embedded systems and do not consider the resource constraints inherent to these systems. Memory-based techniques, for instance, can lead to a substantial memory footprint when important patterns are stored in memory. Furthermore, for short prediction horizons, real-time model parameter updates on multiple data points (both current and stored) are unviable because of the computational latency observed in resource-constrained devices. Therefore, rather than relying on specialized model architectures for adaptation, this study aims to empower existing model architectures with on-device learning for continuous adaptation to new data. This paper makes the following contributions:
We trained and evaluated state-of-the-art models for battery power prediction with forecasting horizons of one, two, and three seconds.
We demonstrate that a "one model fits all" approach is ineffective when encountering a data distribution different from the training dataset, caused by dynamic driving conditions. To address this, we enabled on-device learning through two strategies:
Online learning: Model processes incoming data streams, adapts to changes in real-time.
Offline learning: Model analyzes historical trips, learns power consumption patterns by iterating over data.
Model inference and training are executed on two resource-constrained edge devices, mimicking the limited computational capabilities of in-vehicle processors.
To the best of our knowledge, this study is the first to enable deep learning-based time-series forecasting models with on-device learning capabilities on resource-constrained edge devices, allowing the models to adapt to changing operating conditions for electric vehicle power predictions. The demonstrated methodology can be seamlessly transferred to other time series forecasting domains as well.
The remainder of this paper is organized as follows. Section 2 discusses the methodology for training state-of-the-art models for battery power prediction and the deployment of inference- and on-device learning-enabled models on resource-constrained hardware. Sections 3 and 4 detail the experimental setup and discuss the results, respectively. Finally, Section 5 presents the conclusions and outlines future work.
We employed the NIXTLA NeuralForecast library [14] for time-series forecasting, leveraging its implementation of various state-of-the-art models. We utilized historical exogenous features and past battery power values for battery power forecasting to generate univariate forecasts. We trained deep learning models to implicitly learn from these multiple input time series and to predict the output power. The models considered included Multi-Layer Perceptron (MLP) based architectures, such as Neural Basis Expansion Analysis with exogenous variables (N-BEATSx) [15], Deep Non-Parametric Time Series forecaster (DeepNPTS) [16], Time-series Dense Encoder (TiDE) [17], and Neural Hierarchical Interpolation for Time Series Forecasting (N-HiTS) [18]. Additionally, we evaluated the 1D convolutional neural network Bidirectional Temporal Convolutional Network (BiTCN) [19], the recurrent neural network-based Temporal Fusion Transformer (TFT)[20], and Kolmogorov–Arnold Networks (KAN)[21]. We trained these models with prediction horizons of 1 , 2 , and 3 s using a direct forecasting strategy , in which the model simultaneously makes all predictions rather than employing a regressive , sequential approach Given the non - trivial nature of multi - time step forecasting , we optimized the hyperparameters using the Ray tuning library [22] with default search spaces for each model and forecasting horizon This approach identified optimally trained models for each forecasting horizon , accounting for variations in architecture , input time steps , learning rate , batch size , and number of layers.
An overview of the edge AI deployment and training for the battery power prediction models can be seen in Fig. 1. The TVM machine learning compiler [23] facilitates the deployment of machine learning models on diverse hardware backends. It optimizes model deployment for target hardware through high-level graph and kernel optimizations. Integrating the compiled model with real-time operating systems, such as Zephyr [24], enables model inference on resource-constrained embedded devices [25]. This approach enables the deployment of trained prediction models, allowing on-device predictions from new data. Beyond inference, we enable on-device learning by statically appending the forward computation graph with a backward pass at compile time. We obtain this training graph from the artifact generation phase of the ONNX Runtime’s on-device training support [26]. This enables backpropagation, where we compute the gradients of the Mean Absolute Error (MAE) loss function with respect to the model parameters for continuous adaptation. The resultant graph can be executed on-device using the same framework as the inference-only model deployment. We extended TVM frontend support for operators specific to loss and gradient calculation to accommodate the new ONNX training graph.
We illustrate our online continuous adaptation strategy for the model updates in Fig. 2. Unlike the initial batch training, this approach continuously updates the model using the latest input data. The model generates a prediction, after prediction horizon passes and the actual value becomes available, we update the MAE. Using this loss, the gradients are calculated, and the model parameters are updated. This methodology ensures that the model performance is always evaluated on data points before they are used for training, effectively preventing data leakage. We employed a lower learning rate for the online strategy. As the model is updated continuously on single data points, this lower learning rate prevents aggressive updates based on outliers or noise, thereby safeguarding the long-term model performance. To update the models online at iteration \(t\), we apply the general update rule based on the stochastic gradient descent: \[\theta_{m, t+1} = \theta_{m, t} - \eta_{\text{online}, m} \cdot \nabla L(f_m(\theta_{m, t}, x_i), y_i) \label{eq:single95point95update}\tag{1}\]
Here, \(f_m\) denotes the output for model \(m\), and \(L(f_m(\theta_{m, t}, x_i), y_i)\) is the loss evaluated on the prediction of model \(m\) for input \(x_i\) against the true label \(y_i\). \(\theta_{m, t+1}\) represents the updated model parameters, obtained using the online learning rate \(\eta_{\text{online}, m}\), and \(\nabla L()\) is the computed gradient of the loss function with respect to the model parameters \(\theta_{m, t}\).
An alternative strategy for on-device learning, similar to initial model training, involves batch gradient descent. This approach utilizes the training graph to iterate through the stored data for multiple epochs, updating the model parameters in batches. However, this method is only feasible in an offline manner because it requires the entire dataset for its multi-epoch and multi-batch training strategy. Here, the update rule based on mini-batch gradient descent can be expressed as: \[\theta_{m, t+1} = \theta_{m, t} - \eta_{\text{offline}, m} \cdot \frac{1}{B_m} \sum_{j=1}^{B_m} \nabla L(f_m(\theta_{m, t}, x_j), y_j) \label{eq:batch95update}\tag{2}\]
For each model \(m\) at training iteration \(t\), a batch of data points of the same size as that used for its training \({B_m}\) is taken, and the mean of gradients over the entire batch is used, along with the offline learning rate \(\eta_{\text{offline}, m}\) to obtain the updated parameters \(\theta_{m, t+1}\).
Dataset: We utilized the Battery and Heating Data in Real Driving Cycles Dataset from the Technical University of Munich, Institute of Automotive Technology [27]. This dataset comprises 72 real driving trips conducted using a BMW i3 (60 Ah) under both summer and winter conditions. Each trip included environmental (e.g., temperature and elevation), vehicular (e.g., speed and throttle), battery-specific (e.g., voltage, current, temperature, and SOC), and heating circuit (e.g., indoor temperature and heating power) data. We derived the instantaneous battery power by multiplying the battery voltage and current signals. The original 100 ms sampling rate was upsampled to 1 s to ensure a minimum 1-second forecasting horizon for time series forecasters and facilitate model deployment on resource-constrained devices where execution time may exceed 100 ms.
For model evaluation, we reserved the randomly choosen trip numbers 32 (summer) and 37 (winter) as unseen data to independently assess seasonal performance. The remaining trips were individually split into 70 % training and 30 % testing sets. We performed a correlation analysis on the training data to identify the most significant input features for forecasting the battery power. This analysis yielded the following features: Battery Current [A], Throttle [%], Motor Torque [Nm], Longitudinal Acceleration [m/s\(^2\)], Battery Voltage [V], Velocity [km/h], Regenerative Braking Signal, Requested Heating Power [W], CAN Heating Power [KW], and last observed Battery Power [W]. These input features were then standardized using the mean and standard deviation of the training dataset.
Edge Devices: We considered two processors with different processing capabilities to represent resource-constrained compute environments in vehicles. The first is a quad-core Arm Cortex-A53 processor operating at 1.2 GHz with 4 GB of RAM, present on the processing system of the AMD Zynq UltraScale+ MPSoC ZCU102 Evaluation Board. The second is a RISC-V based Rocket Processor Core, which we implemented on the programmable logic side of the same FPGA board. This Rocket Core operates at 150 MHz, with 16 KB L1 (Instruction and Data) and 2 MB L2 caches, and 512 MB of external DRAM.
Update Strategies: Initial model training used learning rates ranging from \(2.48 \times 10^{-4}\) to \(9.53 \times 10^{-2}\) and batch sizes 64 to 256. For online continuous model adaptation, we selected a learning rate equal to 0.1 times the training learning rate for each model and prediction horizon. Lower learning rate is a common practice for fine-tuning models with limited data, ensuring conservative updates, and balancing learning from new data points while retaining prior prediction knowledge. This strategy allows for on-the-fly model updates, where performance improves as a trip progresses compared to unadapted models. Alternatively, an offline update strategy is used to adapt the model to recent trip data after trip completion to improve the performance of upcoming trips. This involves iterating through the trip data multiple times and updating the model with the same batch gradient settings (learning rate and batch size) used in the initial training for 100 epochs. In this batch learning setting, the gradients are averaged over the entire batch, preventing overfitting to a single observation, unlike online adaptation. Consequently, the original learning rate is appropriate here, whereas it would lead to suboptimal adaptation and degraded long-term performance in the online case. Offline adaptation is also computationally more intensive than online adaptation because it processes data for multiple epochs, whereas online adaptation processes data only once.
This section presents a comprehensive analysis of our experimental results, focusing on the model performance across various forecasting horizons and selected processors, the impact of data distribution shifts, and the effectiveness of on-device adaptation strategies. Our findings highlight the challenges posed by evolving data environments and demonstrate the benefits of both offline and online model adaptation for mitigating performance degradation.
Fig. 3 illustrates the unnormalized MAE values for the trained models across various forecasting horizons on the test dataset. A clear trend emerges, showing that the error increases with an increasing forecasting horizon, indicating that all models degrade in performance as the forecasting horizon lengthens. The maximum observed error at a 3 s forecasting horizon was approximately 4 KW, which remained below 2.2 % of the total range of battery power values (180 KW). NBEATSx was not included for the 1-second horizon due to its inherent requirement for a longer forecasting horizon to effectively model seasonal and trend components.
Fig. 4 illustrates the data distributions of the training, test, summer (trip 32), and winter (trip 37) datasets. The violin plots depict the data density, along with the min, max, and mean power values for each dataset. A clear shift in data distribution was evident between the individual summer and winter trips compared to the distribution used for model training. This shift also extends to other input features. Such shifts degrade the model performance, as demonstrated in the subsequent Fig. 5. This observation underscores the need for on-device model adaptation to improve performance for specific trips rather than relying on a single model for all scenarios.
Based on preliminary performance, we selected the BiTCN, MLP, TiDE, and DeepNPTS models for on-device adaptation, representing both lower and higher performing forecasters. As detailed in the methodology, we enabled on-device learning for these models and calculated the gradients necessary for parameter updates. For the DeepNPTS model, the batch-normalization layers were frozen during the single-data-point updates to maintain stable normalization, avoiding corruption from noisy, single-sample statistics. We also evaluated the effect of the data distribution shift on the performance of these models. Fig. 5 presents overlapped bar plots that illustrate the MAE of the trained models when evaluated on the test dataset and the unseen summer and winter trips. For all models and forecasting horizons, the observed MAE for the unseen summer and winter trips was considerably higher than that for the test dataset. The increase in error is more pronounced for the summer trips, showing an average increase of approximately 184 %, compared to a 46 % average increase for the winter trips. This behavior can be attributed to the greater extent of the data distribution shift observed in the summer trip power values, as shown in Fig. 4.
| Horizon | Model Characteristics | BiTCN | MLP | TiDE | DeepNPTS |
|---|---|---|---|---|---|
| Rocket Inf. (s) | 0.0063 | 0.0626 | 0.3229 | 0.0024 | |
| Rocket Train. (s) | 0.0321 | 0.3167 | 1.8322 | 0.0111 | |
| ARM Inf. (s) | 0.0003 | 0.0035 | 0.0164 | 0.0001 | |
| ARM Train. (s) | 0.0016 | 0.0121 | 0.0804 | 0.0006 | |
| # Parameters | 4,740 | 558,083 | 2,319,126 | 20,571 | |
| Param Size (MB) | 0.018 | 2.129 | 8.847 | 0.078 | |
| Rocket Inf. (s) | 0.0085 | 0.1204 | 0.0789 | 0.0004 | |
| Rocket Train. (s) | 0.0448 | 0.6264 | 0.3895 | 0.0018 | |
| ARM Inf. (s) | 0.0006 | 0.0068 | 0.0018 | 0.0001 | |
| ARM Train. (s) | 0.0020 | 0.0220 | 0.0079 | 0.0004 | |
| # Parameters | 13,251 | 1,072,642 | 637,784 | 3,532 | |
| Param Size (MB) | 0.050 | 4.092 | 2.433 | 0.013 | |
| Rocket Inf. (s) | 0.0047 | 0.2778 | 0.6772 | 0.0002 | |
| Rocket Train. (s) | 0.0212 | 1.6194 | 4.1255 | 0.0011 | |
| ARM Inf. (s) | 0.0003 | 0.0156 | 0.0392 | 0.0001 | |
| ARM Train. (s) | 0.0012 | 0.0791 | 0.1985 | 0.0004 | |
| # Parameters | 8,962 | 2,131,969 | 5,359,031 | 1,845 | |
| Param Size (MB) | 0.034 | 8.133 | 20.443 | 0.007 |
The computation latencies of these models on the selected processor cores are presented in Table 1. Inference latency represents the time required for a model to execute and make predictions on the input data, whereas training latency includes the additional computation for loss and parameter gradients calculation. The model parameter counts vary with the forecasting horizons owing to the hyperparameter optimization for each horizon. The table also lists the parameter size required to store the model weights and biases; note that training typically requires at least double the memory for gradients. The training execution time is generally 3-6 times longer than the inference time for both processors. This is because gradient calculation during training requires more operations; for instance, a convolution layer requires both transposed convolution and convolution operations to compute gradients with respect to its input and weights. The DeepNPTS model is generally the most lightweight in terms of computational resource demand, whereas the TiDE and MLP models tend to have a higher number of parameters, resulting in higher model execution times. Generally, both model training and inference latencies are below the forecasting horizon, enabling online model updates using the previous predictions and ground truth values. However, for a 1-second forecasting horizon, the TiDE and MLP models exhibit training times of 4.1 s and 1.6 s, respectively, on the Rocket core. These times significantly exceed the 1-second update window due to the limited computing capability of the processor. This can be resolved by utilizing a more powerful processor, such as an ARM processor, to achieve a truly online adaptive prediction system. On the other hand, the offline adaptation strategy introduces additional overhead compared to the online strategy. In our experiments, the training latency of offline adaptation is scaled by a factor of 100 with the number of epochs. Furthermore, offline adaptation requires the entire trip’s data to be stored. Also, the gradients stored can be 64 to 256 times larger, depending on the batch size for the respective model.
| SOTA Model | Summer | Winter | Mean | ||||||||||||||||
| 1s | 2s | 3s | 1s | 2s | 3s | ||||||||||||||
| DeepNPTS | -0.46 | 1.4 | -0.16 | 0.71 | -0.05 | 0.11 | 0.26 | ||||||||||||
| MLP | -0.5 | 2.23 | 0.12 | 1.16 | 0.04 | 0.11 | 0.53 | ||||||||||||
| TiDE | 4.95 | 1.7 | 0.95 | 2.25 | 0.61 | 0.12 | 1.76 | ||||||||||||
| BiTCN | 7.49 | -1.24 | 0.38 | 5.16 | 0.73 | 1.48 | 2.33 | ||||||||||||
| SOTA Model | Summer | Winter | Mean | ||||||||||||||||
| 1s | 2s | 3s | 1s | 2s | 3s | ||||||||||||||
| DeepNPTS | 5.3 | 5.83 | 2.17 | 3.74 | 3.64 | 2.3 | 3.83 | ||||||||||||
| MLP | 8.08 | 10.85 | 2.3 | 9.79 | 7.06 | 2.16 | 6.71 | ||||||||||||
| TiDE | 13.82 | 6.07 | 5.5 | 10.18 | 4.52 | 4.78 | 7.48 | ||||||||||||
| BiTCN | 14.88 | 5.13 | 9.37 | 11.09 | 7.11 | 9.29 | 9.48 | ||||||||||||
Tables 2 and 3 illustrate the relative error reduction achieved through offline and online model adaptations, respectively. As anticipated, the percentage reduction in error is significantly higher for offline adaptation than for online adaptation, primarily because offline adaptation allows for model updates over multiple epochs. However, it is crucial to note that offline adaptation evaluates the model on the same data on which it was trained, whereas online adaptation updates metrics based on predicted values and subsequently received ground truths. This makes online adaptation a more practical evaluation method for real-world deployments. Although a slight performance degradation, as can be seen from the negative values for the percentage error reduction, occurs occasionally with online adaptation, it remains relatively low compared to the observed improvements. This degradation, compared to the baseline unadapted model, can be attributed to the limitations of the stochastic gradient descent used for updating the model parameters, resulting in a local optimum and, therefore, a limited model performance.
As observed from the mean percentage error reduction values across the trips, the most significant model improvement for both adaptation strategies was observed in the TiDE and BiTCN models, which represent the top and bottom performers, respectively, in our initial selection. However, the performance improvement for DeepNPTS is limited because the frozen batch-normalization layers are not updated. Furthermore, for a given trip, the online adaptation performance improved as the forecasting horizon decreased. This is because the model can be updated on more data points when data are processed in a non-overlapping fashion, such as with a 1 s forecasting horizon compared to 3 s. In conclusion, these adaptation strategies enable models to effectively adapt to unseen data and evolving environments, leading to improved performance compared to unadapted models.
We demonstrated that on-device adaptation significantly improves EV battery power prediction model performance in the presence of data distribution shifts. We identified the optimal state-of-the-art time-series forecasting models for horizons (1 , 2 , and 3 s ) and observed significant performance degradation under unseen summer and winter driving conditions To mitigate this , we deployed and evaluated on - device learning using online and offline adaptation strategies for continuous model updates To account for the computational limitations of EVs , this approach was evaluated on resource - constrained Rocket and ARM processors , examining both inference and training performance of the model Our results demonstrate a substantial percentage error reduction of up to 7.49 % in an online adaptation scenario and over 14.88 % with offline adaptation , showcasing the effectiveness of our approach in enhancing prediction accuracy and reliability While this approach reduces MAE , its real - world utility requires integration and thorough evaluation within a complete battery management system Future work should focus on preventing occasional performance degradation in online adaptations and exploring its applicability to adapt to individual driving styles.
This research was funded by the German Federal Ministry of Research, Technology and Space (BMFTR) as part of the project KI4BoardNet under Grant 16ME0778.↩︎