Manuscript Offprint

arXiv:2610.21833

Physics-Aware Distillation of a Grid Foundation Model for Real-Time Edge Inference

Vlad Alexandru Sănduleac, Shahariya Rasheed Rayamarakkarveettil Puthanpurayil, Noman Khan, Remus Teodorescu

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Grid foundation models (GridFMs) are graph transformers pretrained on a masked power-flow objective, and once trained they evaluate power flow orders of magnitude faster than an iterative solver. Their size, however, targets data-centre inference, whereas low-inertia operation — grids with little rotating reserve, where disturbances evolve within milliseconds — increasingly asks for inference at the edge, next to the measurement, at batch size one and within a single synchrophasor (PMU) reporting frame. We distil a 20.1M-parameter, 12-layer GridFM teacher into a 0.62M-parameter, 6-layer student, a 32.5× parameter reduction at half the message-passing depth, using an objective that combines the masked power-flow loss with output, physics-residual, latent-state and attention transfer. The physics-residual term, which asks the student to reproduce the teacher's active- and reactive-power residual profile rather than only to minimise its own, has not previously been applied to typed power-grid graphs. We evaluate on a renewable variant of the IEEE 118-bus benchmark grid in which 26 of the conventional (synchronous) generators are replaced by inverter-based renewables with battery flexibility and standardised reactive-power limits (IEEE 1547), giving 97 529 physically valid (AC-OPF-feasible) operating scenarios, and we ablate all eight combinations of the transfer terms, reporting accuracy against ground truth and fidelity to the teacher separately. Distillation lowers student error on all four predicted quantities, by up to 48% on active-power dispatch, and every distilled student is more accurate than its teacher on reactive-power dispatch. The gain is largely carried by the output matching term. The physics-residual term, in the layer-aggregated form used here, is consistently harmful, which we attribute to the spatial averaging it applies to a bus-level residual field. The resulting student is 32.5× smaller in parameter count and has half the message-passing depth, making it a candidate for subsequent edge-device benchmarking.

1 Introduction

Power-system operation is moving to the grid edge. Converter-interfaced renewables, batteries and flexible loads have displaced the synchronous machines that once provided inertia, and the dynamics of the resulting low-inertia systems unfold on timescales that leave little room for a round-trip to a control centre [Milano et al., 2018, Dörfler and Groß, 2023]. Visions of autonomous energy grids therefore place monitoring and control decisions locally, next to the distributed resources they act on [Kroposki et al., 2020], and the measurement infrastructure already runs at that pace: synchrophasors report at 10–50 frames per second, i.e. every 20–100 ms [IEEE, 2011]. Edge intelligence, running learned models on embedded hardware at the point of measurement, is the natural enabling paradigm [Zhou et al., 2019, Gooi et al., 2023], but it requires models that fit the device and answer within the frame.

Graph neural networks (GNNs) are the natural learned representation of a grid, with buses, generators and branches as typed nodes and relations [Liao et al., 2022]. Recent work has scaled this idea into grid foundation models (GridFMs): graph transformers pretrained on a masked power-flow (PF) objective, regularised by a Kirchhoff physics loss, across many topologies and operating points [Hamann et al., 2024, Puech et al., 2025]. Once trained, such a model acts as a PF surrogate that is three to four orders of magnitude faster than iterative numerical solution [Puech et al., 2024], which makes it attractive precisely for the high-rate, local inference that edge operation demands.

*Corresponding author: vlad.sanduleac@upb.ro

The obstacle is size. The GridFM teacher used in this work has 12 layers, 8 attention heads and 20 million parameters, and was designed for cloud or HPC inference. An edge device must instead execute it at batch size one, within a bounded latency and memory budget. For GNNs the parameter count is a poor proxy for that cost: irregular gather/scatter and the number of message-passing layers dominate the runtime [Barillaro et al., 2025], so depth, not width, is what has to shrink. The standard compression toolbox, quantization [Jacob et al., 2018, Nagel et al., 2021, Tailor et al., 2021], hardware-aware pruning [Shen et al., 2022] and once-for-all supernets [Cai et al., 2020], reduces arithmetic and storage but is agnostic to physics: nothing in these procedures guarantees that the compressed model still respects nodal power balance.

Knowledge distillation (KD) addresses the functional side of the problem by training a small student to reproduce a large teacher through its outputs, its intermediate representations or its attention maps [Bucila et al., 2006, Ba and Caruana, 2014, Hinton et al., 2015, Romero et al., 2015, Zagoruyko and Komodakis, 2017, Gou et al., 2021], and has been extended to graphs [Tian et al., 2025]. For a physical system, however, a student should inherit more than the teacher's predictions: it should inherit the teacher's physical consistency, that is, how its active- and reactive-power residuals are distributed over the network. Classification-style KD has no term for that, and the physics-aware distillation that has recently appeared for PDE solvers and PDE foundation models [Bounja et al., 2025, Musekamp et al., 2026] has not been applied to typed power-grid graphs with bus-type-dependent masking. This paper closes that gap by distilling a pretrained GridFM into a 32.5×32.5 \times smaller, half-depth student with a physics-aware objective, and by measuring the result on edge hardware. Our contributions are:

• A physics-aware distillation objective for grid foundation models that combines output, physics-residual, latent and attention terms with a frozen GridFM teacher (Section 3, Eq. 1). The physics-residual term, which matches the teacher’s active/reactive residual profile rather than only penalising the student’s own residual, is new.

• A renewable-grid benchmark derived from IEEE 118, in which 26 synchronous units are replaced by converter-interfaced generators with battery flexibility and IEEE 1547 reactive bands, and 100 000 AC-OPF-feasible scenarios are generated (Section 3.2).

• A systematic ablation over all combinations of the four losses (Tables 2 and 3) that reports accuracy against ground truth and fidelity to the teacher separately, since the two are known to diverge [Stanton et al., 2021].

• Edge deployment of the 0.6M-parameter student on an NVIDIA Jetson Orin, with measured latency and memory (Section 4.2).

References (50)