WorksEngineering
State Estimation as In-context Tabular Prediction
Abstract
This letter poses state estimation (SE) as an in-context tabular prediction (ICTP) problem. The key idea is a tabular arrangement in which historical measurement vectors and corresponding state estimates serve as the context, and a new measurement vector forms the query for which we predict a state vector. We propose to use tabular foundation models (TFMs), pretrained on synthetic data, whose weights are never updated, so power system data is needed only as context. With frozen TFM weights we estimate the state of 14-, 30-, 33-, 70-, and 118-bus transmission and distribution networks, and do so where weighted least squares (WLS) fails or degrades, under low observability and with bad data. ICTP errors are 11 to 57 below the per-bus average of the context at full metering, and 1.3 to 4.0 below it with only 5% of measurements available. With measurements at six buses biased by 8, the ICTP angle error rises 1.8 to 5.0 over its bias-free value against 2.5 to 12.7 for WLS with bad-data detection. Without retraining, ICTP has lower voltage error than DSS on both of its feeders, and lower than a retrained TAPINE on two of three reconfiguration sets.
Introduction
The state of a power system, the voltage magnitude and phase angle at every bus, underpins monitoring, control, and planning. It is estimated from meter readings that carry measurement and communication errors. The standard estimator, weighted least squares (WLS), minimizes the weighted sum of squared residuals, which is the maximum-likelihood estimate when errors are zero-mean Gaussian with known covariance. WLS relies on two conditions that are not guaranteed in practice. First, errors must be Gaussian. A gross error from a stuck meter or a mis-scaled transducer is still weighted by its meter’s assumed variance. Residual-based and largest-normalized-residual tests are applied afterward, but a gross error at a leverage point pulls the estimate onto itself and escapes detection [1]. Second, the system must be observable. Meters go out of service or lose communication, and WLS fails abruptly once observability is lost.
Recently, learned estimators have been proposed that map measurements to states using historical data. DSS{sup}2 trains a graph neural network by penalizing power-flow violations, without seeing true states {citep}[2], while TAPINE builds the physics into its architecture {citep}[3]. Both are tied to their training network: a new network, measurement configuration, or topology requires retraining. The same is true for Bayesian and data-driven estimators, which infer the state of unobservable systems from historical data {citep}[4], [5] and require network-specific model training. This letter addresses both the WLS failure modes and the need for network-specific training by posing SE as an in-context tabular prediction (ICTP) problem. The main idea is that, given historical measurements with their estimated states, the current state can be inferred by a pretrained tabular foundation model (TFM). TFMs such as TabPFN v2 {citep}[6] and TabICL v2.1 {citep}[7]` are transformer-based in-context learners, pretrained on synthetic tables, learning how columns relate to one another and to the target. Given SE data in this tabular format as a context, the model predicts the label of a new query in a single forward pass. We stress-test ICTP under measurement loss, noise variation, bad data, and topology change, against classical and learned estimators. Our main contributions are:
State estimation as in-context tabular prediction. Measurements form the input columns, and per-bus voltage magnitudes and per-line angle differences form the target columns. No step uses the measurement Jacobian or the admittance matrix. Each TFM uses a single pretrained checkpoint across all five networks.
Estimation without an observability precondition. ICTP returns a full state vector at every measurement level tested. WLS can fail with more measurements than states. On the 118-bus system it returns no estimate once half the meters are gone, with 362 readings for 235 states. On the radial 33-bus feeder with a single unmetered bus, WLS returns angle estimates worse than each bus’s historical average, even with bad-data checks. Over the same dark-bus sweep, the ICTP angle error grows at most 4.4× over its full-metering value on all three networks.
Robustness to bad data and evaluation on published benchmarks. With six buses biased by , the WLS angle error rises 2.5 to 12.7× against 1.8 to 5× for ICTP. On TAPINE’s reconfiguration sets, where TAPINE degrades by 19 and 35× in voltage once the feeder is reconfigured beyond what it was trained on, the TabPFN voltage error varies by at most 1.2× across all three sets.
Proposed In-Context State Estimation
WLS minimizes the weighted squared residuals between the measurements and the nonlinear measurement function , solved iteratively by Gauss-Newton using the gain matrix , with the Jacobian of and the noise covariance [1]. Each measurement contributes one row to , and observability is decided by the rank of , since is necessary but not sufficient. When loses full column rank, becomes singular, and the normal equations have no unique solution. With finite precision, the WLS solver may fail outright or return an inaccurate estimate.
The proposed ICTP instead poses SE as a tabular prediction task using two pretrained TFMs, TabPFN [6] and TabICL [7]. The context table holds historical snapshots of the network being estimated, one per row (Figure 1). Measurements form the input columns . These are bus voltage magnitudes, active and reactive bus injections, and active and reactive branch flows at the from-end, all carrying noise. No phase angle is measured. The targets are corresponding state estimates, one column per bus for the voltage magnitude and one per line for the angle difference . Each context row is a past snapshot in which all meters were in service, and its targets are the WLS estimates obtained at that time. All errors are computed against the true power-flow states. Predicting angle differences rather than absolute angles lowers the angle error by 1.1 to 1.9 at full observability, on all networks. The query is the current measurement vector , and each of the target columns is predicted in its own forward pass:

Figure 1. Proposed in-context state estimation via TFMs. The query consists of the current meter readings for which the state vector is to be predicted.
where is row of , is the th entry of row of , and is the TFM with its pretrained parameters held fixed. (1) uses no H, admittance matrix, or network connectivity, and the same weights serve any network. Connectivity enters only afterward, when absolute angles are recovered from the predicted differences by a linear least-squares solve on the branch-bus incidence matrix with the slack angle fixed.
Results and discussions
We evaluate on two fronts. First, on the 30- and 118-bus transmission systems and the 33-bus radial distribution system, we compare ICTP against WLS and its robust variants [8]. Second, we compare ICTP with DSS2 [2] and TAPINE [3] under the conditions their authors report.
For the first front, each snapshot is one operating point. Real loads are drawn from a Gaussian with 30% standard deviation about nominal, each load’s reactive-to-active ratio from the case file perturbed by a Gaussian with 20% standard deviation, and power flow is solved before adding noise. Meters measure branch flows, bus injections, and bus voltage magnitudes, all present at full metering. Base noise is zero-mean Gaussian with standard deviation . Voltage magnitudes take an absolute of 0.002 p.u. while injections and flows are perturbed by 2% of their true value, and is 2% of the resulting noisy reading. A floor on keeps the weight finite at zero-injection buses. WLS receives for each measurement, while the ICTP receives only the noisy measurements. The context holds past snapshots with their corresponding state estimates. ICTP performs 100 estimations from a single context table, and errors are the mean absolute error (MAE) over all buses and those 100, over converged snapshots only. The context mean, each bus’s average over its context rows, is the baseline a useful estimator must beat. The tests are described below.
Test A, meter loss at base noise. The context targets stay as they are, and measurements are removed from the context and query input columns: A1) a percentage of a measurement type randomly across buses, A2) dark buses, every measurement at the highest-degree buses, and the flows on their incident branches, for , never the slack, and A3) is A1 without restriction of measurement types.
Test B, noise variations. B1) At full metering, is scaled by 5 and 2.5 for voltage magnitude and power measurements respectively, and WLS receives the scaled . B2) Laplace noise at same , scale .
Test C, bad data. Every measurement at 3 or 6 random buses, and the flows on their incident lines, is biased by or with an independent random sign, while the context stays clean. WLS here runs with bad-data detection ( and largest normalized residual). Tests A and B use plain WLS.
Context size is the one design choice. At full metering, the error falls 2.4 to 22 from 10 to 100 rows, and at most 1.7 from 100 to 500, so is used throughout.
First, Test A1 showed that any single measurement type can be thinned heavily on every network at a cost in accuracy, not convergence, since H stays at full rank at every level. Losing flow meters down to 5% of the total costs 118-bus the most, raising the WLS angle error 7.7 to 0.249°, Losing injection meters to the same 5% raises it only 1.6 to 0.051°, and losing voltage meters down to 10% moves it by at most 5%. ICTP is far less sensitive, varying by at most 0.006° across the injection sweep.
In Test A2, as in Figure 2(top), the 33-bus is the worst hit because a single dark bus leaves the radial network unobservable, and the WLS angle error exceeds the context-mean error. The ICTP error rises early on all networks and never exceeds 4.4 its full-metering angle error, or 1.3 for voltage. Test A3 sweep is shown in Figure 2(bottom), in which WLS on 30-bus and 118-bus converged on all 100 snapshots from 100% to 75% and returned no estimate with measurement available. ICTP returned a full state vector at every level, and stayed below the context mean in Figure 2 by 11 to 57 at full metering and 1.3 to 4.0 at 5% metering.

Figure 2. Test A results. Top, A2 angle error. Bottom, A3 voltage error. Crosses mark levels where WLS returned no estimate, the red line is the context mean.
With all measurements, ICTP’s voltage error is 0.69 to 1.05 that of WLS and its angle error 1.46 to 2.03, with both ratios moving in ICTP’s favor as measurements reduce. ICTP sees context, while WLS does not, so for a fair comparison we also fit ridge regression on the same context. At 500 rows ridge is competitive, within of ICTP on voltage across the three networks, and lower on angle on the two smaller feeders. At 50 rows it is not, and TabPFN is better on voltage and better on angle on the 118-bus system, since it is pretrained whereas ridge refits for every network at each metering level. At every test level where H is full rank, WLS converged on all 100 snapshots and stayed below . Wherever the rank fell short, it exceeded , and WLS either returned nothing or answered on some snapshots with an error far above the context mean. Having therefore guarantees neither a good estimate nor any estimate at all.
Test B1, in Figure 3 (left), raises the noise at full metering. Every method’s error increases by a similar factor against its own base-noise result, to in voltage and to in angle, with neither WLS nor ICTP consistently worse. For Test B2, we report that Laplace noise at the base leaves each method at to its base Gaussian noise error. In Test C, WLS angle estimates degrade more than ICTP at every level on every network (Figure 3 (right)). With six buses having bias (bad data), the WLS angle error reaches to of unbiased situation error, against to for ICTP. The voltage ratios are to for WLS and to for ICTP. For the same test, among the other WLS variants in pandapower 3.4.0 [8], IRWLS, Schweppe-Huber GM, quadratic-constant, and Huber answer at most 1 of 100 snapshots. Least-absolute-value answers 97 to 100 and beats ICTP at one of the four biased levels, losing at the other three.
Figure 3. Left Test B1, voltage error on 118-bus at raised noise, dotted line, WLS (base noise). Center and right, Test C angle error ratio to clean value.
Now for the second testing front. For the TU-Delft model [2] comparison, we ran the published DSS checkpoint and WLS on their 1080-snapshot test file for the CIGRE 14-bus and Oberrhein 70-bus distribution networks. TabPFN and TabICL receive 500 context rows from TU-Delft’s training samples and predict out of sample without training. In the context, true states are used instead of past estimates. WLS converged on only 227 of the 500 context snapshots. Both have lower voltage error than DSS and WLS on both feeders in Figure 4, while WLS converged only for 501 of 1080 snapshots on the 70-bus feeder whose H is full rank, so the failure is numerical rather than a lack of measurements, and its bar averages those 501. The second learned estimator is TAPINE [3], which tests the system on reconfigured topologies, where sets T1, T2, and T3 contain 11, 20, and 25 feeder topologies built from one, two, and three simultaneous switch pairs (as in their Section IV-A). Figure 5 plots the transferred model and TAPINE retrained model on each set. Their T1-trained model degrades 19 and in voltage on T2 and T3, and recovers only after retraining on each set. For ICTP, context and query snapshots are disjoint draws from each topology, 500 WLS-estimated context labels per topology. With TabPFN, voltage MAPE stays within 0.358 to 0.421 [ %], TAPINE’s own metric and unit, across the three sets, and is below its retrained model at both T2 and T3. ICTP therefore matches a learned estimator that must be retrained for each topology set, needing only labeled context from that topology and no weight update.
Figure 4. TU-Delft DSS2 comparison on their 1080-snapshot test file with their published checkpoint. Voltage RMSE in p.u. and line loading in %. WLS’s 70-bus line loading, %, is off-scale and omitted.

Figure 5. Feeder reconfiguration under TAPINE’s convention [3]. WLS values are as cited, tr. refers to TAPINE’s transferred model, and re. retrained.
Conclusion
We posed state estimation as an in-context tabular prediction problem, where past measurements and their state estimates form the context, and a new measurement vector is the query. The same pretrained weights estimate the state of five networks. Across the three stress tests, WLS converged wherever H was full rank, and when rank fell short, it returned either nothing or an estimate whose error exceeded the context mean. Neither the measurement count nor the WLS bad-data checks reveal the rank loss, so doesn’t guarantee a good estimate, or any estimate at all. ICTP returned a full state vector at every level and stayed below the context mean throughout. It also degrades less than WLS with bad-data detection under injected bias, and reaches or beats two published learned estimators on their own benchmarks without retraining. ICTP costs 239 to 393 s for 100 estimations on the 118-bus system against 81 s for WLS, so reducing the per-target loop is left to future work.
References
- [8]Thurner, L., & al., . et . (2018). pandapower - an open-source Python tool for modeling, analysis, and optimization of electric power systems. IEEE Trans. On Power Syst., 33(6), 6510–21.

