# Gradient-Free Topology Adaptation for Power Flow Surrogates via In-Context Whitening

arXiv: https://arxiv.org/abs/2607.12241 · HTML: https://mlsanity.com/paper/2607.12241/

## Key facts

- No citing papers in the map yet (data through 14 Oct 2026).
- Builds on 6 of its 21 references that are in the map.
- First posted on arXiv 14 Jul 2026.

## Builds on (most cited first, 6 of 6)

- [Deep CORAL: Correlation Alignment for Deep Domain Adaptation](https://mlsanity.com/paper/1607.01719/) (2016)
- [Optimal whitening and decorrelation](https://mlsanity.com/paper/1512.00809/) (2015)
- [PowerFlowNet: Power Flow Approximation Using Message Passing Graph Neural Networks](https://mlsanity.com/paper/2311.03415/) (2023)
- [Data-Driven Power Flow Linearization: A Regression Approach](https://mlsanity.com/paper/1710.10621/) (2017)
- [Meta-model Neural Process for Probabilistic Power Flow under Varying N-1 System Topologies](https://mlsanity.com/paper/2509.12281/) (2025)
- [Admittance Sensitivity-Informed Modular GP for Scalable Topology-Adaptive Power-Flow Learning](https://mlsanity.com/paper/2606.03717/) (2026)

## Abstract (arXiv)

Machine-learned surrogates for the AC power flow (ACPF) problem amortize the cost of repeated solves on a fixed network, but lose one to two orders of magnitude of accuracy when a line outage changes the topology. This degradation is an operator shift. The altered admittance matrix changes the input-to-output map, so identical inputs yield a different output distribution. Existing methods correct this with target-topology data and per-topology gradient steps. We ask whether the correction can instead be made statistical and gradient-free. We propose In-Context Whitening (ICW), which trains an ACPF surrogate in an output space whitened by the base topology's first two moments, and adapts it to an unseen N-1 or N-2 topology by re-estimating that whitening from a few hundred solved cases on the new topology. This adaptation is gradient-free, weight-free, and architecture-agnostic. We prove that among affine whiteners the unique choice that preserves the coordinate-wise semantics of the physical output vector is ZCA whitening, so within efficient invertible corrections, two moments are sufficient. Across the IEEE 30-, 118-, and 300-bus systems under N-1 and N-2 contingencies, ICW reduces overall error by 6× to 28× over frozen surrogates (up to 54× per-quantity under N-2) and cuts worst-bus power-balance mismatch by up to 30×, with consistent gains across three backbones. At deployment scale it matches or beats gradient-based adaptation in accuracy while adapting 21× to 34× faster, with a cost that parallelizes on commodity CPU cores rather than requiring one GPU per contingency.
