Paper commentary
Metamorphic testing of learned AC optimal power flow surrogates reveals representation dependence
Metamorphic tests show learned AC-OPF surrogates depend on how grids are encoded
- Problem Accuracy on one grid file format cannot show whether a learned AC-OPF surrogate depends on how the grid is encoded. Reordering buses or swapping branch endpoints leaves the physics unchanged, so the error mixes physics with file layout.
- Method The authors test each surrogate with thirteen metamorphic relations. Each relation re-encodes the same grid, runs the surrogate, and maps predictions back to physical devices before comparing them.
- Results Every one of the 17 audited configurations violates at least six of the thirteen relations at the 10−6 tolerance. Two released checkpoints and 15 random-weight controls all fail.

Figure 2 : Examples of REP relations. They change labels, row order, branch orientation, or angle reference without changing the underlying AC-OPF problem, and we compare predictions after undoing the declared map. The pipeline-specific basekv-scale relation changes an exported model input that is absent from the standard per-unit AC-OPF target.
Original paper · CC BY 4.0 · Stephen Peng, Vineet Jagadeesan Nair · Metamorphic testing of learned AC optimal power flow surrogates reveals representation dependence · Original paper figure · Extracted the figure area from page 16 of the original PDF.Why one encoding can't settle accuracy
Learned AC-OPF surrogates are usually scored on accuracy, feasibility, and speed over held-out cases, and each case sits in one file format. The same physical grid can list its buses in another row order, reverse eligible branches, or give each island its own angle reference. The physical problem stays the same under these rewrites, so the error number mixes two things at once.
It mixes how well the model solves the physics with how well it copes with one particular file layout.
The authors call this a construct-validity gap, since the measured quantity isn't quite the claim they want to make. Error on one serialization can't show whether accuracy reflects the physical problem or an encoding convention. It does this without requiring a unique reference output for each input.
The sharper question is whether a deterministic surrogate should return the same answer for every encoding of one case. Once predictions go back to their physical devices and a shared angle reference, the answers should match. One encoding leaves that property unmeasured, so the authors build a test that varies the encoding. The test uses thirteen transformations in two tiers, representation relations and electrical-equivalence relations.
Only the relations that pass their applicability checks count as valid tests of the surrogate.
Thirteen relations and a normalized discrepancy
Here the linked inputs are one grid and a transformed encoding of it, and the relation says the restored outputs should agree.
The thirteen relations fall into two tiers: eight representation-equivalence relations that re-encode the same grid, and five electrical-equivalence relations that change component or graph bookkeeping. Bus-relabel permutes bus order and branch-reversal swaps the endpoints of an eligible branch, with its attributes moved along. A relation is used only after its algebraic applicability condition holds and a sampled solver check passes.
For a relation r, the serialized case d becomes \( T_r d \), the surrogate runs on it, and the output map \( P_r \) returns predictions to physical devices and aligns angles within each island. The discrepancy is \[ \Delta_r(d) = \max_{c \in C} \frac{\mathrm{MAE}_c\big(P_r f(T_r d),\, f(d)\big)}{\tau_c}, \qquad C=\{V_m, V_a, P_g, Q_g\} \] Each MAE averages absolute differences over the elements of one channel, and the maximum runs over the four channels, each divided by its own tolerance.
The tolerance is 10−6 in native units, per unit for voltage magnitude and generation and radians for angle, and a value of 1 marks the reporting threshold rather than a percentage error.
Which configurations fail the relations
The built-in screen covers 17 configurations on case14/500: two trained open-weight checkpoints and 15 random-weight architecture or mechanism controls. A configuration passes a relation only when every executed, applicable draw keeps the normalized discrepancy at or below 1. No configuration passes all thirteen relations.
The verdict depends on the threshold, but only to a limited extent. At a relaxed native-channel threshold of 10−3, every configuration still fails at least four relations. At the 10−6 threshold, excluding basekv-scale leaves 140 of 204 cells failed, with at least five failed relations per configuration. The authors state that this reaggregation tests threshold sensitivity and does not calibrate numerical noise.
The relabeling relations separate the designs most clearly. Using all buses instead of array-selected landmarks removes the selection dependence in the matched control.
The six shared failures point to two kinds of preprocessing dependence. ref-bus-move and island-ref-mix show that the pipelines don't consistently canonicalize the angle reference, and basekv-scale shows that target-irrelevant metadata isn't discarded.
Trained checkpoints versus random weights
The comparison pairs each released checkpoint with its three random initializations, which see the same scenarios and draws. Three source scenarios come from each of five grids, case14, case118, case500, case2000 and case4661, with three draws per source–relation pair. That design yields 117 comparisons per grid and model or seed run, and the grids sit at different points relative to each checkpoint's training coverage.
Under the source-median, worst-grid aggregate, trained and random versions of both backbones agree on all 13 threshold classifications. So the trained checkpoints didn't remove the failures that the random controls show. For GridSFM, the aggregate falls below threshold only on component-relabel. These below-threshold aggregates match the finite permutation and aggregation checks, but they don't guarantee every input.
In LUMINA, trained discrepancy exceeds the random control in 50 of 58 cells. The median ratios are 7.50× and 6.23×, with substantial variation across grids. The authors dropped component-relabel from the ratios because its trained and random discrepancies all sit below 10−6.
Random networks can look consistent because their outputs are nearly constant, so these ratios don't rank model quality. A metamorphic discrepancy shows representation dependence without showing that either output is physically invalid.
Where GridSFM-Open's discrepancy enters
The first detected discrepancy in GridSFM-Open shows up in derived features, before the prediction network runs. The first candidate, landmark selection for effective-resistance summaries, picks up to 64 landmarks partly by bus index. The combined line and transformer offsets count appended arrays instead of edges. A sign applied to near-zero DC flows turns numerical noise into a categorical feature.
The authors swapped aligned intermediate tensors to test these mechanisms, and they didn't retrain the checkpoint. For case500 source 9245 under bus relabeling at draw 0, the legacy equal-channel score falls from 30.4769 to 30.4712 after node and cycle feature substitution. That score divides channel errors by 10−3, so it isn't the maximum-channel Δr at 10−6 used in the main audit.
The final-to-initial ratio of 1.724×10−6 measures the relative residual, not an absolute pass threshold.
Other relations keep substantial residuals under the same interventions. These tests locate sensitivity before the prediction network, but they neither prove full invariance nor validate four independent repairs.
The mechanisms suggest four repairs: landmarks chosen independently of arbitrary indices, cumulative edge counts, a dead band for near-zero flows, and cycle information independent of row order. Those predictions are AC infeasible, so these figures measure encoding sensitivity, not realized losses or optimality gaps.
Relations as training augmentation
The authors ask whether training on the relations reduces representation dependence, and what that costs elsewhere. They train baseline and augmented versions of an MPNN, LapPE+MPNN, RWSE+MPNN and LUMINA. The raw Laplacian positional encodings in LapPE+MPNN are the ones the paper calls raw, while RWSE+MPNN uses random-walk encodings that avoid sign and eigenvector-basis ambiguities.
The same augmentation raises transformed MAE by 3.2% for MPNN. Canonical MAE improves by 0.4% for RWSE+MPNN, but it worsens by 3.9% for MPNN and by 3.0% for LUMINA. Median normalized discrepancy falls for all four models, so the representation gain holds across architectures.
A lower median therefore doesn't establish improvement on every relation.
Median augmented discrepancies still sit 563 to 1,260 times the reporting threshold. Constraint-violation P95 also falls for all four models under augmentation, but the authors didn't test whether training on invariance-preserving transformations causes that drop.
Limitations of the audit
The audit's passing results reach only as far as the tests went, so a clean run isn't proof of invariance. A finite set of passing tests shows only that the audit found no violation for the cases it sampled. The thirteen relations don't generate every equivalent AC-OPF encoding, so a pass doesn't prove invariance to all inputs.
The augmentation study used one training grid family, three seeds, and one compute budget. No augmented arm produces an AC-feasible prediction, so the augmentation results don't establish deployment readiness. PowerModels.jl and IPOPT serve as high-accuracy numerical controls, but they don't certify global optimality for the nonconvex problem.
The trained and random-weight checkpoints agree on all thirteen threshold classifications, so these checkpoints kept the detected failures. A metamorphic discrepancy shows representation dependence of the surrogate, not that either output is physically invalid. The authors didn't benchmark trained SignNet or BasisNet, so the LapPE findings don't extend to every spectral graph model.
Paper info
- Authors
- Stephen Peng, Vineet Jagadeesan Nair
- Venue
- arXiv · Preprint
- First published
- 2026-11-10
- Added
- 2026-11-11
- Updated
- 2026-11-10
- Version
- v1
- arXiv
- 2611.13566
- Category
- cs.LG · cs.AI · eess.SY · math.OC
- Original paper terms
- CC BY 4.0
- What we show
- Paper info, commentary and permitted figures from the original paper
AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.
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.
Figures from the paper

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 prespecified10 −6 tolerance.
Original paper · CC BY 4.0
Table 4 : Catalog of the 13 metamorphic relations. For each relation, Tr constructs an equivalent input and Pr aligns or aggregates the transformed prediction with the original physical quantities; the validity condition states when that equivalence holds.
Original paper · CC BY 4.0
Figure 3 : Examples of ELC relations. They change graph size or component-family bookkeeping while preserving the AC-OPF feasible set and objective under the stated validity conditions. Their output maps sum split quantities, separate joined islands, reassign a fixed injection, or remove inert padding, depending on the relation.
Original paper · CC BY 4.0
Table 7 : Sensitivity of the saved architecture-screen verdicts to the channel-mean reporting threshold. Each row uses the same 221 cells and partial-coverage mask.
Original paper · CC BY 4.0
Figure 4 : Trained and random-weight models agree on all 13 threshold classifications of the displayed aggregate statistic. For each relation, the horizontal coordinate is the worst-channel discrepancy, maximized over five grids, divided by the10−6 tolerance; random-weight markers also take the worst of three seeds. The vertical line at one marks the aggregate reporting threshold and does not serve as an all-draw pass criterion. Connecting segments show the change in magnitude after training.
Original paper · CC BY 4.0
Figure 5 : Per-grid effect of training on metamorphic discrepancy. Each point is the trained discrepancy divided by its random-weight control for one grid and relation; values above one indicate a larger mis- match after training. Short black bars mark relation-level medians. Ratios for component-relabel compare values that are already below the10 −6 tolerance, so they carry little information.
Original paper · CC BY 4.0
Figure 6 : Absolute case500 discrepancies underlying the ratio comparison. Circles show released checkpoints; diamonds and intervals show the central value and range across three random seeds. The plot distinguishes a large relative change near zero from a discrepancy far above 10−6. Each point uses its worst channel, so values should be read against the tolerance and not compared across channel units.
Original paper · CC BY 4.0
Table 10 : Full augmentation results under the AC constraint-penalty objective. Positive improvement (Imp.) denotes the mean seed-paired reduction under augmentation. Metamorphic values report the dimensionless normalized discrepancy ∆r(d) defined in (1); 0 denotes exact invariance and dashes mark excluded relations. Constraint rows use the scenario-clustered seed-level P95 defined in the text and report mean ± sample standard deviation across three seeds. Equality is in per unit. The pooled inequality metric is dimensionless and displayed in millions of family-specific 10−6 tolerances. Absolute family-level results appear in Table 12.
Original paper · CC BY 4.0
Table 11 : Expanded augmentation results under the AC constraint-penalty objective. Panel A compares three-seed mean accuracy, median ∆r over each model’s trained relations, and scenario- clustered constraint P95; violation entries are mean ± sample standard deviation across seeds. Equality is in per unit, while pooled inequality is dimensionless and displayed in millions of family- specific 10−6 tolerances. Feasible is the percentage of 50 source scenarios per seed whose 53 views all satisfy both 10−6 tolerances. Panel B gives the percentage reduction in ∆r by relation; positive values denote improvement under augmentation, and dashes mark excluded relations.
Original paper · CC BY 4.0
Table 12 : AC constraint violations from the augmentation training experiment. Panel A reports absolute family-level violations as baseline → augmented; each side is the mean ± sample standard deviation across three seed-level statistics after clustering 53 views under each of 50 source scenarios. P95 uses linear interpolation. Panel B reports normalized context using scenario- or element-specific denominators. The AC-feasible source-scenario rate is 0% for every arm at the10 −6 tolerance.
Original paper · CC BY 4.0Quote from the paper
Stephen Peng, Vineet Jagadeesan Nair (2026). Metamorphic testing of learned AC optimal power flow surrogates reveals representation dependence. arXiv:2611.13566v1. https://arxiv.org/abs/2611.13566v1
BibTeX
@misc{peng2026metamorphic,
title = {{Metamorphic testing of learned AC optimal power flow surrogates reveals representation dependence}},
author = {Stephen Peng and Vineet Jagadeesan Nair},
year = {2026},
eprint = {2611.13566},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/2611.13566v1}
}