Neural networks can now predict power-grid dispatch decisions thousands of times faster than numerical solvers, but they are still not trusted to act on their own because their outputs break physical limits a small fraction of the time. The fast remedies, closed-form projections onto linear constraints, are rebuilt from scratch for every snapshot of the grid. They also have to be recomputed whenever a transmission line trips. Real-time dispatch is not a stream of unrelated snapshots, though. It is re-solved every few minutes, and consecutive operating points are close. This proposal makes the constraint-enforcement step itself recurrent. A small gated recurrent unit (GRU) carries forward the previous interval's feasible point and the multipliers that measure how hard each constraint was pushing. A few cheap rounds of neighbor-to-neighbor message passing then return the new prediction to the feasible set. The step size on each edge is set dynamically by learned attention instead of a fixed rule.
The bet is that warm-starting turns an expensive global projection into a handful of local sparse updates. Because those updates are local, they survive topology changes without rebuilding any matrix. The same structure appears in molecule generation. A diffusion model's reverse process takes many small steps, and a projection onto valency constraints is currently recomputed at each step. Valency, the limit on how many bonds each atom can form, is a node-budget constraint with the same algebra as power balance. We use chemistry as a second, smaller testbed for the same mechanism.
Core Claim
When a constrained prediction problem is solved repeatedly along a trajectory, whether dispatch intervals or denoising steps, a learned projection layer can reach near-zero constraint violation in a constant, small number of local iterations. It does this by keeping the previous step's dual variables, the per-constraint "pressure" terms of the projection, in recurrent state. Dynamic neighbor weighting then supplies per-edge step sizes that adapt to the current operating point and topology.
Three things would be new. The first is amortizing the constraint solve across time instead of only across instances. The second is replacing a topology-specific pseudoinverse with local iterations that need no recomputation after a contingency. The third is reading attention coefficients as a learned preconditioner for a convergent solver, rather than as a free-form aggregation weight.
Relation to Prior Work
Three works motivate the gap.
- KCLNet predicts power flows with GATv2 attention layers and enforces Kirchhoff's current law exactly through a Moore-Penrose pseudoinverse projection. It reports a violation score of 0.000. However, it treats each snapshot independently, handles only linear equalities, and its projection matrix is tied to a fixed graph.
- Learning Optimization Proxies for Large-Scale Security-Constrained Economic Dispatch achieves millisecond inference on a 6,708-bus French grid but reports no constraint-satisfaction rate. It also operates per window without tracking state across intervals.
- Scaling Laws of Machine Learning for Optimal Power Flow shows that larger models and more data lower average error without eliminating hard violations. This constrains the design: capacity alone will not close the gap.
At the other extreme, QCQP-Net obtains feasibility on non-convex AC optimal power flow by solving a quadratically constrained program inside every forward pass. That is exact but expensive, and it uses no graph structure. PF∆ shows that learned power-flow models degrade under multi-line outages and near the voltage-stability limit. These are exactly the regimes where a fixed-graph projection is brittle.
The recurrent ingredient borrows from RNN-LSTM-Based Model Predictive Control for a Corn-to-Sugar Process. That work uses an LSTM as the predictive model inside a controller and linearizes around the current state. It flattens a 655-sensor plant into 18 inputs and ignores topology. We keep its local-linearization idea but place the recurrence on the grid graph and on the constraint solver's state.
On the chemistry side, Diffuse, Sample, Project (PRODIGY) interleaves a closed-form projection onto constraints with each reverse diffusion step and reaches up to 100% constraint satisfaction. It recomputes that projection independently at every step, which is the redundancy we target. GEOM-Drugs Revisited supplies the evaluation discipline: its corrected valency tables and kekulized molecules reveal violations that earlier metrics hid.
Graph Attention Networks supplies the attention form we reuse. Its known tendency to collapse toward uniform weights in deep stacks is one reason we use attention only to set positive step sizes inside a solver with its own convergence guarantee.
Research Program
At dispatch interval $t$, a spatio-temporal backbone produces a raw setpoint vector $\hat y_t$. The backbone is GATv2 message passing over the grid, with a GRU at each node carrying temporal state. Grid constraints are linearized and written in sparse form, with bus angles as auxiliary variables. This makes every constraint row touch only a bus and its neighbors. The constraints are $A_t y \le b_t$, plus equality rows for power balance and box bounds that encode generator limits and ramp limits relative to $y_{t-1}$. The matrix $A_t$ changes whenever a line trips.
The feasibility layer runs $K$ iterations of projected dual ascent on the problem of finding the nearest point to $\hat y_t$ that satisfies the constraints:
$$y^{(k)} = \Pi_{\text{box}}\big(\hat y_t - A_t^\top \lambda^{(k)}\big), \qquad \lambda^{(k+1)} = \big[\lambda^{(k)} + D_t\,(A_t y^{(k)} - b_t)\big]_+ ,$$
Here $\lambda$ holds one multiplier per constraint, kept nonnegative for inequalities. $\Pi_{\text{box}}$ clips to the bounds. $D_t$ is a diagonal matrix of per-constraint step sizes produced by an attention head from the current node features, bounded above by a safe value so that convergence of dual ascent on this strongly convex problem is preserved. Each iteration is one sparse multiply by $A_t$ and one by $A_t^\top$, which is one round of message passing. A topology change only deletes rows and columns; nothing has to be refactored.
The recurrent part is the initialization $\lambda^{(0)}_t = \lambda^{(K)}_{t-1}$, gated by the node GRU so that the model can discard stale multipliers after a contingency. A final exact step restores power balance by distributing the residual over unsaturated generators in proportion to their headroom, which is the standard participation-factor rule. This makes the equality constraints hold to machine precision. Line limits are the inequalities left approximately satisfied, and we report their violation directly.
Training is end-to-end through the unrolled $K$ iterations, on whole multi-interval trajectories. The loss combines dispatch cost and distance to solver solutions.
Two extensions test the boundaries of the idea:
- AC power flow. Following the corn-to-sugar controller's local linearization, we linearize the AC equations around the previous interval's AC point held in recurrent state. We then measure the remaining AC mismatch with a single Newton-Raphson residual evaluation.
- Molecules. We attach the same layer to a pretrained graph diffusion model. Bond orders are the edge variables, and "sum of bond orders at each atom ≤ allowed valence" is the node-budget row. Multipliers are carried across denoising steps instead of dispatch intervals.
Baselines
The naive reference is a numerical solver run from scratch on every interval. It has zero violation and is slow. Learning Optimization Proxies for Large-Scale Security-Constrained Economic Dispatch reports an average of 15.93 seconds per instance on the RTE system. We rerun it on our hardware so latencies are comparable.
The strongest existing proxy for latency is that paper's Classification-Then-Regression model. It reports a mean absolute percentage error of 0.59% for medium and 0.34% for large generators, and a batch of 288 instances in 1.5 ms. No reported constraint-satisfaction rate was found on Lacuna, so we will measure it ourselves. Beating it means matching its error within 0.1 percentage points while cutting line-limit violation rates by at least an order of magnitude, at a per-interval latency within a factor of two.
The strongest exact-projection competitor is KCLNet. It reports a KCL violation of 0.000 and an MSE of 0.273 on IEEE 118-bus, with no reported latency on Lacuna. We run it with its pseudoinverse recomputed after every topology change and give it the same backbone width and the same tuning budget.
QCQP-Net is the feasibility ceiling on PGLib-OPF. It reports 100% feasibility on the 30- and 118-bus cases and 92% test accuracy on 300-bus after 200 epochs, with no latency reported on Lacuna. We compare against it on training cost and inference latency, not only on feasibility.
Two operationally obvious competitors are a per-interval proxy followed by a warm-started quadratic-program projection solved with a commercial solver, and a cached factorization with low-rank updates for each line trip.
Three ablations isolate the key ingredients:
- No recurrence: cold-start multipliers, $\lambda^{(0)}=0$, so we see whether warm-starting is what buys the small $K$.
- No dynamic weighting: a fixed scalar step in place of attention-derived $D_t$.
- No exact correction: the final balance step removed.
All methods share training data, trajectories, a common hyperparameter search budget, and a single GPU for inference timing.
On molecules, the baseline is PRODIGY with per-step projection from scratch. It reports up to 100% constraint satisfaction on ZINC250k. No reported wall-clock number was found on Lacuna, so we time it under identical sampling settings.
Why not just…?
Why not just train a bigger unconstrained model with penalty terms? Scaling Laws of Machine Learning for Optimal Power Flow finds that violation rates do not fall with scale. In KCLNet's comparisons, the penalty-trained models LeapNet and KodyNet keep nonzero violations while projection reaches zero. We still include a penalty-trained model of matching size, so that this evidence is reproduced on our multi-interval data rather than assumed.
Why not just run the existing per-interval proxy and then a warm-started solver projection? This is the real threat. A warm-started quadratic program over a slightly perturbed problem can converge in very few iterations, and it is exact. Our experiments settle it with a latency-versus-violation curve on RTE-scale batches. If the solver matches our violation at comparable batched latency, the contribution reduces to a GPU-friendly reimplementation, and we will say so. We expect an advantage only for large scenario batches and after topology changes, where solver warm starts are least effective.
Why not just cache a factorization and apply low-rank updates when a line trips? For a single outage on a fixed linear system, low-rank updates are cheap. They may match us on the equality part under N-1, and we will report that honestly. They do not handle the active inequality set changing from interval to interval. They also compound in cost under N-2 and multi-element events, which is where PF∆ shows models break. We test N-1 and N-2 separately to locate the crossover.
Why not just use a flat LSTM over the whole system, as in the corn-to-sugar controller? A flat recurrent model has no notion of which constraint touches which bus. It therefore cannot carry per-constraint multipliers in a way that survives a topology change. The no-graph ablation, a GRU on flattened inputs with the same projection, tests whether spatial structure matters once the recurrence is present.
Proposed Experiments
PGLib-OPF cases and the PF∆ systems are static snapshots. We will therefore build multi-interval trajectories by driving the IEEE 118-bus, IEEE 300-bus, and GOC-2000 cases with smooth load and renewable paths at 5-minute resolution. Line trips are injected at random intervals, including the near-infeasible loadings that PF∆ identifies. Every interval is solved with Ipopt to obtain labels. If the RTE data from the dispatch-proxy paper is accessible, we repeat the main comparison there. If it is not, GOC-2000 is our large case.
The decisive checks are three.
- Does warm-starting pay off? Measured line-limit violation as a function of iteration count $K$ should show the recurrent layer reaching a target violation, for example under 0.1% of lines exceeding limits, with several-fold fewer iterations than the cold-start ablation. If the two curves coincide, the core claim fails.
- Does the layer survive topology changes? Violation and latency in the five intervals after an N-1 or N-2 event, compared with KCLNet with recomputed pseudoinverse and with low-rank-updated factorization.
- Does attention help the solver? Iterations-to-tolerance with attention-derived steps versus a fixed step, on held-out topologies.
For the AC extension, we report the Newton-Raphson mismatch norm after projection against QCQP-Net's feasibility on the 118- and 300-bus cases. For the molecule testbed, we report valency validity under the corrected GEOM-Drugs tables on kekulized molecules, plus wall-clock time per sample, against PRODIGY on QM9 and ZINC250k. Success there means equal validity at reduced projection cost. A negative result would indicate that the dispatch gains rely on physical smoothness that denoising trajectories lack.
References
- KCLNet: Physics-Informed Power Flow Prediction via Constraints Projections
- Learning optimization proxies for large-scale Security-Constrained Economic Dispatch
- Scaling Laws of Machine Learning for Optimal Power Flow
- QCQP-Net: Reliably learning feasible alternating current optimal power flow solutions under constraints
- PF∆: A Benchmark Dataset for Power Flow under Load, Generation, and Topology Variations
- RNN-LSTM-Based Model Predictive Control for a Corn-to-Sugar Process
- Diffuse, Sample, Project: Plug-And-Play Controllable Graph Generation
- GEOM-Drugs Revisited: Toward More Chemically Accurate Benchmarks for 3D Molecule Generation
- Graph Attention Networks