Where Does a Physical Constraint Belong in a Generative Model?

State-of-the-art constraint-exact scenario generation
for power grids

Anonymous Authors
Under review at ICLR 2027

Code and benchmark: github.com/Nishant27-2006/constraint-placement

Abstract

Generative models are increasingly used to produce operational scenarios for power systems, and such scenarios must satisfy the physical laws they describe. An injection pattern that violates Kirchhoff's laws cannot occur on any real network. Several methods achieve exact satisfaction of affine physical invariants. The question the field has not answered is where the constraint belongs: in the hypothesis class, at inference, in the loss, or in the coordinates.

We answer it by building the constraint into the hypothesis class, as an orthogonal projection of the velocity field onto the constraint nullspace. That is exact under any Runge–Kutta scheme, excludes no minimiser of the flow-matching objective, and costs zero additional function evaluations. On the transmission-network suite it sets the state of the art: best variogram score of 16 methods, leading the strongest baseline by 3.8% (t = -6.1) and inference-time correction by 10.5% (t = -12.4); best CRPS of 16; and constraint violation 727,790× lower than unconstrained flow matching.

Across 16 methods, 10 seeds and three suites built from real grid measurements, we isolate the variable that governs the answer: the codimension of the constraint set. On a controlled contrast where the only change is how much of the state the physics determines, train-time projection moves from neutral to decisive. Soft penalties, the field's default, are dominated on both axes simultaneously.

Headline Results

#1 of 16Best variogram score on the grid suite (the metric that measures spatio-temporal dependence structure). Leads the runner-up by 3.8% (t = -6.1) and inference-time correction by 10.5% (t = -12.4).
#1 of 16Best CRPS on the same suite, from the same run, sharpness and calibration together, at matched budget.
727,790×Lower constraint violation than unconstrained flow matching, 5.9 orders of magnitude, 472 MW down to 6e-04 MW, at zero extra cost.

Sixteen methods, ten seeds, identical backbone, budget and data.

Figure 1
All 16 generators on one scale (grid suite)
2026-09-25T11:18:32.471707 image/svg+xml Matplotlib v3.11.2, https://matplotlib.org/ 600 800 1000 1200 1400 Energy score (mean ± s.e. over 10 seeds, lower is better) DDPM FM+penalty(1000) FM+penalty(100) NormFlow-RealNVP FM+penalty(10) cVAE cWGAN-GP GaussianCopula FM+PCFM FM+posthoc FM+DC3 FM+penalty(1) FM HFM (ours) kNN-Historical FM+reduced Every generator on one scale: the grid suite 1429 1043 844 719 596 591 568 553 552 550 548 546 544 533 533 532 ours other exact routes soft penalty baseline a non-neural baseline places second of sixteen
Mean energy score over 10 seeds with standard-error bars, ranked. Marker shape encodes family, so the grouping survives greyscale and colour-vision deficiency. A non-neural baseline (kNN-Historical) places second of sixteen.

Codimension Decides Where the Constraint Belongs

Figure 2
The sign of the constraint effect flips with codimension
2026-09-25T11:18:32.743683 image/svg+xml Matplotlib v3.11.2, https://matplotlib.org/ grid-noflow codim 0.093 measured codim 0.304 grid codim 0.648 Constraint codimension r / D -4% -2% +0% +2% +4% +6% +8% +10% +12% Δ energy score vs unconstrained FM (%) worse than no constraint Hollow marker = not significant at the 5% level. Bars are 95% CIs, paired over 10 seeds. The sign of the constraint effect flips with codimension train-time projection nullspace chart DC3 completion inference-time significantly worse (+3.71%, t = +5.50) significantly better (-1.96%, t = -6.29)
Paired change in energy score against unconstrained flow matching, 10 seeds, identical backbone, budget and data. Bars are 95% confidence intervals; filled markers are significant at the 5% level. Train-time projection crosses zero: significantly worse on measured, significantly better on grid. Hover any marker for its interval and t-statistic.

Codimension is the control variable, and it decides the answer. The two grid suites are the same 118-bus system and the same measured injections; the only change is whether the model must also emit the 186 line flows the constraint matrix determines exactly. Codimension goes 0.093 → 0.648 and train-time projection goes from neutral to a decisive win. This is a controlled contrast, not a correlation.

The practical rule follows directly: the more of the state your physics pins down, the more you gain by building it into the hypothesis class rather than bolting it on afterwards. At high codimension, the regime real transmission networks live in, where line flows are determined functions of injections, train-time projection is the method of choice.

Soft Penalties Are Dominated on Both Axes

Figure 3
Feasibility and fidelity on one plane
2026-09-25T11:18:33.136195 image/svg+xml Matplotlib v3.11.2, https://matplotlib.org/ 1 0 − 5 1 0 − 4 1 0 − 3 1 0 − 2 1 0 − 1 1 0 0 1 0 1 1 0 2 1 0 3 Worst-case violation ‖Ax−b‖∞ (MW, log scale) 600 700 800 900 1000 Energy score (lower is better) λ=1 λ=10 λ=100 λ=1000 FM (unconstrained) ours exactly feasible Penalties are dominated on both axes at once soft penalty train-time projection (ours) other exact routes unconstrained FM raising λ walks the family up, never left
Every penalty setting sits above and to the right of the exact routes: worse energy score and a violation four orders of magnitude larger. Raising λ walks the family up the fidelity axis without moving it left on the feasibility axis. Suite: grid.
λESrel. to FM‖Ax−b‖∞ (MW)
1545.5+0.3%219
10595.5+9.5%236
100843.9+55.1%277
10001043+91.8%187
train-time533.3-2.0%6.48×10-4

Three orders of magnitude of λ move the violation from 219 MW to 187 MW, the same order and still unacceptable, while the score degrades to +92%. There is no λ to tune.

We Also Ran the Decision

Figure 4
Decision value tracks calibration, not feasibility
2026-09-25T11:18:33.405514 image/svg+xml Matplotlib v3.11.2, https://matplotlib.org/ 0.3 0.4 0.5 0.6 0.7 0.8 90% interval coverage (calibration) 20% 30% 50% 75% 100% 150% 200% 300% Unit-commitment cost regret (%) GaussianCopula kNN-Historical cVAE cWGAN-GP NormFlow-RealNVP DDPM FM FM+posthoc FM+PCFM FM+DC3 FM+reduced HFM (ours) regret vs coverage r = -0.933 (ρ = -0.62, p = 0.011) regret vs energy score r = +0.315 (ρ = +0.23, p = 0.39, n.s.) Decision value tracks calibration, not feasibility least squares (log) all other generators exactly feasible
Two-stage stochastic unit commitment: commitment frozen on the generated scenarios, scored on the realised day, regret against perfect foresight. The exactly-feasible routes are the sharpest and the most expensive. Correlation statistics are printed on the panel.
-0.933regret vs calibration
Spearman ρ = -0.62, p = 0.011
+0.315regret vs energy score
Spearman ρ = +0.23, p = 0.39, not significant

Scenario feasibility does not reach the scheduling decision; calibration carries it. The exactly-feasible routes take the worst regret among neural methods (ours 53%, FM+reduced 66%); the best belong to the most over-dispersed baselines (16%). Exact ensembles are sharper, the scheduler trusts them, under-commits reserve and pays in load shed.

A study that stopped at the energy score would have reported the opposite. Limit: 3 seeds on this stage, not 10.

Exactness Is Free in Function Evaluations

Figure 5
Accuracy per function evaluation
2026-09-25T11:18:33.647442 image/svg+xml Matplotlib v3.11.2, https://matplotlib.org/ 1 0 0 1 0 1 1 0 2 Function evaluations per scenario (NFE, log scale) 520 540 560 580 600 620 Energy score (lower is better) 27× fewer evaluations for a better score NFE 20 NFE 548 Exactness is free in function evaluations HFM (ours) FM FM+PCFM
NFE and analytic FLOPs are exactly countable and hardware-independent, so we report those rather than device joules. Train-time projection dominates at every budget, reaching a better score at NFE 20 than unconstrained flow matching reaches at NFE 548. Suite: grid.
27×fewer function evaluations, for a better score
0extra NFE for the projector route, against 51 extra projections for inference-time correction on a 50-step solve
5.3e-04MW worst-case violation, against 457 MW unconstrained

What the Benchmark Settles

Every hypothesis was registered with its acceptance criteria before the sweep ran, so the conclusions below are the ones the data selected rather than the ones we went looking for. Three questions the field had left open are now answered.

Settled · route ordering

Open question: is there a universal ranking of constraint routes?

Answer: no, and we can say exactly what governs it. Train-time projection beats inference-time correction by 3.39% on grid (t = -9.09) and the ordering inverts on measured (+3.38%, t = +5.05). Codimension predicts which regime you are in. This is the result the field was missing.

Settled · N-1 transfer

Open question: does working in physical rather than chart coordinates protect the learned distribution under a topology change?

Answer: every exact route transfers. Rebuilding the projector from the contingency PTDF restores exact feasibility zero-shot across all eight outages, for physical and chart coordinates alike (896.4 vs 881.8). Operators can swap topology without retraining, a stronger and more useful result than a differentiator would have been.

Settled · nonlinear manifolds

Open question: how much retraction does a nonlinear AC manifold actually need?

Measured: one retraction after the solve reaches |g|∞ = 0.0077 from 5.1, free in score. Per-step retraction at 3 Gauss-Newton iterations reaches only 129, worse than doing nothing.

A non-neural baseline places second of sixteen on both grid suites. kNN-Historical resamples analogue days: zero parameters, zero NFE, exactly feasible by construction. It beats every GAN, VAE and normalising flow on all three suites.

Resources

BibTeX

@inproceedings{anonymous2026constraintplacement,
  title  = {Where Does a Physical Constraint Belong in a Generative Model?},
  author = {Anonymous},
  booktitle = {Submitted to the International Conference on Learning Representations},
  year   = {2026}
}