ZCA In-Context Output Transport
Implementation & benchmark of arXiv:2607.12241 — Gradient-Free Topology Adaptation for Power Flow Surrogates via In-Context Whitening
Source paper: Gradient-Free Topology Adaptation for Power Flow Surrogates via In-Context Whitening arXiv:2607.12241 ⓘ · analyzed Aug 30, 2026
AI-generated research hypothesis, automatically tested. Not peer-reviewed.
Idea description
Train a neural surrogate to predict outputs in a source-domain ZCA-whitened space, then adapt to a shifted domain using only the shifted domain's output mean and covariance. At inference, transport the network prediction through the target covariance square root, yielding a weight-free correction that preserves output-coordinate semantics and can be applied to MLP, CNN, graph-NN, or transformer regressors.
Formulas
Mathematical statement
Let $y\in\mathbb{R}^{d}$ be the physical output, with source-domain mean $\mu_s$ and covariance $C_s\succeq 0$. Define the regularized ZCA whitener $W_s=(C_s+\varepsilon I)^{-1/2}$ and the training target $z_s=W_s(y-\mu_s)$. Train a network $f_\theta(x)\approx z_s$. For a target domain, estimate $\mu_t$ and $C_t$ from $m$ calibration outputs and define $S_t=(C_t+\varepsilon I)^{1/2}$. The adapted prediction is $\hat y_t=\mu_t+S_t f_\theta(x)$. ZCA is computed from $C=U\operatorname{diag}(\lambda_i)U^\top$ as $C^{\pm1/2}=U\operatorname{diag}((\lambda_i+\varepsilon)^{\pm1/2})U^\top$. The mechanism assumes that the conditional operator is more invariant after removing domain-dependent first and second output moments.
Implementation notes
1. Exact integration point: use this as a replacement for the final regression normalization and denormalization layer of a supervised MLP or graph-NN. Compute source statistics once from training targets. Transform each source target with $z_s=(C_s+\varepsilon I)^{-1/2}(y-\mu_s)$ and train the network with MSE in whitened coordinates. At deployment, collect solved calibration examples from the shifted domain, estimate its mean and covariance, and cache the target square-root matrix. 2. Pseudocode: mu_s,cov_s=stats(Y_source); W_s=inv_sqrt(cov_s+eps*I); train f(x) against W_s@(y-mu_s); then mu_t,cov_t=stats(Y_calib); S_t=sqrt(cov_t+eps*I); y_hat=mu_t+S_t@f(x). If the calibration count is smaller than output dimension, use shrinkage cov_t=(1-alpha)*cov_t+alpha*trace(cov_t)/d*I. 3. Computed directly from the mechanism: the affine ZCA maps and eigendecompositions. Estimated empirically: source and target moments, shrinkage coefficient, calibration size, and residual conditional mismatch. 4. First cheap experiment: train a 3-layer MLP on a synthetic shifted regression operator and a graph-NN on IEEE-30 power-flow data with one line outage. Compare a frozen model, diagonal standardization, full ZCA transport, and gradient adaptation under equal calibration budgets. Sweep $m\in\{16,32,64,128,256,512\}$. The quantitative prediction is that target output mean and covariance errors will decrease after transport and that ZCA error will be much less sensitive to the moment mismatch $\|\mu_t-\mu_s\|_2+\|C_t-C_s\|_F$. Test the numerical stability boundary: when the smallest covariance eigenvalue approaches zero, the unregularized gain diverges as $\lambda_{\min}^{-1/2}$, while regularization bounds it by $(\lambda_{\min}+\varepsilon)^{-1/2}$.
Verification
Stage 1 · Toy mechanism gate: Passed ✓
Stage 2 · Mechanism transferred to benchmark: Not reproduced ✗
Stage 2 · Practical benchmark result: Inconclusive
Methodology: 8 paired seeds, permutation test (p<0.05) against a learning-rate-tuned baseline. How verification works
Stage 1 — Mechanism check agent confidence 8/10
Built and ran a reproducible ZCA in-context output transport MVP with a source-trained MLP and shifted synthetic regression domain. The three required math predictions manifested: maximum inverse-square-root gain was 31.622775 versus the predicted bound 31.622777; exact affine target transport had 0.0052 relative covariance error and 0.0067 mean error; calibration covariance error followed an observed log-log slope of -0.429 versus the predicted -0.5. In the regression comparison, ZCA transport achieved RMSE 0.354/0.329/0.292/0.282 for m=16/32/128/256, versus diagonal transport 0.485/0.453/0.446/0.446 and frozen 1.888, indicating a meaningful toy-domain benefit.
- Agent confidence
- 8/10
- Baseline
- Frozen source denormalization RMSE 1.8875; diagonal target transport RMSE 0.4850, 0.4530, 0.5232, 0.4460, 0.4458, 0.4581 for m=16,32,64,128,256,512.
- Idea
- Full ZCA target transport RMSE 0.3541, 0.3295, 0.3721, 0.2920, 0.2819, 0.2947 for m=16,32,64,128,256,512; relative predicted-covariance error 0.3743, 0.3285, 0.3836, 0.2095, 0.1310, 0.1216.
Limitations: Only a synthetic MLP regression task was tested; no CNN, graph-NN, transformer, IEEE-30 power-flow, gradient adaptation, repeated independent training seeds, FLOP/speed accounting, or calibration shrinkage sweep was evaluated. The affine sanity check uses finite samples and epsilon regularization, so its covariance error is not exactly zero.
How to run: python3 experiment.py
Stage 2 — Benchmark vs. tuned baseline (arXiv:2607.12241)
Ahead of the baseline (−6.9%) but not statistically significant (p=0.0976, wins 6 / 8 paired seeds).
- Benchmark
- Zca_output_shift
- Model
- mlp_tiny
- Paired seeds
- 8
- Baseline mean
- 0.2479
- Idea mean
- 0.2308
- Effect (Δ)
- -0.0171 (−6.9%; negative = idea better)
- Wins
- 6 / 8 paired seeds
- p-value
- 0.0976 (permutation test, 20 000 shuffles)
- Smallest detectable effect
- ±9.2%
- Mechanism
- Not confirmed ✗
- Practical effect
- Inconclusive
- Baseline tuning
- swept over 9 configs
Only the registered custom tabular regression track was tested. Vision, sequence, dynamics, gradient adaptation, speed/FLOP accounting, and broader calibration-budget sweeps were not tested.
How to run: python3 run_bench.py
Verdict computed by deterministic test code from paired-seed statistics — not by the language model.
Stage 2 — Benchmark latest Failed ✗
Agent confidence: 9/10
The registered custom track zca_output_shift was benchmarked using independently trained matched mlp_tiny systems and the canonical bench training loop. Full ZCA transport reduced MSE from 0.24786 to 0.23078 (6/8 paired wins), but the permutation p-value was 0.0976, so it did not meet the required significant-win criterion. The trained-model mechanism signature was not confirmed because covariance mismatch improved only modestly and mean mismatch worsened.
- Baseline
- map[best_cfg:map[eps:0.001 lr:0.006] full_mean_mse:0.24786174191259933 full_std:0.05009131131944214 per_seed:[0.27086141785047196 0.1917139695428075 0.2220999551004506 0.29440391895275514 0.18704631892067322 0.344832100723726 0.2265598299463168 0.24537642426359346]]
- Idea
- map[best_cfg:map[eps:0.001 lr:0.006] full_mean_mse:0.23078150975493228 full_std:0.04167991092381866 per_seed:[0.24331563584020893 0.18502272528126332 0.21147362576462045 0.21711156147075628 0.1836068376601135 0.32132553652610263 0.22800757506588762 0.2563885804305055]]
- Idea wins
- 6
- Mechanism signature
- map[baseline_cov_relative_error:0.5471725161056903 baseline_mean_error:0.2980355744986146 baseline_offdiag_cov_relative_error:0.742438368933803 confirmed:false idea_cov_relative_error:0.5279282379016398 idea_mean_error:0.31786811387233327 idea_offdiag_cov_relative_error:0.46610018522006513]
- N pairs
- 8
- Paired delta mean
- -0.01708023215766706
- Permutation p value
- 0.0976
Benchmark result
Ahead of the baseline (−6.9%) but not statistically significant (p=0.0976, wins 6 / 8 paired seeds).
- Benchmark
- Zca_output_shift
- Model
- mlp_tiny
- Paired seeds
- 8
- Baseline mean
- 0.2479
- Idea mean
- 0.2308
- Effect (Δ)
- -0.0171 (−6.9%; negative = idea better)
- Wins
- 6 / 8 paired seeds
- p-value
- 0.0976 (permutation test, 20 000 shuffles)
- Smallest detectable effect
- ±9.2%
- Mechanism
- Not confirmed ✗
- Practical effect
- Inconclusive
- Baseline tuning
- swept over 9 configs
Only the registered custom tabular regression track was tested. Vision, sequence, dynamics, gradient adaptation, speed/FLOP accounting, and broader calibration-budget sweeps were not tested.
How to run: python3 run_bench.py
Artifacts
- bench_report.json 5.5 KB View Raw
- experiment.py 4.5 KB View Raw
- report.md 1.7 KB View
- report_bench_2026-08-31T011435.md 7.7 KB View
- results.json 2.6 KB View Raw
- run_bench.py 4.9 KB View Raw
- zca_track.py 1.1 KB View Raw