Graph-Based Attention Mechanisms for Solving the AC Optimal Power Flow Problem in Electrical Power Networks
With the increasing complexity and data availability in modern power systems, learning-based approaches to AC Optimal Power Flow (AC OPF) have garnered significant attention. In particular, the structure of smart grids lends itself naturally to graph-based representations, where Graph Neural Networks (GNNs) can capture spatial and relational dependencies. This paper investigates attention-based GNN architectures tailored to heterogeneous graph representations of electric grids. We evaluate two major paradigms: relational attention, which distinguishes between edge types during message passing, and meta-path attention, which captures high-level semantics through multi-hop, typed paths. Using a large corpus of public AC OPF scenarios, we benchmark representative models of each type of attention. Our results demonstrate the benefits of heterogeneous attention-based models in accurately capturing grid dynamics; heterogeneous attention models achieve superior performance in both standard and perturbed settings. The findings highlight the importance of semantic-aware architectures for improving prediction robustness and interpretability in power system applications.