Abstract
Accurate short-term building energy consumption forecasting is crucial for energy-system operational efficiency and demand-side management. Existing deep learning models heavily rely on historical data, making them costly for data-scarce buildings. Furthermore, their cross-building generalization ability is limited, requiring building-specific tuning that hinders large-scale deployment. To address these issues, this study proposes a novel framework based on large language models for short-term building energy consumption forecasting. It adapts large language models through parameter-efficient LoRA fine-tuning and incorporates building domain knowledge by using enhanced feature extraction modules and prompt design. Specifically, a prompt template rich in building physical semantics was designed to leverage the abundant pre-training knowledge of the large language model (LLM). This enables the model to avoid blindly fitting the data, directly aligning with building operating rules, providing a reasonable prediction basis even with limited data, and enhancing cross-building generalization. In addition, a cross-feature attention mechanism is designed to analyze the impact of dynamic meteorological features on energy consumption, thereby improving cross-climate scenario adaptability. Finally, to handle non-typical mutations in actual building operations, depthwise separable convolutional layers decompose residual components to filter out noise while preserving key features of anomalous occupancy patterns, thereby enhancing model robustness. Experiments on five real-world datasets have shown that the proposed framework outperforms state-of-the-art baselines, achieving an average improvement of 6.06% in the MAE and 4.80% in the RMSE. More importantly, it exhibits strong few-shot learning capabilities and extends to zero-shot forecasting. By reducing data dependency and enabling cross-building generalization, the framework developed in this work achieves scalable, low adaptation cost energy consumption forecasting from single buildings to clusters.
1. Introduction
1.1. Background and Motivation
Building energy consumption accounts for a large proportion of global energy consumption. According to the International Energy Agency (IEA), building energy consumption accounts for 30% of total global energy consumption [1]. With the acceleration of urbanization and the progressive implementation of smart building and smart grid technologies, the accurate forecasting of building energy consumption has become a critical factor in promoting energy conservation, enhancing operational efficiency, and optimizing intelligent energy systems [2]. In time series prediction, short-term prediction usually covers a time range from hours to days [3]. Through accurate short-term energy forecasting, the building energy management system can actively optimize the operation of heating, ventilation, and air conditioning (HVAC), reduce the overcooling and overheating caused by building thermal inertia, support power dispatching, and provide early warning of abnormal energy consumption. This reduces inefficient equipment operation and energy waste, thereby reducing overall building energy consumption.
Building energy consumption is affected by the complex nonlinear interaction among meteorological changes, human behavior, and equipment operation. Deep learning methods that rely solely on single-modal time series data find it difficult to capture the underlying physical mechanism, resulting in limited generalization ability under different building scenarios and data-scarce conditions. In addition, these methods usually need to individually tune the hyperparameters for each building, which increases the workload of large-scale deployment in real-world scenarios. Additionally, the frequently experience abrupt load fluctuations during actual building operation further increases the complexity of accurate prediction.
In recent years, pre-trained large language models (LLMs) have achieved success in sequence modeling tasks [4]. Existing research uses its rich pre-training knowledge to apply LLMs to specific sub-domains, showing excellent generalization performance. Therefore, it is still a key research challenge to effectively apply pre-trained LLMs to building energy prediction and develop a unified prediction framework for different building types, which can deal with few-shot or even zero-shot scenarios and is robust to noise in the real world.
1.2. Related Works
With the rapid development of deep learning, building energy consumption forecasting has gradually shifted from traditional model-driven approaches to data-driven approaches. This section reviews and summarizes the related research methods.
1.2.1. Building Energy Consumption Forecasting Based on Model-Driven Approaches
Model-driven forecasting methods rely on predefined physical or statistical assumptions, using the physical properties of buildings and thermodynamic principles to predict energy consumption. For instance, Su et al. [5] used dynamic DeST simulation to quantify the marginal contribution of multiple parameters to building energy consumption for the special climate adaptation needs of substation buildings with large loads in cold regions, and proposed an integrated energy-saving strategy. Villano et al. [6] used a calibrated EnergyPlus model to simulate the space heating demand of a residential building and performed thermal load forecasting. Ozarisoy and Altan [7] developed a dynamic thermal simulation model using IES-VE. Energy calibration processes in the IES software are used to mimic the reference parameters that illustrate the problem, providing reliable quantitative support for developing building energy assessment strategies. Although model-driven methods have good interpretability, they are limited by physical assumptions and have limited flexibility in dealing with complex systems. Therefore, its prediction accuracy is usually lower than that of data-driven methods.
1.2.2. Building Energy Consumption Forecasting Based on Data-Driven Approaches
Data-driven prediction methods model the mapping between input and output by learning the inherent patterns in data, including machine learning and deep learning techniques. Because these methods can directly learn complex patterns from historical data, reduce dependence on artificial physical assumptions, and have high modeling flexibility, they have become the mainstream prediction paradigm. Kawa et al. [8] studied the electricity demand forecasting of heterogeneous commercial buildings by comparing the prediction performance of traditional statistical models and deep learning models. The results show that when the data samples are limited or only contain features of traditional commercial buildings, classical statistical models, such as ARIMA, show significantly higher accuracy in energy consumption modeling than neural network models. Kangalli Uyar et al. [9] used the XGBoost quantile regression algorithm to predict the building energy efficiency ratio and used the SHapley Additive exPlanations (SHAP) method to evaluate the influence of each feature on the energy efficiency ratio, thus improving the interpretability of the model. Dehghan et al. [10] evaluated the performance of six models, including random forest (RF) and linear regression (LR), on five tasks, including predicting building energy consumption and carbon dioxide equivalent emissions. The results show that RF and XGBoost outperform the other algorithms. Hasan et al. [11] combined the random forest model with three different fusion strategies to solve the redundancy and noise problems in multi-modal sensor data processing, and proposed a solution to achieve highly robust short-term energy prediction in resource-constrained scenarios. The solution achieves a balance between computational efficiency and interpretability. Chen et al. [12] proposed the FGF framework to solve the modeling problems in multi-source data processing and few-shot learning in building energy consumption prediction. The framework integrates gated adaptive fusion, explicit physical decomposition, and Bayesian regularization into a unified differential framework, which significantly improves the prediction accuracy under limited-data conditions while maintaining good interpretability. Although machine learning methods perform well on relatively simple tasks, their overall performance is generally inferior to that of deep learning models.
Deep learning models, particularly Transformer-based architectures and Recurrent Neural Network (RNN) variants such as Long Short-Term Memory (LSTM), possess strong feature extraction capabilities and can capture complex nonlinear relationships, thereby improving the accuracy of building energy consumption forecasting. Lian et al. [13] compared five mainstream algorithms and confirmed that integrating real-time occupancy data and meteorological parameters into the LSTM forecasting framework can significantly improve the short-term energy consumption prediction accuracy of office buildings. Somu et al. [14] proposed a building energy consumption prediction model that combines LSTM with an improved sine cosine optimization algorithm. The experiments were performed using data from a university teaching building in India. The results showed that the proposed model outperforms the benchmark models. Jang et al. [15] studied the prediction performance of LSTM models using different types of input data. By combining building environment data, outdoor environment data, and building operation mode data, the model was applied to predict the energy consumption of non-residential buildings. The results showed that the model performs best when additional building operation-related variables are used as input features.
Transformer is a sequence modeling framework based on the attention mechanism and was originally used to solve the sequence-to-sequence problem in natural language processing. It uses the self-attention mechanism to model the dependencies between the entire sequence in parallel and has become an important method for time series forecasting. For instance, Wu et al. [16] proposed a decomposition architecture called Autoformer, which introduces an autocorrelation mechanism to enhance the model’s ability to process complex time series. Zhou et al. [17] proposed Fedformer, which enhances frequency characteristics and captures global dependencies by integrating seasonal trend decomposition. Nie et al. [18] proposed PatchTST, which draws on the patching mechanism of Vision Transformer (ViT) and introduces channel independence, significantly improving forecasting accuracy.
In building energy consumption forecasting, deep learning-based models have also been widely explored. For instance, Romańska et al. [19] addressed the weather-related electricity consumption forecasting problem for non-residential buildings and proposed a generalized neural network. Using diversified historical energy consumption and meteorological data, they verified the feasibility of generalized power consumption prediction for non-residential buildings. Moveh et al. [20] constructed a temporal graph neural network integrated with meteorological parameters, which can effectively capture the complex spatial and temporal dependencies within the building complex. Under the condition of data loss and seasonal fluctuation, this approach significantly improves the short-term energy consumption prediction accuracy and system robustness of multiple buildings. Jiang et al. [21] proposed DeepAutoformer, an Autoformer-based framework to address extreme fluctuations and irregular data patterns in very short-term residential load data. It achieves more efficient feature extraction by integrating additional multi-layer perceptron layers. In response to the problem of data scarcity in new buildings, Spencer et al. [22] explored six data-centric transfer learning strategies on three Transformer architectures and found that combining multiple source datasets can significantly improve zero-shot forecasting performance, while fine-tuning the target domain data further improves performance. Although deep learning methods achieve strong predictive performance, in practical applications, they usually require a large amount of historical data for training [23], and hyperparameters need to be tuned separately for different buildings, which increases the workload in real deployment.
1.2.3. Time Series Forecasting with LLMs
LLMs have acquired extensive knowledge through pre-training on massive text datasets, so that they can effectively learn the potential features in time series. Therefore, an increasing number of studies have begun to explore their potential for time series forecasting. For example, Zhou et al. [24] proposed GPT4TS, which systematically introduced pre-trained LLMs into time series forecasting for the first time. The model converts time series segments into tokens and uses a pre-trained GPT-2 model. In this architecture, the self-attention and feedforward network layers are frozen, and only the input layer and the output layer are fine-tuned to achieve state-of-the-art (SOTA) performance. Xue et al. [25] proposed a prompt-based time series forecasting framework, PromptCast, which converts numerical input and output into prompts. This framework remodels the prediction problem into a sequence-to-sequence task, so that the language model can be directly applied to the prediction task. Jin et al. [26] subsequently proposed Time-LLM, which keeps all LLM parameters frozen. By introducing a reprogramming layer, Time-LLM transforms time series data into a text prototype representation suitable for LLMs’ understanding. It also uses a Prompt-as-Prefix method to enrich the input context, thereby improving the reasoning ability of the model. Time-LLM achieves the best performance in multiple benchmarks and performs well in few-shot and zero-shot learning scenarios. Cao et al. [27] proposed TEMPO, a forecasting framework based on soft prompts. This study combines prompts with sequence decomposition to guide LLMs to use different semantic knowledge, thereby achieving the best performance in zero-shot experiments.
The existing research has successfully applied the LLM-based time series forecasting frameworks to multiple sub-fields. For instance, Wu et al. [28] proposed a method called STELLM. This method uses decomposition techniques to parse complex time series into more structured patterns, and then integrates spatial dependencies among wind turbines through a spatio-temporal prompt to achieve accurate wind speed prediction. Gao et al. [29] proposed MMGPT4LF for load forecasting, which uses the multi-modal cross-attention mechanism to fuse time series and text information, thereby significantly improving the generalization ability. Li et al. [30] proposed AirGPT, which integrates time, meteorological, and geographic data into a large language model through deep spatio-temporal encoders. The framework uses Chain-of-Thought technology to improve interpretability and can still provide accurate air quality forecasting in data-scarce and zero-shot scenarios. Fan et al. [31] proposed M2WLLM, which improves the performance of ultra-short-term wind power forecasting by combining multi-modal input of text and numerical data. This method also shows excellent performance in few-shot scenarios.
In the field of building energy consumption prediction, some studies have explored the integration of LLMs and simulation software. Jiang et al. [32] used a fine-tuned LLM to convert the natural language description of user requirements into an EnergyPlus modeling file, and proposed EPlus-LLM, an automated building modeling platform that can significantly reduce the workload. Zhang et al. [33] studied the synergistic effect between LLMs and energy modeling software by using ChatGPT-4 to optimize EnergyPlus simulation. Although recent studies have demonstrated the potential of LLMs in general time-series forecasting, existing methods usually do not explicitly model the potential relationship between variables affecting building energy consumption, and do not support cross-building generalization under limited historical observations. To address these limitations, this study proposes a building-oriented forecasting framework that incorporates several methodological enhancements to adapt pre-trained LLMs to building energy forecasting. A summary of LLM-based time-series forecasting methods and their applications in various sub-domains is presented in Table 1.
Table 1.
Recent LLM-based forecasting methods and their sub-domain applications.
1.3. Contributions
To address challenges such as data scarcity in building energy forecasting while reducing the cost and workload of practical deployment, this study proposes BEFLLM (Building Energy Forecasting Large Language Model), a short-term forecasting framework for building-cluster energy consumption management. It has strong adaptability to new buildings and is robust to noise in the real world. The main contributions are as follows.
- Application contribution. In order to solve the problem that the deep learning model adjusts the hyperparameters of each building separately, which hinders scalable deployment in multiple building clusters, the proposed framework in this study, BEFLLM, adopts LoRA fine-tuning technology to quickly adapt LLMs for energy consumption forecasting. By making full use of the extensive pre-training knowledge of LLMs, the framework performs better than traditional data-driven models in cross-building generalization ability without the need for individual model retraining.
- Methodological contribution. In order to solve the problem of data scarcity in new buildings and the limitation of traditional models relying on a large amount of historical data for training, a prompt template rich in architectural physical semantics is designed, aiming to inject prior knowledge in the building field into LLMs. This method enables the model to capture energy consumption patterns based on building operation principles, rather than relying solely on data-driven pattern matching. By establishing an internal alignment relationship between the prediction process and the physical characteristics of building operation, the proposed framework effectively reduces the dependence on massive historical data, thereby improving the generalization ability of buildings in data-scarce scenarios.
- Methodological contribution. In order to solve the complex interaction of meteorological factors on building energy consumption, a cross-feature attention mechanism is introduced. Unlike simple feature splicing or linear fusion, this mechanism can capture the dependencies between meteorological variables and their specific impact on building energy consumption. This targeted integration enhances the adaptability and scene generalization ability of the model under different climatic conditions.
- Methodological contribution. In order to solve the problem that abrupt fluctuations are often mistaken for noise in actual building operation, a residual pattern mining module is proposed. The module uses stacked depthwise separable convolutions with different dilation rates to model the decomposed residual components. By adopting learnable filter-strength parameters, the signal contribution is adaptively adjusted to effectively suppress irrelevant noise while retaining key operational fluctuations, thereby improving the prediction robustness in complex and disturbed building environments.
- Application contribution. Extensive experiments are conducted on five real-world datasets representing different building types and time zones to evaluate the forecasting performance of the BEFLLM framework at the building cluster level against eight SOTA baseline models. The results show that there has been a continuous improvement across all prediction time steps, exhibiting strong generalization capabilities across diverse building types and data-scarce scenarios.
2. Framework Architecture and Related Techniques
This section first defines the building energy consumption forecasting problem addressed in this study and presents the overall technical roadmap of the BEFLLM framework, then analyzes the forecasting mechanism of LLMs and related techniques used in the framework.
2.1. Problem Definition for Building Energy Consumption Forecasting
The task of building energy consumption forecasting is to predict the energy consumption for the subsequent H time steps, based on the K preceding historical observations X starting from time step t. Since fluctuations in building energy consumption are often influenced by the combined effects of operational patterns and external environmental perturbations, this study focuses on a multivariate-input, univariate-output time-series forecasting task. In addition to historical observations, relevant variables that may indirectly trigger dynamic load shifts must be incorporated. Specifically, external meteorological features Z (e.g., temperature, dew point, etc.), which heavily influence HVAC operations and overall building loads, are introduced to perform multivariate-to-univariate forecasting. The number of external meteorological variables is denoted by D. Accordingly, the multivariate-to-univariate building energy consumption forecasting problem can be formulated as follows:
where denotes the historical building energy consumption series, denotes the external meteorological features series, and the forecasting series can be derived from a model f with parameters . The model is trained to minimize the mean squared error between the predicted values and the ground truth, and the loss function is defined as in Equation (2):
where, is the norm, N denotes the number of training samples, denotes the starting forecasting time step of the i-th sample. is the index of time offset, representing the k-th step from the starting time step. Y denotes the ground-truth building energy consumption value. Specifically, LLMs inherently possess the capability to process textual sequences. To bridge the gap between pure numerical time series and the LLM’s semantic space, the prompts are designed to guide the model in performing the forecasting task more effectively. Accordingly, the input to the large language model is given by Equation (3):
where F is a pre-trained large language model with parameters . is a structured input vector representing numerical data. denotes a structured prompt input vector enriched with building physical semantics. It guides the large language model to perform the forecasting task by translating building operational rules into textual priors, enabling alignment with physical building patterns. P1–P5 represent the respective components of the prompt template. The design of the prompt template is detailed in Section 2.2.3.
2.2. BEFLLM Framework Architecture
Figure 1 shows the overall technical roadmap of BEFLLM.
Figure 1.
The technical roadmap of the BEFLLM framework.
First, the preprocessed data is enhanced through a cross-feature attention mechanism. Then, the enhanced data is transformed into three independent structured components consisting of trend, seasonality, and residual via STL decomposition, which reduces the learning difficulty of the model. For the residual component, a residual mining module is employed to extract complex patterns, such as abrupt noise or perturbations, generating optimized residual features. These optimized residual features, along with the other two components, serve as the data stream. Concurrently, building prior knowledge embedded via prompt templates serves as the text stream. The data stream and the text stream are fed in parallel into the large language model. The pre-trained LLM, which has been effectively transferred to the building energy forecasting task via LoRA fine-tuning, outputs the final prediction results. The key techniques and their mechanisms are detailed below.
2.2.1. Forecasting Mechanism of LLMs
Traditional deep learning models typically model numerical sequences directly, whereas LLMs capture long-term dependencies through token-based sequence modeling. Therefore, continuous time series must be tokenized so that the language model architecture can transfer its capability in processing textual tasks to a new sequential modality. In this study, the continuous time series is divided into fixed-length patches using a patch tokenization approach, where each patch is treated as a token representing a local energy consumption pattern. Let C represent the number of input features and represent the patch length. The historical sequence can be divided into patches, , where represents the i-th time series segment. To adapt to the Transformer architecture, each patch is mapped to a higher-dimensional token vector via linear projection, as follows:
where denotes the token embedding. and are the weight matrix and bias term, respectively. denotes the vectorization operation. Finally, a token sequence is obtained as .
Since the Transformer architecture does not inherently encode the sequential order, positional encoding is introduced to represent temporal information in the time series. The time-series tokens with embedded positional encoding are then fed into the input layer. LLMs are typically based on the Transformer architecture and capture complex dependencies in time series through multiple layers of self-attention mechanisms. Specifically, the input features are mapped to Query (Q), Key (K), and Value (V) vectors via linear projection, which are mapped into corresponding vector spaces for attention computation. Self-attention computation is given by Equation (5):
Finally, the hidden states produced by the large language model are projected back to the numerical space through a linear mapping layer to obtain the predicted future time series.
2.2.2. Low-Rank Adaptation Fine-Tuning for LLMs
Natural language contains highly complex semantics, including syntax, logical structure, and emotional expression, which require deep neural networks to capture and represent effectively. In contrast, time series data are primarily characterized by trends, seasonality, and stochastic fluctuations, resulting in a much lower information density than natural language. To mitigate overfitting, the model is first truncated to reduce its depth. Next, the majority of the large language model’s core weights are frozen to preserve its pre-trained feature extraction capability while reducing computational cost. Finally, a parameter-efficient fine-tuning strategy is employed to further minimize the number of trainable parameters.
This study employs Low-Rank Adaptation (LoRA) [34] as the fine-tuning strategy. Rather than updating all model parameters, LoRA decomposes weight updates into two low-rank matrices, significantly reducing the number of trainable parameters while preserving the pre-trained semantic priors that are crucial for data-scarce new buildings. Assume that the weight matrix of the attention layer is , where d and j represent the input dimension and output dimension, respectively. LoRA introduces a low-rank update to the frozen original weights, which can be formulated as in Equation (6):
where and are low-rank matrices, r represents the rank dimension, and . The attention layer determines the distribution of attention weights across different time steps. In time-series forecasting tasks, the forecasting performance of a model is highly dependent on temporal information within the historical sequence. Therefore, applying LoRA fine-tuning to the attention projection matrices can effectively enhance the ability of the model to represent and model temporal dependencies.
2.2.3. Prompt Engineering of LLMs
Building energy consumption can be viewed as the combination of two components: a baseline load, which is largely determined by intrinsic building characteristics and operational patterns, and a dynamic load, which is influenced by external factors, such as weather conditions and occupant activities. Based on this understanding, this study adopts a multi-modal input paradigm that integrates textual prompts with numerical data. The textual prompts inject building-domain prior knowledge, enabling the model to capture the relatively stable baseline energy patterns of a building, while the historical numerical time series reflects dynamic fluctuations. Through this design, the proposed framework better aligns with the underlying mechanism of building energy consumption generation.
For the textual information, this study designs a prompt template that incorporates building physical knowledge. A full example of the textual prompt is presented in Figure 2.
Figure 2.
An example of the textual prompts for building energy consumption forecasting.
Specifically, the description of the prediction task (DPT) is defined to provide the large language model with a macroscopic definition of the task. Then, the temporal description (TD) is constructed at the sample level, where specific timestamps are incorporated into the prompt. To account for the impact of human activities on building energy consumption, holiday and weekend information is also included in the prompt.
Next, the characteristics of electricity consumption in buildings (CECB) are introduced. Taking data from an office building as an example, Figure 3 presents the visualization of building energy consumption over daily, weekly, and monthly cycles. The analysis reveals the following prominent characteristics of office building energy consumption: (1) It is driven by working schedules. (2) The intraday peak occurs in the morning, and energy consumption remains relatively stable during working hours, while showing a clear gap compared with non-working periods. (3) Energy consumption significantly decreases during weekends, approaching the baseline level observed at night.
Figure 3.
Visualization of building energy consumption over daily, weekly, and monthly periods, using an office building as a case study.
To avoid excessive token consumption in textual prompts and to enhance the model’s adaptability to different data distributions, this study employs statistical indicators to quantify the stability of building energy consumption and meteorological characteristics (MC). These statistical indicators are further discretized into semantic categories using 20–80% percentile thresholds. Taking the air temperature as an example, the mean temperature of each sample sequence is first computed, followed by the calculation of percentile-based thresholds, which can be expressed by Equation (7):
Here, denotes the temperature value below which 20% of the samples fall. denotes the temperature value below which 80% of the samples fall. Finally, the temperature of a given sample is categorized into semantic classes, which can be expressed as follows:
where denotes the semantic category of the temperature for the i-th sample. For the remaining fields that require dynamic filling in the prompt template, the Load Trend is determined by calculating the standard deviation of the input energy consumption sequence. The lowest 20% of the samples are labeled as “stable”, the highest 20% as “highly fluctuating”, and the remaining samples as “moderate”. The Atmospheric State is determined according to the standard deviation of wind speed by comparing it with the median value and is classified as either “relatively stable” or “variable”. The Holiday Status is obtained using the Python (version 3.10.18) holidays. US library, which identifies weekends and public holidays based on the corresponding calendar date. The percentile thresholds used for dynamically generating prompt descriptions were determined based on the training samples only. Specifically, global thresholds were calculated from the training data distribution during the training stage and were kept unchanged during the validation and testing stages. These fixed thresholds were then used to generate prompt descriptions for subsequent input samples, ensuring that no information from validation or test data was involved in prompt construction.
Component prompts (CPs) are used to guide the large language model to focus on different components obtained from time series decomposition. In summary, the overall structure of the textual prompts designed for the building energy consumption forecasting task in this study can be formulated as Equation (9). The ablation experiments for each part of the prompt template are presented in Section 4.5.
2.2.4. Cross-Feature Attention Mechanism
Meteorological features significantly influence variations in building energy consumption by altering heating and cooling loads. For example, temperature determines the indoor–outdoor heat transfer temperature difference, while cloud cover affects the solar radiation reaching the building surface. Consequently, meteorological features are typically essential inputs for building energy forecasting. Traditional models usually assume that individual features are relatively independent or only implicitly coupled through network parameters, which makes it difficult to fully capture complex interaction relationships among features.
To enhance the model’s information fusion capability, this study proposes a Cross-Feature Attention (CFA) mechanism, which enables more effective feature integration and improves generalization ability under different scenarios. This mechanism adaptively integrates information from various features through weighted aggregation, allowing the model to dynamically select more significant features based on the current forecasting task. Specifically, for the original sequence x, the temporal representation of each feature is first projected into the Query, Key, and Value spaces through linear transformations, which can be expressed as in Equation (10):
Then, the multi-head attention mechanism is applied along the feature dimension, as shown in Equation (5). Finally, residual connections and a feed-forward network are employed to refine the attention features, yielding enhanced representations.
2.2.5. Residual Pattern Mining Module
Compared with directly feeding complex raw time-series data into the model, decomposing it into components with different meanings can help the model extract useful information more effectively [27,28]. STL decomposition [35] is currently one of the most widely used decomposition methods. It smooths time-series data through a series of simple locally weighted regression operations, which can be expressed by Equation (11):
where denotes the trend component, reflecting the long-term variation in the time series. denotes the seasonal component, representing periodic fluctuations. denotes the residual component, capturing short-term dynamic patterns or high-frequency variations that are not modeled by the trend and seasonal components. STL decomposition is performed independently within each input window using only the available historical observations and does not involve information from the validation or test periods.
Although STL decomposition can decompose the original sequence into trend, seasonal, and residual components, the residual component in real-world building energy consumption data does not represent pure noise [36]. Instead, it often contains useful temporal patterns that cannot be captured by the trend or seasonal components. Therefore, instead of directly discarding the residual component, deep mining of it helps capture informative high-frequency temporal dynamics and improves prediction robustness under noisy conditions.
Inspired by the approach in [37], this study designs a Residual Pattern Mining (RPM) module based on depthwise separable convolution. The module progressively enlarges the receptive field through multiple layers of dilated convolution, thereby enhancing feature extraction capability to capture short-term fluctuation patterns in the residual component. Specifically, the module outputs an enhanced residual representation that preserves the original residual signal while incorporating informative temporal dynamics extracted by the residual filtering layers. Figure 4 provides an intuitive illustration of the internal implementation of this module. Let R denote the input residual representation, and the module can be formulated by Equation (12):
where denotes 1D depthwise convolution, denotes 1 × 1 pointwise convolution, denotes a learnable filter strength parameter, and denotes a nonlinear activation function.
Figure 4.
The implementation principle of the RPM module.
3. The Experimental Setup for the Forecasting Framework
3.1. Cross-Building-Type and Time-Zone Datasets
3.1.1. Dataset Introduction
The Building Data Genome Project 2 (BDG2) [38] is a publicly available building energy consumption dataset. It collects building energy data and related external weather information, such as air temperature and wind speed, from 19 locations across North America and Europe, and assigns each building a specific nickname. The dataset spans two years, from 1 January 2016 to 31 December 2017, with hourly sampling of time-series data, resulting in 17,544 records per building. In this study, 10 buildings are selected from BDG2, with 5 representative buildings distributed across different time zones serving as the primary datasets. The remaining five buildings are reserved for evaluating generalization ability to unseen buildings of the same type in Section 4.3. The detailed information of the primary datasets is shown in Table 2.
Table 2.
The datasets used in this study from BDG2.
The nicknames of the remaining five buildings are as follows: Fox_food_Scott, Rat_office_Adele, Eagle_lodging_Stephanie, Bear_education_Yvette, and Hog_health_Hisako. In the following text, these buildings are denoted as Restaurant_2, Office_2, Housing_2, Education_2, and Hospital_2, respectively, and are used as the source buildings in the zero-shot experiments in Section 4.3.
3.1.2. Dataset Analysis
The five primary datasets selected in this study encompass diverse building types and are widely distributed across four different time zones. This selection aims to establish a comprehensive benchmark for evaluating model generalization ability by incorporating diversity in both building functions and climatic environments.
Figure 5 shows the total energy consumption and temperature change curves of each dataset. It can be seen that different types of buildings show different energy consumption patterns. The average power consumption of office buildings is 33.26 kWh (range: 20–70 kWh), which has obvious seasonal periodicity. The average power consumption of the restaurant is 60.71 kWh (range: 10–130 kWh). Due to highly random factors, such as personnel access and business activities, this fluctuation is the largest. The average power consumption of the teaching building is 69.01 kWh (range: 40–110 kWh), and the high-frequency repetition mode reflects the daily teaching arrangement. The average power consumption of residential buildings is 79.27 kWh (range: 40–140 kWh), and there are significant seasonal fluctuations, which are closely related to weather changes and daytime peaks. At the same time, due to the influence of human behavior, its energy consumption also shows stronger randomness. Finally, the average power consumption of the hospital is 181.66 kWh (range: 150–260 kWh), and the fluctuation is relatively stable, with occasional peak consumption.
Figure 5.
The energy consumption and air temperature profiles of the five primary building datasets.
The large span of the time zone leads to significant changes in the climate, which makes the meteorological characteristics of each dataset very different. For example, for the key indicator of temperature, the average temperatures of the office and residential sampling points are 15.66 °C and 13.16 °C (range: −10 to 35 °C), respectively. The restaurant sites averaged 25.08 °C (range: 0 to 45 °C); the average temperature of the teaching building was 15.10 °C (range: 0 to 30 °C). The average temperature of the hospital site was 9.56 °C, ranging from −25 °C to 35 °C.
3.1.3. Data Preprocessing
To ensure data integrity, the datasets used in this study have a missing value ratio of less than 1% for energy consumption data. Missing values are processed before dataset splitting using a predefined imputation strategy. For continuous variables, such as energy consumption and air temperature, missing values are imputed using linear interpolation. For discrete variables, such as cloud cover and wind direction, nearest-neighbor imputation is applied. The same imputation strategy is used across all datasets to ensure that model performance is not affected by differences in data preprocessing methods. The datasets are divided chronologically into training, validation, and test sets in a ratio of 7:1:2. Taking the Office_1 dataset as an example, the data splitting strategy is illustrated in Figure 6. The training set covers the period from 1 January 2016 to 26 May 2017, the validation set covers the period from 26 May 2017 to 7 August 2017, and the test set covers the period from 7 August 2017 to 31 December 2017.
Figure 6.
A visual overview of the Office_1 dataset.
To eliminate the scale differences among features and accelerate model convergence, all input features are normalized during the data preprocessing stage. Specifically, Z-score normalization is applied to transform the data into a distribution with a mean of zero and a variance of one, as expressed in Equation (13):
where denotes the original value of a given feature, denotes the normalized value, denotes the mean of the feature, and denotes the standard deviation of the feature. The normalization statistics are calculated exclusively from the training set and then applied to the validation and test sets.
In order to reduce the scale difference and distribution change between buildings, Reversible Instance Normalization (RevIN) is introduced into the BEFLLM. After the historical data are preprocessed and fed into the model, each input sample is further normalized using its own sample mean and standard deviation. When the model generates the predicted results, the same statistics are used for denormalization, restoring the outputs to the original scale of the target building. This reversible normalization allows the model to focus on learning temporal patterns rather than absolute magnitudes, thereby improving its robustness to cross-building distribution shifts.
The input and output features selected in this study are listed in Table 3. A detailed discussion of the feature selection process is provided in Section 5.1.
Table 3.
Input and output features.
3.2. Comparison with Advanced Baselines
In this study, BEFLLM is compared with the following representative baseline models, including deep learning models and large language model-based frameworks.
- TCN [39]: The temporal convolutional network is a convolution-based sequence modeling architecture that leverages 1D causal convolution and dilated convolution to capture long-term temporal dependencies.
- LSTM [40]: Long short-term memory is a Recurrent Neural Network variant that alleviates the vanishing gradient problem by introducing forget, input, and output gates.
- Dlinear [41]: DLinear models time series by separately modeling trend and seasonal components and then summing them for final prediction. It is a lightweight linear forecasting model that performs well on data with strong periodic patterns.
- Autoformer [16]: Autoformer is a decomposition-based Transformer architecture, which integrates progressive sequence decomposition at each layer and replaces the self-attention mechanism with an automatic correlation mechanism to better capture periodic dependencies.
- FEDformer [17]: FEDformer is a frequency-enhanced Transformer architecture that incorporates series decomposition and performs attention operations in the frequency domain via Fourier transform.
- PatchTST [18]: PatchTST is a patch-based Transformer that segments the input sequence into equal-length patches. It also introduces a channel-independent design to reduce computational complexity and improve forecasting accuracy.
- GPT4TS [24]: GPT4TS applies LLMs to time series forecasting tasks. It freezes the self-attention and feed-forward network layers, and only fine-tunes positional embeddings and layer normalization layers, thereby reducing the number of trainable parameters.
- Time-LLM [26]: Time-LLM reformulates time series forecasting as a language modeling task through a reprogramming mechanism and prompt engineering. The pre-trained LLM is frozen, and only task-specific reprogramming layers and output layers are trained.
All large language model-based forecasting frameworks use Qwen3-0.6B-Base as the backbone model.
3.3. Evaluation Metrics and Experiment Settings
The forecasting performance of all baseline models and the proposed model is assessed using two widely used metrics, namely, the mean absolute error (MAE) and the root mean square error (RMSE), which are respectively defined in Equations (14) and (15):
where denotes the actual value of the i-th sample, denotes the predicted value, and N denotes the total number of samples.
All experiments in this study are performed on a single NVIDIA 5090-32G GPU and implemented in PyTorch 2.8.0. Qwen3-0.6B-Base is an open-source large language model available on a public platform. The BEFLLM framework utilizes consistent hyperparameters across various buildings and scenarios, whereas all other models were individually tuned for each building. Hyperparameter settings for all models are listed in Appendix A.
4. Application in the Building Sector
4.1. Cross-Building Generalization Ability Study
To evaluate the forecasting performance of the proposed model across building clusters, it is compared with several baseline models. The results are reported in Table 4. It can be observed that BEFLLM consistently achieves the best performance across all building types and forecasting horizons, demonstrating its strong adaptability for building-cluster energy consumption forecasting. Specifically, the proposed method achieves an average reduction of 6.06% in the MAE and 4.80% in the RMSE.
Table 4.
Results of comparative experiments on different building types.
The relatively inferior performance of TCN and LSTM can be attributed to their limited ability to model complex multivariate interactions and long-range nonlinear dependencies in building energy consumption data. Autoformer and FEDformer are Transformer-based models that leverage attention mechanisms to capture complex nonlinear dependencies. Nevertheless, their performance is generally inferior to the simple linear model DLinear in most cases. This is because building energy consumption data inherently exhibit highly stable periodic patterns, and the dataset used in this study contains a limited amount of data, which also allows linear models to achieve good performance. Benefiting from patch-based modeling and channel-independent design, PatchTST can effectively extract local patterns while mitigating interference caused by inter-variable mixing. Building energy consumption data reflect continuous physical processes influenced by human activities. Although Time-LLM innovatively transforms time series into tokens, it may partially disrupt the inherent structural continuity of building energy consumption data. GPT4TS fine-tunes LLMs and directly models real-valued sequences in the embedding space, thereby preserving data continuity and achieving the second-best performance in most cases. However, GPT4TS mainly exploits the feature extraction capability of LLMs without fully leveraging multi-modal inputs to activate the extensive knowledge acquired during pre-training, which may limit its performance in specific domains.
Based on this observation, BEFLLM preserves the continuity of the original time series and uses prompts with building physical semantic to guide the large language model in capturing temporal variation patterns of building energy consumption. Compared with methods that directly model time series data, BEFLLM achieves superior forecasting performance across different building types, demonstrating its strong generalization ability for building-cluster energy consumption forecasting.
To further study the robustness of different models to random initialization, we use three independent random seeds to conduct additional experiments on four representative models. In this analysis, three representative building types are selected. The average values of the MAE and RMSE for the three times are shown in Figure 7, where the error bars represent the corresponding standard deviations.
Figure 7.
Performance stability analysis under different random seeds.
All models show relatively small changes between the different random seeds, which proves the stability of the experimental results. BEFLLM always achieves lower MAE and RMSE values in different building types and forecasting horizons, while maintaining a standard deviation comparable to or smaller than the baseline model. This shows that the performance improvement of BEFLLM is not caused by specific random initialization.
Figure 8 shows the actual and predicted values of different models on a one-week segment of the Office_1 test set, providing a more intuitive demonstration of the performance of BEFLLM. As shown in the figure, BEFLLM is more responsive to fluctuations in building energy consumption compared with other baseline models. In particular, during the early stage of prediction, BEFLLM can converge more quickly to the true energy consumption level, producing more stable and reliable forecasts, whereas other models often exhibit significant fluctuations or deviations and fail to accurately capture the initial dynamic changes.
Figure 8.
The actual and predicted curves on the Office_1 test set.
To clarify the practical significance of the forecasting results, the normalized predictions were converted back to the original energy scale (kWh) through an inverse normalization process. Specifically, the samplewise mean and standard deviation calculated from each individual input instance during the normalization stage were reused for denormalization.
Taking Office_1 as an example, Table 5 presents the average forecasting errors, peak-hour forecasting errors (9:00–17:00), and the corresponding implications for demand-side management (DSM) across the four forecasting horizons. It should be noted that the reduction in forecasting error reflects the improvement of prediction accuracy, rather than direct energy saving. The actual operational energy saving depends on the adopted building control strategies and the application of the forecasting results in the practical building energy management.
Table 5.
The practical significance analysis of the forecasting results for Office_1.
4.2. Few-Shot Generalization Ability for Buildings with Limited Historical Data
In this section, 5% (37 days) and 10% (75 days) of the original dataset are used for training and testing to simulate data scarcity in new buildings. The results are shown in Figure 9 and Figure 10. It can be seen that BEFLLM continues to outperform the baseline model under different data scales. This shows that the proposed framework can effectively utilize the physical semantics of prompt injection and is consistent with the building operation rules, even in the case of a serious shortage of numerical data.
Figure 9.
Comparison of prediction error under 5% few-shot settings.
Figure 10.
Comparison of prediction error under 10% few-shot settings.
Specifically, under the 5% few-shot setting, the proposed method achieved an average reduction of 5.13% in the MAE and 4.47% in the RMSE. Under the 10% few-shot setting, the average reductions in the MAE and RMSE reached 6.64% and 5.12%, respectively. The specific results are reported in Appendix B.1.
4.3. The Zero-Shot Generalization Ability for Buildings of the Same Type
As shown in Figure 11, even buildings of the same type exhibit slight variations in energy consumption due to stochastic factors, such as occupant behavior and occupancy density. In this section, five additional datasets (Office_2, Restaurant_2, Housing_2, Education_2, and Hospital_2) with the same time zones and building usage types as the original datasets are used as source buildings for model training, representing existing buildings with available historical data. The trained model is then directly applied to the original datasets, which are treated as unseen buildings (target buildings), to evaluate its transfer generalization ability to buildings of the same type. To ensure a strict zero-shot protocol, no target building data is used for model training, normalization statistic calculation, prompt threshold calculation, or model selection.
Figure 11.
Comparison of January energy consumption variations between Housing_1 and Housing_2.
The results are shown in Figure 12. It can be observed that BEFLLM achieves lower errors than all baseline models across all forecasting horizons. This indicates that the proposed framework enables the model to learn shared energy consumption patterns across buildings of the same type from the training data and effectively transfer the learned patterns to the target buildings via cross-feature attention and semantic alignment.
Figure 12.
Comparison of prediction error under zero-shot setting.
Specifically, under the zero-shot setting, the proposed method achieved an average decrease of 7.40% in the MAE and 5.90% in the RMSE. As prediction errors decrease, uncertainty in demand-side response bidding for newly constructed buildings is also reduced. The specific results are reported in Appendix B.2.
4.4. Robust Prediction Under Real-World Building Operational Fluctuations
Gaussian noise is injected into the dataset to simulate a complex measurement environment. Although there are already natural fluctuations in the real data, the added noise is used to mask the underlying pattern to create a more challenging test scenario. By comparing the results of the original data (w/o noise) with the results of the disturbed data (w/ noise), the ability of the residual module to distinguish the key operating mode from the background noise is evaluated, and its robustness to interference is verified.
Figure 13 shows the waveforms of the Office_1 dataset at different Gaussian noise levels. It can be seen that when the noise level is 0.01, it almost overlaps with the original sequence. When the noise level is 0.1, the waveform is obviously distorted. The noise level of 0.05 can properly simulate the real small fluctuations without destroying the original waveform structure. Therefore, a Gaussian noise level of 0.05 is adopted.
Figure 13.
Energy consumption sequence under different noise levels in Office_1.
Figure 14 compares the prediction performance of BEFLLM before and after adding the noise. The blue bar graph represents the prediction error when there is no noise, and the red bar graph corresponds to the prediction error after adding noise. The results show that despite the additional uncertainty introduced by the noise, BEFLLM still maintains strong robustness, and its prediction error is only slightly changed compared with the noise-free case; in some cases, there is even a performance improvement. These findings show that the proposed framework can effectively resist noise disturbances and maintain reliable prediction accuracy, so it is very suitable for practical building energy management systems.
Figure 14.
Comparison of BEFLLM’s prediction errors before and after noise injection.
Specifically, following noise injection, the MAE and RMSE increased by an average of 5.37% and 2.98%, respectively.
4.5. Ablation Study
4.5.1. Analysis of the Contributions of the Key Components in BEFLLM
In the following, an ablation study is conducted on each component of BEFLLM to verify its effectiveness. Three ablation experiments are conducted as follows.
w/o CFA mechanism: The text prompts and the three decomposed components of the time series are directly input into the large language model for final prediction.
w/o RPM module: The residual component is directly input into the large language model for prediction.
w/o textual prompt: To evaluate the role of textual information in building energy consumption forecasting, the designed textual prompts are replaced with blank text, and only numerical data are used as input for prediction.
As observed in Table 6, each component of BEFLLM contributes to the final forecasting performance. When the CFA mechanism is removed, the prediction performance degrades significantly, indicating the importance of explicitly modeling dependencies among all variables. After removing the RPM module, the performance also decreases, suggesting that the residual component after decomposition still contains useful temporal information, which can be effectively captured through deep mining of the residual. Replacing textual prompts with blank text also leads to performance degradation, indicating that incorporating additional textual information enables the better utilization of the pre-trained knowledge of LLMs and facilitates learning the variation patterns in the energy consumption data.
Table 6.
Ablation study results.
In addition, to further verify the effectiveness of the textual prompts, an ablation study is conducted on their structure. The experiment is performed on the Housing_1 dataset with a forecasting horizon of 24 steps. Specifically, different combinations of textual prompts are constructed, and the results are reported in Table 7. The results show the performance of each component in the designed textual prompts. Notably, the model without any textual prompts outperforms all configurations except the one using the complete prompt, indicating that improper prompt design may hinder the large language model from correctly learning temporal variation patterns specific to the task, thereby degrading forecasting performance.
Table 7.
Ablation study of textual prompt structure.
4.5.2. Analysis of the Contributions of the Pre-Trained LLM
Although BEFLLM uses a pre-trained LLM as the backbone, its specific contribution is still unclear. In order to better understand whether the performance improvement comes from pre-trained knowledge, the Transformer architecture, or the parameter adaptation strategy, we conducted a series of ablation experiments.
Specifically, three variants are introduced for comparison: (1) A randomly initialized Qwen3 architecture with the same model structure as BEFLLM but without any pre-trained weights is used to evaluate the contribution of pre-training knowledge. (2) A fully trained Transformer model without an LLM backbone is used to check whether the performance improvement is mainly from the Transformer architecture. (3) A frozen pre-trained Qwen3 model, where both the original pre-trained parameters and LoRA parameters are frozen, is used to evaluate the forecasting capability provided solely by the pre-trained representations without any parameter adaptation. The additional BEFLLM components are retained to keep the overall forecasting framework consistent. The results are shown in Table 8.
Table 8.
The ablation study of the contributions of the pre-trained LLM.
The results show that compared with BEFLLM, the performance of these three control models is inferior, which indicates the importance of pre-training knowledge and the proposed adaptive strategy. Specifically, the performance of the randomly initialized Qwen3 model is not as good as that of BEFLLM, which indicates that the pre-training knowledge embedded in the Qwen3 backbone contributes to improving forecasting capability. Compared with BEFLLM, the fully trained Transformer model shows a larger performance gap, which indicates that the improvement of BEFLLM cannot be attributed only to the Transformer architecture, and the large-scale pre-trained LLM backbone provides stronger representation. In addition, the performance of the frozen pre-trained Qwen3 model is not as good as that of BEFLLM, which indicates that parameter adaptation is crucial for effectively adapting the pre-trained representation to the building energy consumption forecasting task. Overall, these results confirm that the performance improvement of BEFLLM comes from the joint contribution of pre-training knowledge, LLM architecture, and task-specific adaptation mechanisms.
5. Practical Implications and Discussion
5.1. Visualization Analysis of Cross-Feature Attention Mechanism
In this study, cross-feature attention is employed to assign adaptive weights to each feature at every time step, enabling the model to capture interactions among different features. The ablation study in Section 4.5 has already verified the effectiveness of this module. In this section, we further conduct a visualization analysis of this mechanism to illustrate how the weights of input features vary across different building types and forecasting horizons, thereby providing insights into how BEFLLM learns feature interaction patterns for building energy consumption forecasting.
To provide a comprehensive analysis of the learned feature interaction patterns, two forecasting horizons from two different building datasets are selected for attention weight analysis. Figure 15a,b present the cross-feature attention weight matrices learned by BEFLLM in the Housing_1 dataset with forecasting horizons of 6 and 24, while Figure 15c,d show the corresponding results for the Restaurant_1 dataset with the same horizons. In these matrices, each row represents a Query feature and each column represents the corresponding Key feature being attended to. As highlighted by the red box, the last row illustrates the attention distribution across all features when the target variable (Energy) serves as the Query.
Figure 15.
Cross-feature attention weight matrices.
As shown in the figure, the weight allocation to input features varies across different building types and forecasting horizons. This difference indicates that BEFLLM can adaptively capture the dataset-specific environmental influences on building energy consumption. Among all features, historical energy consumption exhibits stronger attention responses, indicating that BEFLLM relies more heavily on historical consumption patterns when aggregating information for forecasting, while the weights of other meteorological variables do not exhibit a pronounced polarization. Therefore, to improve cross-building generalization performance, all meteorological variables contained in the BDG2 are used as input features in this study, and dynamic weight allocation is performed through the CFA mechanism. In practical engineering applications, the selection of input variables should still consider building characteristics and forecasting objectives.
It should be noted that the attention weights represent the internal information aggregation process of BEFLLM and should not be directly interpreted as quantitative feature importance. A higher attention value indicates stronger interaction during model learning, rather than a causal contribution of the corresponding feature to the prediction results.
5.2. Application and Deployment Strategies of BEFLLM in the Building Domain
BEFLLM shows excellent prediction performance on five different types of building datasets and can be deployed in a unified framework, so it is very suitable for energy consumption forecasting and energy management at the building clusters level. In addition, research on the generalization ability of few-shot and zero-shot scenarios shows that the framework can still maintain reliable prediction ability in the absence of historical data or when only obtaining the historical data for the same type of buildings, thus expanding its practical application scope in new and existing buildings lacking historical data.
From the perspective of deployment strategy, the traditional deep learning model is highly dependent on historical energy consumption data and needs to tune the hyperparameters for each building separately, which brings huge computational and labor costs. In contrast, BEFLLM can use a model to train different types of representative buildings and then directly deploy to other buildings of the same type without additional retraining or tuning. This significantly reduces the computational cost and the workload of building energy managers. In addition, meteorological features can be easily obtained through weather forecast APIs or environmental sensors. This low adaptation cost and highly scalable forecasting framework shows great potential in practical engineering applications in smart grid demand-side management.
The high forecasting accuracy of statistical error metrics (e.g., the MAE and RMSE) is a necessary condition for quantitative prediction, but the accuracy alone cannot guarantee that the model output is directly converted into an operable building energy management strategy. Therefore, BEFLLM should be considered as a data-driven component within a broader building energy management framework, rather than an independent solution for building performance evaluation or certification. Its practical contribution lies in providing reliable forecasting performance to support energy management and operational decision-making. For example, accurate forecasts can facilitate early warnings of abnormal or excessive energy consumption and enable more reasonable power scheduling, including better coordination with renewable energy. The comprehensive building performance assessment still relies on the combination of predictive results with standardized evaluation and certification processes [7].
5.3. Limitations and Future Work
Although the proposed method shows strong predictive performance, several limitations should be acknowledged. Only a limited number of real-world building datasets from the BDG2 are used in the experiments, and the input variables are limited to meteorological factors affecting building energy consumption. Consequently, the current evaluation may not fully capture the diversity of building types, building control strategies, and occupancy regimes encountered in real-world applications. Furthermore, the cross-building zero-shot experiments are limited to transfers between buildings of the same functional type. Beyond these experimental limitations, in actual building energy management, not only reliable forecasting performance is required, but also calibrated operational data, evidence-based policy frameworks, and robust building performance assessment and certification procedures are required [42]. Finally, although cross-feature attention weights offer some interpretability, the framework still lacks more human-readable explanations. Based on these limitations, future research directions are as follows.
- Explore using other LLMs for forecasting and study dynamic prompt generation strategies under different forecasting scenarios.
- Validate the proposed framework on independent building datasets beyond BDG2 and extend cross-building zero-shot transfer to more diverse building types, covering a wider range of building functions and climatic environments.
- Integrate BEFLLM with calibrated building performance assessment and operational monitoring to further improve its practical value in intelligent energy management and policy support.
- Integrate Chain-of-Thought into the proposed framework to have LLMs generate human-understandable explanations and enhance the practical value of this work.
6. Conclusions
This paper proposed a short-term building energy consumption forecasting framework, BEFLLM, based on pre-trained LLMs. By integrating multimodal input, cross-feature attention, and deep residual mining, the framework solves the challenges of generalization ability and data dependence in building energy systems. The main results are as follows.
- The comparative experiments of five building types in different time zones show that BEFLLM effectively adapts to different operating modes and climate characteristics. In all forecasting horizons, it performed better than the eight SOTA baselines, with an average improvement of 6.06% in the MAE and 4.80% in the RMSE. Notably, this excellent performance is achieved without specific hyperparameter tuning, which verifies its practical applicability under different building types and climatic conditions.
- BEFLLM also has the best forecasting performance in few-shot and zero-shot building scenarios. Under the 5% and 10% few-shot settings, the proposed method achieves an average MAE reduction of 5.13% and 6.64%, and an RMSE reduction of 4.47% and 5.12%, respectively. In addition, in the zero-shot setting, the average decrease rates for the MAE and RMSE were 7.40% and 5.90%, respectively. This proves that it has strong generalization ability in the case of data scarcity and overcomes the dependence of traditional models on a large amount of historical data.
- The experimental results show that BEFLLM achieves stable forecasting performance under noise conditions. Compared with other baseline models, it shows limited error growth. Specifically, the average growth of the MAE and RMSE after noise injection is only 5.37% and 2.98%, respectively. This shows that the key mode of sudden fluctuations in building operations has been effectively retained, confirming its strong robustness.
- Ablation studies further confirmed the necessity of each component of BEFLLM and demonstrated how it can improve the forecasting performance and generalization ability of the backbone model. In addition, the ablation study of each part of the prompt template shows that all elements of the text information are indispensable.
Based on its generalization ability across different buildings and data scarcity conditions, as well as its robustness to data noise, BEFLLM can be reliably applied to a variety of scenarios, including newly constructed, cross-climate, and cross-type buildings, without the need for separate hyperparameter tuning, thus providing a low adaptation cost and practical method for short-term building energy consumption forecasting, which can be extended from a single building to clusters.
Since building energy consumption accounts for nearly 30% of global energy consumption, improving energy efficiency at the building-cluster level is crucial for sustainable energy management. The BEFLLM framework proposed in this study has high accuracy, strong generalization, and robustness, which can be cost-effectively deployed to AI-driven energy management systems on a large scale, providing a practical way to significantly reduce building energy consumption.
Author Contributions
Conceptualization, C.W., M.A. and R.Y.; methodology, C.W. and S.L. (Shanshan Li); validation, C.W. and S.L. (Shanshan Li); formal analysis, C.W., X.X., Z.W., S.A. and S.L. (Sichen Liu); investigation, Z.W., S.A. and S.L. (Sichen Liu); data curation, S.L. (Shanshan Li); writing—original draft preparation, C.W.; writing—review and editing, S.L. (Shanshan Li), M.A., R.Y. and C.W.; visualization, X.X.; supervision, S.L. (Shanshan Li), M.A. and R.Y.; funding acquisition, S.L. (Shanshan Li). All authors have read and agreed to the published version of the manuscript.
Funding
This project was funded by Liaoning Provincial Science and Technology Joint Program Project (No. 2024JH2/102600096) in China.
Data Availability Statement
The data presented in this study are available on request from the corresponding author.
Conflicts of Interest
The authors declare no conflicts of interest.
Abbreviations
The following abbreviations are used in this manuscript:
| BEFLLM | Building Energy Forecasting Large Language Model |
| LLMs | Large Language Models |
| HVAC | Heating, Ventilation, and Air Conditioning |
| CFA | Cross-Feature Attention |
| RPM | Residual Pattern Mining |
| SOTA | State-of-the-Art |
| LoRA | Low-Rank Adaptation |
| DPT | Description of the Prediction Task |
| CECBs | Characteristics of Electricity Consumption in Buildings |
| TD | Temporal Description |
| MCs | Meteorological Characteristics |
| CP | Component Prompts |
| MAE | Mean Absolute Error |
| RMSE | Root Mean Square Error |
| Symbols | |
| x | Original data |
| X | Historical energy consumption data |
| Y | Actual energy consumption data |
| Predicted energy consumption data | |
| K | Input length |
| H | Forecasting horizon |
| t | A time step |
| Z | Meteorological data |
| D | Number of meteorological features |
| N | Number of training samples |
| r | Low-rank dimension |
| A & B | Low-rank update matrices |
| norm | |
| Trend component of STL decomposition | |
| Seasonal component of STL decomposition | |
| Residual component of STL decomposition | |
| R | Original residual representation |
| Enhanced residual representation | |
| DWConv(·) | 1D depthwise convolution |
| PWConv(·) | 1 × 1 pointwise convolution |
| Model parameters | |
| f | Backbone model |
| F | Pre-trained large language model |
| Patch length | |
| Number of patches | |
| T | Token sequence |
| Weight matrix of token embeddings | |
| Weight matrix of LoRA fine-tuning | |
| Activation function | |
| Vectorization | |
| d | Dimension of the input vector |
| j | Dimension of the output vector |
| V | Input numerical vector |
| P | Input textual vector |
| C | Number of input features |
| Mean of data | |
| Variance of the data | |
| Standard deviation of the data | |
| B | Batch size |
| Bias | |
Appendix A
Appendix A.1. Training Strategy
For all of the models, the hyperparameter settings during training are as follows: the learning rate is set to 0.01, the batch size is 32, the loss function is MSELoss, and the optimizer is AdamW with weight decay set to 0.1. The patch size is set to 16, and the stride is set to 8. In this study, assuming that future meteorological variables are unavailable and using only historical data as input to prevent information leakage. To prevent overfitting, an early stopping strategy is adopted during training, where training is terminated if the validation loss does not decrease for five consecutive epochs.
Appendix A.2. Hyperparameter Optimization
Ablation studies are conducted to obtain the optimal values of several key hyperparameters. The input length is searched from {24, 36, 48, 60}. The number of layers in the Qwen3 backbone is searched from {1, 2, 3, 4, 5, 6, 7}. The number of layers in the RPM module is searched from {4, 5, 6, 7, 8, 9}, and the convolution kernel size of the RPM module is searched from {3, 4, 5, 6}.
For the other hyperparameters of all models, the Optuna library in Python is employed for hyperparameter optimization, using only the training data. Specifically, the original training set is further divided into an inner training subset and a validation subset for hyperparameter selection. After identifying the optimal hyperparameter configuration, each model is retrained using the complete training set and finally evaluated on the independent test set. The corresponding Optuna settings are listed in Table A1, while the search space is summarized in Table A2.
Table A1.
Optuna hyperparameter optimization configuration.
Here, e_layers denotes the number of encoder layers in the Transformer; d_layers denotes the number of decoder layers. d_model denotes the hidden dimension of the model. n_heads denotes the number of attention heads. d_ff denotes the hidden dimension of the feed-forward network. num_layers denotes the number of network layers. kernel_size denotes the convolution kernel size. In particular, for large language model-based forecasting methods, d_model corresponds to the hidden dimension of the employed large language model, which is 1024 for Qwen3-0.6B-Base. The LoRA rank used for parameter-efficient fine-tuning is set to 16. DLinear is a single-layer linear model that uses a window with kernel_size = 25 for trend extraction, and its original configuration is retained in this study.
After freezing the core weights of the large language model, the trainable parameters fall into two categories. The first consists of the LoRA fine-tuning matrices injected into the attention projection layers, together with the LayerNorm and positional embedding parameters. The second comprises the external components of BEFLLM, including the time series decomposition mapping module, the input and output linear projection layers, the prompt mapping layer, the CFA mechanism, and the RPM module. The total number of trainable parameters is 983,040, accounting for approximately 0.164% of the 0.6B model. This is consistent with the typical parameter scale of LoRA fine-tuning, which generally requires training only 0.1–1% of the original model parameters.
Table A2.
Hyperparameters and their search space for different models.
Appendix B
Appendix B.1. Results of Section 4.2
Table A3.
Results under 5% few-shot setting.
Table A4.
Results under 10% few-shot setting.
Appendix B.2. Results of Section 4.3
Table A5.
Results under zero-shot setting.
References
- Buildings—Energy System. Available online: https://www.iea.org/energy-system/buildings (accessed on 8 April 2026).
- Chou, J.-S.; Nguyen, H.-M. Advancing Energy Predictive Models in Smart and Sustainable Buildings through the Age of Exploration-Inspired Optimization of Machine and Deep Learning. Build. Environ. 2026, 290, 114113. [Google Scholar] [CrossRef] [Scilit]
- Ge, C.; Yan, J.; Song, W.; Zhang, H.; Wang, H.; Li, Y.; Liu, Y. Middle-Term Wind Power Forecasting Method Based on Long-Span NWP and Microscale Terrain Fusion Correction. Renew. Energy 2025, 240, 122123. [Google Scholar] [CrossRef] [Scilit]
- Wang, H.; Li, J.; Wu, H.; Hovy, E.; Sun, Y. Pre-Trained Language Models and Their Applications. Engineering 2023, 25, 51–65. [Google Scholar] [CrossRef] [Scilit]
- Su, J.; Zhang, J.; Li, G.; Zhang, W.; Yu, H.; Kang, L.; Zhang, L.; Zhang, X.; Wang, J. Research on Dynamic Simulation and Optimization of Building Energy Consumption of Substations in Cold Regions Based on DeST: A Case Study of an Indoor Substation in Shijiazhuang. Buildings 2025, 15, 3706. [Google Scholar] [CrossRef] [Scilit]
- Villano, F.; Łokczewska, W.; Cholewa, T.; Ascione, F.; Mauro, G.M.; Balaras, C.A. From Physics to Machine Learning in Forecasting Thermal Load of a District-Heated Residential Building: Assessment of Different Methods and Influence of Input Data. Energy Build. 2026, 361, 117435. [Google Scholar] [CrossRef] [Scilit]
- Ozarisoy, B.; Altan, H. Energy Calibration: Developing a Novel Methodology to Calibrate Building Energy Performance of Social Housing Estates. In Handbook of Retrofitting High Density Residential Buildings; Springer: Cham, Switzerland, 2022; pp. 453–505. [Google Scholar] [CrossRef] [Scilit]
- Kawa, K.; Mularczyk, R.; Bauer, W.; Grobler-Dębska, K.; Kucharska, E. Prediction of Energy Consumption on Example of Heterogenic Commercial Buildings. Energies 2024, 17, 3220. [Google Scholar] [CrossRef] [Scilit]
- Kangalli Uyar, S.G.; Ozbay, B.K.; Dal, B. Interpretable Building Energy Performance Prediction Using XGBoost Quantile Regression. Energy Build. 2025, 340, 115815. [Google Scholar] [CrossRef] [Scilit]
- Dehghan, F.; Amores, C.P.; Khanmohammadi, L.; Labib, R. Evaluating Machine Learning Models for Sustainable Building Design: Energy, Emissions, and Comfort Metrics. Build. Environ. 2025, 285, 113582. [Google Scholar] [CrossRef] [Scilit]
- Hasan, R.; Mansouri, M.; Arkhangelski, J.; Abdou Tankari, M. Interpretable Multi-Sensor Fusion for Short-Term Energy Consumption Forecasting. Energies 2026, 19, 2230. [Google Scholar] [CrossRef] [Scilit]
- Chen, X.; Jin, Y.; Li, D.; Wu, N. A Fusion-Grounded Framework for Building Performance Forecasting: Structural Design and Optimization with Mathematical Interpretability and Statistical Reliability. Buildings 2026, 16, 2255. [Google Scholar] [CrossRef] [Scilit]
- Lian, H.; Wei, H.; Wang, X.; Chen, F.; Ji, Y.; Xie, J. Research on Real-Time Energy Consumption Prediction Method and Characteristics of Office Buildings Integrating Occupancy and Meteorological Data. Buildings 2025, 15, 404. [Google Scholar] [CrossRef] [Scilit]
- Somu, N.; M R, G.R.; Ramamritham, K. A Hybrid Model for Building Energy Consumption Forecasting Using Long Short Term Memory Networks. Appl. Energy 2020, 261, 114131. [Google Scholar] [CrossRef] [Scilit]
- Jang, J.; Han, J.; Leigh, S.-B. Prediction of Heating Energy Consumption with Operation Pattern Variables for Non-Residential Buildings Using LSTM Networks. Energy Build. 2022, 255, 111647. [Google Scholar] [CrossRef] [Scilit]
- Wu, H.; Xu, J.; Wang, J.; Long, M. Autoformer: Decomposition Transformers with Auto-Correlation for Long-Term Series Forecasting. In Neural Information Processing Systems; Curran Associates Inc.: Red Hook, NY, USA, 2021. [Google Scholar]
- Zhou, T.; Ma, Z.; Wen, Q.; Wang, X.; Sun, L.; Jin, R. FEDformer: Frequency Enhanced Decomposed Transformer for Long-Term Series Forecasting. In Proceedings of the International Conference on Machine Learning, Baltimore, MD, USA, 17–23 July 2022. [Google Scholar]
- Nie, Y.; Nguyen, N.H.; Sinthong, P.; Kalagnanam, J. A Time Series Is Worth 64 Words: Long-Term Forecasting with Transformers. In Proceedings of the International Conference on Learning Representations, Kigali, Rwanda, 1–5 May 2023. [Google Scholar]
- Romańska, A.; Dudzik, M.; Dudek, P.; Górny, M.; Kuc, S.; Bomberg, M. Perspective for Improving Energy Efficiency and Indoor Climate Towards Prediction of Energy Use: A Generalized LSTM-Based Model for Non-Residential Buildings. Energies 2026, 19, 2446. [Google Scholar] [CrossRef] [Scilit]
- Moveh, S.; Merchán-Cruz, E.A.; Abuhussain, M.; Alhumaid, S.; Almazam, K.; Dodo, Y.A. Multi-Building Energy Forecasting Through Weather-Integrated Temporal Graph Neural Networks. Buildings 2025, 15, 808. [Google Scholar] [CrossRef] [Scilit]
- Jiang, Y.; Gao, T.; Dai, Y.; Si, R.; Hao, J.; Zhang, J.; Gao, D.W. Very Short-Term Residential Load Forecasting Based on Deep-Autoformer. Appl. Energy 2022, 328, 120120. [Google Scholar] [CrossRef] [Scilit]
- Spencer, R.; Ranathunga, S.; Boulic, M.; van Heerden, A.; Susnjak, T. Transfer Learning on Transformers for Building Energy Consumption Forecasting—A Comparative Study. Energy Build. 2025, 336, 115632. [Google Scholar] [CrossRef] [Scilit]
- Li, D.; Qi, Z.; Zhou, Y.; Elchalakani, M. Machine Learning Applications in Building Energy Systems: Review and Prospects. Buildings 2025, 15, 648. [Google Scholar] [CrossRef] [Scilit]
- Zhou, T.; Niu, P.; Wang, X.; Sun, L.; Jin, R. One Fits All: Power General Time Series Analysis by Pretrained LM. Adv. Neural Inf. Process. Syst. 2023, 36, 43322–43355. [Google Scholar] [CrossRef] [Scilit]
- Xue, H.; Salim, F.D. PromptCast: A New Prompt-Based Learning Paradigm for Time Series Forecasting. IEEE Trans. Knowl. Data Eng. 2024, 36, 6851–6864. [Google Scholar] [CrossRef] [Scilit]
- Jin, M.; Wang, S.; Ma, L.; Chu, Z.; Zhang, J.Y.; Shi, X.; Chen, P.-Y.; Liang, Y.; Li, Y.-F.; Pan, S.; et al. Time-LLM: Time Series Forecasting by Reprogramming Large Language Models. In Proceedings of the International Conference on Learning Representations, Vienna, Austria, 7–11 May 2024. [Google Scholar]
- Cao, D.; Jia, F.; Arik, S.O.; Pfister, T.; Zheng, Y.; Ye, W.; Liu, Y. TEMPO: Prompt-Based Generative Pre-Trained Transformer for Time Series Forecasting. In Proceedings of the International Conference on Learning Representations, Vienna, Austria, 7–11 May 2024. [Google Scholar]
- Wu, T.; Ling, Q. STELLM: Spatio-Temporal Enhanced Pre-Trained Large Language Model for Wind Speed Forecasting. Appl. Energy 2024, 375, 124034. [Google Scholar] [CrossRef] [Scilit]
- Gao, M.; Zhou, S.; Gu, W.; Wu, Z.; Liu, H.; Zhou, A.; Wang, X. MMGPT4LF: Leveraging an Optimized Pre-Trained GPT-2 Model with Multi-Modal Cross-Attention for Load Forecasting. Appl. Energy 2025, 392, 125965. [Google Scholar] [CrossRef] [Scilit]
- Li, Z.; Chen, T.; Xu, Y. AirGPT: Spatio-Temporal Large Language Model for Air Quality Prediction. Inf. Fusion 2026, 127, 103730. [Google Scholar] [CrossRef] [Scilit]
- Fan, H.; Li, M.; Zhang, Z.; Cheng, L.; Ye, Y.; Liu, W.; Liu, D. M2WLLM: Multi-Modal Multi-Task Ultra-Short-Term Wind Power Prediction Algorithm Based on Large Language Model. Inf. Fusion 2026, 126, 103541. [Google Scholar] [CrossRef] [Scilit]
- Jiang, G.; Ma, Z.; Zhang, L.; Chen, J. EPlus-LLM: A Large Language Model-Based Computing Platform for Automated Building Energy Modeling. Appl. Energy 2024, 367, 123431. [Google Scholar] [CrossRef] [Scilit]
- Zhang, L.; Chen, Z.; Ford, V. Advancing Building Energy Modeling with Large Language Models: Exploration and Case Studies. Energy Build. 2024, 323, 114788. [Google Scholar] [CrossRef] [Scilit]
- Hu, E.J.; Shen, Y.; Wallis, P.; Allen-Zhu, Z.; Li, Y.; Wang, S.; Wang, L.; Chen, W. LoRA: Low-Rank Adaptation of Large Language Models. In Proceedings of the International Conference on Learning Representations, Virtual, 25–29 April 2022. [Google Scholar]
- Cleveland, R.B.; Cleveland, W.S.; McRae, J.E.; Terpenning, I. STL: A Seasonal-Trend Decomposition Procedure Based on Loess. J. Off. Stat. 1990, 6, 3–73. [Google Scholar]
- Fan, S.; Wang, H.; Zhang, F. CAWformer: A Cross Variable Attention with Discrete Wavelet Denoising for Multivariate Time Series Forecasting. Knowl.-Based Syst. 2025, 324, 113846. [Google Scholar] [CrossRef] [Scilit]
- Liu, M.; Xia, C.; Xia, Y.; Deng, S.; Wang, Y. TDCN: A Novel Temporal Depthwise Convolutional Network for Short-Term Load Forecasting. Int. J. Electr. Power Energy Syst. 2025, 165, 110512. [Google Scholar] [CrossRef] [Scilit]
- Miller, C.; Kathirgamanathan, A.; Picchetti, B.; Arjunan, P.; Park, J.Y.; Nagy, Z.; Raftery, P.; Hobson, B.W.; Shi, Z.; Meggers, F. The Building Data Genome Project 2, Energy Meter Data from the ASHRAE Great Energy Predictor III Competition. Sci. Data 2020, 7, 368. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Lea, C.; Flynn, M.D.; Vidal, R.; Reiter, A.; Hager, G.D. Temporal Convolutional Networks for Action Segmentation and Detection. In IEEE Conference on Computer Vision and Pattern Recognition; IEEE: Piscataway, NJ, USA, 2017. [Google Scholar]
- Hochreiter, S.; Schmidhuber, J. Long short-term memory. Neural Comput. 1997, 9, 1735–1780. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Zeng, A.; Chen, M.; Zhang, L.; Xu, Q. Are Transformers Effective for Time Series Forecasting? In Proceedings of the AAAI Conference on Artificial Intelligence, Washington, DC, USA, 7–14 February 2023. [Google Scholar]
- Ozarisoy, B.; Altan, H. Limitations: Developing an Evidence-Based Energy Policy Framework to Asset Robust Energy Performance Evaluation and Certification Schemes. In Handbook of Retrofitting High Density Residential Buildings; Springer: Cham, Switzerland, 2022; pp. 617–640. [Google Scholar] [CrossRef] [Scilit]
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. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license.














