Metamorphic testing of learned AC optimal power flow surrogates reveals representation dependence

Stephen Peng, Vineet Jagadeesan NairarXiv 2026

TL;DR

Researchers have uncovered a significant "construct-validity" flaw in how AI surrogates for power grid optimization (AC-OPF) are evaluated. By applying metamorphic testing, they demonstrate that state-of-the-art models produce inconsistent results based on arbitrary data encoding choices—like the order of buses in a list—revealing that these models often fail to capture the underlying physics of the grid.

What Problem Does This Paper Address?

The Alternating Current Optimal Power Flow (AC-OPF) problem is the backbone of power system operations, determining the most cost-effective way to generate and move electricity while respecting complex physical laws. Because traditional solvers are slow, the research community has turned to "learned surrogates"—machine learning models that approximate these solutions instantly.

However, these models are typically evaluated on a single "serialization" (a specific way of writing down the grid data). The authors argue this is a major oversight. A power grid is a physical entity; its behavior shouldn't change just because you renumber the buses or flip the direction of a branch in your spreadsheet. If a model’s prediction changes based on these arbitrary choices, it suffers from representation dependence. This paper introduces a rigorous framework to audit this dependence and determine if these models are truly learning physics or just memorizing data formats.

Methods

The authors employ metamorphic testing, a technique that checks for necessary relationships between outputs for transformed inputs, even when the "correct" answer is unknown. They defined 13 specific transformations categorized into two tiers:

  1. Representation-equivalence (REP): Changes that only affect labels or conventions (e.g., reordering rows, moving the reference angle).
  2. Electrical-equivalence (ELC): Changes to the graph structure that preserve the aggregate electrical problem (e.g., splitting one generator into two identical ones).

The audit covered 17 configurations, including two prominent open-weight models (GridSFM-Open and LUMINA-2M) and various architectural controls like Graph Neural Networks (GNNs) with different positional encodings.

Table 1: The thirteen relations at a glance. The two tiers describe the output-map contract; neither tier asserts that every relation is a bijective group action.

Datasets

The study utilized scenarios from the OPFData release, which includes topology-perturbed versions of standard PGLib networks. The models were tested across various grid sizes, specifically:

  • case14 and case118 (smaller grids)
  • case500, case2000, and case4661 (larger, more complex grids)

Key Insights and Ideas

  • Universal Failure: Every single one of the 17 audited configurations failed at least six metamorphic relations. Even at relaxed error tolerances, the models remained inconsistent.
  • Bugs in the Plumbing: Inconsistencies weren't just in the neural networks themselves. In GridSFM-Open, the authors localized discrepancies to the preprocessing pipeline, identifying an indexing bug and numerically unstable feature choices (like how cycle bases are constructed).
  • The Spectral Trap: Models using Laplacian eigenvectors (spectral features) are particularly vulnerable. Because the signs and bases of these eigenvectors are arbitrary, a simple bus reordering can completely change the input features, leading to wildly different predictions.
  • Hardware Mismatch: A surprising amount of error in spectral models was traced to a mismatch between the GPU eigensolver used during training and the CPU eigensolver used during testing.

Key Results

The authors tested whether using these transformations as data augmentation during training could fix the issue. While augmentation significantly reduced the median discrepancy ($\Delta_r$), it did not eliminate it.

Figure 1: Metamorphic consistency for 17 model and pipeline configurations (two trained checkpoints and 15 random-weight architecture or mechanism controls) across 13 relations on case14/500. Each case uses 3 source scenarios, 3 sampled transformations per admitted case–relation pair, and 3 random initializations where applicable. Green denotes a pass at the prespecified 10−6 tolerance.

As shown in the table below, while augmentation improved mean absolute error (MAE) on transformed views, the models still struggled with physical feasibility.

Table 2: Aggregate augmentation outcomes. Note the significant drop in Median $\Delta_r$ but the continued failure to reach AC feasibility.

Crucially, every evaluated prediction remained AC infeasible, meaning the models still produced solutions that violated the basic laws of physics, even after augmentation.

Limitations and Future Work

The authors acknowledge that their catalog of 13 relations is representative but not exhaustive. Furthermore, the study was limited by the availability of open-weight models; many published surrogates are not fully auditable because their preprocessing code or trained weights are private.

Future work should focus on invariance by construction—designing architectures that are mathematically guaranteed to ignore representation choices—rather than relying on data augmentation as a "band-aid." The authors also call for new benchmarking standards where researchers must report representation consistency alongside traditional metrics like accuracy and speed.

Summary updated

Abstract

Evaluating a learned AC optimal power flow (AC-OPF) surrogate on one grid serialization cannot show whether its accuracy depends on that encoding. We test this dependence with thirteen metamorphic relations, each specifying when a transformation is valid and how to compare its outputs. Our audit covers 17 model and pipeline configurations: two released trained checkpoints and 15 random-weight architecture or mechanism controls. Every configuration violates at least six relations, even at reporting tolerances ten times tighter or looser. For GridSFM-Open v1.1, source inspection and intermediate-tensor interventions point to an indexing bug and three noncanonical or numerically unstable preprocessing choices; a repaired checkpoint remains untested. In a separate case500 training experiment, augmentation lowers transformed-view error in three of four models and median discrepancy and constraint-violation P95 in all four. These benefits depend on the training protocol: some relations worsen, and every evaluated prediction remains AC infeasible. A GPU/CPU eigensolver mismatch accounts for most of the large raw-Laplacian-baseline gain. We recommend reporting representation consistency alongside accuracy, feasibility, and cost. These results establish neither deployment readiness nor universal invariance.
BibTeX
@misc{peng2026metamorphic,
  author = {Stephen Peng and Vineet Jagadeesan Nair},
  title = {{Metamorphic testing of learned AC optimal power flow surrogates reveals representation dependence}},
  year = {2026},
  eprint = {2611.13566},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.13566},
}
Figure