FMOPF: Latent Flow Matching with Constraint-Aware Interaction Priors for AC Optimal Power Flow

arXiv cs.LG Papers

Summary

FMOPF uses latent flow matching with constraint-aware interaction priors to generate diverse, feasible near-optimal solutions for AC optimal power flow, scaling to hundreds of buses while preserving feasibility.

arXiv:2607.22788v1 Announce Type: new Abstract: AC optimal power flow determines the minimum-cost generation dispatch under nonlinear power balance constraints and is solved thousands of times daily in electricity market operations. Learning a direct mapping from load conditions to OPF solutions can accelerate this computation, yet with deepening renewable penetration, a single optimal dispatch is no longer sufficient. Operators require a characterization of the distribution of feasible near-optimal solutions for risk quantification, sensitivity analysis, and multi-objective trade-off assessment. Supervised neural networks provide fast point predictions but cannot capture this conditional distribution. Diffusion-based generative models can sample diverse solutions in principle, yet existing methods operating in the raw state space exhibit degraded solution quality and fail to scale beyond medium-sized systems. We identify the root cause as the conflation of two distinct tasks within a single model. Compressing the high-dimensional OPF solution manifold is one task, and learning the conditional mapping from loads to that manifold is another. This paper presents FMOPF, a framework that resolves this conflation by decoupling compression from generation through latent flow matching and by explicitly modeling load-state coupling through a Constraint-Aware Interaction Prior Network. Experiments on four IEEE test systems demonstrate that FMOPF provides the most effective Newton-Raphson warm starts, achieves the lowest tail risk among generative methods, and is the first such method to scale to systems with several hundred buses while preserving full feasibility. Ablation studies confirm that the latent generation pipeline is a necessary condition for physical feasibility and that the interaction prior functions as a late-stage tail-risk controller.
Original Article
View Cached Full Text

Cached at: 07/28/26, 06:22 AM

# FMOPF: Latent Flow Matching with Constraint-Aware Interaction Priors for AC Optimal Power Flow
Source: [https://arxiv.org/html/2607.22788](https://arxiv.org/html/2607.22788)
###### Abstract

AC optimal power flow determines the minimum\-cost generation dispatch under nonlinear power balance constraints and is solved thousands of times daily in electricity market operations\. Learning a direct mapping from load conditions to OPF solutions can accelerate this computation, yet with deepening renewable penetration, a single optimal dispatch is no longer sufficient\. Operators require a characterization of the distribution of feasible near\-optimal solutions for risk quantification, sensitivity analysis, and multi\-objective trade\-off assessment\. Supervised neural networks provide fast point predictions but cannot capture this conditional distribution\. Diffusion\-based generative models can sample diverse solutions in principle, yet existing methods operating in the raw state space exhibit degraded solution quality and fail to scale beyond medium\-sized systems\. We identify the root cause as the conflation of two distinct tasks within a single model\. Compressing the high\-dimensional OPF solution manifold is one task, and learning the conditional mapping from loads to that manifold is another\. This paper presents FMOPF, a framework that resolves this conflation by decoupling compression from generation through latent flow matching and by explicitly modeling load\-state coupling through a Constraint\-Aware Interaction Prior Network\. Experiments on four IEEE test systems demonstrate that FMOPF provides the most effective Newton\-Raphson warm starts, achieves the lowest tail risk among generative methods, and is the first such method to scale to systems with several hundred buses while preserving full feasibility\. Ablation studies confirm that the latent generation pipeline is a necessary condition for physical feasibility and that the interaction prior functions as a late\-stage tail\-risk controller\.

## IIntroduction

The AC optimal power flow problem determines the minimum\-cost generation dispatch subject to nonlinear power balance equations and operational constraints of a transmission network\[[1](https://arxiv.org/html/2607.22788#bib.bib1)\]\. As the computational engine behind electricity market clearing, real\-time dispatch, and reliability assessment, AC\-OPF must be solved thousands of times per day under continuously varying load and renewable generation conditions\[[2](https://arxiv.org/html/2607.22788#bib.bib2)\]\. The nonconvexity of the AC power flow equations makes each solve computationally demanding and has motivated over a decade of research into fast learning\-based approximations\.

Neural networks trained to predict optimal OPF solutions from load inputs have achieved remarkable accuracy and speed\[[3](https://arxiv.org/html/2607.22788#bib.bib3),[4](https://arxiv.org/html/2607.22788#bib.bib4),[5](https://arxiv.org/html/2607.22788#bib.bib5)\]\. These supervised models produce a single deterministic point estimate of the optimal dispatch for each load condition\. In modern power systems with high renewable penetration, however, a single point prediction is insufficient\. Operators must quantify the risk of constraint violations under forecast uncertainty, assess the sensitivity of generation costs to forecast errors, and explore near\-optimal alternatives when balancing multiple objectives\. These tasks require the ability to sample diverse, physically feasible dispatch decisions from the conditional distribution of OPF solutions and reason about their variability\[[6](https://arxiv.org/html/2607.22788#bib.bib6)\]\. Supervised regression models are architecturally incapable of providing this distributional information regardless of their accuracy\.

Diffusion and flow\-based generative models\[[7](https://arxiv.org/html/2607.22788#bib.bib7),[8](https://arxiv.org/html/2607.22788#bib.bib8)\]have achieved remarkable success in image synthesis, video generation, and scientific discovery\[[9](https://arxiv.org/html/2607.22788#bib.bib9),[10](https://arxiv.org/html/2607.22788#bib.bib10),[11](https://arxiv.org/html/2607.22788#bib.bib11),[12](https://arxiv.org/html/2607.22788#bib.bib12),[13](https://arxiv.org/html/2607.22788#bib.bib13),[14](https://arxiv.org/html/2607.22788#bib.bib14),[15](https://arxiv.org/html/2607.22788#bib.bib15),[16](https://arxiv.org/html/2607.22788#bib.bib16),[17](https://arxiv.org/html/2607.22788#bib.bib17)\]because the data distributions in these domains, while high\-dimensional, admit effective low\-dimensional representations that can be learned\. The OPF problem presents a structural challenge that distinguishes it from these domains\. The OPF state vector grows linearly with system size as an artifact of the bus\-level representation\. A system with several hundred buses has a state space of over a thousand dimensions, yet the feasible OPF solutions lie on a manifold of much lower dimension\. This artificial dimensionality masks the compact structure of the feasible region and makes joint\-space generation prohibitively expensive\. DiffOPF\[[18](https://arxiv.org/html/2607.22788#bib.bib18)\]and Fast Diffusion\[[19](https://arxiv.org/html/2607.22788#bib.bib19)\]have applied generative models to OPF by operating directly in this raw state space, with DiffOPF formulating solution generation as a denoising diffusion process in a joint load\-state space and Fast Diffusion augmenting it with physics\-guided sampling\. These methods, however, exhibit two fundamental limitations that stem from the joint\-space formulation\. The first is degraded solution quality compared to supervised baselines, particularly on tail\-risk metrics\. The second and more critical limitation is scalability\. Operating in the raw state space conflates two distinct tasks within a single model\. Compressing the high\-dimensional OPF solution manifold into a tractable representation is one task, and learning the conditional mapping from loads to that representation is another\. When a single model attempts both simultaneously, it fails at both\. Furthermore, these methods lack any mechanism for explicitly modeling the coupling between load conditions and system states, relying solely on hard measurement replacement that provides no gradient signal about how load variations propagate through the network equations\.

This paper presents FMOPF, a framework that addresses these limitations through two key innovations\. The first is latent flow matching, which decouples compression from generation\. An autoencoder compresses the OPF state into a compact latent representation, and a flow matching model\[[8](https://arxiv.org/html/2607.22788#bib.bib8),[20](https://arxiv.org/html/2607.22788#bib.bib20)\]learns to generate diverse latent vectors conditioned on load inputs\. Flow matching learns a continuous velocity field with a regression\-based objective that is simpler than the noise prediction of diffusion models and admits efficient sampling with fewer integration steps\. The second is the Constraint\-Aware Interaction Prior Network, which explicitly models the coupling between load conditions and system states\. At each generation step, the CA\-IPN takes the load conditions and a coarse state estimate, computes an interaction feature encoding their coupling, and injects this feature into the flow matching model for a refined prediction\. A constraint\-aware branch provides corrections supervised by power flow residuals\. Training proceeds in two stages\. The autoencoder is first trained independently to establish a high\-quality latent space\. The flow matching model and CA\-IPN are then jointly trained with the autoencoder frozen\.

We evaluate FMOPF on four standard IEEE test systems spanning 6 to 300 buses\. Our experiments demonstrate three central findings\. First, FMOPF provides the most effective Newton\-Raphson warm starts among all compared methods, achieving the lowest after\-refinement power flow errors on every test system and improving over the supervised baseline by up to3\.6×3\.6\\timeson the 300\-bus system\. Second, FMOPF achieves the lowest tail risk among all generative methods, with the CA\-IPN functioning as a tail\-risk controller\. Third, FMOPF is the only generative method that scales to the 300\-bus system while maintaining competitive optimality and full feasibility\. FMOPF is not designed to surpass supervised regression models at point prediction accuracy\. It provides the best warm starts for Newton\-Raphson refinement and offers distributional information that deterministic methods cannot provide, at competitive mean accuracy\.

The main contributions of this work are as follows\.

1. 1\.We formulate OPF solution generation as a flow matching problem in a learned latent space, decoupling compression from generation and enabling scalable sampling beyond the reach of prior diffusion\-based methods\.
2. 2\.We design the CA\-IPN, which explicitly models load\-state coupling and provides constraint\-aware corrections\. The CA\-IPN functions as a tail\-risk controller concentrated in the late stage of generation\.
3. 3\.We develop a two\-stage training pipeline that establishes a high\-quality latent space and then jointly trains the generative model with the interaction prior\.
4. 4\.We conduct the first systematic evaluation of generative OPF methods on the 300\-bus system and identify the autoencoder compression ratio as the primary scalability bottleneck\.

![Refer to caption](https://arxiv.org/html/2607.22788v1/x1.png)Figure 1:Overview of the FMOPF framework\. Stage 1 trains an autoencoder to compress OPF states into a compact latent space\. Stage 2 jointly trains a flow matching model and the CA\-IPN to generate latent representations conditioned on load inputs\. At inference, latent vectors are generated by integrating the learned flow ODE, decoded to the state space, and refined through Newton\-Raphson projection\.
## IIRelated Work

### II\-ALearning\-Based Optimal Power Flow

Supervised learning approaches train neural networks to approximate the mapping from load inputs to optimal generation setpoints using solutions obtained from conventional solvers\. DeepOPF\[[3](https://arxiv.org/html/2607.22788#bib.bib3)\]introduced a deep neural network architecture for security\-constrained DC\-OPF, achieving substantial speedups over interior point methods\. Fioretto et al\.\[[5](https://arxiv.org/html/2607.22788#bib.bib5)\]combined deep learning with Lagrangian dual methods to predict AC\-OPF solutions with improved constraint satisfaction\. Zamzam and Baker\[[4](https://arxiv.org/html/2607.22788#bib.bib4)\]proposed a warm\-starting approach that uses neural network predictions as initial points for conventional solvers\. Unsupervised and physics\-informed methods eliminate the dependence on pre\-computed optimal solutions\. DC3\[[21](https://arxiv.org/html/2607.22788#bib.bib21)\]formulated a differentiable correction layer that projects neural network outputs onto the feasible set\. DeepOPF\-NGT\[[22](https://arxiv.org/html/2607.22788#bib.bib22)\]employed an unsupervised training scheme with augmented Lagrangian terms for constraint satisfaction\. Nellikkath and Chatzivasileiadis\[[23](https://arxiv.org/html/2607.22788#bib.bib23)\]incorporated power flow equations directly into the training loss\. Graph neural network architectures\[[24](https://arxiv.org/html/2607.22788#bib.bib24)\]have been explored to capture topological structure, improving generalization across operating conditions\. These methods, however, are fundamentally regression\-based: they learn a deterministic mapping from loads to a single optimal solution\. They cannot characterize the distribution of near\-optimal solutions, quantify the uncertainty of their predictions, or support risk\-aware decision\-making\. FMOPF addresses this gap by providing a generative model that samples diverse feasible solutions while maintaining competitive mean optimality\.

### II\-BGenerative Models for OPF

Diffusion\-based generative models\[[7](https://arxiv.org/html/2607.22788#bib.bib7),[25](https://arxiv.org/html/2607.22788#bib.bib25)\]learn to reverse a gradual noising process, transforming noise into complex data distributions\. DDIM\[[26](https://arxiv.org/html/2607.22788#bib.bib26)\]enables deterministic sampling with fewer steps, and classifier guidance\[[27](https://arxiv.org/html/2607.22788#bib.bib27)\]improves sample quality by incorporating gradients from an auxiliary classifier during sampling\. In the OPF domain, DiffOPF\[[18](https://arxiv.org/html/2607.22788#bib.bib18)\]pioneered the application of diffusion models, operating in a joint load\-state space where load conditions are injected through measurement replacement\. Fast Diffusion\[[19](https://arxiv.org/html/2607.22788#bib.bib19)\]extended this with physics\-guided corrections during deterministic sampling\. Generative adversarial networks have also been applied to OPF\. MI\-GAN\[[6](https://arxiv.org/html/2607.22788#bib.bib6)\]integrates a feasibility filter and gradient\-guided layer into the GAN architecture to improve solution quality\. These generative methods, however, share a common limitation: they operate directly in the raw OPF state space, whose dimension grows linearly with system size\. This joint\-space formulation conflates the task of compressing the solution manifold with that of learning the conditional mapping from loads to states\. As system size increases, the model must simultaneously learn a high\-dimensional data distribution and a complex conditional relationship, leading to degraded solution quality and a failure to scale\. FMOPF resolves this conflation through latent flow matching: an autoencoder handles compression, and a flow matching model operating in the compact latent space handles conditional generation\.

Flow matching\[[8](https://arxiv.org/html/2607.22788#bib.bib8),[20](https://arxiv.org/html/2607.22788#bib.bib20),[28](https://arxiv.org/html/2607.22788#bib.bib28)\]has emerged as a powerful alternative to diffusion models\. Unlike diffusion, which learns to reverse a stochastic noising process, flow matching learns a continuous normalizing flow by regressing a velocity field\. The conditional flow matching objective\[[8](https://arxiv.org/html/2607.22788#bib.bib8)\]provides a simple regression target that is easier to optimize than the score matching or noise prediction objectives of diffusion models\. Generative models on SE\(3\) have been successfully applied to molecule generation\[[29](https://arxiv.org/html/2607.22788#bib.bib29)\], protein backbone design\[[30](https://arxiv.org/html/2607.22788#bib.bib30)\], and image generation\[[11](https://arxiv.org/html/2607.22788#bib.bib11)\]\. FMOPF is the first work to apply flow matching to the OPF problem, leveraging its simpler objective and more efficient sampling to enable generative OPF at scales beyond the reach of diffusion methods\. More broadly, diffusion and flow\-based generative models have demonstrated remarkable versatility across scientific and engineering domains, including molecular conformer generation, protein structure prediction, climate modeling, and video generation, establishing generative modeling as a general\-purpose framework for learning complex conditional distributions in high\-dimensional spaces\.

The combination of autoencoders with generative models has proven highly effective for high\-dimensional data\. Stable Diffusion\[[10](https://arxiv.org/html/2607.22788#bib.bib10)\]demonstrated that compressing images into a latent space before applying diffusion dramatically improves both quality and efficiency\. This latent generation paradigm underpins our approach of compressing the high\-dimensional OPF state into a compact latent representation and applying flow matching in this reduced space\.

### II\-CPhysics\-Informed Generative Priors

Incorporating structural priors into generative models has been shown to improve sample quality in structured prediction tasks\. IPDiff\[[31](https://arxiv.org/html/2607.22788#bib.bib31)\]demonstrated that embedding a dedicated interaction prior network into each denoising step can substantially improve 3D molecule generation quality by capturing protein\-ligand binding interactions\. The interaction prior provides a mechanism for the model to reason about relationships between entities at each step of the generative process, rather than relying solely on the backbone model to implicitly learn these dependencies from data\. Our CA\-IPN extends this concept to the OPF domain in two key respects\. First, the interaction is between load conditions and system states, requiring a cross\-modal coupling mechanism that captures how load variations propagate through the network equations rather than the geometric protein\-ligand coupling of the original setting\. Second, the CA\-IPN is augmented with a constraint prediction head that provides explicit physics\-informed corrections, supervised by power flow residuals\. This combination of latent generation, flow matching, and constraint\-aware interaction priors enables FMOPF to achieve both competitive mean optimality and the lowest tail risk among generative methods\.

## IIIMethodology

### III\-AAC Optimal Power Flow Formulation

The AC optimal power flow problem minimizes generation cost subject to physical and operational constraints\. For annn\-bus power system with generator set𝒢\\mathcal\{G\}and line setℒ\\mathcal\{L\}, the standard AC\-OPF is formulated as

min𝑷G,𝑸G,𝑽,𝜽\\displaystyle\\min\_\{\\bm\{P\}\_\{G\},\\bm\{Q\}\_\{G\},\\bm\{V\},\\bm\{\\theta\}\}\\;\\;∑i∈𝒢\(ci,2​PG,i2\+ci,1​PG,i\+ci,0\)\\displaystyle\\sum\_\{i\\in\\mathcal\{G\}\}\\bigl\(c\_\{i,2\}P\_\{G,i\}^\{2\}\+c\_\{i,1\}P\_\{G,i\}\+c\_\{i,0\}\\bigr\)\(1a\)s\.t\.PG,i−PL,i=giP​\(𝑽,𝜽\),∀i\\displaystyle P\_\{G,i\}\-P\_\{L,i\}=g\_\{i\}^\{P\}\(\\bm\{V\},\\bm\{\\theta\}\),\\quad\\forall i\(1b\)QG,i−QL,i=giQ​\(𝑽,𝜽\),∀i\\displaystyle Q\_\{G,i\}\-Q\_\{L,i\}=g\_\{i\}^\{Q\}\(\\bm\{V\},\\bm\{\\theta\}\),\\quad\\forall i\(1c\)PG,imin≤PG,i≤PG,imax,∀i∈𝒢\\displaystyle P\_\{G,i\}^\{\\min\}\\leq P\_\{G,i\}\\leq P\_\{G,i\}^\{\\max\},\\;\\;\\forall i\\in\\mathcal\{G\}QG,imin≤QG,i≤QG,imax,∀i∈𝒢\\displaystyle Q\_\{G,i\}^\{\\min\}\\leq Q\_\{G,i\}\\leq Q\_\{G,i\}^\{\\max\},\\;\\;\\forall i\\in\\mathcal\{G\}Vimin≤Vi≤Vimax,∀i\\displaystyle V\_\{i\}^\{\\min\}\\leq V\_\{i\}\\leq V\_\{i\}^\{\\max\},\\;\\;\\forall i\|Si​j\|≤Si​jmax,∀\(i,j\)∈ℒ\\displaystyle\|S\_\{ij\}\|\\leq S\_\{ij\}^\{\\max\},\\;\\;\\forall\(i,j\)\\in\\mathcal\{L\}where𝐆\+j​𝐁\\mathbf\{G\}\+j\\mathbf\{B\}is the network admittance matrix,θi​j=θi−θj\\theta\_\{ij\}=\\theta\_\{i\}\-\\theta\_\{j\}, and the power injection functions aregiP​\(𝑽,𝜽\)=Vi​∑j=1nVj​\(Gi​j​cos⁡θi​j\+Bi​j​sin⁡θi​j\)g\_\{i\}^\{P\}\(\\bm\{V\},\\bm\{\\theta\}\)=V\_\{i\}\\sum\_\{j=1\}^\{n\}V\_\{j\}\(G\_\{ij\}\\cos\\theta\_\{ij\}\+B\_\{ij\}\\sin\\theta\_\{ij\}\),giQ​\(𝑽,𝜽\)=Vi​∑j=1nVj​\(Gi​j​sin⁡θi​j−Bi​j​cos⁡θi​j\)g\_\{i\}^\{Q\}\(\\bm\{V\},\\bm\{\\theta\}\)=V\_\{i\}\\sum\_\{j=1\}^\{n\}V\_\{j\}\(G\_\{ij\}\\sin\\theta\_\{ij\}\-B\_\{ij\}\\cos\\theta\_\{ij\}\)\. The load conditions\[𝑷L,𝑸L\]\[\\bm\{P\}\_\{L\},\\bm\{Q\}\_\{L\}\]are exogenous inputs\.

### III\-BLearning the OPF Solution Map

Given𝒍=\[𝑷L,𝑸L\]∈2​n\\bm\{l\}=\[\\bm\{P\}\_\{L\},\\bm\{Q\}\_\{L\}\]\\in^\{2n\}sampled fromp​\(𝒍\)p\(\\bm\{l\}\), we learn a generative modelpϕ​\(𝒙∣𝒍\)p\_\{\\phi\}\(\\bm\{x\}\\mid\\bm\{l\}\)where𝒙=\[𝑷G,𝑸G,𝑽,𝜽\]∈4​n\\bm\{x\}=\[\\bm\{P\}\_\{G\},\\bm\{Q\}\_\{G\},\\bm\{V\},\\bm\{\\theta\}\]\\in^\{4n\}is the full OPF state\. Each generated sample must be near\-optimal for the given load condition and the model must capture the distribution of feasible solutions for uncertainty quantification\. This differs fundamentally from supervised regression\. Rather than learning a point estimate of the conditional expectation𝔼​\[𝒙∣𝒍\]\\mathbb\{E\}\[\\bm\{x\}\\mid\\bm\{l\}\], we learn the full conditional distributionp​\(𝒙∣𝒍\)p\(\\bm\{x\}\\mid\\bm\{l\}\), including variance, multimodality, and tail behavior\. Existing diffusion\-based approaches\[[18](https://arxiv.org/html/2607.22788#bib.bib18),[19](https://arxiv.org/html/2607.22788#bib.bib19)\]operate in a joint load\-state space and inject the conditioning signal through measurement replacement without explicitly modeling the coupling between loads and states\. Our approach operates in a learned latent space and uses an interaction prior network to model this coupling explicitly\.

### III\-CLatent Autoencoder for State Compression

The first component of FMOPF is an autoencoder that compresses the high\-dimensional OPF state vector into a compact latent representation\. Let𝒙∈4​n\\bm\{x\}\\in^\{4n\}denote the full OPF state\. The encoderℰ:4​n→dz\\mathcal\{E\}:^\{4n\}\\to^\{d\_\{z\}\}maps the state to a latent vector𝒛=ℰ​\(𝒙\)\\bm\{z\}=\\mathcal\{E\}\(\\bm\{x\}\), and the decoder𝒟:dz→4​n\\mathcal\{D\}:^\{d\_\{z\}\}\\to^\{4n\}reconstructs the state as𝒙^=𝒟​\(𝒛\)\\hat\{\\bm\{x\}\}=\\mathcal\{D\}\(\\bm\{z\}\)\. Both are implemented as multi\-layer perceptrons with residual connections and SiLU activations\. The latent dimensiondzd\_\{z\}scales with system size, ranging from 64 for the 6\-bus and 24\-bus systems to 128 for the 118\-bus system and 256 for the 300\-bus system\. The autoencoder is trained to minimize the mean squared reconstruction error

ℒAE=𝔼𝒙∼p​\(𝒙\)​\[‖𝒙−𝒟​\(ℰ​\(𝒙\)\)‖2\]\.\\mathcal\{L\}\_\{\\text\{AE\}\}=\\mathbb\{E\}\_\{\\bm\{x\}\\sim p\(\\bm\{x\}\)\}\\left\[\\\|\\bm\{x\}\-\\mathcal\{D\}\(\\mathcal\{E\}\(\\bm\{x\}\)\)\\\|^\{2\}\\right\]\.\(2\)
By operating in the latent space of dimensiondz≪4​nd\_\{z\}\\ll 4n, the autoencoder provides a compression ratio of4​n/dz4n/d\_\{z\}, which reaches4\.7×4\.7\\timesfor the 300\-bus system\.

### III\-DLatent Flow Matching

Given the pretrained autoencoder, we work entirely in the latent space\. Let𝒛0=ℰ​\(𝒙\)∈dz\\bm\{z\}\_\{0\}=\\mathcal\{E\}\(\\bm\{x\}\)\\in^\{d\_\{z\}\}be the latent representation of an OPF solution and𝒍∈2​n\\bm\{l\}\\in^\{2n\}be the load condition\. We learn a conditional generative modelp​\(𝒛0∣𝒍\)p\(\\bm\{z\}\_\{0\}\\mid\\bm\{l\}\)\. Flow matching\[[8](https://arxiv.org/html/2607.22788#bib.bib8)\]learns a time\-dependent vector fieldvθ​\(𝒛t,t,𝒍\)v\_\{\\theta\}\(\\bm\{z\}\_\{t\},t,\\bm\{l\}\)that transports samples from a base distribution𝒩​\(𝟎,𝐈\)\\mathcal\{N\}\(\\bm\{0\},\\mathbf\{I\}\)att=1t=1to the target distributionp​\(𝒛0∣𝒍\)p\(\\bm\{z\}\_\{0\}\\mid\\bm\{l\}\)att=0t=0\. The probability path is constructed via linear interpolation between data and noise

𝒛t=\(1−t\)​𝒛0\+t​𝒛1,𝒛˙t=𝒛1−𝒛0,\\bm\{z\}\_\{t\}=\(1\-t\)\\bm\{z\}\_\{0\}\+t\\bm\{z\}\_\{1\},\\qquad\\dot\{\\bm\{z\}\}\_\{t\}=\\bm\{z\}\_\{1\}\-\\bm\{z\}\_\{0\},\(3\)where𝒛1∼𝒩​\(𝟎,𝐈\)\\bm\{z\}\_\{1\}\\sim\\mathcal\{N\}\(\\bm\{0\},\\mathbf\{I\}\)andt∼𝒰​\(0,1\)t\\sim\\mathcal\{U\}\(0,1\)\. The flow matching loss regresses the velocity field against the target velocity

ℒFM=𝔼t,𝒛0,𝒛1​\[‖vθ​\(𝒛t,t,𝒍\)−\(𝒛1−𝒛0\)‖2\]\.\\mathcal\{L\}\_\{\\text\{FM\}\}=\\mathbb\{E\}\_\{t,\\bm\{z\}\_\{0\},\\bm\{z\}\_\{1\}\}\\left\[\\\|v\_\{\\theta\}\(\\bm\{z\}\_\{t\},t,\\bm\{l\}\)\-\(\\bm\{z\}\_\{1\}\-\\bm\{z\}\_\{0\}\)\\\|^\{2\}\\right\]\.\(4\)
The ODEd​𝒛td​t=vθ​\(𝒛t,t,𝒍\)\\frac\{d\\bm\{z\}\_\{t\}\}\{dt\}=v\_\{\\theta\}\(\\bm\{z\}\_\{t\},t,\\bm\{l\}\)defines the flow\. Under this convention, the target velocity𝒛1−𝒛0\\bm\{z\}\_\{1\}\-\\bm\{z\}\_\{0\}points from data toward noise\. During sampling, the ODE is integrated backward fromt=1t=1tot=0t=0, starting from Gaussian noise and following the learned velocity field to the data distribution\. Flow matching offers several advantages over the noise prediction objective of diffusion models\. The velocity field is simpler to learn than the score function, the linear interpolation path provides well\-defined geometric structure, and straighter trajectories require fewer integration steps during sampling\. The velocity fieldvθv\_\{\\theta\}is parameterized by an MLP with residual connections and SiLU activations, taking𝒛t\\bm\{z\}\_\{t\}, a sinusoidal embedding oftt, and an encoding of𝒍\\bm\{l\}as concatenated input\.

### III\-EConstraint\-Aware Interaction Prior Network

The CA\-IPN explicitly models load\-state coupling and provides structured prior information to the flow matching model at each generation step\. It consists of a base interaction branch with three components, a constraint\-aware branch with two components, and a learned gating mechanism that fuses their outputs\. In the base interaction branch, the load encoderψl:2​n→dh\\psi\_\{l\}:^\{2n\}\\to^\{d\_\{h\}\}is a two\-layer MLP with LayerNorm and SiLU activations that transforms the normalized load conditions into a hidden representation𝒉l\\bm\{h\}\_\{l\}\. The state encoderψs:4​n→dh\\psi\_\{s\}:^\{4n\}\\to^\{d\_\{h\}\}is a two\-layer MLP that encodes the coarse state estimate, decoded from the coarse latent, into a hidden representation𝒉s\\bm\{h\}\_\{s\}of the same dimension\. The load\-state coupling is captured through element\-wise multiplication𝒉cross=𝒉l⊙𝒉s\\bm\{h\}\_\{\\text\{cross\}\}=\\bm\{h\}\_\{l\}\\odot\\bm\{h\}\_\{s\}, which models multiplicative interactions between corresponding latent dimensions\. The fusion networkψf\\psi\_\{f\}combines𝒉l\\bm\{h\}\_\{l\},𝒉s\\bm\{h\}\_\{s\},𝒉cross\\bm\{h\}\_\{\\text\{cross\}\}, and the flow time embedding𝒆t\\bm\{e\}\_\{t\}to produce the base interaction feature𝒇base∈dint\\bm\{f\}\_\{\\text\{base\}\}\\in^\{d\_\{\\text\{int\}\}\}\.

𝒇base=ψf​\(\[𝒉l,𝒉s,𝒉cross,𝒆t\]\)\.\\bm\{f\}\_\{\\text\{base\}\}=\\psi\_\{f\}\(\[\\bm\{h\}\_\{l\},\\bm\{h\}\_\{s\},\\bm\{h\}\_\{\\text\{cross\}\},\\bm\{e\}\_\{t\}\]\)\.\(5\)
In the constraint\-aware branch, the constraint prediction headψc\\psi\_\{c\}takes the base interaction feature, load features, state features, and time embedding, and predicts a state correction vector𝜹∈4​n\\bm\{\\delta\}\\in^\{4n\}\.

𝜹=tanh⁡\(ψc​\(\[𝒇base,𝒉l,𝒉s,𝒆t\]\)\),\\bm\{\\delta\}=\\tanh\(\\psi\_\{c\}\(\[\\bm\{f\}\_\{\\text\{base\}\},\\bm\{h\}\_\{l\},\\bm\{h\}\_\{s\},\\bm\{e\}\_\{t\}\]\)\),\(6\)where thetanh\\tanhactivation bounds each element of the correction within\[−1,1\]\[\-1,1\]\. A constraint encoderψe\\psi\_\{e\}maps the correction into a feature𝒇con=ψe​\(𝜹\)∈dint\\bm\{f\}\_\{\\text\{con\}\}=\\psi\_\{e\}\(\\bm\{\\delta\}\)\\in^\{d\_\{\\text\{int\}\}\}\. During training,𝜹\\bm\{\\delta\}is supervised to match the negative power flow residuals at non\-slack buses and the voltage bound violations, scaled by a factor of0\.010\.01, using a mean squared error loss computed on a randomly sampled subset of training batches\. The base and constraint features are combined via a learned gate that adaptively balances the two information sources\.

𝒈\\displaystyle\\bm\{g\}=σ​\(𝐖g​\[𝒇base,𝒇con\]\+𝒃g\),\\displaystyle=\\sigma\(\\mathbf\{W\}\_\{g\}\[\\bm\{f\}\_\{\\text\{base\}\},\\bm\{f\}\_\{\\text\{con\}\}\]\+\\bm\{b\}\_\{g\}\),\(7a\)𝒇\\displaystyle\\bm\{f\}=𝒈⊙𝒇base\+\(1−𝒈\)⊙𝒇con\.\\displaystyle=\\bm\{g\}\\odot\\bm\{f\}\_\{\\text\{base\}\}\+\(1\-\\bm\{g\}\)\\odot\\bm\{f\}\_\{\\text\{con\}\}\.\(7b\)
The learned gate adaptively weights the interaction and constraint features based on the flow time and current state quality\.

### III\-FTwo\-Stage Training Strategy

FMOPF employs a two\-stage training strategy that ensures stable optimization of each component\. In Stage 1, the autoencoder is trained independently on the full dataset of OPF solutions using the reconstruction loss in Eq\. \([2](https://arxiv.org/html/2607.22788#S3.E2)\)\. The training uses the AdamW optimizer\[[32](https://arxiv.org/html/2607.22788#bib.bib32)\]with CosineAnnealingLR scheduling and early stopping\. This stage establishes a high\-quality latent space\. The trained autoencoder is frozen for the subsequent stage\. In Stage 2, the flow matching model and the CA\-IPN are trained jointly\. Each training step consists of two forward passes\. In the coarse pass, the flow matching model predicts the velocity without the CA\-IPN, yielding𝒗^c=vθ​\(𝒛t,t,𝒍,𝟎\)\\hat\{\\bm\{v\}\}^\{\\text\{c\}\}=v\_\{\\theta\}\(\\bm\{z\}\_\{t\},t,\\bm\{l\},\\bm\{0\}\)\. The coarse latent𝒛^0c=𝒛t−t⋅𝒗^c\\hat\{\\bm\{z\}\}\_\{0\}^\{\\text\{c\}\}=\\bm\{z\}\_\{t\}\-t\\cdot\\hat\{\\bm\{v\}\}^\{\\text\{c\}\}is decoded to the state space and detached from the computation graph\. In the refined pass, the CA\-IPN computes the interaction feature𝒇=CA\-IPN​\(𝒍,𝒙^c,t\)\\bm\{f\}=\\text\{CA\-IPN\}\(\\bm\{l\},\\hat\{\\bm\{x\}\}^\{\\text\{c\}\},t\), and the flow matching model produces a refined prediction𝒗^r=vθ​\(𝒛t,t,𝒍,𝒇\)\\hat\{\\bm\{v\}\}^\{\\text\{r\}\}=v\_\{\\theta\}\(\\bm\{z\}\_\{t\},t,\\bm\{l\},\\bm\{f\}\)\. The total loss combines the refined and coarse flow matching objectives with a constraint alignment loss:

ℒtotal=‖𝒗^r−𝒗‖2\+λc​‖𝒗^c−𝒗‖2\+λcon​ℒcon,\\mathcal\{L\}\_\{\\text\{total\}\}=\\\|\\hat\{\\bm\{v\}\}^\{\\text\{r\}\}\-\\bm\{v\}\\\|^\{2\}\+\\lambda\_\{c\}\\\|\\hat\{\\bm\{v\}\}^\{\\text\{c\}\}\-\\bm\{v\}\\\|^\{2\}\+\\lambda\_\{\\text\{con\}\}\\mathcal\{L\}\_\{\\text\{con\}\},\(8\)where𝒗=𝒛1−𝒛0\\bm\{v\}=\\bm\{z\}\_\{1\}\-\\bm\{z\}\_\{0\}is the target velocity,λc=0\.3\\lambda\_\{c\}=0\.3, andλcon=0\.1\\lambda\_\{\\text\{con\}\}=0\.1\. The constraint loss is a mean squared error between the predicted correction and a supervision target derived from the power flow residuals:

ℒcon=‖𝜹−𝒕‖2,\\mathcal\{L\}\_\{\\text\{con\}\}=\\\|\\bm\{\\delta\}\-\\bm\{t\}\\\|^\{2\},\(9\)where𝒕\\bm\{t\}is the negative of the power flow residuals at non\-slack buses and voltage bound violations, scaled by0\.010\.01\. The constraint loss is computed on a randomly sampled subset of training batches to reduce computational overhead\. The flow matching model and CA\-IPN are jointly optimized using the AdamW optimizer with different learning rates\.

### III\-GInference Pipeline

At inference time, a latent vector is sampled from𝒩​\(𝟎,𝐈\)\\mathcal\{N\}\(\\bm\{0\},\\mathbf\{I\}\)and the ODEd​𝒛td​t=vθ​\(𝒛t,t,𝒍,𝒇t\)\\frac\{d\\bm\{z\}\_\{t\}\}\{dt\}=v\_\{\\theta\}\(\\bm\{z\}\_\{t\},t,\\bm\{l\},\\bm\{f\}\_\{t\}\)is integrated fromt=1t=1tot=0t=0usingKKEuler steps\. At each step, a coarse velocity is predicted without the CA\-IPN, the coarse latent is decoded to obtain a state estimate, the CA\-IPN computes the interaction feature𝒇\\bm\{f\}, and a refined velocity drives the integration\. The final latent is decoded to𝒙^=𝒟​\(𝒛0\)\\hat\{\\bm\{x\}\}=\\mathcal\{D\}\(\\bm\{z\}\_\{0\}\)and refined via Newton\-Raphson projection with an analytical Jacobian\[[33](https://arxiv.org/html/2607.22788#bib.bib33)\]\. Algorithm[1](https://arxiv.org/html/2607.22788#alg1)summarizes the procedure\.

Algorithm 1FMOPF Inference0:Target loads

𝒍\\bm\{l\}, trained AE

ℰ,𝒟\\mathcal\{E\},\\mathcal\{D\}, flow matching model

vθv\_\{\\theta\}, CA\-IPN

ψ\\psi, steps

KK
0:OPF solution

𝒙∗\\bm\{x\}^\{\*\}
1:

𝒛1∼𝒩​\(𝟎,𝐈\)\\bm\{z\}\_\{1\}\\sim\\mathcal\{N\}\(\\bm\{0\},\\mathbf\{I\}\)
2:for

k=0k=0to

K−1K\-1do

3:

t←1−k/Kt\\leftarrow 1\-k/K
4:

𝒗^c←vθ​\(𝒛t,t,𝒍,𝟎\)\\hat\{\\bm\{v\}\}^\{\\text\{c\}\}\\leftarrow v\_\{\\theta\}\(\\bm\{z\}\_\{t\},t,\\bm\{l\},\\bm\{0\}\)
5:

𝒛^0c←𝒛t−t⋅𝒗^c\\hat\{\\bm\{z\}\}\_\{0\}^\{\\text\{c\}\}\\leftarrow\\bm\{z\}\_\{t\}\-t\\cdot\\hat\{\\bm\{v\}\}^\{\\text\{c\}\}
6:

𝒙^c←𝒟​\(𝒛^0c\)\\hat\{\\bm\{x\}\}^\{\\text\{c\}\}\\leftarrow\\mathcal\{D\}\(\\hat\{\\bm\{z\}\}\_\{0\}^\{\\text\{c\}\}\)
7:

𝒇←ψ​\(𝒍,𝒙^c,t\)\\bm\{f\}\\leftarrow\\psi\(\\bm\{l\},\\hat\{\\bm\{x\}\}^\{\\text\{c\}\},t\)
8:

𝒗^r←vθ​\(𝒛t,t,𝒍,𝒇\)\\hat\{\\bm\{v\}\}^\{\\text\{r\}\}\\leftarrow v\_\{\\theta\}\(\\bm\{z\}\_\{t\},t,\\bm\{l\},\\bm\{f\}\)
9:

𝒛t−1/K←𝒛t−1K​𝒗^r\\bm\{z\}\_\{t\-1/K\}\\leftarrow\\bm\{z\}\_\{t\}\-\\frac\{1\}\{K\}\\hat\{\\bm\{v\}\}^\{\\text\{r\}\}
10:endfor

11:

𝒙∗←NewtonRaphson​\(𝒟​\(𝒛0\)\)\\bm\{x\}^\{\*\}\\leftarrow\\text\{NewtonRaphson\}\(\\mathcal\{D\}\(\\bm\{z\}\_\{0\}\)\)
12:return

𝒙∗\\bm\{x\}^\{\*\}

### III\-HComplexity Analysis

The CA\-IPN uses a pure MLP architecture\. Model complexity is dominated by the flow matching backbone, which operates in the compact latent space wheredz≪4​nd\_\{z\}\\ll 4n\. The per\-sample inference cost has two components\. TheKKflow matching steps each require a coarse and refined forward pass through the flow matching model and CA\-IPN, both operating in the low\-dimensional latent space\. The CA\-IPN overhead is approximately constant across system scales because its interaction dimensiondintd\_\{\\text\{int\}\}is fixed\. The Newton\-Raphson projection scales withO​\(n3\)O\(n^\{3\}\)in the worst case but converges in one to three iterations given the high\-quality warm start\.

## IVExperiments

### IV\-AExperimental Setup

We evaluate on four standard IEEE test systems\. Table[I](https://arxiv.org/html/2607.22788#S4.T1)summarizes their key parameters\. The state dimension is4​n4nfor annn\-bus system, yielding a range from 24 to 1,200\. The autoencoder compression ratio ranges from0\.09×0\.09\\timesto4\.69×4\.69\\times\. Training datasets are generated by varying loads uniformly within±15%\\pm 15\\%of nominal values, with 10000 samples per system for the 6\-bus, 24\-bus, and 118\-bus systems and 30000 samples for the 300\-bus system\. Ground\-truth OPF solutions are obtained using pandapower\[[34](https://arxiv.org/html/2607.22788#bib.bib34)\]\. All variables are normalized to the interval\[−1,1\]\[\-1,1\]\.

TABLE I:Test system parameters\. State dimension is4​n4n\. Compression ratio usesdz=256d\_\{z\}=256\.We compare FMOPF against the following baselines\. DeepOPF\[[3](https://arxiv.org/html/2607.22788#bib.bib3)\]is a supervised MLP that provides a deterministic upper bound on predictive accuracy\. DiffOPF\[[18](https://arxiv.org/html/2607.22788#bib.bib18)\]is a joint\-space DDIM diffusion method\. NR\-Flat uses flat\-start Newton\-Raphson \(50 iterations,V=1\.0V=1\.0,θ=0\\theta=0\) as a computational reference\. Increasing the budget to 100 iterations produces identical results, confirming full convergence within 50 iterations\. Fast Diffusion\[[19](https://arxiv.org/html/2607.22788#bib.bib19)\]extends diffusion with physics guidance\.

We evaluate performance using optimality gap, power flow error, line feasibility, and box feasibility\. We report both the mean and the conditional value\-at\-risk at the 10% level across all samples\. The CVaR captures tail\-risk behavior that is critical for operational reliability\.

The autoencoder uses 4 layers with hidden dimension 1024\. The flow matching model uses 3 layers with hidden dimension 4096 and a time embedding dimension of 128\. The CA\-IPN uses hidden dimension 1024 with 2 fusion layers\. All models are trained with the AdamW optimizer\[[32](https://arxiv.org/html/2607.22788#bib.bib32)\]and CosineAnnealingLR scheduling, using a batch size of 64\. Training runs for 5000 epochs on the 6\-bus, 24\-bus, and 118\-bus systems and 10000 epochs on the 300\-bus system\. The autoencoder and flow matching model use a learning rate of10−410^\{\-4\}and the CA\-IPN uses3×10−43\\times 10^\{\-4\}\. The coarse loss weight isλc=0\.3\\lambda\_\{c\}=0\.3and the constraint loss weight isλcon=0\.1\\lambda\_\{\\text\{con\}\}=0\.1\. FMOPF sampling uses Euler integration withK=30K=30steps and a maximum of 10 Newton\-Raphson iterations\. All experiments use five random seeds and we report the mean and standard deviation across seeds\.

Before presenting the results, we clarify why power flow error is the central metric in our evaluation\. In AC optimal power flow, the power flow equations are a hard physical constraint\. Any dispatch that violates Kirchhoff’s laws is physically unrealizable regardless of its cost\. The power flow error, defined as the root\-mean\-square of the active and reactive power mismatches across all buses, directly quantifies the degree to which a candidate solution satisfies these equations\. A solution with zero power flow error that is5%5\\%suboptimal can be implemented on the physical grid\. A solution with zero optimality gap that has a power flow error of1\.01\.0pu cannot\.

This distinction is particularly relevant for learned OPF methods that use Newton\-Raphson refinement\. Newton\-Raphson converges to a solution of the power flow equations when initialized sufficiently close to one, but may diverge from a poor initial point\. The post\-refinement power flow error therefore serves as a direct and objective measure of warm\-start quality\. A method that consistently achieves lower power flow error after refinement provides initial points that are closer to the power flow manifold, enabling Newton\-Raphson to converge to more physically accurate solutions\. The optimality gap measures cost efficiency, a distinct and complementary objective\. The ideal OPF solver minimizes both, but the power flow constraint is lexicographically prior\. Feasibility must be satisfied before optimality becomes meaningful\.

We therefore structure our evaluation around three complementary dimensions\. The power flow error after Newton\-Raphson refinement measures warm\-start quality and physical consistency\. The optimality gap measures cost efficiency relative to the reference solution\. Tail risk, captured by CVaR10%, measures reliability in the worst\-case operating scenarios\. All three are necessary for a complete assessment and none alone is sufficient\.

### IV\-BMain Results

Table[II](https://arxiv.org/html/2607.22788#S4.T2)presents the raw model outputs before Newton\-Raphson refinement, evaluated across five random seeds\. These values reveal each method’s inherent physical consistency without post\-hoc correction\. Table[III](https://arxiv.org/html/2607.22788#S4.T3)reports results after refinement\. The comparison directly measures each method’s effectiveness as a warm\-start provider\. Best results among learned methods are in bold and second\-best are underlined\.

TABLE II:Raw model outputs before Newton\-Raphson refinement\. Values are mean±\\pmstd\. over five seeds\.↓\\downarrow= lower is better,↑\\uparrow= higher is better\. Best results among learned methods are bolded; second\-best are underlined\. NR\-Flat uses flat\-start initialization as a computational reference\.TABLE III:Results after Newton\-Raphson refinement\. Values are mean±\\pmstd\. over five seeds\. Best results among learned methods are bolded; second\-best are underlined\.↓\\downarrow= lower better,↑\\uparrow= higher better\.Table[II](https://arxiv.org/html/2607.22788#S4.T2)reports the raw model outputs before Newton\-Raphson refinement, revealing each method’s inherent physical consistency without post\-hoc correction\. The central finding is that latent\-space generation inherently encodes power flow physics\. FMOPF achieves power flow errors one to two orders of magnitude lower than the joint\-space diffusion baselines on all four systems and maintains full box feasibility before any post\-processing\. On the largest test system, it achieves a raw optimality gap competitive with DeepOPF while the supervised baseline experiences a drop in box feasibility\. The flat\-start Newton baseline yields zero box feasibility across all systems\. This is a structural consequence of the power flow formulation\. Newton\-Raphson solves for voltages and angles that satisfy power balance at each bus but does not constrain generator outputs during the solve, so flat\-start initialization leads the solver to generator outputs outside operational limits\. FMOPF avoids this by providing initial points already within the feasible region, directly demonstrating the value of learning\-based warm starting\.

Table[III](https://arxiv.org/html/2607.22788#S4.T3)reports results after Newton\-Raphson refinement and directly measures each method’s effectiveness as a warm\-start provider\. FMOPF achieves the lowest after\-refinement power flow error on every system, with the improvement being most pronounced on the medium\-scale systems where the joint\-space methods also benefit from refinement but remain far behind\. DeepOPF achieves the best mean optimality gap on medium\-scale systems, consistent with its regression formulation optimized for point accuracy\. On the largest system, all learned methods converge to comparable optimality gaps, indicating a shared scalability challenge independent of the modeling paradigm\. FMOPF’s contribution is not superior point prediction accuracy\. It provides the most effective warm starts, measured by post\-refinement power flow error, while additionally offering generative diversity that neither supervised regression nor joint\-space diffusion can provide\.

The NR\-Flat baseline warrants separate discussion\. It converges fully within 50 iterations and produces identical results with 100 iterations, confirming that the observed behavior is asymptotic rather than a consequence of insufficient iteration budget\. Flat\-start Newton\-Raphson yields zero box feasibility on every system because the solver finds a power flow solution without constraining generator outputs\. On the smallest system, the solver converges to a lower\-cost local minimum that violates generation limits\. On medium\-scale systems, the optimality gaps are far worse than any learned method\. On the largest system, NR\-Flat produces a competitive optimality gap but the solution is again operationally unusable due to generator limit violations\. These results underscore a structural insight\. Newton\-Raphson solves the power flow equations but does not enforce generation limits during the solve\. A high\-quality initial point already within the feasible region is essential for producing operationally viable solutions, and this is precisely what FMOPF provides\.

The largest test system reveals a sharp divergence in scalability\. At this scale, the joint\-space diffusion baselines are effectively non\-functional\. One fails to produce any feasible samples, and the other exhibits power flow errors several orders of magnitude beyond usable range\. FMOPF is the only generative method that simultaneously achieves competitive optimality, low power flow error, and full feasibility\. All learning\-based methods exhibit comparable optimality gaps on this system, reflecting the inherent difficulty of the OPF manifold at scale rather than a shortcoming of any particular method\. The autoencoder achieves a reconstruction error well within acceptable tolerance, confirming that the latent representation retains adequate fidelity for the largest system tested\.

Tail\-risk behavior constitutes a second major dimension of comparison\. The CVaR10%captures the expected cost in the worst 10% of operating scenarios\. FMOPF achieves the lowest CVaR10%among all generative methods across all four test systems, with values one to two orders of magnitude lower than DiffOPF and Fast Diffusion\. The spread between CVaR10%and the mean optimality gap quantifies tail heaviness\. FMOPF consistently exhibits the tightest spread\. The difference remains negligible on three of the four systems and stays below one percentage point on the remaining system\. DiffOPF and Fast Diffusion show substantially wider spreads, revealing heavy\-tailed distributions where worst\-case costs far exceed the average\. This tail behavior makes joint\-space diffusion methods unreliable for risk assessment\. The meaningful comparison is among generative methods, where FMOPF’s tail risk is more than an order of magnitude lower than both joint\-space baselines across all systems\. DeepOPF, as a deterministic regressor without sampling variance, serves as a reference point for the cost prediction task rather than a competitor on distributional metrics\.

The optimality gap comparison between FMOPF and DeepOPF reflects their differing objectives\. DeepOPF is trained via supervised regression to minimize point prediction error, an objective directly aligned with the mean optimality gap metric\. FMOPF is trained via flow matching to learn the full conditional distribution\. A generative model that perfectly captures this distribution would still exhibit a non\-zero mean optimality gap when the true distribution has non\-zero variance, which is the case for non\-convex AC\-OPF\. Both approaches succeed at their respective tasks\. DeepOPF achieves superior point accuracy on medium\-scale systems\. FMOPF achieves competitive accuracy while additionally capturing the distribution of feasible solutions, a capability that deterministic regression cannot provide\.

Taken together, these results establish FMOPF as the most effective warm\-start provider among generative OPF methods, with controlled tail risk and the unique ability to scale beyond medium\-sized systems\. We now examine the mechanisms responsible for this performance through a series of ablation experiments\.

### IV\-CAblation Study

We conduct an ablation study to quantify the contribution of each design component\. All values are evaluated after Newton\-Raphson refinement and reported as mean±\\pmstandard deviation over five random seeds\. The study addresses two questions\. The first is whether the latent generation pipeline is necessary, or whether the same interaction prior can work directly in the raw state space\. The second is how the architecture and injection timing of the CA\-IPN affect performance\.

TABLE IV:Ablation of the latent generation pipeline\. FMOPF uses a learned 256\-dimensional latent space with flow matching\. The joint\-space variant applies the same interaction prior network directly in the raw OPF state space with DDIM sampling\. Both use identical training data, interaction prior design, and Newton\-Raphson post\-processing\.TABLE V:Ablation of the CA\-IPN architecture and injection timing\. All variants use the same latent autoencoder and flow matching backbone\. The MLP\-based CA\-IPN uses the architecture described in Section[III](https://arxiv.org/html/2607.22788#S3)\. GNN\-IPN replaces the state encoder with a graph neural network\. The injection timing variants activate the CA\-IPN only during the specified portion of the generation trajectory\.#### IV\-C1Impact of the Latent Generation Pipeline

Table[IV](https://arxiv.org/html/2607.22788#S4.T4)isolates the effect of the latent generation pipeline\. It compares FMOPF, which operates in a learned latent space with flow matching, against a joint\-space counterpart that applies the same interaction prior network directly in the raw OPF state space with DDIM sampling\. This comparison holds the interaction prior design constant\.

The results are decisive\. On the 6\-bus system, both variants achieve comparable optimality, but the joint\-space variant already shows a slight degradation in box feasibility\. The gap widens dramatically on the 24\-bus system\. The joint\-space variant achieves a mean optimality gap of1\.662%1\.662\\%, which is actually lower than FMOPF’s1\.813%1\.813\\%, but its box feasibility collapses to44\.9%44\.9\\%versus FMOPF’s100%100\\%\. Over half of the joint\-space samples violate generation limits after Newton\-Raphson refinement, rendering them unusable\. On the 118\-bus system, the joint\-space variant’s box feasibility degrades to98\.7%98\.7\\%and its CVaR10%is higher\. The joint\-space variant achieves near\-zero power flow error because DDIM hard measurement replacement enforces exact load matching, but this comes at the expense of feasibility since the model overfits to the load constraint while ignoring generation limits\. FMOPF’s latent autoencoder, by contrast, learns a compressed representation of the feasible solution manifold\. The reconstruction objective forces the latent space to retain information about all physical variables, and states decoded from this space are inherently biased toward the feasible region\. This ablation directly validates the central hypothesis\. Decoupling compression from generation through a latent autoencoder is a necessary condition for generating physically meaningful OPF solutions\.

#### IV\-C2CA\-IPN Architecture and Injection Timing

Table[V](https://arxiv.org/html/2607.22788#S4.T5)examines the architecture and injection timing of the CA\-IPN using four variants\. The first variant uses the full MLP\-based CA\-IPN active at all steps\. The second activates it only during the final thirty percent of generation\. The third removes the CA\-IPN entirely\. The fourth replaces the MLP state encoder with a graph neural network\.

The No CA\-IPN results confirm that the interaction prior is essential\. Removing it increases the CVaR10%by two orders of magnitude on the 6\-bus system, by a factor of four on the 24\-bus system, and by a factor of four on the 118\-bus system\. The flow matching model, despite operating in the structured latent space, cannot learn the load\-state coupling implicitly\. The injection timing results reveal a clear asymmetry\. Activating the CA\-IPN only during the final thirty percent of generation steps matches or exceeds the full CA\-IPN performance on all systems\. Activating it only during the first thirty percent performs no better than removing it entirely\. This confirms that the CA\-IPN functions as a late\-stage correction module\. The early stage establishes the coarse solution structure from the latent space geometry\. The late stage performs local refinement where explicit load\-state coupling information becomes critical\. The GNN\-IPN achieves mixed results\. It improves the mean optimality gap by0\.1150\.115percentage points over the MLP\-based CA\-IPN on the 24\-bus system, but degrades it by0\.0250\.025percentage points on the 118\-bus system with a higher CVaR10%of0\.265%0\.265\\%versus0\.236%0\.236\\%\. On the 6\-bus system the two are indistinguishable\. This inconsistency, together with the additional complexity of the graph adjacency structure, suggests that the MLP\-based CA\-IPN already captures the relevant load\-state interactions effectively within the structured latent space\. Taken together, these ablations explain the mechanism underlying FMOPF’s performance\. The latent space provides a global prior that keeps generations within the feasible region\. The CA\-IPN applies targeted, late\-stage corrections that eliminate residual violations\. Neither component alone is sufficient, and their combination is what enables FMOPF to achieve the lowest tail risk among generative OPF methods\.

### IV\-DSolution Diversity and Distributional Properties

A generative OPF method is distinguished from a deterministic regressor not by its mean accuracy, but by its ability to characterize the conditional distributionp​\(𝒙∣𝒍\)p\(\\bm\{x\}\\mid\\bm\{l\}\)\. We evaluate this capability by samplingN=50N=50solutions from FMOPF for each of several fixed load conditions and measuring the diversity of the resulting generations\.

#### IV\-D1Experimental Protocol

For each ofK=5K=5randomly selected test load conditions, we run FMOPFN=50N=50times with independent noise samples\. Each run produces a candidate OPF solution; the collection ofNNsolutions for a given load forms an empirical estimate of the conditional distribution\. We report the following statistics, aggregated across loads\. We evaluate three dimensions of generative diversity\. First, for cost distribution, For each load, we compute the generation cost of every sample and report the mean, standard deviation, and range of the resulting cost distribution\. The standard deviation quantifies the economic diversity of the generated solutions\. A larger standard deviation indicates that FMOPF is exploring a wider range of near\-optimal dispatch decisions\. For comparison, DeepOPF produces exactly one cost value per load condition, with zero diversity by construction\. Second, we verify that the diversity of generated solutions does not come at the expense of physical feasibility\. For each load condition, we report the fraction of theNNsamples that satisfy box and line constraints after Newton\-Raphson refinement\.

#### IV\-D2Results

Table[VI](https://arxiv.org/html/2607.22788#S4.T6)reports the cost diversity and pairwise state distance for all methods across the four test systems\. Each method generatesN=50N=50solutions for each ofK=5K=5fixed test loads\. The reported values aggregate allK×N=250K\\times N=250samples\. Four observations emerge from this experiment: \(1\) DeepOPF is quantitatively deterministic\. Across all four test systems, its cost standard deviation and pairwise distance are identically zero since the same load condition always produces the same output\. This is expected for a regression model and confirms that it cannot explore the solution space\. \(2\) FMOPF generates genuinely diverse solutions\. Its cost standard deviation is non\-zero on all systems, with values of0\.410\.41pu on the 6\-bus system,147\.28147\.28pu on the 24\-bus system,11\.0911\.09pu on the 118\-bus system, and109\.71109\.71pu on the 300\-bus system\. Its pairwise distance is likewise non\-zero, confirming that independent sampling runs produce different dispatch decisions\. The magnitude of cost diversity varies with system size and is determined by the width of the near\-optimal region in the OPF solution space of each network\. \(3\) FMOPF’s diversity is quality\-preserving\. On the 6\-bus system, its cost standard deviation of0\.410\.41pu is two orders of magnitude smaller than DiffOPF’s112\.05112\.05pu and Fast Diffusion’s180\.80180\.80pu\. This is not because FMOPF lacks diversity\. Its pairwise distance is non\-zero, but all of its samples remain within a tight near\-optimal band\. The joint\-space diffusion methods exhibit large cost variance because a substantial fraction of their samples produce poor\-quality solutions, inflating the variance\. Their diversity reflects degraded solution quality rather than useful exploration of the near\-optimal region\. FMOPF’s controlled diversity is precisely the desired behavior for a generative OPF method since operators need alternative dispatch decisions that are all operationally viable, not a wide scatter that includes infeasible or severely suboptimal solutions\. \(4\) on the 300\-bus system, FMOPF achieves a Load/Gen voltage variance ratio of29\.3×29\.3\\times, confirming that load bus voltages are substantially more diverse than generator bus voltages\. This is physically expected since generator voltages are tightly regulated\. Joint\-space methods exhibit physically implausible ratios exceeding105×10^\{5\}\\times, further evidence that their variance reflects degraded quality rather than meaningful diversity\. These results establish that FMOPF provides meaningful, quality\-preserving generative diversity\. It produces different, physically consistent solutions for a fixed load condition, a capability that deterministic regression models fundamentally cannot provide, while maintaining the controlled variance that distinguishes useful exploration from degraded solution quality\.

TABLE VI:Cost diversity and pairwise distance\. Cost std\. is the standard deviation of quadratic generation costs acrossN=50N=50samples for a given load, averaged overK=5K=5loads\. Pairwise distance is the mean Euclidean distance between all pairs of generated state vectors\. DeepOPF is deterministic and produces identical output for all samples of the same load\. Best \(non\-zero, controlled\) diversity is bolded\.

### IV\-EComputational Efficiency

Table[VII](https://arxiv.org/html/2607.22788#S4.T7)compares the model parameters and per\-sample computational cost of FMOPF against the baselines\. For generative methods, FLOPs are reported for the full generation pipeline with thirty sampling steps\. For the supervised DeepOPF, a single forward pass is reported\.

TABLE VII:Model parameters and per\-sample FLOPs across system scales\. For FMOPF, the autoencoder encoder and decoder are applied once per sample and the flow matching model and CA\-IPN are applied over the full generation trajectory\. DeepOPF requires a single forward pass\.The key architectural advantage of FMOPF is the decoupling of generation from system scale\. The flow matching model and the CA\-IPN operate in a fixed 256\-dimensional latent space, independent of the number of buses\. Only the autoencoder scales with the state dimension, and its contribution to the total parameter count is modest\. As a result, FMOPF’s total parameter count grows from 67\.0M to 69\.4M when scaling from the 6\-bus to the 300\-bus system, an increase of only3\.6%3\.6\\%\. The per\-sample FLOPs remain approximately 1\.97 to 1\.99 GFLOPs across all four systems\. In contrast, methods that operate directly in the joint space see their parameter counts grow substantially with system size\. The FMOPF w/o Latent variant grows from 63\.4M to 82\.0M across the same range and would require approximately 130M parameters for a system with 1,354 buses\. DiffOPF and Fast Diffusion share the same joint\-space MLP denoiser architecture and grow from 50\.7M to 65\.1M\. DeepOPF has the smallest model size due to its simple MLP architecture, but its supervised formulation precludes generative capabilities\. The FLOPs comparison reinforces this scaling advantage\. FMOPF’s per\-sample cost is nearly constant across system scales, while joint\-space methods require increasing computation for larger systems\.

## VConclusion

This paper presented FMOPF, a generative framework for AC optimal power flow that decouples compression from generation through latent flow matching and explicitly models load\-state coupling through a constraint\-aware interaction prior network\. Experiments on four IEEE test systems demonstrated that FMOPF provides the most effective Newton\-Raphson warm starts among all compared methods, achieves the lowest tail risk among generative methods, and is the first such method to scale to systems with several hundred buses while preserving full feasibility\. The latent generation pipeline was shown to be a necessary condition for physical feasibility, and the interaction prior network was found to function as a late\-stage tail\-risk controller whose removal increases tail risk by orders of magnitude\. These results establish latent flow matching with interaction priors as an effective paradigm for generative OPF\. Future work includes hierarchical autoencoder architectures for transmission systems at the scale of thousands of buses and extensions to security\-constrained formulations under contingency constraints\.

## References

- \[1\]S\. Frank and S\. Rebennack, “An introduction to optimal power flow: Theory, formulation, and examples,”*IIE transactions*, vol\. 48, no\. 12, pp\. 1172–1197, 2016\.
- \[2\]A\. J\. Wood, B\. F\. Wollenberg, and G\. B\. Sheblé,*Power generation, operation, and control*\. John wiley & sons, 2013\.
- \[3\]X\. Pan, T\. Zhao, M\. Chen, and S\. Zhang, “Deepopf: A deep neural network approach for security\-constrained dc optimal power flow,”*IEEE Transactions on Power Systems*, vol\. 36, no\. 3, pp\. 1725–1735, 2020\.
- \[4\]A\. S\. Zamzam and K\. Baker, “Learning optimal solutions for extremely fast ac optimal power flow,” in*2020 IEEE international conference on communications, control, and computing technologies for smart grids \(SmartGridComm\)*\. IEEE, 2020, pp\. 1–6\.
- \[5\]F\. Fioretto, T\. W\. Mak, and P\. Van Hentenryck, “Predicting ac optimal power flows: Combining deep learning and lagrangian dual methods,” in*Proceedings of the AAAI conference on artificial intelligence*, vol\. 34, no\. 01, 2020, pp\. 630–637\.
- \[6\]Y\. Li, C\. Zhao, and C\. Liu, “Model\-informed generative adversarial network for learning optimal power flow,”*IISE Transactions*, vol\. 57, no\. 1, pp\. 30–43, 2025\.
- \[7\]J\. Ho, A\. Jain, and P\. Abbeel, “Denoising diffusion probabilistic models,”*Advances in neural information processing systems*, vol\. 33, pp\. 6840–6851, 2020\.
- \[8\]Y\. Lipman, R\. T\. Chen, H\. Ben\-Hamu, M\. Nickel, and M\. Le, “Flow matching for generative modeling,” in*The Eleventh International Conference on Learning Representations*, 2023\.
- \[9\]L\. Yang, Z\. Huang, Y\. Song, S\. Hong, G\. Li, W\. Zhang, B\. Cui, B\. Ghanem, and M\.\-H\. Yang, “Diffusion\-based scene graph to image generation with masked contrastive pre\-training,”*arXiv preprint arXiv:2211\.11138*, 2022\.
- \[10\]R\. Rombach, A\. Blattmann, D\. Lorenz, P\. Esser, and B\. Ommer, “High\-resolution image synthesis with latent diffusion models,” in*Proceedings of the IEEE/CVF conference on computer vision and pattern recognition*, 2022, pp\. 10 684–10 695\.
- \[11\]P\. Esser, S\. Kulal, A\. Blattmann, R\. Entezari, J\. Müller, H\. Saini, Y\. Levi, D\. Lorenz, A\. Sauer, F\. Boesel*et al\.*, “Scaling rectified flow transformers for high\-resolution image synthesis,” in*Forty\-first international conference on machine learning*, 2024\.
- \[12\]Z\. Huang, Y\. Yu, L\. Yang, C\. Qin, B\. Zheng, X\. Zheng, Z\. Zhou, Y\. Wang, and W\. Yang, “Motion\-aware latent diffusion models for video frame interpolation,” in*Proceedings of the 32nd ACM International Conference on Multimedia*, 2024, pp\. 1043–1052\.
- \[13\]Z\. Huang, C\. Qin, Y\. Xing, and W\. Yang, “Enhanced motion\-aware latent diffusion models for video frame interpolation,” in*Proceedings of the 33rd ACM International Conference on Multimedia*, 2025, pp\. 2811–2820\.
- \[14\]Z\. Huang, L\. Yang, X\. Zhou, Z\. Zhang, W\. Zhang, X\. Zheng, J\. Chen, Y\. Wang, B\. Cui, and W\. Yang, “Protein\-ligand interaction prior for binding\-aware 3d molecule diffusion models,” in*The Twelfth International Conference on Learning Representations*, 2024\.
- \[15\]Z\. Huang, L\. Yang, X\. Zhou, C\. Qin, Y\. Yu, X\. Zheng, Z\. Zhou, W\. Zhang, Y\. Wang, and W\. Yang, “Interaction\-based retrieval\-augmented diffusion models for protein\-specific 3d molecule generation,” in*Forty\-first International Conference on Machine Learning*, 2024\.
- \[16\]Z\. Huang, L\. Yang, Z\. Zhang, X\. Zhou, Y\. Bao, X\. Zheng, Y\. Yang, Y\. Wang, and W\. Yang, “Binding\-adaptive diffusion models for structure\-based drug design,” in*Proceedings of the AAAI Conference on Artificial Intelligence*, vol\. 38, no\. 11, 2024, pp\. 12 671–12 679\.
- \[17\]Z\. Huang, L\. Yang, C\. Qin, Y\. Xing, H\. Yu, X\. Zhou, B\. Zheng, Y\. Wang, X\. Gao, and W\. Yang, “Disentangled diffusion model for 3d molecular generation with protein–ligand interaction priors,”*Bioinformatics*, vol\. 42, no\. 6, p\. btag165, 2026\.
- \[18\]M\. Hoseinpour and V\. Dvorkin, “Diffopf: Diffusion solver for optimal power flow,”*Electric Power Systems Research*, vol\. 262, p\. 113621, 2027\.
- \[19\]S\. Shekhar, A\. Karn, K\. Keshav, S\. Bansal, and P\. Pareek, “Fast diffusion with physics\-correction for acopf,”*arXiv preprint arXiv:2602\.03020*, 2026\.
- \[20\]X\. Liu, C\. Gong*et al\.*, “Flow straight and fast: Learning to generate and transfer data with rectified flow,” in*The Eleventh International Conference on Learning Representations*, 2023\.
- \[21\]P\. L\. Donti, D\. Rolnick, and J\. Z\. Kolter, “Dc3: A learning method for optimization with hard constraints,”*arXiv preprint arXiv:2104\.12225*, 2021\.
- \[22\]W\. Huang, M\. Chen, and S\. H\. Low, “Unsupervised learning for solving ac optimal power flows: Design, analysis, and experiment,”*IEEE Transactions on Power Systems*, vol\. 39, no\. 6, pp\. 7102–7114, 2024\.
- \[23\]R\. Nellikkath and S\. Chatzivasileiadis, “Physics\-informed neural networks for ac optimal power flow,”*Electric Power Systems Research*, vol\. 212, p\. 108412, 2022\.
- \[24\]S\. Liu, C\. Wu, and H\. Zhu, “Topology\-aware graph neural networks for learning feasible and adaptive ac\-opf solutions,”*IEEE Transactions on Power Systems*, vol\. 38, no\. 6, pp\. 5660–5670, 2022\.
- \[25\]J\. Sohl\-Dickstein, E\. Weiss, N\. Maheswaranathan, and S\. Ganguli, “Deep unsupervised learning using nonequilibrium thermodynamics,” in*International conference on machine learning*\. pmlr, 2015, pp\. 2256–2265\.
- \[26\]J\. Song, C\. Meng, and S\. Ermon, “Denoising diffusion implicit models,” in*International Conference on Learning Representations*, 2021\.
- \[27\]P\. Dhariwal and A\. Nichol, “Diffusion models beat gans on image synthesis,”*Advances in neural information processing systems*, vol\. 34, pp\. 8780–8794, 2021\.
- \[28\]M\. S\. Albergo and E\. Vanden\-Eijnden, “Building normalizing flows with stochastic interpolants,” in*The Eleventh International Conference on Learning Representations*, 2023\.
- \[29\]Y\. Song, J\. Gong, M\. Xu, Z\. Cao, Y\. Lan, S\. Ermon, H\. Zhou, and W\.\-Y\. Ma, “Equivariant flow matching with hybrid probability transport for 3d molecule generation,”*Advances in Neural Information Processing Systems*, vol\. 36, pp\. 549–568, 2023\.
- \[30\]J\. Yim, B\. L\. Trippe, V\. De Bortoli, E\. Mathieu, A\. Doucet, R\. Barzilay, and T\. Jaakkola, “Se \(3\) diffusion model with application to protein backbone generation,”*arXiv preprint arXiv:2302\.02277*, 2023\.
- \[31\]Z\. Huang, L\. Yang, X\. Zhou, Z\. Zhang, W\. Zhang, X\. Zheng, J\. Chen, Y\. Wang, B\. Cui, and W\. Yang, “Protein\-ligand interaction prior for binding\-aware 3d molecule diffusion models,” in*The Twelfth International Conference on Learning Representations*, 2024\.
- \[32\]I\. Loshchilov and F\. Hutter, “Decoupled weight decay regularization,”*arXiv preprint arXiv:1711\.05101*, 2017\.
- \[33\]B\. Stott, “Review of load\-flow calculation methods,”*Proceedings of the IEEE*, vol\. 62, no\. 7, pp\. 916–929, 1974\.
- \[34\]L\. Thurner, A\. Scheidler, F\. Schäfer, J\.\-H\. Menke, J\. Dollichon, F\. Meier, S\. Meinecke, and M\. Braun, “pandapower—an open\-source python tool for convenient modeling, analysis, and optimization of electric power systems,”*IEEE Transactions on Power Systems*, vol\. 33, no\. 6, pp\. 6510–6521, 2018\.

Similar Articles

Multimarginal flow matching with optimal transport potentials

arXiv cs.LG

Proposes OTP-FM, a novel method for multimarginal flow matching that uses optimal transport potentials to softly steer flows through intermediate marginals, achieving state-of-the-art performance on single-cell RNA sequencing, oceanographic, and meteorological datasets.

Perron--Frobenius Operator Matching for Generative Modeling

arXiv cs.LG

Introduces Perron–Frobenius Operator Matching (PFOM), a generative framework that unifies flow, diffusion, and jump models via integral PF operator matching, proving KL divergence yields a practical loss equivalent to Koopman path matching, and develops Nesterov-accelerated training and sampling for improved efficiency.