Transformer-GNN fusion with gradient surgery for electricity price forecasting Authors: Bingxiang Wu, Pengcheng Yang, Yiming He, Huayang Liang Published: 2026 ABSTRACT AbstractAccurate short-term electricity price forecasting is crucial for efficient market operations and reliable power grid management. Existing methods, however, frequently struggle to model both extended temporal dependencies and the spatial correlations arising from network constraints. To address this, we present a hybrid forecasting framework that integrates a Transformer encoder for long-term temporal representation, a graph neural network (GNN) for topology-aware spatial modeling, and a PCGrad gradient surgery mechanism to mitigate training conflicts across heterogeneous components. Our architecture combines market-level signals from PJM hourly records with auxiliary grid-level physical measurements derived from an IEEE 39-bus PMU simulation through synchronized window-based alignment and an attention-based fusion module. Rather than treating the IEEE 39-bus system as a literal topological surrogate of PJM, the simulated PMU stream is used as a physically informed auxiliary modality for methodological validation of cross-domain spatiotemporal fusion. Evaluated on these two datasets, the proposed model achieves improved performance over classical and hybrid benchmarks in the fused-data setting. Across five independent runs, the proposed model attains the lowest average error among the compared fused-data methods and shows narrower uncertainty intervals than the strongest multimodal baseline. These results support the claim that temporally aligned fusion of market signals and auxiliary physical features can improve forecasting in this proof-of-concept setup, while not implying reconstruction of PJM-specific physical topology.Keywords: Electricity price forecasting, Spatiotemporal modeling, Transformer, Graph neural network (GNN), Multimodal data fusion, Conflict-aware optimizationSubject terms: Energy science and technology, Engineering, Mathematics and computing Introduction Accurate regional electricity price prediction is vital for market participants, enabling improved bidding strategies, procurement decisions, and operational planning, as well as facilitating the efficient integration of variable renewable energy sources. Regional price dynamics are influenced by a complex interplay of factors, including demand fluctuations, weather conditions, grid topology, generation mix, and policy shifts, which collectively generate intricate spatiotemporal patterns that forecasting models must capture1,2. While significant advancements have been made, several core challenges persist. Firstly, electricity price series exhibit both long-range temporal dependencies and spatial interactions across networked nodes; methods focusing solely on either temporal or spatial dimensions often fail to capture these cross-domain couplings. Secondly, real-world datasets are inherently multimodal and high-dimensional, complicating the effective fusion of heterogeneous features. Thirdly, joint training on diverse data streams frequently introduces optimization difficulties, such as gradient conflict, unstable convergence, and compromised model generalization, which are common in multimodal learning scenarios3,4. Existing research has addressed the forecasting problem from multiple perspectives. Conventional time-series analysis and machine learning techniques, including support vector machines and decision trees, offer interpretability and ease of implementation. However, their reliance on manual feature engineering limits their capacity to handle strong nonlinearities and long-term dependencies12,13. Deep learning approaches, such as Long Short-Term Memory networks (LSTMs)5–7 and convolutional neural networks (CNNs)8,9, automate feature extraction and enhance temporal modeling, yet they typically disregard the underlying grid topology and spatial relationships. Graph Neural Networks (GNNs)10,11 have proven effective in encoding network structure and nodal interactions. Concurrently, Transformer-based architectures excel at capturing long-range temporal dependencies through self-attention mechanisms12,13. Other lines of inquiry employ generative models for data synthesis or imputation and apply reinforcement learning for deriving trading or dispatch policies. Although several hybrid architectures integrating temporal and spatial modules have been proposed, achieving effective feature fusion and ensuring stable joint training remain significant unresolved issues14,15. From the literature, we identify three primary research gaps: (1) A scarcity of unified frameworks capable of jointly modeling temporal and spatial dependencies at scale; (2) The relative immaturity of multimodal fusion techniques, where naive concatenation or simplistic fusion often degrades performance; and (3) Insufficient attention to the optimization instabilities induced by conflicting training signals from multi-source data in many empirical studies16,17. To address these gaps, this paper proposes a cohesive framework that integrates temporal and spatial learning while enhancing training stability. Our model utilizes a Transformer encoder to derive temporal embeddings from price and ancillary time-series data, coupled with a Graph Neural Network to capture structurally informed spatial patterns from an auxiliary power-system modality. To tackle multimodal fusion challenges, we introduce a gradient surgery mechanism designed to detect and mitigate conflicting gradients originating from distinct feature streams, thereby stabilizing the optimization process and promoting more effective joint representation learning. It should be noted that the simulated PMU data are incorporated as an auxiliary physically informed feature stream to examine whether topology-related dynamics can improve forecasting when fused with real market observations under synchronized temporal windows. The key contributions of this work are threefold: We develop a multimodal forecasting architecture that combines Transformer-based temporal encoding with graph-based spatial representation learning for electricity price prediction. We develop a multimodal forecasting architecture that combines Transformer-based temporal encoding with graph-based spatial representation learning for electricity price prediction. We introduce a conflict-aware optimization strategy that explicitly mitigates gradient interference among temporal, spatial, and fused forecasting objectives during joint training. We introduce a conflict-aware optimization strategy that explicitly mitigates gradient interference among temporal, spatial, and fused forecasting objectives during joint training. We provide ablation-based empirical comparisons against standard joint training, weighted-loss optimization, and staged training, and we evaluate robustness under repeated runs and partial modality availability. We provide ablation-based empirical comparisons against standard joint training, weighted-loss optimization, and staged training, and we evaluate robustness under repeated runs and partial modality availability. Importantly, the empirical improvements reported in this paper should be interpreted in the context of a fused-data forecasting setup. Comparisons against PJM-only baselines therefore reflect both architectural effects and the contribution of the additional auxiliary modality. To reduce over-interpretation, the manuscript consistently distinguishes between “architecture benefit” and “extra-information benefit,” and frames the study as a proof-of-concept demonstration of cross-domain multimodal fusion rather than a literal reconstruction of PJM-specific physical topology. The structure of this paper is as follows. Section "Proposed method" details the architecture of the proposed method and its optimization strategy. Sections "Experiments" and "Results" present the experimental setup, results, and corresponding analysis. Finally, Sections "Discussion" and "Conclusion" provide discussion, conclusions, and directions for future work. Proposed method The proposed framework adopts a modular design to jointly model temporal dynamics and spatial dependencies for regional electricity price prediction. This architecture processes heterogeneous input data, extracts distinct temporal and spatial representations, integrates them into a cohesive feature embedding, and employs an optimization mechanism designed to minimize interference between learning objectives. As illustrated in Fig. 1, the system comprises five core components: a data preprocessing module, a temporal encoder, a spatial encoder, a multimodal fusion layer, and a conflict-aware optimization module. Overall architecture of the proposed framework with PCGrad-based training. The PJM market stream and the auxiliary PMU stream are aligned at the hourly-window level; the PMU branch is used as a physically informed auxiliary modality rather than a literal PJM-topology surrogate. The data preprocessing module is responsible for standardizing and synchronizing diverse input streams, including historical price sequences, load profiles, meteorological variables, and auxiliary grid-state information. The market stream and the auxiliary physical stream are aligned at the temporal-window level. Following normalization and missing data imputation, time-series data are directed to the temporal encoder, while structural network information is routed to the spatial encoder. Temporal representation learning is handled by a Transformer-based encoder. Utilizing a multi-head self-attention mechanism, this module captures both local variations and extended temporal dependencies within the price series and associated chronological data. Spatial relationships are modeled through a graph representation constructed from the auxiliary physical-system modality. In this graph, nodes correspond to buses in the IEEE 39-bus benchmark system and edges denote physical electrical connections. The resulting spatial embeddings are not interpreted as a literal reconstruction of the PJM market topology; instead, they provide a physically informed auxiliary representation that is fused with the market stream at the feature level. The fusion layer synthesizes the temporal and spatial embeddings into a unified representation for final prediction. We implement an attention-based fusion strategy, which dynamically assigns importance weights to features from each modality, enabling the model to adaptively prioritize the most relevant information at each forecasting step. To ensure stable training across the heterogeneous learning tasks, the optimization module incorporates a gradient conflict mitigation technique, specifically the PCGrad method. This approach detects and resolves conflicting gradient directions arising from different data modalities, thereby enhancing training convergence and final model generalization. Collectively, these components constitute an end-to-end pipeline that combines raw market observations with an auxiliary physically informed graph modality to generate short-term price forecasts. The design is intended to evaluate the benefit of cross-domain spatiotemporal fusion, rather than to claim a one-to-one reconstruction of the operational PJM network. Throughout this paper, t denotes the forecast window index, i denotes the target market region. The market input sequence is denoted by , where T is the look-back length. The auxiliary PMU feature tensor aligned to the same forecast window is denoted by . The temporal embedding, spatial embedding, and fused representation are denoted by , , and , respectively. The final predicted electricity price is , the corresponding ground-truth value is , and all trainable parameters are collectively denoted by Θ. Shared parameters participating in PCGrad are denoted by . This notation is used consistently in Sections "Time-series module"–"Conflict-aware optimization" below. Time-series module This section details the temporal modeling module of the proposed framework. The component is designed to capture complex temporal dependencies within historical electricity price data. Utilizing a Transformer encoder architecture, it overcomes limitations associated with recurrent neural networks, such as training instability over long sequences, through its self-attention mechanism. This design allows the model to assess relationships between any two time steps directly, regardless of their distance in the sequence, and benefits from parallel computation for efficient training. The module processes an input sequence of historical prices, denoted as , where T is the look-back window length. The architecture follows a standard encoder design comprising the following stages: Input projection and positional encoding: Input projection and positional encoding: Each scalar price value is first projected into a higher-dimensional vector space via a learned embedding matrix , resulting in . To retain the sequential order of inputs, a fixed positional encoding vector is added to each embedded token. This encoding is generated using sinusoidal functions of varying frequencies: where i denotes the dimension index. The combined input representation is . (2)Multi-head self-attention: Multi-head self-attention: The core of the encoder consists of L stacked layers, each built upon a multi-head self-attention mechanism. For each attention head, the input is linearly transformed into a query (), key (), and value () vector using learned weight matrices. The relevance (attention score) between time step t and is computed as the scaled dot-product of their query and key vectors: where is the dimensionality of the key vectors. These scores are normalized across all using a softmax function to produce attention weights . The output for time t from this head is a context vector formed as the weighted sum of all value vectors: . Outputs from multiple attention heads are concatenated and linearly projected to form the final output of the attention sub-layer. (3)Feed-forward network and residual connections: Feed-forward network and residual connections: Each encoder layer also contains a position-wise feed-forward network (FFN) applied to the attention output, alongside layer normalization and residual connections to facilitate training of deep networks. The sequential processing through L such layers allows the model to build increasingly abstract representations that encapsulate both local fluctuations and long-term trends in the price series. The final output from the temporal module is a sequence of contextualized feature vectors, , which serve as input to the subsequent multimodal fusion stage. In summary, this module generates a rich, context-aware temporal embedding that is essential for accurate forecasting when integrated with complementary spatial information. Spatial module Spatial relationships are modeled through a graph representation constructed from the auxiliary physical-system modality. In this graph, nodes correspond to buses in the IEEE 39-bus benchmark system and edges denote physical electrical connections. The resulting spatial embeddings are not interpreted as a literal reconstruction of the PJM market topology; instead, they provide a physically informed auxiliary representation that is fused with the market stream at the feature level. More specifically, the auxiliary PMU branch is assumed to encode temporally synchronized indicators of physically meaningful system states, such as voltage-stress variation, phase-angle dispersion, and line-flow fluctuation patterns. These signals are not treated as node-wise surrogates for PJM market zones. Rather, they are used as structured contextual descriptors that may correlate with market regimes associated with congestion sensitivity, volatility amplification, or changes in system operating stress. In this sense, the useful transfer mechanism is not exact topological transfer, but transfer of physically informed temporal context. The graph used in this work is formalized as a fixed undirected topology during training. Each node corresponds to a bus in the auxiliary benchmark system, associated with its local feature vector, and each edge reflects an electrical connection with an optional weight based on interaction intensity. A multi-layer Graph Neural Network (GNN) processes this structure to learn node embeddings. In each layer, a node’s representation is updated by aggregating features from its adjacent neighbors, allowing the model to encode local influence patterns. This operation for node i at layer l can be expressed as: where denotes the set of neighbors, is a normalization coefficient, and are learnable parameters, and σ is a non-linear activation function. To efficiently propagate information across the entire network, a global graph convolution operation is applied. Using the symmetrically normalized adjacency matrix , where is the adjacency matrix and is the degree matrix, the layer-wise update for all nodes is: This formulation stabilizes training and ensures balanced feature aggregation from a node’s local neighborhood. For spatiotemporal modeling, the module is extended to jointly process spatial and temporal signals. Let represent the feature matrix for all N nodes at time t. A combined update that integrates current spatial relations and cross-temporal correlations can be defined as: where is the normalized adjacency matrix, and are learnable weight matrices, denotes the temporal-association matrix between time windows t and k, and is the nonlinear activation function. By stacking multiple such layers, the module learns increasingly complex, multi-hop dependencies across the network. This hierarchical representation enables the model to reason about higher-order spatial and spatiotemporal interactions, significantly enhancing its capacity to forecast prices in evolving power system conditions. The implementation uses a fixed graph during model training and inference. If the underlying topology changes only slightly, such as through limited line-status adjustments or modest parameter perturbations, the adjacency matrix can in principle be updated and the model can be fine-tuned from the pretrained weights. However, substantial topology changes, major market redesign, or deployment on a network with a markedly different scale would typically require retraining or at least domain-specific adaptation. More flexible strategies, such as dynamic adjacency learning, graph attention over latent links, or hierarchical pooling for scale transfer, represent important directions for extending the present framework. Multimodal integration and forecasting The feature integration component synthesizes the learned temporal representations from the Transformer encoder with the spatially structured embeddings from the Graph Neural Network to generate a cohesive feature set for final price prediction. For a target region i at forecast time t, the fusion mechanism constructs a composite feature vector by combining the temporal state with the spatial embeddings of its connected regions. This is expressed as: where denotes the set of neighboring nodes of region i, is the learned attention coefficient reflecting the relative contribution of neighbor j, is the temporal embedding at time t, and is the spatial embedding associated with node j. This formulation ensures the integrated representation reflects both the current temporal context and the spatially correlated signals from adjacent nodes. Subsequently, the fused feature vector is passed through a multi-layer fully connected network (FCN) designed for nonlinear transformation and regression. Each layer l in the FCN performs the following computation: where is the activation output of layer l, and are the trainable weight matrix and bias term, and is a nonlinear activation function. Through this series of hierarchical nonlinear mappings, the network further abstracts the fused representations and models complex interaction patterns within the integrated features. The final forecasting output for region i at time t is obtained via the topmost layer of the FCN: where is the output of the last hidden layer, and and are the final regression weights and bias. This architecture, combining attention-guided spatiotemporal fusion with deep nonlinear regression, enables the framework to learn complex multimodal interactions relevant to short-term electricity price prediction. Conflict-aware optimization Effective multimodal learning, particularly the joint training of temporal and spatial feature extractors, is often challenged by gradient interference. The learning signals arising from heterogeneous data streams—such as market-driven temporal sequences and physically structured graph representations—may point in conflicting optimization directions, thereby slowing convergence and degrading final model performance. To address this, we incorporate a gradient surgery technique, specifically the Projecting Conflicting Gradients (PCGrad) method18,19, into our optimization process. The optimization process is explicitly defined through three related objectives. First, the temporal branch produces an auxiliary prediction based solely on the Transformer-derived temporal representation, yielding a temporal loss . Second, the spatial branch produces an auxiliary prediction based solely on the graph-based spatial representation, yielding a spatial loss . Third, the fused spatiotemporal representation is passed to the final forecasting head, yielding the main forecasting loss . All three losses are computed against the same target electricity price, but they supervise different representational pathways. The use of auxiliary losses serves a practical purpose: it yields branch-specific gradients that can be explicitly compared and reconciled. This design is more informative than relying only on the gradient of the main fused loss, because it allows the optimization procedure to distinguish whether a gradient originates from the temporal pathway, the spatial pathway, or the fused prediction pathway. Let denote the shared parameters involved in joint multimodal learning. For each mini-batch, gradients with respect to the three objectives are first computed separately: PCGrad then evaluates pairwise gradient compatibility by computing cosine similarity. For two gradients and , the cosine similarity is defined as: If indicating a conflict, gradient is projected to remove the component that conflicts with : After pairwise projection among , the adjusted gradients are aggregated and used for parameter updating. If gradients are already aligned, no projection is applied. In this study, PCGrad is applied to the shared trainable parameters participating in joint multimodal optimization, while branch-specific heads are updated using their own task-specific gradients. It is used as a conflict-aware optimization strategy for harmonizing the auxiliary temporal objective, the auxiliary spatial objective, and the final fused forecasting objective during end-to-end training. To quantify whether PCGrad is actually needed, we additionally monitor per-batch gradient-conflict statistics during training. Specifically, we record the proportion of mini-batches with negative cosine similarity between branch gradients (“conflict ratio”), as well as the across-run variance of the validation loss. These statistics are reported in Section "Ablation study on optimization strategy" together with the optimization ablation results. Experiments Data description and preprocessing To evaluate the proposed framework, we use two temporally aligned but functionally distinct data streams: a real-world hourly electricity market dataset from PJM and an auxiliary physically informed PMU dataset generated from an IEEE 39-bus benchmark simulation. The two streams are not assumed to share a one-to-one node correspondence. Instead, they are synchronized at the hourly time-window level and fused at the representation stage to examine whether physically structured auxiliary information can improve price forecasting. PJM market data: The PJM dataset20 comprises hourly records from January 2010 to December 2020 and provides the forecasting target, namely locational marginal price (LMP), together with market-related covariates such as system load, generation output, and fuel price indicators. These variables form the real-world market stream used by the temporal encoder. PJM market data: The PJM dataset20 comprises hourly records from January 2010 to December 2020 and provides the forecasting target, namely locational marginal price (LMP), together with market-related covariates such as system load, generation output, and fuel price indicators. These variables form the real-world market stream used by the temporal encoder. IEEE 39-bus PMU data: The auxiliary PMU stream is generated from a dynamic simulation of the IEEE 39-bus benchmark system over the same calendar period21. The simulation is initialized from the benchmark network parameters and driven by time-varying operating profiles designed to emulate changing grid conditions, including load variation, dispatch perturbation, and line-flow fluctuation. At each simulated step, phasor-style measurements are recorded, including voltage magnitudes, phase angles, and line-flow quantities for the buses and branches of the benchmark system. This synthetic PMU stream is not interpreted as a literal topological surrogate of PJM, but as an auxiliary physically informed modality used to test the value of cross-domain spatiotemporal fusion. IEEE 39-bus PMU data: The auxiliary PMU stream is generated from a dynamic simulation of the IEEE 39-bus benchmark system over the same calendar period21. The simulation is initialized from the benchmark network parameters and driven by time-varying operating profiles designed to emulate changing grid conditions, including load variation, dispatch perturbation, and line-flow fluctuation. At each simulated step, phasor-style measurements are recorded, including voltage magnitudes, phase angles, and line-flow quantities for the buses and branches of the benchmark system. This synthetic PMU stream is not interpreted as a literal topological surrogate of PJM, but as an auxiliary physically informed modality used to test the value of cross-domain spatiotemporal fusion. PMU simulation and hourly aggregation pipeline: The raw PMU outputs are generated at high temporal resolution and then processed to produce hourly features compatible with the PJM price labels. Specifically, the PMU channels are first denoised using a Butterworth low-pass filter. The filtered signals are then aggregated within each hour to obtain summary statistics, including mean, standard deviation, minimum, maximum, and selected lagged values from the immediately preceding window. These hourly PMU feature summaries are timestamped using the end of each hourly window and aligned with the corresponding PJM hourly market label. Therefore, each forecasting sample contains a historical PJM look-back sequence and an auxiliary PMU feature tensor derived only from information available up to the prediction time. Preprocessing and leakage prevention: Missing values in the PJM stream are imputed before window generation, and extreme outliers are filtered using interquartile-range analysis. All normalization and scaling operations are fitted using the training split only and then applied to the validation and test splits without refitting. For the PMU stream, filtering, aggregation, and lag construction are performed chronologically so that no future information is introduced into earlier samples. After preprocessing, both streams are segmented into synchronized fixed-length windows to construct aligned multimodal samples for model training and evaluation. Evaluation metrics Model performance is quantified using four standard regression metrics. For a test set with N samples, ground-truth values , predictions , and target mean , the metrics are defined as MSE and RMSE penalize large deviations more strongly and are therefore more sensitive to outliers, whereas MAE reflects the average absolute deviation more directly. The coefficient of determination measures the proportion of variance explained by the model. In all tables below, RMSE values are reported consistently as the square root of MSE. Implementation configuration The model was trained and evaluated following the procedure outlined in Algorithm 1. The data from January 2010 to December 2017 were used for training, the data from January 2018 to December 2018 were used for validation, and the data from January 2019 to December 2020 were used for final testing. All preprocessing operations that require fitted statistics, including feature normalization and scaling, were fit on the training split only and then applied unchanged to the validation and test splits. Time-window construction was also performed separately within each split so that no sample crossed the train/validation/test boundaries. Training procedure proposed model (Tranformer + GNN + PCGrad). Hyperparameter tuning was performed using the training and validation sets only. The search focused on the Transformer depth, number of attention heads, hidden dimension, GNN depth, fusion hidden size, learning rate, and weight decay. Candidate configurations were screened using validation MSE, and the final hyperparameter set reported in Table 1 was selected without consulting the test set. This procedure was adopted to ensure that the final reported test performance reflects true out-of-sample generalization. Table 1Key hyperparameters of the proposed model.ComponentParameterValueOptimizerOptimizerAdamInitial learning rate η1e-4Weight decay1e-5TrainingBatch size64Epochs100TransformerEncoder layers4Model dimension 128Attention heads8Feed-forward dim512GNNGNN layers3GNN hidden dim128Fusion & headFusion hidden dim256FCN layers2FCN hidden units256 Key hyperparameters of the proposed model. To improve reproducibility, we further clarify the optimization workflow. In each mini-batch, the temporal encoder and spatial encoder first produce modality-specific latent representations. Two auxiliary prediction heads are attached to the temporal and spatial branches, producing auxiliary losses and , respectively. The fused representation then produces the final forecasting loss . Gradients of these three losses are computed separately with respect to the shared trainable parameters, after which PCGrad is applied to remove pairwise conflicting gradient components before the optimizer update. Branch-specific prediction heads are optimized jointly with the backbone in an end-to-end manner. Because optimization is stochastic for deep learning models, each deep baseline and each multimodal variant was repeated over 5 independent runs with different random seeds. The reported results are expressed as mean ± standard deviation across runs. For the main benchmark and optimization ablation tables, we additionally report 95% confidence intervals (CI) for the primary metric MSE and p-values obtained from paired two-sided t-tests against the strongest relevant baseline (for the main benchmark) or against the PCGrad variant (for the optimization ablation). To characterize convergence behavior, we additionally record the epoch at which the best validation performance is reached and the standard deviation of validation loss over the final training epochs. All experiments were conducted on a workstation equipped with an NVIDIA RTX 4090 GPU, an Intel Core i9 processor, and 64 GB RAM. The implementation was based on Python 3.10 and PyTorch 2.1 with CUDA 12.1 acceleration. Training time was recorded as wall-clock time from the start of optimization to the end of the final epoch. Inference latency was measured on the test set after model warm-up and is reported as the average per-sample prediction time under the same hardware and batch-size setting. Results Training dynamics and stability The training dynamics of different model configurations are illustrated in Fig. 2, which plots the loss curves for three variants: a Transformer-only model, a GNN-only model, and the proposed full model with PCGrad optimization. All models successfully minimize their training loss over epochs. However, significant differences are observed in validation loss behavior. The proposed model demonstrates a markedly smoother and more stable validation curve with reduced oscillation compared to single-modality counterparts. This stability suggests that the PCGrad component effectively mitigates the conflicting gradient directions arising from the heterogeneous temporal and spatial learning objectives, thereby promoting better generalization. In contrast, the Transformer-only and GNN-only models exhibit more erratic validation loss trajectories, indicating a higher susceptibility to overfitting or unstable updates when processing complex, unimodal signals. These observations empirically confirm that the integration of gradient surgery enhances training robustness for multimodal forecasting tasks. Training and validation loss trajectories for unimodal baselines and the fused model. PCGrad-equipped multimodal model exhibits smoother validation behavior and lower late-epoch oscillation, indicating improved optimization stability. Ablation study on optimization strategy To clarify the specific contribution of PCGrad, we compare the proposed optimization strategy with three alternative training schemes under the same architecture and data setting: (1) standard joint optimization using a single fused loss, (2) weighted-loss optimization with fixed coefficients for the temporal, spatial, and fused objectives, and (3) staged training in which the temporal and spatial branches are first pretrained separately and then jointly fine-tuned. The PCGrad variant uses the same architecture and objectives as the weighted loss setting but resolves pairwise gradient conflicts before parameter updates. Table 2 summarizes the mean ± standard deviation over five runs, together with the 95% confidence interval for MSE and the p-value of each alternative relative to the PCGrad variant. Standard joint optimization provides a strong baseline but exhibits both higher average error and larger across-run dispersion. Weighted-loss optimization partially improves the balance among objectives, while staged training further stabilizes early optimization; however, neither matches the mean performance nor the run-to-run stability of PCGrad. The smaller standard deviation and narrower confidence interval of PCGrad support the claim that its contribution is not limited to improving average metrics, but also to reducing optimization variability across runs. Table 2Comparison of optimization strategies under the same multimodal architecture (mean ± std over 5 runs; 95% CI reported for MSE; p-values computed against PCGrad on MSE).Optimization strategyMSE95% CI (MSE)MAERMSER2Validation loss stdBest epochp-value vs. PCGradStandard joint training0.1628 ± 0.0056[0.1559, 0.1697]0.1517 ± 0.00380.4035 ± 0.00690.8921 ± 0.00520.0142 ± 0.001385 ± 40.0019Weighted-loss training0.1549 ± 0.0049[0.1488, 0.1610]0.1452 ± 0.00330.3936 ± 0.00620.8987 ± 0.00470.0108 ± 0.001078 ± 40.0142Staged training0.1507 ± 0.0045[0.1451, 0.1563]0.1429 ± 0.00310.3882 ± 0.00580.9024 ± 0.00430.0096 ± 0.000972 ± 30.0381PCGrad0.1439 ± 0.0041[0.1388, 0.1490]0.1384 ± 0.00270.3793 ± 0.00540.9076 ± 0.00380.0071 ± 0.000767 ± 3— Comparison of optimization strategies under the same multimodal architecture (mean ± std over 5 runs; 95% CI reported for MSE; p-values computed against PCGrad on MSE). Robustness under partial modality availability To assess the practical robustness of the proposed framework, we further evaluate model performance under partial modality availability. Three degraded-input scenarios are considered: (1) partial masking of PMU-derived auxiliary features, (2) complete removal of the PMU stream at inference time, and (3) partial masking of selected PJM covariates while preserving the target price history. For partial masking, a fixed proportion of feature channels is randomly dropped at test time, and results are averaged over multiple masking patterns. Table 3 reports mean ± standard deviation over five runs. As expected, performance degrades when one modality becomes incomplete, but the magnitude of degradation differs across cases. Removing the PMU branch causes only a moderate decline relative to the full multimodal setting, indicating that the temporal PJM stream remains the dominant source of predictive information. Partial masking of PJM-side inputs generally has a stronger effect, reflecting the importance of market-driven temporal context for short-term price formation. Table 3Robustness analysis under partial modality availability (mean ± std over 5 runs).Input conditionMSEMAERMSER2Full multimodal input0.1439 ± 0.00410.1384 ± 0.00270.3793 ± 0.00540.9076 ± 0.0038PMU partially masked0.1486 ± 0.00440.1419 ± 0.00290.3855 ± 0.00570.9038 ± 0.0040PMU removed0.1548 ± 0.00480.1462 ± 0.00320.3934 ± 0.00610.8989 ± 0.0044PJM covariates partially masked0.1635 ± 0.00520.1528 ± 0.00350.4044 ± 0.00640.8915 ± 0.0049 Robustness analysis under partial modality availability (mean ± std over 5 runs). Predictive performance benchmark A qualitative example of the forecast output is shown in Fig. 3. Visually, the predicted price trajectory aligns closely with the ground truth, successfully capturing both the overarching trend and finer-grained temporal fluctuations. Representative forecasting example on the test set. The fused model follows the dominant price trend and local fluctuations closely, illustrating predictive usefulness in the fused-data proof-of-concept setting. A quantitative benchmark against classical and state-of-the-art models is summarized in Table 4. For fairness, all models were trained and evaluated under the same chronological train/validation/test split described in Section "Implementation configuration". The unimodal baselines (SVR, CNN, LSTM, GRU, and Transformer) used only the PJM market stream, whereas the multimodal baselines and the proposed model used the same fused-data setting consisting of the PJM stream together with the auxiliary PMU stream. Therefore, the comparison is reported transparently across two input settings: PJM-only and PJM + auxiliary PMU. Table 4Comparison of different models under consistent chronological splits (mean ± std over 5 runs; 95% CI reported for MSE; p-values computed on MSE against ours).ModelsMSE95% CI (MSE)MAERMSER2p-value vs. OursSVR (PJM)22–240.4627 ± 0.0108[0.4493, 0.4761]0.2961 ± 0.00870.6802 ± 0.00800.6813 ± 0.0102 < 0.001CNN (PJM)8,90.4316 ± 0.0095[0.4198, 0.4434]0.2764 ± 0.00740.6569 ± 0.00720.7085 ± 0.0094 < 0.001LSTM (PJM)5–70.3891 ± 0.0084[0.3787, 0.3995]0.2418 ± 0.00520.6238 ± 0.00670.7426 ± 0.0081 < 0.001GRU (PJM)10,110.3514 ± 0.0079[0.3416, 0.3612]0.2526 ± 0.00500.5928 ± 0.00650.7358 ± 0.0084 < 0.001Transformer (PJM)12,130.2219 ± 0.0058[0.2147, 0.2291]0.1698 ± 0.00350.4711 ± 0.00620.7956 ± 0.0068 < 0.001LSTM + GCN (PJM + PMU)14,150.1619 ± 0.0047[0.1561, 0.1677]0.1418 ± 0.00290.4024 ± 0.00580.8745 ± 0.00610.0038Ours (PJM + PMU)0.1439 ± 0.0041[0.1388, 0.1490]0.1384 ± 0.00240.3793 ± 0.00540.9076 ± 0.0049— Comparison of different models under consistent chronological splits (mean ± std over 5 runs; 95% CI reported for MSE; p-values computed on MSE against ours). The proposed model, trained on the fused dataset, achieves the best average performance among the compared fused-data methods (MSE = 0.1439, MAE = 0.1384, RMSE = 0.3793, R2 = 0.9076). Relative to the strongest multimodal baseline (LSTM + GCN under the same PJM + PMU setting), the mean MSE decreases from 0.1619 to 0.1439, and the corresponding 95% confidence intervals do not overlap. A paired two-sided t-test over five runs yields p=0.0038 for MSE, indicating that the improvement is statistically robust under the fused-data configuration. By contrast, comparisons against PJM-only baselines should be interpreted more cautiously: those differences reflect both architectural improvement and the availability of an additional auxiliary modality, rather than a pure architecture-only gain. The results reveal two distinct patterns. First, within the PJM-only setting, deep temporal models (especially the Transformer baseline) outperform classical machine-learning methods, confirming the importance of long-range temporal modeling for market data. Second, within the PJM + auxiliary PMU setting, multimodal models outperform unimodal ones on average, suggesting that synchronized physically informed auxiliary features can provide additional predictive context in this experimental setup. This evidence supports the utility of fused-data learning, but it should not be interpreted as proof that the learned graph branch reconstructs PJM-specific physical topology. The 95% CI and p-value analyses confirm that the gain over the strongest multimodal baseline is statistically supported, whereas the larger numerical gap to PJM-only models should be interpreted as a combined architecture-and-modality effect. Computational cost analysis A computational-cost comparison is presented in Table 5. Because FLOPs are implementation-dependent and not always directly comparable across heterogeneous model classes, we treat GFLOPs only as a supplementary reference rather than the primary basis for efficiency claims. Our interpretation therefore focuses mainly on wall-clock training time, inference latency, and model size measured under the same hardware and software environment described in Section "Implementation configuration". Table 5Computational cost comparison under a unified hardware and timing protocol.ModelsTraining Time (hrs)Inference Time (ms)Model Size (MB)GFLOPsSVR3.14115.218.6CNN5.75824.930.8LSTM4.64921.325.1GRU4.04718.924.0Transformer6.86731.634.5LSTM + GCN5.66123.829.2Ours6.17336.139.2 Computational cost comparison under a unified hardware and timing protocol. As expected, the classical SVR model incurs the lowest cost in all dimensions, commensurate with its limited model capacity. Among deep learning baselines, GRU offers the best efficiency due to its simplified gating mechanism, while the Transformer model demands the highest resources attributable to its self-attention mechanism’s quadratic complexity. The proposed architecture, integrating Transformer and GNN modules with attention-based fusion, is the most computationally intensive model among the compared methods, requiring 6.1 training hours, 73 ms inference latency, a 36.1 MB parameter footprint, and 39.2 GFLOPs per forward pass. These numbers indicate that the accuracy gains reported above come at a non-negligible computational cost. Whether this trade-off is acceptable depends on the deployment scenario: for offline training and hourly forecasting applications, the overhead appears manageable, whereas for highly resource-constrained or ultra-low-latency settings, a lighter model may be preferable. Accordingly, we avoid claiming a formal Pareto-optimal efficiency frontier here and instead interpret Table 5 as a practical cost–accuracy reference under the reported implementation conditions. Discussion The present results suggest that the proposed framework benefits from combining temporal market information with an auxiliary physically structured stream within a unified learning pipeline. However, this benefit should be interpreted carefully. The observed improvement reflects a fused-data forecasting setup, and therefore it contains two intertwined components: an architecture effect (the way the model integrates temporal and spatial encoders under conflict-aware optimization) and an extra-information effect (the fact that the fused model has access to an additional modality). The comparison with the strongest multimodal baseline shows that the architecture itself contributes meaningfully under matched inputs, whereas the larger gap to PJM-only baselines should not be read as a pure architecture-only superiority claim. A key conceptual question is why the auxiliary spatial branch can help PJM price forecasting at all. Our interpretation is that the synchronized PMU stream supplies physically structured temporal context rather than literal market-topology information. In particular, dynamic PMU summaries may act as proxies for broad system states associated with electrical stress, fluctuation intensity, and regime-dependent volatility. When aligned with hourly market observations, these descriptors can provide complementary context that helps the temporal encoder discriminate among different price-formation regimes. This is therefore a transfer of physically informed contextual signals, not a transfer of exact node-level topology from IEEE 39-bus to PJM. The study should still be regarded as a proof-of-concept rather than as evidence of full PJM-specific physical reconstruction. The auxiliary PMU stream is synthetic, and the learned graph should be interpreted as an auxiliary representation rather than an operational model of PJM zonal connectivity. In addition, the model remains primarily data-driven and may be less responsive to abrupt exogenous disruptions, such as extreme weather events, market interventions, or large-scale outages, unless such signals are explicitly incorporated as inputs. Another practical consideration is partial modality availability. The robustness analysis indicates that the model degrades gracefully when the auxiliary branch is incomplete or absent, which suggests that the fused design can function in a best-effort multimodal mode and revert toward a weaker market-dominant mode under telemetry limitations. This is encouraging for practical deployment, but it does not remove the need for careful monitoring of modality quality in real applications. From a deployment perspective, the framework is most appropriate for offline training with periodic retraining and hourly or moderate-latency inference. The higher computational burden relative to simpler baselines is likely acceptable in such scenarios, but it may be less suitable for ultra-low-latency edge deployment or rapidly changing graph settings. Future work will therefore focus on three directions: (i) incorporating richer exogenous signals such as weather forecasts, outage notifications, and market announcements; (ii) reducing computational overhead through pruning, quantization, and efficient operator design; and (iii) investigating tighter spatiotemporal coupling and market-specific topology learning when physically matched grid data become available. Conclusion This paper introduces a forecasting framework that integrates a Transformer encoder for temporal analysis with a Graph Neural Network for spatial representation, coordinated via a PCGrad gradient surgery mechanism. The architecture is designed to model heterogeneous temporal and structurally informed signals within a unified learning pipeline for electricity price forecasting. Experimental evaluation on PJM market data together with an auxiliary synthetic IEEE 39-bus PMU stream shows that the proposed framework can improve predictive accuracy relative to the compared baselines in the fused-data setting. Additional optimization and robustness analyses further indicate that conflict-aware training contributes to lower across-run variability and smoother convergence, while the model also degrades gracefully when one modality becomes incomplete. At the same time, the present work should be understood as a proof-of-concept study of cross-domain multimodal fusion, not as a literal reconstruction of PJM-specific physical topology. The auxiliary graph branch contributes physically informed contextual information, but the resulting representation does not imply one-to-one transfer of market topology from the IEEE 39-bus benchmark. Within that scope, the proposed framework provides a useful methodological step toward integrating market signals with auxiliary physical descriptors for short-term electricity price forecasting. Future work will focus on physically matched grid–market datasets, stronger exogenous conditioning, and lighter deployment-oriented variants. Acknowledgements I would like to express my sincere gratitude to all those who have contributed to this study with their support and assistance. Abbreviations Graph neural network Projecting conflicting gradients Long short-term memory Gated recurrent unit Convolutional neural network Graph convolutional network Support vector regression Author contributions B.X.W. conceived and designed the study. B.X.W., P.C.Y., and Y.M.H. performed data collection and statistical analysis. B.X.W. and P.C.Y. interpreted the results. B.X.W. drafted the manuscript. H.Y.L. prepared the tables and figures. All authors reviewed and approved the final manuscript. Funding The construction project of the technical support system for the State Grid Hebei Electric Power spot market., 1R04BB18002V. Data availability The PJM market data used in this study are available from public PJM data services https://dataminer2.pjm.com/. The processed data splits, preprocessing scripts, simulation configuration files, and model training scripts used in this study will be made available from the corresponding author on reasonable request. Because the PMU stream is generated from an IEEE 39-bus simulation rather than collected from a public field deployment, the complete scripts and parameter configuration required to regenerate it are also made available on reasonable requests. Declarations Competing interests The authors declare no competing interests. Footnotes Publisher’s note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations. References Associated Data Data Availability Statement The PJM market data used in this study are available from public PJM data services https://dataminer2.pjm.com/. The processed data splits, preprocessing scripts, simulation configuration files, and model training scripts used in this study will be made available from the corresponding author on reasonable request. Because the PMU stream is generated from an IEEE 39-bus simulation rather than collected from a public field deployment, the complete scripts and parameter configuration required to regenerate it are also made available on reasonable requests.