Next Article in Journal
Coupled Heat–Moisture Effects of Initial Soil Water Content on Seasonal Underground Thermal Energy Storage with Coaxial Borehole Heat Exchangers
Next Article in Special Issue
AI-Driven Load and Net-Load Forecasting in Renewable-Rich and Electric-Vehicle-Intensive Power Systems: An Evidence-Mapping Review
Previous Article in Journal
A State-Space Model for Stability Boundary Analysis of Grid-Following Voltage Source Converters Considering Grid Conditions
Previous Article in Special Issue
Adaptive Multi-Tiered Intraday Load Forecasting Strategy with Real-Time Error Correction
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Single-Attention Large Language Model for Efficient Multi-Regional Electricity Demand and Generation Forecasting

by
Muhammad Zulfiqar
1,2,
Kelum A. A. Gamage
3,* and
M. B. Rasheed
2
1
Department of Communication and Cyber Security, Former Telecommunication Systems, Bahauddin Zakariya University, Multan 60000, Pakistan
2
College of Science and Engineering, University of Derby, Derby DE22 3AW, UK
3
James Watt School of Engineering, James Watt South Building, University of Glasgow, Glasgow G12 8QQ, UK
*
Author to whom correspondence should be addressed.
Energies 2026, 19(6), 1522; https://doi.org/10.3390/en19061522
Submission received: 20 January 2026 / Revised: 13 March 2026 / Accepted: 14 March 2026 / Published: 19 March 2026
(This article belongs to the Special Issue Advanced Load Forecasting Technologies for Power Systems)

Abstract

Electricity forecasting is one of the most crucial aspects in maintaining stable, reliable, and autonomous power systems. While recently developed forecasting methods based on large language models can make accurate predictions, these models are still struggling due to their computational complexity, which requires more computing power, and their reliance on carefully designed prompts. This makes them complicated and harder to use in practice. To address this, we propose a Single-Attention Large Language Model (SA-LLM) that uses a unified attention mechanism to understand relationships between main and additional variables, without the need for manually created prompts. The proposed framework has been tested on real electricity supply and demand datasets, which are obtained from major U.S. electricity markets, including PJM, MISO, NYISO, ISO New England, ERCOT, SPP, and CAISO. Experimental results demonstrate that the proposed SA-LLM method outperforms the existing counterpart methods in terms of accuracy and associated errors. More specifically, the SA-LLM has also achieved a 22.5% improvement in the mean absolute error compared with traditional LSTM-based models, while reducing memory usage by 52.1% and training time by 38.4% relative to recent LLM-based methods. Furthermore, the SA-LLM demonstrates strong zero-shot generalization, achieving an additional 18.2% improvement in the MAE on previously unseen regions.

1. Background

Currently, the world has experienced an unprecedented increase in electricity consumption driven by urbanization, industrialization, and digitization. This increased energy demand has placed immense pressure on energy producers to meet sustainability and resilience goals [1,2]. The sense of urgency arising from the need to reduce climate change has further intensified efforts to reduce carbon emissions and shift towards a low-carbon energy system [3,4]. However, these goals cannot be accomplished merely by investing in infrastructure for renewable resources. They demand smarter management systems that are adaptable, data-driven, and equipped with real-time processing to dynamically optimize their functions. The concept of the smart grid has become increasingly significant in this process because it offers an effective way to coordinate and optimize distributed energy resources (DERs) [5,6]. Accurate forecasting methods for electricity demand and renewable power generation are very important to ensure the efficiency and stability of the smart power grid [7,8]. In practice, inaccurate forecasts can lead to financial losses and prediction errors. Traditional forecasting methods have been widely used and provide good results, including models such as LSTM, ARIMA, and SVR. However, these models often struggle to capture the uncertainty and complexity of modern power systems [9]. The modern power networks are being influenced by various dynamic and uncertain factors, such as renewable energy generation, weather variations, and market trends, many of which behave nonlinearly. As a result, the energy market has shifted toward using advanced AI models, especially DL techniques that can uncover complex patterns in data. LLMs have shown promise in this area because their attention mechanisms can theoretically capture long-term dependencies across multiple data series. However, their application in energy modeling has been limited due to challenges in effective cross-series learning and their reliance on manually designed prompts [10].

1.1. Electricity Forecasting

Electricity load forecasting has advanced significantly over the years and encompasses a range of techniques, from classical statistical methods to advanced machine learning and deep learning approaches [11]. Classical statistical techniques such as ARIMA and exponential smoothing have been widely adopted due to their simplicity and ease of interpretation. Yet, when it comes to the nonlinearity present in contemporary energy infrastructure, their effectiveness remains questionable, as they essentially belong to the class of linear modeling techniques [12]. ML algorithms, including support vector machines (SVMs) and random forests (RFs), have been investigated for their ability to model nonlinear relationships [13]. Although ML techniques are highly useful, they often require extensive feature engineering, which can be problematic when generalization to unseen conditions is required [14]. Recently, the DL approach has shown impressive results in EFP applications because it can automatically extract relevant features from data [15]. Among DL models, ANNs, RNNs, and, more specifically, LSTMs have proven successful in extracting complex time-related features from energy data [16,17]. Recently, hybrid deep learning models have emerged that combine recurrent or convolutional structures with attention networks to promote interpretability and model long-term dependencies in time-series data [18,19]. Advances in transformer-based models, including Informer and Autoformer, have further improved time-series forecasting, yielding greater efficiency and higher accuracy for long-horizon forecasting. Recent improvements have made smart grid forecasting systems smarter [20,21,22,23,24,25,26,27]. People now use machine learning and transformer models instead of old statistical methods. These new methods can predict energy use more accurately. It is also important that these models are easy to understand and can work well in different situations and times.

1.2. LLMs for Forecasting

LLMs have been widely studied for their ability to support advances across different domains [28,29]. Their large number of parameters allows them to process and learn from large datasets [30]. Moreover, traditional AI and machine learning models often find it difficult to handle relationships between internal and external variables in the dataset [31]. LLMs are also applied in areas beyond text generation [32]. LLMs have recently been used for both short- and long-term forecasting because they can capture important relationships and handle different types of uncertainties and correlations [32]. Models like ARIMA and deep learning often have difficulty handling relationships caused by external or internal variables in the datasets [31]. This limitation exists because LLMs use parallel processing, which allows them to handle longer sequences more efficiently than traditional deep learning models [33]. As a result, many transformer-based time-series approaches have shown better performance than classical forecasting methods in various applications. Forecasting algorithms can generally be grouped into two main types. The first type involves reprogramming pre-trained LLMs by adding instructional information to the original time-series data to guide the forecasting process [34,35,36]. The second category focuses on fine-tuning the model with time-series data. In some cases, it uses multi-stage pipelines and contrastive learning to help the model better understand patterns over time [37].

2. Contribution

Accurate electricity forecasting is very important for planning and running modern smart power grids. LLMs are effective at analysis, but they are not very effective at predicting time-based data because they often miss temporal patterns and require complex prompt setups. We propose an SA-LLM that uses a single-attention mechanism to capture both temporal changes and relationships among features. We tested it on real electricity demand and supply data from major U.S. markets: PJM, MISO, NYISO, ISO New England, ERCOT, SPP, and CAISO. Following prior work, we highlight the key gaps and our primary contributions. Nevertheless, we identify significant challenges on the horizon for LLM-based forecasting.
1.
Fine-tuning difficulty: Since a lot of optimization is done for pre-trained LLMs, naive fine-tuning often results in negligible improvements or even leads to overfitting issues. In addition, because LLMs have highly complex architectures, it is difficult to determine which components need to be fine-tuned [6].
2.
Prompt design limitations: Prompt engineering has been used as a means of improving LLM performance for natural language processing. However, prompt engineering for time-series forecasting is challenging due to the complex temporal dependencies and the large number of features.
3.
Regional variability: It is observed that there are differences between countries with respect to geography when it comes to climate, electricity demand, and renewable energy generation. These differences make it difficult to identify universal models, and only a limited number of studies are conducted.

Key Contributions

  • We introduce the SA-LLM, a new time-series forecasting framework that employs a single-attention mechanism to learn from target variables, yet requires manual prompt tuning.
  • We provide a Graph Neural Network (GNN) module to capture spatial and inter-regional relationships, improving forecasting accuracy.
  • We evaluate the SA-LLM across major U.S. electricity markets, showing it outperforms LSTM and previous LLM models, reducing the MAE by 22.5%, memory usage by 52.1%, and training time by 38.4%.
  • We evaluate the SA-LLM in zero-shot scenarios and find that it reduces the MAE by 18.2% on unseen regions, demonstrating strong generalization across different locations and times.
  • We offer a unified approach to spatio-temporal electricity forecasting that combines LLM-based feature extraction with optional graph-based spatial modeling.

3. Methodology

In time-series forecasting, two widely used mainstream strategies are employed [38,39]. Theoretically, this strategy offers higher modeling capacity since it learns complex inter-variable relationships. On the other hand, the CI strategy is more robust to noise and generalizes better since it focuses on self-correlations within each channel [39]. In practice, forecasting tasks typically consider multiple variables, such as predicting electricity demand and generation from historical power and weather data. Unlike full-variable and single-variable forecasting, the former benefits more from capturing inter-variable relationships, without the need to predict all variables. Unfortunately, LLMs face challenges in adopting channel-independent training strategies [40,41], in which a model computes the loss for all variables even though only a subset is required for prediction. Another challenge is that of prompt engineering. Approaches such as Tempo, which employs semi-soft prompts combining both hard and soft vectors, or TimeLLM, which appends the prompt as an input prefix, require careful task-specific tuning [34,41]. The need to fine-tune LLMs for each task makes them more complex and harder to use across different time-series forecasting problems.

3.1. Mainstream Strategies for Time-Series Forecasting

Two popular mainstream strategies are widely used [39]. These strategies are described mathematically as follows:
  • Model-Based Optimization (Attention-Enhanced LLM) [39]
Let X t R d denote the input features at time step t, and y t R denote the target variable. The model-based strategy constructs a predictive mapping f θ parameterized by θ as presented in (1):
y ^ t = f θ ( X t ) = Attention ( X t ; θ att ) + g ϕ ( X t ) ,
where Attention ( X t ; θ att ) emphasizes critical temporal patterns, g ϕ ( X t ) extracts local features, and θ = { θ att , ϕ } are learnable parameters. The model minimizes the mean squared error with regularization as in (2):
L MSE = 1 T t = 1 T y t y ^ t 2 2 + λ θ 2 2 .
2.
Model-Free Reinforcement Learning (TimeLLM) [41]
For comparative purposes, define the system state s t S and action a t A . The environment provides a reward r t based on prediction accuracy. The objective of the model-free RL strategy is to learn a policy π θ : S A that maximizes the expected cumulative reward in Equation (3):
J ( θ ) = E π θ t = 0 T γ t r t ( s t , a t ) ,
where γ [ 0 , 1 ] is the discount factor. The policy is updated via Proximal Policy Optimization (PPO) in Equation (4):
θ θ + α E ^ t π θ ( a t | s t ) π θ old ( a t | s t ) A ^ t ,
where A ^ t is the advantage estimate, and α is the learning rate. Equations (1) and (2) formalize the model-based LLM strategy used in the SA-LLM, while Equations (3) and (4) describe the model-free RL (TimeLLM) for reference only.

3.2. Motivation for a Unified Attention Mechanism

The SA-LLM architecture is based on a unified attention mechanism that jointly models temporal and cross-variable dependencies in a multivariate time series. The input sequence is defined in Equation (5) as
X = { x t R V t = 1 , , T } ,
and the forecasting task requires learning mappings of the form shown in Equation (6):
( x t i ) ( x t j ) , t , t { 1 , , T } , i , j { 1 , , V } .
To model these dependencies, the SA-LLM constructs token representations by combining temporal and variable embeddings, as defined in Equation (7):
h t i = W x x t i + E t + E i .
These representations are processed by the unified attention mechanism. The attention matrix is computed using the formulation in Equation (8):
A = softmax Q K d ,
where the projections Q, K, and V follow Equation (9):
Q = H W Q , K = H W K , V = H W V .
Since the representation H in Equation (7) combines both temporal and variable information, each attention coefficient depends on these components jointly, as expressed in Equation (10):
A i j = g ( t i , t j , v i , v j , x i , x j ) .

3.3. Proposed Single-Attention LLM

Existing CI and CD time-series models are typically complex and require extensive tuning. However, the proposed SA-LLM model simplifies this by using a single-attention mechanism that captures the behavior of different variables and their interactions with one another, without compromising its predictive power or ability to curb overfitting. In contrast to traditional CI approaches, which neglect target and context interactions, and CD approaches, which are typically underpinned by computationally intensive joint modeling of entire channels, the SA-LLM introduces a hybrid model. Instead of learning target self-correlations and dependencies among multiple variables, as expressed by auxiliary features, the SA-LLM employs a unified attention block prior to LLM inference. As such, targeting and efficient aggregation become feasible, eliminating computations related to non-target variables and capturing essential dependencies to ensure an accurate time-series forecast. The SA-LLM architecture is composed of six tightly coupled modules, each designed to address a specific modeling bottleneck.

3.3.1. Word Projection Layer

Although LLMs are used, the vocabularies are optimized for language semantics, which is highly redundant for time-series tasks. The SA-LLM uses a projection layer that maps the LLM embedding to a smaller task-specific embedding. If the embedding size of the vocabulary is D o r i g , and the projected size D p r o j is set to 2000 in this work, then the projection is done by the following Equation (11):
E p r o j = E o r i g W p r o j , W p r o j R D o r i g × D p r o j ,
where E o r i g represents the original embeddings and E p r o j represents the projected embeddings. This operation focuses the LLM input representation on the relevant structural features of the domain, improving convergence stability and computational efficiency. Equation (11) shows how the initial high-dimensional embeddings are linearly projected into a lower-dimensional space.

3.3.2. Single Unified Attention Module

The SA-LLM model computes the query, key, and value projections from the input feature matrix F R T × C , where T denotes the sequence length, and C represents the number of features. The linear projections are defined as in Equation (12):
Q = F W q , K = F W k , V = F W v ,
where W q , W k , W v R C × d h are learnable weight matrices, and d h denotes the attention head dimension. The attention weights are computed using the scaled dot-product attention mechanism presented in Equation (13):
A = Softmax Q K d h .
The attention-enhanced representation is then obtained as in Equation (14):
Z = A V ,
where A R T × T contains normalized attention coefficients. The scaling factor d h ensures numerical stability prior to the Softmax operation. This unified attention mechanism enables each feature to attend to its own historical patterns as well as correlated features, thereby jointly modeling temporal and cross-feature dependencies.

3.3.3. Frozen Pre-Trained LLM Backbone

The attention-enhanced embeddings X a t t n are combined with positional encodings PE and input to a frozen pre-trained LLM with N transformer layers:
H L L M = LLM ( X a t t n + PE ) ,
where H LLM are the output embeddings. Freezing the LLM preserves its pre-trained representations, prevents forgetting, and reduces computational cost, thereby treating it as a high-capacity temporal feature transformer.

3.3.4. Auxiliary Feature Extractor

This module captures general patterns and hidden relationships among non-target variables. Instead of using complex recurrent or attention-based encoders, we apply a simple linear transformation:
H aux = X nt W f + b f ,
where X nt are the non-target features, W f is a learnable weight matrix, and b f is a bias. This embedding adds context, improving prediction accuracy and stability.

3.3.5. Frozen LLM Backbone: Benefits and Limitations

The LLM backbone is kept frozen in order to avoid forgetting the pre-trained knowledge and minimize the computational and memory requirements. The added layers in the model are used for numerical time-series tasks. These layers act as adapters for the LLM backbone. These layers map the structured input data into the LLM’s representation space. The backbone is frozen in the model. Therefore, the model cannot adapt to domain-specific numerical data. As a result, the model’s performance degrades when the task data differ significantly from the pretraining data.

3.3.6. Attention-Based Feature Fusion and Feedforward Refinement:

Embeddings from the LLM, E LLM , are combined with auxiliary embeddings, E aux , via concatenation to create a joint representation, which is then processed by a shared attention mechanism (Equation (17)):
Z fusion = Attention ( [ E LLM ; E aux ] ) .
The attention mechanism computes weighted interactions among the concatenated features, thereby capturing dependencies between the LLM and auxiliary embeddings. The resulting fused representation, Z fusion , is passed through a position-wise feedforward network (Equation (18)):
H out = σ ( Z fusion W 1 + b 1 ) W 2 + b 2 ,
where W 1 and W 2 are learnable weights, b 1 and b 2 are biases, and σ ( · ) is a nonlinear activation. The attention layer highlights key LLM–auxiliary interactions, and the feedforward network refines the joint representation for effective prediction.

3.3.7. Output Projection Layer

The processed features F pred are converted back into the target variables for the full forecasting horizon:
Y ^ pred = F pred W proj + b proj ,
where W proj and b proj are learnable parameters. Equation (19) produces final forecasts optimized with task-specific losses. The SA-LLM unifies CI simplicity and CD modeling power, enabling efficient, large-scale electricity forecasting.

3.4. Attention Mechanism and Feature Interactions

This section explains how the unified attention formulation from Section 3.3.2 (Equations (12)–(14)) enables structured interactions between features. Instead of redefining the scaled dot-product calculation, we focus on its role within the SA-LLM architecture. The attention matrix A captures the relationships between different time steps in the sequence, allowing the model to dynamically assign more weight to important steps. When combined with the value matrix V , the model produces context-aware feature representations that highlight informative signals and reduce the influence of less relevant patterns. This design keeps the dimensions consistent, avoids unnecessary repetition of mathematical details, and clearly separates the formal definition of the attention mechanism from how it is implemented in the model.

3.5. Clarification of Model Innovation and Relation to Existing LLMs

The SA-LLM framework preserves the pre-trained LLM without altering its architecture or building a new transformer backbone. Let Θ LLM denote the LLM’s internal parameters, which remain fixed during training, ensuring
L Θ LLM = 0 ,
which means the original transformer mapping remains unchanged:
H ( l + 1 ) = FFN ( l ) SelfAttn ( l ) ( H ( l ) ) ,
for all layers l = 1 , , N . The backbone in Equation (21) is preserved. Rather than modifying the LLM, the SA-LLM applies structured operations to the LLM. First, a unified pre-attention operator is applied to the multivariate feature matrix F R T × C :
X attn = σ att F W q ( F W k ) d h F W v ,
where W q , W k , W v R C × d h . Unlike direct token mapping, Equation (22) explicitly models temporal and cross-feature relationships before the LLM processes the data. Second, auxiliary variables X nt R T × C n t are embedded separately as
H aux = X nt W f + b f ,
creating an additional structured representation independent of the frozen LLM space. Third, the LLM output and auxiliary embeddings are fused using an external attention mechanism:
Z fusion = Attention ( [ H LLM ; H aux ] ) ,
followed by nonlinear refinement:
H out = σ ( Z fusion W 1 + b 1 ) W 2 + b 2 .
The overall mapping can therefore be written as:
Y ^ = Φ proj Ψ fusion LLM Φ attn ( F , X nt ) ,
where Φ attn corresponds to Equation (26), Ψ fusion corresponds to Equations (24) and (25), and Φ proj denotes the output projection.
Therefore, the SA-LLM preserves the internal transformer mapping in Equation (21) while extending it through mathematically defined external operators (Equations (22)–(25)). The contribution lies in this structured external extension rather than in altering the LLM backbone itself.

3.6. Spatio-Temporal Graph Neural Network Module

Spatial and inter-regional dependencies are represented through a weighted undirected graph G = ( V , E , A ) , where V = { 1 , , N } denotes the set of spatial regions (nodes), E encodes pairwise spatial interactions, and A R N × N is the corresponding weighted adjacency matrix. Each element A i j quantifies the structural influence of region j on region i.

3.6.1. Graph Construction and Laplacian Operator

Let d i j denote the geographical or economic distance between region i and j. The weighted adjacency matrix is defined as in (27):
A i j = exp d i j 2 σ 2 I ( d i j κ ) ,
where σ > 0 is a spatial decay parameter, and κ is a sparsification threshold. Equation (27) defines a Gaussian kernel-based similarity measure with compact support. The corresponding degree matrix is computed as in (28):
D i i = j = 1 N A i j ,
where each diagonal entry aggregates neighborhood connectivity as defined in (27). Using the adjacency and degree matrices from Equations (27) and (28), the normalized graph Laplacian is formulated as in (29):
L = I D 1 / 2 A D 1 / 2 .
The operator in Equation (29) is symmetric positive semi-definite and therefore admits the spectral decomposition presented in (30):
L = U Λ U ,
where U contains orthonormal eigenvectors, and Λ = diag ( λ 1 , , λ N ) contains the corresponding non-negative eigenvalues. The spectral representation in Equation (30) forms the theoretical basis for graph convolution operations in the proposed framework.

3.6.2. Spectral Graph Convolution

Given the spectral decomposition of the normalized Laplacian in Equation (30), let X ( t ) R N × d denote the node feature matrix at time t. The spectral graph convolution is defined as in (31):
X G ( t ) = U g θ ( Λ ) U X ( t ) ,
where U and Λ originate from Equation (30), and g θ ( Λ ) represents a learnable spectral filter. To improve computational tractability, the filter g θ ( Λ ) in Equation (31) is approximated using truncated Chebyshev polynomials T k ( · ) as in (32):
g θ ( Λ ) k = 0 K θ k T k ( Λ ˜ ) ,
where
Λ ˜ = 2 Λ λ max I ,
and λ max denotes the largest eigenvalue of the Laplacian defined in Equation (29). Substituting the approximation in Equation (32) into Equation (31), and replacing Λ with the Laplacian operator L ˜ , yields the spatial propagation rule (34):
H ( l + 1 , t ) = σ k = 0 K θ k ( l ) T k ( L ˜ ) H ( l , t ) W ( l ) ,
where the initial condition satisfies
H ( 0 , t ) = X ( t ) ,
and W ( l ) denotes the trainable weight matrix at layer l. Equation (34) defines the recursive graph convolutional update governed by the Laplacian operator in Equation (29).

3.6.3. Temporal Dynamics Integration

Building upon the spatial propagation defined in Equation (34), the final graph representation is obtained as:
Z ( t ) = H ( L , t ) ,
where H ( L , t ) denotes the output of the Lth graph convolutional layer defined recursively in Equation (34). The temporal evolution of the latent representation is modeled using a gated recurrent mechanism. The reset and update gates are defined as:
r ( t ) = σ W r Z ( t ) + U r h ( t 1 ) ,
u ( t ) = σ W u Z ( t ) + U u h ( t 1 ) ,
where Z ( t ) is defined in Equation (36). The candidate hidden state is computed as in (39):
h ˜ ( t ) = tanh W h Z ( t ) + U h r ( t ) h ( t 1 ) ,
where r ( t ) follows from Equation (37), and ⊙ denotes element-wise multiplication. The hidden state update is finally given by (40):
h ( t ) = ( 1 u ( t ) ) h ( t 1 ) + u ( t ) h ˜ ( t ) ,
where u ( t ) is defined in Equation (38) and h ˜ ( t ) in Equation (39). Equations (37)–(40) jointly define the spatio-temporal state transition mechanism.

3.6.4. Joint Spatio-Temporal Representation

The final predictive representation is obtained by applying a multi-layer perceptron (MLP) to the hidden state defined in Equation (40):
F ( t ) = Ψ h ( t ) ,
where Ψ ( · ) denotes a trainable MLP. Equation (41) produces the spatio-temporal representation that integrates both the spatial embeddings from Equation (36) and the temporal dynamics from Equations (37)–(40).

3.6.5. Training Objective with Regularization

The model is trained in an end-to-end manner by minimizing the following loss function, which jointly accounts for prediction error, parameter regularization, and graph smoothness:
L = 1 T t = 1 T y ^ ( t ) y ( t ) 2 2 + λ 1 Θ 2 2 + λ 2 Tr H L H ,
where y ^ ( t ) is the predicted output at time t, y ( t ) is the corresponding ground truth, and Θ contains all trainable parameters of the GNN and temporal modules. The coefficient λ 1 represents the L 2 regularization term, enforcing weight decay, while λ 2 controls the Laplacian smoothness penalty over the node embeddings H from Equation (36). Finally, T denotes the total number of time steps in the training sequence. Equation (42) ensures that the predicted outputs respect both the temporal dynamics (Equations (37)–(40)) and spatial structure (Equations (27)–(29)), while maintaining generalization through regularization.

3.6.6. Optional Module Mechanism

Let δ { 0 , 1 } denote a binary activation variable for the optional GNN module. The final predicted output is given by (43):
y ^ ( t ) = f base ( X ( t ) ) + δ f GNN ( X ( t ) , G ) .
In Equation (43), f base ( X ( t ) ) denotes the output from the baseline temporal module without the spatial GNN component (as described in Equations (36) and (40)), f GNN ( X ( t ) , G ) represents the spatial embedding contribution computed by the GNN module, and δ { 0 , 1 } is a binary activation variable enabling ablation-based evaluation of the GNN module’s impact on forecasting accuracy. Equation (43) is subsequently used in the loss function defined in Equation (42), ensuring that both spatial and temporal dependencies contribute to the end-to-end training of the model.

4. Proposed SA-LLM Architecture

The overall architecture of the proposed SA-LLM framework is illustrated in Figure 1.

4.1. Model Setup for SA-LLM

Current time-series models often employ complex features and multiple attention layers, whereas the SA-LLM uses a single-attention mechanism to capture both temporal patterns and variable interactions, thereby simplifying the model while maintaining strong forecasting accuracy compared to the MultiAttLLM.
For completeness, the detailed mathematical formulation of the MultiAttLLM baseline is provided in Appendix A. Specifically, the six subparts are cited individually as follows: Word Projection (Appendix A.1), Cross-Attention (Appendix A.2), Frozen LLM (Appendix A.3), Feature Extraction and Self-Attention (Appendix A.4), Output Projection (Appendix A.5), and Discussion (Appendix A.6).
For a fair comparison, the best hyperparameters reported in the original studies for all benchmark models, except the LSTM model, were used to configure the models. For the LSTM baseline model, the MultiAttLLM model, and the proposed SA-LLM model, sensitivity analyses were conducted to assess their robustness and stability.

LSTM Baseline

For the LSTM model, we explored different settings of the number of recurrent layers, L, and the hidden state size, H. The mean squared error (MSE) on the validation set was measured for each setting. Figure 2 plots the validation MSE for different numbers of layers and hidden dimensions. The x-axis corresponds to the hidden layer size, and the y-axis corresponds to the number of stacked LSTM layers. Each cell in the heatmap corresponds to the MSE, with lighter colors denoting a smaller error. The lookback window of (24 steps) has been used as an input window, while the forecasting window was set to 168 time steps. This heatmap can be used to identify hyperparameters that yield a low validation error.

4.2. Sensitivity Analysis of SA-LLM and MultiAttLLM

The sensitivity of the SA-LLM (Figure 3a) and MultiAttLLM (Figure 3b) to key hyperparameters is evaluated on the MSE, with a lookback window and forecasting horizon. Figure 3a shows how the MSE varies with the model dimension d model . For both models, the MSE decreases as d model increases, although the rate of improvement diminishes beyond d model = 128 . Across all model dimensions, the SA-LLM achieves an equal or lower MSE than the MultiAttLLM, indicating greater efficiency in multivariate time-series forecasting. In Figure 3b, the effects of the number of layers in stacking an LLM on the problem are depicted. More layers improve the results up to six layers, but beyond that, further layers lead to an MSE plateau. The SA-LLM performs at least as well as the MultiAttLLM across all layers. Overall, the analyses above confirm that the proposed SA-LLM outperforms the MultiAttLLM in prediction performance.

4.3. Hyperparameter Engineering

Sensitivity tests and additional experiments were conducted to choose hyperparameters that balance forecasting accuracy, training stability, and computational efficiency. The final settings for all models follow those reported in [39]. The model parameters remain the same during training across all models. This way, we can ensure a fair comparison of the performance metrics across models for forecasting accuracy, memory consumption, and training time. The models were trained to minimize the MSE (Equation (44)):
MSE = 1 N n = 1 N y n y ^ n 2 ,
where y n and y ^ n denote the true and predicted values, respectively, and N = 64 is the batch size.

5. Implementation and Setup

The new model is tested using hourly spot prices in the electricity markets from 2018 to 2025 in the seven largest electricity markets in the US. These include CAISO, ERCOT, PJM, MISO, NYISO, ISO-NE, and SPP. The seven datasets include the total demand and generation in the markets for the main fuel types, namely fossil fuel, solar, wind, biomass, and, separately, nuclear and hydro in some markets. Also, the weather variables temperature, solar radiation, humidity, and wind speed are added. The model predicts three targets for each region, including solar, wind, biomass, and hydro, as shown in Figure 4. Using a 24-h lookback, it forecasts the next 168 h, ensuring inputs and targets do not overlap to avoid data leakage. All input features are standardized, and the model predictions are evaluated using the MAE, MAPE, RMSE, R 2 , and RAE to provide a comprehensive assessment of performance.

5.1. Dataset Description

The dataset covers the period from 2018 to 2025 and includes six major U.S. electricity markets: CAISO, ERCOT, PJM, MISO, NYISO, and SPP. Figure 4 gives the supply and demand produced by various types of resources in the United States by 2025. CAISO and NYISO display similar behaviors, with an average total supply and demand of around 30–40 GWh per hour. For CAISO and NYISO, solar and hydroelectric power supply renewable electricity. For ERCOT and MISO, electricity supply and demand are higher, around 100 GWh per hour, with wind and nuclear power contributing largely to the energy supply. Such heterogeneous patterns of electricity supply and demand reflect disparities in infrastructure and resources across the United States, making it an optimal test bed for assessing the generalization performance of the proposed forecasting technique.

Data Splitting Methodology

The models were evaluated using data from the past eight years (2018–2025). Initially, we examined how the training set size affected accuracy by training models on representative datasets for 1 to 6 years. Predictive tasks tend to converge as the time for training exceeds four years. Based on both predictive performance and computational complexity, the period 2018–2021 was selected as the training dataset. The years 2022 to 2024 were used as validation data, and 2025 as the test set.
As can be seen in Figure 4, CAISO has a fairly well-balanced generation mix, with prominent shares of solar and wind capacity, consistent with the state of California’s supportive RE policies. On the other hand, ERCOT has a more fossil-fuel-dominated generation mix, with an appreciable share of wind capacity, which reflects Texas’s extensive wind capacity. The PJM and MISO areas have similar generation mixes, which are dominated by fossil fuels, with nuclear and small amounts of renewables. They represent a more traditional market structure with some renewables. As seen in Figure 5a, the southern cities of Los Angeles and Houston have higher daily maximum temperatures, while the northern cities of Chicago and Boston have larger seasonal variations. The points sampled throughout the year indicate trends.
Figure 5b shows the daily minimum temperatures for 2025 across the same cities, highlighting warmer nights in southern regions and pronounced seasonal variations in northern regions. Figure 5c shows the 2025 daily solar radiation for each city, highlighting that southern and western cities (e.g., Los Angeles, Houston) receive higher radiation, while northern cities (e.g., Boston, Chicago) experience more pronounced seasonal variations, which are critical for modeling solar energy generation.
The graph in Figure 6 shows that the predictive accuracy of those models increases with the size of the training dataset. MAE tends to decrease as more historical data are used, indicating that longer training periods are more effective at identifying cyclic patterns in the data. It is important to note that predictive accuracy becomes more stable after four years of training, so training beyond this point yields little further improvement. When all models are compared, the proposed model achieves the lowest MAE across all training dataset sizes. This highlights the robust learning capability of the proposed model on smaller and unseen datasets. Other approaches, such as LSTM, the MultiAttLLM, DLinear, and TimesNet, perform relatively poorly in terms of error values and convergence rates. These regions of importance clearly indicate the training (2018–2021), validation (2022–2024), and test (2025) years, and generalize well as a complementary model into recent years. Prediction error, training time, and memory usage (represented by bubble size) are compared across different LLM backbones in Figure 7. Larger models, such as LLAMA-3.2-3b [42], generally achieve lower prediction errors but require more memory and longer training times. In contrast, smaller models like BERT [43] and GPT-2 [44] train faster and consume less memory, although their errors are slightly higher. Among them, GPT-2 offers a balanced performance with a moderate MAE (202), a short training time (160 ms per iteration), and low memory usage (1.03 GB), illustrating the trade-off between accuracy and computational cost.

5.2. Hardware, Software, and LLM Parameters

The implementation is carried out on a system equipped with NVIDIA A100 GPUs with 40 GB of VRAM, an Intel Xeon Gold 6338 CPU, 1 TB of RAM, and 4 TB of NVMe storage. The software environment includes Python 3.11, PyTorch 2.1, Hugging Face Transformers 4.35, CUDA 12.1, and cuDNN 8.9. For the language model backbone, GPT-2 Medium (355M parameters) is used to balance speed and accuracy, BERT Base (110M) is included for comparison, and LLAMA-3.2-3B (3B) is considered to examine the impact of model size on training time and prediction errors. These settings ensure reproducible experiments while maintaining computational efficiency and manageable memory usage, as illustrated in Figure 7.

5.3. Impact of Prompts on Overall Performance

Table 1 shows that, while TimeLLM and the MultiAttLLM benefit from prompt tuning, the SA-LLM achieves comparable or superior accuracy consistently, exhibiting lower sensitivity to prompt complexity and stronger architectural robustness.
The detailed structure of Prompt1–Prompt3 is summarized in Appendix B (Table A1).
Table 1 shows the comparison of the performance of TimeLLM, the MultiAttLLM, and the proposed SA-LLM under various prompt types. TimeLLM appears highly sensitive to the prompt’s complexity level, and the Prompt3 approach reduces its MAE performance by 8.1% compared to the no-prompt baseline. This implies a heavy reliance on prompt guidance. The MultiAttLLM’s performance remains consistent due to its multi-module attention. The SA-LLM outperforms both models across all prompts, with a negligible difference, demonstrating that its single-attention mechanism effectively captures temporal and cross-variable relationships. This proves that the superior accuracy of the SA-LLM is independent of prompt complexity and enables it to achieve efficiency and scalability in its forecasting capability.

5.4. Analysis of Model Behavior Under Varying Operating Conditions

We assessed the performance of the SA-LLM and other models across a range of operational conditions. This included normal operation and extreme events. We compared the performance of all the models in terms of the MAE, training time, and memory usage. This was done as depicted in Figure 8. The details of each model’s hyperparameters are presented in Table 2.

5.5. Hyperparameter Optimization and Training

During modeling and implementation, the training and hyperparameters were carefully selected to ensure reproducibility. In terms of the SA-LLM and other counterpart algorithms, the learning rate η , batch size B, hidden dimension H, number of layers L, and dropout p were tuned using a grid search algorithm, with stopping criteria as L val to avoid overfitting. It is worth noting that all experiments and simulations used the same data preprocessing, input windows, forecasting horizons, and evaluation metrics to ensure consistency.

Comprehensive Ablation Study on Spectral and Spatio-Temporal Components

The results of a structured ablation study on the proposed SA-LLM model are presented in Table 3. This study focuses on short-term electricity demand forecasting, with the MAE measured on a 4.68 MWh scale. Each experiment removes or modifies a single architectural component while keeping the remaining components unchanged, allowing the individual impact of each design element to be observed. The findings show that spectral graph propagation has the strongest effect on performance, leading to a 30.3% increase in the MAE when it is removed. On the other hand, the temporal gate has also played a key role in terms of error, which caused a 22.2% increase in error, followed by Laplacian normalization with an 11.3% increase. Other components, including Chebyshev polynomial filtering, fully connected graphs, and Laplacian regularization, also influence forecasting accuracy and stability, although their impact is comparatively smaller. Overall, the ablation results highlight the contribution of each component to the effectiveness of the SA-LLM framework.
Table 3. Comprehensive ablation analysis on short-term forecasting subset (MAE in 4.68 MWh scale) (↑—normal increase), ↓—normal decrease, —more than normal decrease.
Table 3. Comprehensive ablation analysis on short-term forecasting subset (MAE in 4.68 MWh scale) (↑—normal increase), ↓—normal decrease, —more than normal decrease.
Model ConfigurationMAE ↓RMSE ↓ Δ MAE (%)Performance Shift
Full SA-LLM + Spectral GCN (All Components)4.686.12Baseline
w/o Spectral Graph Propagation ( δ = 0 )6.10 ↑8.45 ↑+30.3%Severe Degradation
w/o Temporal Gating Mechanism5.72 ↑7.64 ↑+22.2%Major Degradation ↑
w/o Laplacian Normalization5.21 ↑6.89 ↑+11.3%Stability Loss ↑
w/o Chebyshev Polynomial Filtering ( K = 1 )5.34 ↑7.02 ↑+14.1%Reduced Spatial Expressiveness
Fully Connected Graph (No Gaussian Kernel)5.56 ↑7.31 ↑+18.8%Structural Over-Smoothing ↑
w/o Laplacian Regularization ( λ 2 = 0 )5.11 ↑6.89 ↑+9.2%Moderate Structural Drift
Note: MAE values are computed on a short-term forecasting subset (4.68 MWh scale) for ablation analysis. Main results on the full test set are reported in Table 4 (197 MWh scale).
Table 4. Comprehensive performance comparison across evaluation scenarios. The first group reports full benchmark forecasting metrics, while the second group reports the short-horizon error, total training time, and peak GPU memory usage.
Table 4. Comprehensive performance comparison across evaluation scenarios. The first group reports full benchmark forecasting metrics, while the second group reports the short-horizon error, total training time, and peak GPU memory usage.
Model Full Benchmark EvaluationShort-Horizon & Resource Evaluation
MAE RMSE R 2 Params (M) MAE (MWh) Training Time (h) Memory (GB)
LSTM2363250.7061.27.800.122.0
DLinear2153050.7461.58.200.101.8
Informer2102980.7562.1
Autoformer2082950.7662.3
iTransformer2072930.7662.0
TimesNet2062900.7762.4
MultiAttLLM2052880.7662.45.500.324.0
SA-LLM1972740.7963.04.680.182.5

5.6. Comparative Results

A comprehensive comparison of all evaluated models is provided in Table 4, highlighting both forecasting performance and computational efficiency. The first set of columns reports long-term benchmark metrics, including the MAE, RMSE, R 2 , and total trainable parameters, while the second set presents short-horizon operational metrics: the MAE (MWh), training time (h), and peak memory usage (GB). The SA-LLM model achieves the lowest errors in both long-term (MAE 197) and short-horizon evaluations (MAE 4.68 MWh), with moderate training time (0.18 h) and memory usage (2.5 GB), demonstrating a strong balance between predictive accuracy and resource efficiency. In contrast, baseline models such as LSTM and DLinear show higher errors and/or increased computational demands. While DLinear remains the fastest and most memory-efficient model (2 ms/iteration, 0.02 GB), its accuracy is moderate. Figure 9 compares accuracy, training time, and memory usage, whereas Figure 10 illustrates the relative error profiles across models.

5.7. Electricity Demand Forecasting Performance Analysis

Figure 11 demonstrates electricity demand forecasting profiles over a one-week time period, where the SA-LLM successfully follows the actual electricity demand more accurately, while capturing the peak values and dynamic fluctuations. On the other hand, LSTM and DLinear noticeably underestimate the real variations, and the transformer-based models follow the general trend but also struggle to capture extreme values effectively. This eventually makes the SA-LLM one of the most accurate and stable models. Similarly, the SA-LLM also exhibits lower errors and accurately tracks the actual demand profiles (Figure 12).

5.8. Performance Across Different Forecasting Horizons

In order to evaluate the accuracy over the horizon (1 to 720 h, 30 days), the average results across three targets are shown in Figure 13. It can be seen that all models perform well, with accuracy reduced for 1–24 h and declining gradually and slowly beyond the 24th hour. It is also observed that among all benchmarked models, Informer and TimesNet have maintained a comparatively higher accuracy. In addition, the SA-LLM achieves higher forecasting accuracy and demonstrates robustness among all other models. Moreover, it significantly captures long-range dependencies and reduces errors, which can be propagated in multi-step electricity demand forecasting. The SA-LLM consistently has lower errors (MAE, RMSE, MAPE) and higher R 2 across both short- and long-term forecasts (Figure 13). While all models perform well for 1–24-h horizons, errors increase and R 2 decreases for longer periods, indicating that the SA-LLM remains more reliable than the other models.

5.9. Zero-Shot Learning Analysis for Multi-Regional Forecasting

The SA-LLM framework can make accurate forecasts for new electricity markets without retraining. Suppose the model is trained on regions R train = { R 1 , , R 6 } and tested on a new region R test . At each time step t, predictions Y ^ test ( t ) are produced using the features of the test region and the states learned from the training regions (Equation (45)):
Y ^ test ( t ) = SA-LLM X test ( t ) , H R train ( t 1 ) ,
where X test ( t ) contains demand, generation, and weather features, and H R train ( t 1 ) denotes the internal states learned by the model from the training regions. The ability to forecast in unseen regions depends on how similar the new region is to those used during training. To evaluate this, a similarity score S ( R i , R j ) is calculated based on historical demand and generation patterns. Higher similarity indicates the test region behaves more like a training region. Zero-shot transfer works best when (Equation (46)):
S ( R test , R train ) = max R i R train S ( R test , R i ) .
Table 5 shows the similarity scores between the test region and each training region, along with the corresponding MAE. Regions that are more similar to the training set generally result in lower forecasting errors.
Empirically, the SA-LLM achieves up to an 18.2% lower MAE on unseen regions compared to baseline models. This demonstrates that the single-attention mechanism with auxiliary feature modeling provides robust, generalizable forecasts and effective zero-shot transfer.

5.10. Confusion Matrix-Based Diagnostic Evaluation

The predicted electricity load is grouped into three categories using quantiles: low ( C 1 ), medium ( C 2 ), and high ( C 3 ). The limits for these groups are based on the 33rd and 66th percentiles of the historical load data so that the samples are evenly distributed across the three categories. This method connects the classification results with regression metrics such as the MAE, RMSE, and R 2 , helping to evaluate how well the continuous forecasts represent different demand levels. The confusion matrices for TimeLLM, MultiAttLLM, and SA-LLM are presented together in Table 6 for a clear comparison. Each cell shows the number of samples along with the corresponding percentage for each category, while the row totals and class accuracies summarize the overall results. Among the three models, SA-LLM achieves the highest accuracy, correctly predicting more samples and producing fewer errors than TimeLLM and MultiAttLLM, indicating superior forecasting performance.
The heatmaps in Figure 14 visually compare classification performance across models. TimeLLM shows moderate accuracy with misclassifications in all demand regimes. The MultiAttLLM improves correct predictions, particularly for C 1 and C 3 , but still misclassifies a notable portion of C 2 . The proposed SA-LLM achieves the highest accuracy across all regimes, minimizing cross-class errors and demonstrating its robust ability to capture complex spatio-temporal patterns in electricity demand.

6. Performance of SA-LLM (Zero-Shot Learning)

Generalization to unseen regions was evaluated across seven major U.S. power markets: Los Angeles (CAISO), Houston (ERCOT), Chicago (MISO), Philadelphia (PJM), New York City (NYISO), Boston (ISO New England), and Kansas City (SPP). The SA-LLM was trained and tested without additional tuning, demonstrating strong performance (Table 7 and Table 8). It achieves the lowest errors across all source–target pairs. For instance, using Los Angeles (CAISO) as the source, the MAE for Houston is 235 MWh, outperforming LSTM (258 MWh) and DLinear (242 MWh). Traditional models perform well only for similar regions, while transformers achieve moderate accuracy but lag behind the SA-LLM. With Chicago (MISO) as the source, LSTM’s MAE rises to 880 MWh on Philadelphia (PJM), whereas the SA-LLM maintains 790 MWh, highlighting its robustness to unseen demand patterns and domain shifts for scalable deployment.

7. Conclusions

The SA-LLM is a novel multi-target electricity forecasting framework that integrates a single unified attention mechanism with an optional GNN to capture spatial correlations across major U.S. electricity markets, including CAISO, ERCOT, PJM, MISO, NYISO, ISO New England, and SPP. It offers a unified approach for accurate, efficient, and generalizable forecasting. The proposed SA-LLM framework demonstrates significant improvements across multiple aspects. In terms of forecasting accuracy, it reduces the MAE by up to 8.6% compared to LSTM, effectively capturing nonlinear and weather-sensitive patterns, while maintaining low errors (∼1.3%) for more stable fossil fuel generation profiles. Computationally, the SA-LLM is more efficient, reducing memory usage by 52% and training time by 38% relative to previous LLM-based methods. The model also exhibits strong zero-shot generalization, achieving an 18.2% lower MAE on unseen regions and outperforming baselines such as DLinear, Informer, Autoformer, iTransformer, TimesNet, TimeLLM, and the MultiAttLLM. Across forecasting horizons from 1 to 720 h, the SA-LLM consistently achieves the lowest MAE and RMSE (0–8 MWh), the lowest MAPE (0–25%), and the highest R 2 , confirming its robustness and scalability. Overall, these results establish the SA-LLM as an accurate, efficient, and generalizable solution for large-scale electricity forecasting and advanced energy management in dynamic, non-stationary environments.
In terms of further addressing the regional variability in large-scale power system load forecasting, the authors have analyzed the behavior of implemented models across various network service providers based on different demand profiles, climate variability, penetration of renewable capacity, and various operating practices. The simulation results regarding cross-region implementation demonstrate that forecasting errors are dynamic rather than uniform, where the regions with strong peak-demand variation, higher weather volatility, and larger renewable intermittency show comparatively wider error distribution. In contrast, the regions that maintain greater stability show lower variance and narrower confidence intervals. Ultimately, these trends confirm that regional heterogeneity is one of the primary sources of forecasting uncertainty, motivating the authors and researchers to consider region-aware modeling. In future works, the authors would be interested in extending the work in terms of (i) regional transfer learning to better address the robustness in diverse datasets, (ii) dynamically constructing the graphs that can evolve with diverse operational constraints and environmental factors, (iii) considering probabilistic forecasting models with risk and uncertainty-aware modeling and (iv) integration of regional policy and market dynamics to better improve the long-term sustainability and resilience under different events.

Author Contributions

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

Funding

This research received no external funding.

Data Availability Statement

The raw data supporting the conclusions of this article will be made available by the authors on request.

Conflicts of Interest

The authors declare no conflicts of interest.

Appendix A. Multi-Attention Large Language Model (MultiAttLLM)

The MultiAttLLM [39] integrates the strengths of channel-independent (CI) and channel-dependent (CD) strategies while avoiding prompt engineering. It first captures self-correlations of target variables and then incorporates cross-channel interactions, improving forecasting performance compared to standard CI or CD approaches.

Appendix A.1. Word Projection

The original LLM embeddings X v are projected into a compact, domain-specific space:
X w p = X v W w p , W w p R D orig × D proj .

Appendix A.2. Cross-Attention

Target and auxiliary features are combined using query-key-value (QKV) attention:
Q , K , V = X w p W Q , X w p W K , X w p W V ,
X C A = softmax Q K d k V .

Appendix A.3. Frozen LLM

The cross-attention outputs are fed into a frozen pre-trained LLM:
H = LLM frozen ( X C A ) .

Appendix A.4. Feature Extraction and Self-Attention

Auxiliary features X a u x are projected through a linear layer:
F a u x = X a u x W a u x + b a u x .
LLM outputs and auxiliary embeddings are concatenated for self-attention:
X S A = [ H ; F a u x ] ,
X S A o u t = softmax X S A W Q X S A W K d k X S A W V ,
X F F = X S A o u t W 1 + b 1 , X o u t = X F F W 2 + b 2 .

Appendix A.5. Output Projection

Finally, the output projection maps back to the target dimension:
Y ^ = X o u t W p r o j + b p r o j .

Appendix A.6. Discussion

This formulation efficiently captures temporal and cross-variable dependencies while maintaining computational feasibility. Limitations include:
  • Sequential processing introduces high computational costs.
  • The frozen LLM may underutilize numerical time-series information.
  • Complexity grows with the number of auxiliary features, potentially reducing scalability.
  • Some redundant computations over non-target variables may persist.

Appendix B. Prompt Engineering

Each level adds more context about the task, dataset, and input data. Curly braces {} indicate task-specific or dynamically computed values.

Summary Table of Prompts

Table A1. Overview of designed prompts for time-series forecasting tasks.
Table A1. Overview of designed prompts for time-series forecasting tasks.
PromptTask DescriptionDataset InfoInput Statistics
Prompt1
Prompt2
Prompt3
Note: ✓ indicates that the corresponding information is included in the prompt.
Notes: The prompt structure includes several components. First, the task description explains that the objective is to predict future values using past observations. Second, the dataset information provides details about the data, such as its frequency, weather-related features, and different types of energy generation. Third, input statistics summarize the main characteristics of the input sequence to give the model additional context. This setup allows us to examine how each part of the prompt influences model performance. While traditional LLMs often benefit from more detailed prompts, the proposed SA-LLM performs effectively even with minimal prompt information.

References

  1. Oswald, Y.; Owen, A.; Steinberger, J.K. Large Inequality in International and Intranational Energy Footprints between Income Groups and across Consumption Categories. Nat. Energy 2020, 5, 231–239. [Google Scholar] [CrossRef] [Scilit]
  2. Cang, D.; Chen, C.; Chen, Q.; Sui, L.; Cui, C. Does New Energy Consumption Conduce to Controlling Fossil Energy Consumption and Carbon Emissions? Evidence from China. Resour. Policy 2021, 74, 102427. [Google Scholar] [CrossRef] [Scilit]
  3. Khalili, R.; Khaledi, A.; Marzband, M.; Nematollahi, A.F.; Vahidi, B.; Siano, P. Robust Multi-Objective Optimization for the Iranian Electricity Market Considering Green Hydrogen and Analyzing the Performance of Different Demand Response Programs. Appl. Energy 2023, 334, 120737. [Google Scholar] [CrossRef] [Scilit]
  4. Danish, M.S.S.; Senjyu, T.; Funabashi, T.; Ahmadi, M.; Ibrahimi, A.M.; Ohta, R.; Howlader, H.O.R.; Zaheb, H.; Sabory, N.R.; Sediqi, M.M. A Sustainable Microgrid: A Sustainability and Management-Oriented Approach. Energy Procedia 2019, 159, 160–167. [Google Scholar] [CrossRef] [Scilit]
  5. Hsiao, C.-T.; Liu, C.-S.; Chang, D.-S.; Chen, C.-C. Dynamic Modeling of the Policy Effect and Development of Electric Power Systems: A Case in Taiwan. Energy Policy 2018, 122, 377–387. [Google Scholar] [CrossRef] [Scilit]
  6. Ghiasi, M.; Niknam, T.; Wang, Z.; Mehrandezh, M.; Dehghani, M.; Ghadimi, N. A Comprehensive Review of Cyber-Attacks and Defense Mechanisms for Improving Security in Smart Grid Energy Systems: Past, Present and Future. Electr. Power Syst. Res. 2023, 215, 108975. [Google Scholar] [CrossRef] [Scilit]
  7. Hong, T.; Pinson, P.; Wang, Y.; Weron, R.; Yang, D.; Zareipour, H. Energy Forecasting: A Review and Outlook. IEEE Open Access J. Power Energy 2020, 7, 376–388. [Google Scholar] [CrossRef] [Scilit]
  8. Akbary, P.; Ghiasi, M.; Pourkheranjani, M.R.R.; Alipour, H.; Ghadimi, N. Extracting Appropriate Nodal Marginal Prices for All Types of Committed Reserve. Comput. Econ. 2019, 53, 1–26. [Google Scholar] [CrossRef] [Scilit]
  9. Sharma, M.; Mittal, N.; Mishra, A.; Gupta, A. Survey of Electricity Demand Forecasting and Demand Side Management Techniques in Different Sectors to Identify Scope for Improvement. Smart Grids Sustain. Energy 2023, 8, 9. [Google Scholar] [CrossRef] [Scilit]
  10. Ghiasi, M.; Wang, Z.; Mehrandezh, M.; Jalilian, S.; Ghadimi, N. Evolution of Smart Grids towards the Internet of Energy: Concept and Essential Components for Deep Decarbonisation. IET Smart Grid 2023, 6, 86–102. [Google Scholar] [CrossRef] [Scilit]
  11. Aderibigbe, A.O.; Ani, E.C.; Ohenhen, P.E.; Ohalete, N.C.; Daraojimba, D.O. Enhancing Energy Efficiency with AI: A Review of Machine Learning Models in Electricity Demand Forecasting. Eng. Sci. Technol. J. 2023, 4, 341–356. [Google Scholar] [CrossRef] [Scilit]
  12. Román-Portabales, A.; López-Nores, M.; Pazos-Arias, J.J. Systematic Review of Electricity Demand Forecast Using ANN-Based Machine Learning Algorithms. Sensors 2021, 21, 4544. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  13. Sultana, N.; Hossain, S.Z.; Almuhaini, S.H.; Düştegör, D. Bayesian Optimization Algorithm-Based Statistical and Machine Learning Approaches for Forecasting Short-Term Electricity Demand. Energies 2022, 15, 3425. [Google Scholar] [CrossRef] [Scilit]
  14. Velasquez, C.E.; Zocatelli, M.; Estanislau, F.B.; Castro, V.F. Analysis of Time Series Models for Brazilian Electricity Demand Forecasting. Energy 2022, 247, 123483. [Google Scholar] [CrossRef] [Scilit]
  15. Jiang, W.; Wang, X.; Huang, H.; Zhang, D.; Ghadimi, N. Optimal Economic Scheduling of Microgrids Considering Renewable Energy Sources Based on Energy Hub Model Using Demand Response and Improved Water Wave Optimization Algorithm. J. Energy Storage 2022, 55, 105311. [Google Scholar] [CrossRef] [Scilit]
  16. Torres, J.F.; Martínez-Álvarez, F.; Troncoso, A. A Deep LSTM Network for the Spanish Electricity Consumption Forecasting. Neural Comput. Appl. 2022, 34, 10533–10545. [Google Scholar] [CrossRef] [Scilit]
  17. Wu, H.; Hu, T.; Liu, Y.; Zhou, H.; Wang, J.; Long, M. TimesNet: Temporal 2D-Variation Modeling for General Time Series Analysis. arXiv 2022, arXiv:2210.02186. [Google Scholar]
  18. Zhou, H.; Zhang, S.; Peng, J.; Zhang, S.; Li, J.; Xiong, H.; Zhang, W. Informer: Beyond Efficient Transformer for Long Sequence Time-Series Forecasting. Proc. AAAI Conf. Artif. Intell. 2021, 35, 11106–11115. [Google Scholar] [CrossRef] [Scilit]
  19. Wu, H.; Xu, J.; Wang, J.; Long, M. Autoformer: Decomposition Transformers with Auto-Correlation for Long-Term Series Forecasting. Adv. Neural Inf. Process. Syst. 2021, 34, 22419–22430. [Google Scholar]
  20. Iftikhar, H.; Turpo-Chaparro, J.E.; Rodrigues, P.C.; López-Gonzales, J.L. Day-Ahead Electricity Demand Forecasting Using a Novel Decomposition Combination Method. Energies 2023, 16, 6675. [Google Scholar] [CrossRef] [Scilit]
  21. Pallonetto, F.; Jin, C.; Mangina, E. Forecast Electricity Demand in Commercial Building with Machine Learning Models to Enable Demand Response Programs. Energy AI 2022, 7, 100121. [Google Scholar] [CrossRef] [Scilit]
  22. Grandón, T.G.; Schwenzer, J.; Steens, T.; Breuing, J. Electricity Demand Forecasting with Hybrid Classical Statistical and Machine Learning Algorithms: Case Study of Ukraine. Appl. Energy 2024, 355, 122249. [Google Scholar] [CrossRef] [Scilit]
  23. Cebekhulu, E.; Onumanyi, A.J.; Isaac, S.J. Performance Analysis of Machine Learning Algorithms for Energy Demand–Supply Prediction in Smart Grids. Sustainability 2022, 14, 2546. [Google Scholar] [CrossRef] [Scilit]
  24. Wang, Z.; Chen, Z.; Yang, Y.; Liu, C.; Li, X.; Wu, J. A Hybrid Autoformer Framework for Electricity Demand Forecasting. Energy Rep. 2023, 9, 3800–3812. [Google Scholar] [CrossRef] [Scilit]
  25. Wu, C.; Li, J.; Liu, W.; He, Y.; Nourmohammadi, S. Short-Term Electricity Demand Forecasting Using a Hybrid ANFIS–ELM Network Optimised by an Improved Parasitism–Predation Algorithm. Appl. Energy 2023, 345, 121316. [Google Scholar] [CrossRef] [Scilit]
  26. Sekhar, C.; Dahiya, R. Robust Framework Based on Hybrid Deep Learning Approach for Short Term Load Forecasting of Building Electricity Demand. Energy 2023, 268, 126660. [Google Scholar] [CrossRef] [Scilit]
  27. May, E.C.; Bassam, A.; Ricalde, L.J.; Soberanis, M.E.; Oubram, O.; Tzuc, O.M.; Alanis, A.Y.; Livas-García, A. Global Sensitivity Analysis for a Real-Time Electricity Market Forecast by a Machine Learning Approach: A Case Study of Mexico. Int. J. Electr. Power Energy Syst. 2022, 135, 107505. [Google Scholar] [CrossRef] [Scilit]
  28. Brown, T.B. Language Models Are Few-Shot Learners. arXiv 2020, arXiv:2005.14165. [Google Scholar] [CrossRef] [Scilit]
  29. Vaswani, A. Attention Is All You Need. Adv. Neural Inf. Process. Syst. 2017, 31, 6000–6010. [Google Scholar]
  30. Hadi, M.U.; Tashi, Q.A.; Qureshi, R.; Shah, A.; Muneer, A.; Irfan, M.; Zafar, A.; Shaikh, M.B.; Akhtar, N.; Hassan, S.Z.; et al. A Survey on Large Language Models: Applications, Challenges, Limitations, and Practical Usage. TechRxiv 2023. [Google Scholar] [CrossRef]
  31. Nazir, A.; Shaikh, A.K.; Shah, A.S.; Khalil, A. Forecasting Energy Consumption Demand of Customers in Smart Grid Using Temporal Fusion Transformer (TFT). Results Eng. 2023, 17, 100888. [Google Scholar] [CrossRef] [Scilit]
  32. 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. arXiv 2023, arXiv:2310.01728. [Google Scholar]
  33. Su, J.; Jiang, C.; Jin, X.; Qiao, Y.; Xiao, T.; Ma, H.; Wei, R.; Jing, Z.; Xu, J.; Lin, J. Large Language Models for Forecasting and Anomaly Detection: A Systematic Literature Review. arXiv 2024, arXiv:2402.10350. [Google Scholar] [CrossRef] [Scilit]
  34. Xue, H.; Salim, F.D. Promptcast: A New Prompt-Based Learning Paradigm for Time Series Forecasting. IEEE Trans. Knowl. Data Eng. 2023, 36, 6851–6864. [Google Scholar] [CrossRef] [Scilit]
  35. 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. arXiv 2023, arXiv:2310.04948. [Google Scholar]
  36. Tan, M.; Merrill, M.; Gupta, V.; Althoff, T.; Hartvigsen, T. Are Language Models Actually Useful for Time Series Forecasting? Adv. Neural Inf. Process. Syst. 2024, 37, 60162–60191. [Google Scholar]
  37. Sun, C.; Li, H.; Li, Y.; Hong, S. TEST: Text Prototype Aligned Embedding to Activate LLM’s Ability for Time Series. arXiv 2023, arXiv:2308.08241. [Google Scholar]
  38. Guo, T.; Hauptmann, E. Fine-tuning large language models for stock return prediction using newsflow. arXiv 2024, arXiv:2407.18103. [Google Scholar] [CrossRef] [Scilit]
  39. Hu, Z.; Gao, Y.; Sun, L.; Mae, M. A novel attention-enhanced LLM approach for accurate power demand and generation forecasting. Renew. Energy 2025, 252, 123465. [Google Scholar] [CrossRef] [Scilit]
  40. Liu, G.; Bai, Y.; Wen, K.; Wang, X.; Liu, Y.; Liang, G.; Zhao, J.; Dong, Z.Y. LfLLM: A large language model for load forecasting. TechRxiv 2024. [Google Scholar] [CrossRef] [Scilit]
  41. Wang, Y.; Karimi, H.A. Exploring large language models for climate forecasting. arXiv 2024, arXiv:2411.13724. [Google Scholar] [CrossRef] [Scilit]
  42. Dubey, A.; Jauhri, A.; Pandey, A.; Kadian, A.; Al-Dahle, A.; Letman, A.; Mathur, A.; Schelten, A.; Yang, A.; Fan, A.; et al. The LLaMA 3 Herd of Models. arXiv 2024, arXiv:2407.21783. [Google Scholar] [CrossRef] [Scilit]
  43. Devlin, J.; Chang, M.-W.; Lee, K.; Toutanova, K. BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding. arXiv 2018, arXiv:1810.04805. [Google Scholar]
  44. Radford, A.; Wu, J.; Child, R.; Luan, D.; Amodei, D.; Sutskever, I. Language Models are Unsupervised Multitask Learners. OpenAI Blog 2019, 1, 9. [Google Scholar]
Figure 1. Overall architecture of the proposed SA-LLM framework.
Figure 1. Overall architecture of the proposed SA-LLM framework.
Energies 19 01522 g001
Figure 2. LSTM hyperparameter sensitivity heatmap.
Figure 2. LSTM hyperparameter sensitivity heatmap.
Energies 19 01522 g002
Figure 3. Sensitivity analysis of the SA-LLM and MultiAttLLM under different architectural configurations. The SA-LLM achieves a lower or comparable validation MSE, demonstrating superior robustness and performance. (a) Validation MSE vs. model dimension (lookback window: 24, forecast horizon: 168). (b) Validation MSE vs. layers (lookback window: 24, forecast horizon: 168).
Figure 3. Sensitivity analysis of the SA-LLM and MultiAttLLM under different architectural configurations. The SA-LLM achieves a lower or comparable validation MSE, demonstrating superior robustness and performance. (a) Validation MSE vs. model dimension (lookback window: 24, forecast horizon: 168). (b) Validation MSE vs. layers (lookback window: 24, forecast horizon: 168).
Energies 19 01522 g003
Figure 4. Electricity demand and supply composition for representative U.S. markets (CAISO, ERCOT, PJM, MISO), showing total demand and generation shares by major sources: fossil fuels, nuclear, hydro, solar, wind, and biomass.
Figure 4. Electricity demand and supply composition for representative U.S. markets (CAISO, ERCOT, PJM, MISO), showing total demand and generation shares by major sources: fossil fuels, nuclear, hydro, solar, wind, and biomass.
Energies 19 01522 g004
Figure 5. Daily weather-related variables for selected U.S. cities/regions in 2025. (a) Daily maximum temperature. (b) Daily minimum temperature. (c) Daily solar radiation.
Figure 5. Daily weather-related variables for selected U.S. cities/regions in 2025. (a) Daily maximum temperature. (b) Daily minimum temperature. (c) Daily solar radiation.
Energies 19 01522 g005
Figure 6. A comparison between the MAE for different forecasting models over 2018–2025.
Figure 6. A comparison between the MAE for different forecasting models over 2018–2025.
Energies 19 01522 g006
Figure 7. Comparison of different LLM models in terms of accuracy, training time, and memory usage.
Figure 7. Comparison of different LLM models in terms of accuracy, training time, and memory usage.
Energies 19 01522 g007
Figure 8. MAE, training time, and memory indicate that SA-LLM balances accuracy and efficiency.
Figure 8. MAE, training time, and memory indicate that SA-LLM balances accuracy and efficiency.
Energies 19 01522 g008
Figure 9. Comparison of forecasting error (MAE), training time, and memory use for benchmark models and SA-LLM. Bubble size shows memory usage.
Figure 9. Comparison of forecasting error (MAE), training time, and memory use for benchmark models and SA-LLM. Bubble size shows memory usage.
Energies 19 01522 g009
Figure 10. Comparison of errors for different targets across deep learning and LLM models: (a) electricity demand, (b) renewable generation, and (c) fossil fuel generation.
Figure 10. Comparison of errors for different targets across deep learning and LLM models: (a) electricity demand, (b) renewable generation, and (c) fossil fuel generation.
Energies 19 01522 g010
Figure 11. One-week short-term electricity demand forecasts for all models.
Figure 11. One-week short-term electricity demand forecasts for all models.
Energies 19 01522 g011
Figure 12. Comparison of forecasting errors over one week.
Figure 12. Comparison of forecasting errors over one week.
Energies 19 01522 g012
Figure 13. Electricity demand forecasts (1–720 h). SA-LLM (crimson) consistently outperforms benchmarks. Metrics: MAE, RMSE, MAPE, and R 2 .
Figure 13. Electricity demand forecasts (1–720 h). SA-LLM (crimson) consistently outperforms benchmarks. Metrics: MAE, RMSE, MAPE, and R 2 .
Energies 19 01522 g013
Figure 14. Confusion matrices for TimeLLM, the MultiAttLLM, and the SA-LLM compare actual and predicted classes. The SA-LLM shows higher accuracy with fewer misclassifications. Quantile thresholds (33rd and 66th percentiles) link the classification results to regression metrics.
Figure 14. Confusion matrices for TimeLLM, the MultiAttLLM, and the SA-LLM compare actual and predicted classes. The SA-LLM shows higher accuracy with fewer misclassifications. Quantile thresholds (33rd and 66th percentiles) link the classification results to regression metrics.
Energies 19 01522 g014
Table 1. LLM forecasting performance under four prompts (task; task+dataset; task+dataset+input stats; lookback = 72, horizon = 168). MAE/RMSE in MWh, MAPE in %.
Table 1. LLM forecasting performance under four prompts (task; task+dataset; task+dataset+input stats; lookback = 72, horizon = 168). MAE/RMSE in MWh, MAPE in %.
ModelWithout PromptPrompt1Prompt2Prompt3
MAE MAPE RMSE R MAE MAPE RMSE R MAE MAPE RMSE R MAE MAPE RMSE R
TimeLLM23621.023250.7023521.793250.7022819.503120.7221716.243070.73
MultiAttLLM20215.402830.7720916.462920.7520415.902850.7720516.202880.76
Proposed SA-LLM19814.852760.7819914.922770.7819614.552730.7919714.702740.79
Table 2. Technical comparison of TimeLLM, the MultiAttLLM, and the proposed SA-LLM models.
Table 2. Technical comparison of TimeLLM, the MultiAttLLM, and the proposed SA-LLM models.
Feature/ParameterTimeLLMMultiAttLLMProposed SA-LLM
BackboneFrozen Pre-trained LLMFrozen Pre-trained LLMFrozen Pre-trained LLM
Attention MechanismSingle Temporal AttentionDual/Multi-Attention (Temporal + Cross-feature)Unified Single Attention (Temporal + Auxiliary Features)
Input Dimension X ( t ) R N × F X ( t ) R N × F X ( t ) R N × F
Output DimensionForecast Y ( t ) R N × H Forecast Y ( t ) R N × H Forecast Y ( t ) R N × H
Hidden Layer Size512512 (Temporal) + 256 (Spatial)512 (Attention-refined) + 128 (Auxiliary)
Number of Layers4 Transformer Layers4 Transformer Layers + 2 Attention Fusion Layers4 Transformer Layers (Frozen) + 1 Unified Attention Layer
Activation FunctionGELUGELUGELU + σ att
Dropout Rate0.10.10.1
OptimizerAdamWAdamWAdamW
Learning Rate 3 × 10 4 3 × 10 4 3 × 10 4
Batch Size646464
Training Epochs200200200
RegularizationWeight Decay 1 × 10 2 Weight Decay 1 × 10 2 Weight Decay 1 × 10 2 + Laplacian Smoothness
Loss FunctionMAPE + RMSEMAPE + RMSEMAPE + RMSE + 2 + Graph Laplacian Smoothness
Special FeaturesTemporal Embeddings OnlyTemporal + Spatial EmbeddingsTemporal + Auxiliary + Optional GNN Embeddings
Table 5. Zero-shot similarity metric and forecasting accuracy for an unseen test region.
Table 5. Zero-shot similarity metric and forecasting accuracy for an unseen test region.
Training RegionSimilarity to R test (S)SA-LLM MAE (MWh)
R 1 0.924.8
R 2 0.875.1
R 3 0.815.5
R 4 0.755.9
R 5 0.706.2
R 6 0.656.5
Table 6. Unified confusion matrix comparison across models, where quantile boundaries (33rd and 66th percentiles) connect classification results with regression metrics.
Table 6. Unified confusion matrix comparison across models, where quantile boundaries (33rd and 66th percentiles) connect classification results with regression metrics.
ModelActual/Predicted C 1 C 2 C 3 Accuracy
TimeLLM C 1 412
(75%)
58
(11%)
30
(14%)
500
(82%)
C 2 76
(12%)
395
(63%)
64
(25%)
635
(62%)
C 3 42
(8%)
71
(14%)
387
(78%)
500
(78%)
MultiAttLLM C 1 438
(85%)
45
(9%)
17
(6%)
500
(85%)
C 2 62
(10%)
418
(66%)
55
(24%)
635
(66%)
C 3 29
(6%)
63
(13%)
408
(81%)
500
(81%)
Proposed SA-LLM C 1 462
(92%)
28
(6%)
10
(2%)
500
(92%)
C 2 41
(6%)
452
(71%)
42
(23%)
635
(71%)
C 3 18
(4%)
39
(8%)
443
(88%)
500
(88%)
Table 7. Zero-shot forecasts from Los Angeles (CAISO) to other markets. Metrics: MAE and RMSE (MWh), 72 h lookback, and 168 h horizon.
Table 7. Zero-shot forecasts from Los Angeles (CAISO) to other markets. Metrics: MAE and RMSE (MWh), 72 h lookback, and 168 h horizon.
ModelHoustonChicagoPhiladelphiaNYCBostonKansas City
LSTM MAE2581105885830880910
LSTM RMSE34514321218117512101250
LSTM RAE0.490.560.510.500.520.53
LSTM R0.720.640.650.660.640.63
DLinear MAE242935820810825840
DLinear RMSE32012501165114511701185
DLinear RAE0.460.490.480.470.480.49
DLinear R0.740.720.690.700.680.67
SA-LLM MAE235890800795810825
SA-LLM RMSE31212201130112511401155
SA-LLM RAE0.440.460.470.460.470.48
SA-LLM R0.770.740.710.710.700.69
Table 8. Zero-shot learning performance using Houston (ERCOT) as the source domain.
Table 8. Zero-shot learning performance using Houston (ERCOT) as the source domain.
ModelLAChicagoPhiladelphiaNYCBostonKansas City
LSTM MAE2651100870835880900
LSTM RMSE36214251200118012151240
LSTM RAE0.500.550.500.510.520.53
LSTM R0.710.630.650.660.640.63
DLinear MAE235930815805820835
DLinear RMSE32212451160114011651180
DLinear RAE0.460.480.480.470.480.49
DLinear R0.730.710.690.700.680.67
SA-LLM MAE237885795790805820
SA-LLM RMSE31012151120111511301145
SA-LLM RAE0.440.460.460.460.470.48
SA-LLM R0.770.740.710.710.700.69
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Zulfiqar, M.; Gamage, K.A.A.; Rasheed, M.B. Single-Attention Large Language Model for Efficient Multi-Regional Electricity Demand and Generation Forecasting. Energies 2026, 19, 1522. https://doi.org/10.3390/en19061522

AMA Style

Zulfiqar M, Gamage KAA, Rasheed MB. Single-Attention Large Language Model for Efficient Multi-Regional Electricity Demand and Generation Forecasting. Energies. 2026; 19(6):1522. https://doi.org/10.3390/en19061522

Chicago/Turabian Style

Zulfiqar, Muhammad, Kelum A. A. Gamage, and M. B. Rasheed. 2026. "Single-Attention Large Language Model for Efficient Multi-Regional Electricity Demand and Generation Forecasting" Energies 19, no. 6: 1522. https://doi.org/10.3390/en19061522

APA Style

Zulfiqar, M., Gamage, K. A. A., & Rasheed, M. B. (2026). Single-Attention Large Language Model for Efficient Multi-Regional Electricity Demand and Generation Forecasting. Energies, 19(6), 1522. https://doi.org/10.3390/en19061522

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

Article Metrics

Back to TopTop