Microsoft GridSFM: Reshaping Power Grid Planning with AI Foundation Models

Microsoft GridSFM uses graph neural networks to compress power system optimization from minutes to milliseconds, fully open-sourced.
Microsoft Research's GridSFM is an AI foundation model for power systems, targeting two longstanding challenges: slow ACOPF solving and restricted real-grid data access. It builds an open pipeline from public sources like OpenStreetMap and EIA to reconstruct physically consistent grid models, then trains a single graph-based model across 150+ topologies and ~500K scenarios — running ~1,000× faster than AC solvers. It supports feasibility screening (>95% accuracy), fast approximation with reactive power retention, and warm-starting for traditional solvers. Zero-shot tests show transferability to unseen larger grids, with fine-tuning on just 10 scenarios reducing cost error below 2%. All data, code, and weights are fully open.
Behind every overhead power line lies a decision that must be made every few minutes: which generators to dispatch, how much power each should provide, and whether the entire system can remain stable. Today, these decisions rely on solving a complex optimization problem known as AC Optimal Power Flow (ACOPF) — highly accurate, but computationally slow and difficult to scale when operators need to evaluate many scenarios.
Microsoft Research's GridSFM attempts to address two long-standing challenges in power systems research simultaneously: limited data access and slow solver speed.
Why Grid Planning Is Getting Harder
Power systems are becoming unprecedentedly complex. Rising shares of renewable energy, more frequent extreme weather events, and surging demand from electrification and data centers all require grid operators to evaluate an ever-growing number of operating scenarios in ever-shorter timeframes.
The challenge with traditional ACOPF lies in its mathematical nature — it is a nonlinear, non-convex optimization problem. On utility-scale grids, a single solve can take minutes to hours. This creates a painful tradeoff: either solve a few scenarios precisely, or screen a large number of scenarios quickly using approximations that discard critical physical information.

Another often-overlooked barrier is data. Real grid data is critical infrastructure, typically subject to strict restrictions, making it difficult for researchers and engineers to test and build new solutions at scale. GridSFM's first move is to directly confront this data bottleneck.
ACOPF is difficult to solve because power systems obey Kirchhoff's voltage and current laws, which require nonlinear trigonometric relationships among voltage magnitudes, currents, and phase angles. By contrast, DC Optimal Power Flow (DCOPF) linearizes the problem through two simplifying assumptions — ignoring reactive power and assuming equal voltage magnitudes at all buses — enabling solutions in seconds, but at the cost of losing critical information about voltage stability and reactive power balance. In high-renewable scenarios, reactive power management is central to maintaining voltage stability, making DCOPF's approximation errors increasingly unacceptable. N-1 security checks — the standard requiring the system to remain stable after any single component outage — require planners to run ACOPF repeatedly; for a grid with thousands of lines, this means thousands of time-consuming solves, which simply cannot be completed within real-time dispatch windows.
An Open Data Pipeline: Reconstructing Real Grids from Public Data
Microsoft built an open data pipeline capable of reconstructing physically consistent grid models for any region of the United States using only publicly available data sources. The process follows five steps, illustrated here using Texas as an example.
Step 1: Scrape all power-related features from OpenStreetMap — transmission lines, substations, and generators. These crowdsourced data are rich but messy: voltage information is missing, lines are split into multiple segments, and there is no concept of an electrical network.
Step 2: Transform the raw geographic features into a proper bus-branch model. Missing voltages are inferred through iterative consensus among neighbors; the transmission system above 69 kV is extracted; HVDC links are identified; fragmented line segments are reassembled into complete circuits; and electrical buses are established within each substation by voltage level.
Step 3: Fill in physical parameters. Resistance, reactance, susceptance, and thermal ratings are assigned to each line based on voltage level and length. Generator cost curves, reactive power limits, and ramp rates are estimated using EIA data and engineering defaults by fuel type.
Step 4: Hourly demand by balancing authority is obtained from EIA, each bus is mapped to its region based on spatial boundaries, and load is allocated to individual buses using census data.
Step 5: Run both AC and DC optimal power flow using Julia's PowerModels package. Since models built from open data are not guaranteed to be feasible, the solver supports a layered relaxation mechanism that progressively loosens line limits, voltage bounds, or angle constraints until a solution is found.

Notably, the degree of relaxation required to solve a given case is itself a useful signal — it reflects how stressed or constrained the reconstructed model is, providing a quantitative means of assessing model quality across regions. The final output is a fully open, physically consistent grid model.
GridSFM's Architecture: Treating the Grid as a Graph
GridSFM treats the grid as what it actually is — a graph. In power systems, buses are electrical connection points (typically substation nodes) where lines, loads, and generators meet. GridSFM maps buses to graph vertices and transmission lines to edges: voltages reside on vertices, power flows reside on edges, and the grid topology connects them.
This structure gives the model topology-agnostic capability — the same model can handle a 500-bus small grid or a much larger system without requiring per-grid parameterization. Internally, the model embeds node and edge features into a shared representation, refines them through attention modules that operate directly on the grid structure, and decodes predictions for bus voltages, voltage phase angles, active and reactive generation output, and feasibility. Branch power flows are computed analytically from the predicted bus states using standard AC line equations, ensuring outputs remain physically grounded.

What truly distinguishes GridSFM from prior work is how it is trained. Previous research typically trained a dedicated model for a single grid over a narrow operating range. GridSFM trains a single model across more than 150 base grid topologies and approximately 500,000 scenarios. This approach more closely resembles ImageNet pretraining — one backbone network for zero-shot use or fine-tuning on downstream tasks, rather than a specialist trained per grid.
Scenarios come from a perturbation pipeline that stresses the grid along five dimensions: atypical load profiles, generator outages, line deratings, tightened voltage bands, and shuffled generation costs. This forces the model to learn from physical and cost structure rather than memorize patterns. Training supervision balances standard ACOPF solve results against physical penalties for violating Kirchhoff's laws, thermal limits, and voltage bands.
A distinctive feature is that approximately half the training data contains infeasible scenarios — including voltage squeezes, thermal bottlenecks, and deliberately engineered failure modes. Infeasibility is not discarded as noise; it is a first-class output the model must learn to detect.
Modeling the grid as a graph and processing it with graph neural networks (GNNs) aligns naturally with the physical structure of power systems. The message-passing mechanism in GNNs mirrors how power flows propagate: a change in flow on one line cascades layer by layer to neighboring buses, which is structurally isomorphic to how GNN nodes aggregate information from their neighbors. By contrast, flattening the grid into a fixed-dimensional vector and feeding it into a fully connected network strips the model of any awareness of topology, causing it to fail entirely on a different grid. The attention mechanism here plays a role analogous to sensitivity matrices in power systems — it lets the model adaptively learn which neighboring nodes have a greater influence on a given node's voltage and power flow, without hardcoding that relationship as fixed weights. This is also the mathematical foundation that enables GridSFM to transfer across grids of different sizes and topologies.
Three Workflows Unlocked by Millisecond-Level Prediction
Given grid topology, constraints, and a load scenario, GridSFM returns two things in a single forward pass: four physical snapshots (voltages, voltage phase angles, generator output, and power flow on every line), plus a confidence-scored feasibility judgment. It captures the reactive power components that simplified methods ignore, at roughly 1,000× the speed of AC solvers.
This speed unlocks three practical workflows:
Feasibility Screening. Planning studies often require scanning thousands of contingencies such as line or generator outages. Traditional solvers typically discover infeasibility only after failing to converge. GridSFM can instantly triage these scenarios with over 95% accuracy, routing only borderline cases to the solver.

Fast Approximation. The industry-standard DCOPF simplifies the problem by linearizing and discarding reactive power. GridSFM matches DCOPF dispatch costs while retaining voltage and reactive power information.
Warm Starting. When an exact answer is required, GridSFM can provide a strong starting point for traditional solvers, delivering an average speedup of approximately 1.7×, and exceeding 7× on some larger meshed networks.
Is It Really a Foundation Model?
To validate whether GridSFM possesses the characteristics of a foundation model, the team conducted zero-shot testing on a grid it had never seen — 6,470 buses, roughly 40% larger than any grid seen during training. Performance degraded as expected: cost error increased by about 10%, and the feasibility classifier lost calibration.
But the key result was that the model could still rank scenarios by cost with near-perfect accuracy. This suggests it has learned transferable grid physics — it simply needs recalibration of its confidence and cost scale for a new system.
And that recalibration is cheap: fine-tuning with just 10 scenarios brings cost error below 2% and feasibility detection above 90%; with 1,000 scenarios, accuracy on the new grid matches in-sample performance. Even single-line outage holdout sets never seen during fine-tuning show errors below one percentage point.
This confirms GridSFM's core claim as a true foundation model: physics is learned once during training; adapting to a new grid reduces to a single calibration step.
The concept of a "foundation model" originated in natural language processing, referring to large-scale models pretrained on massive general-purpose data and then adapted to downstream tasks with few samples — the GPT series being a canonical example. Transferring this paradigm to physical systems faces a fundamental challenge: statistical patterns in language can be induced from text, whereas the laws governing physical systems are strictly constrained by equations — model outputs must simultaneously satisfy statistical fit and physical feasibility. GridSFM addresses this by incorporating Kirchhoff's law violation penalties and thermal limit penalties into the loss function, so the model pursues predictive accuracy while being constrained by physical laws. The zero-shot result of "near-perfect cost ranking" is particularly significant: even when absolute errors exist, preserving relative rankings means the model has captured the topological and physical structure of grid operating states across different scenarios, rather than merely memorizing the numerical distribution of the training set.
Openness as a Core Commitment
GridSFM's data, models, and code are fully open — open data, open code, open weights. Microsoft Research's goal is to shift power systems analysis from slow, compute-limited workflows toward fast, data-driven decision-making, establishing a shared foundation for the next generation of grid simulation and planning tools.
For a power industry grappling with renewable integration, electrification waves, and surging data center electricity consumption, a tool that is both open and efficient may be exactly what accelerating grid modernization requires.
Related articles

Chain of Thought Isn't Just for AI: How Humans Can Use CoT to Improve Thinking Quality
Chain of Thought isn't just a prompt trick for large models. Starting from a Hacker News discussion, this article analyzes why CoT works for human thinking too, breaks down actionable ways to transfer it, and highlights the key differences between human CoT and machine CoT.
Cloudflare Teams Up with OpenAI: Closi…
Cloudflare Teams Up with OpenAI: Closing the Loop from Vulnerability Discovery to Defense with AI
Cloudflare uses OpenAI Daybreak to investigate security vulnerabilities and generate reviewable remediation plans, while developers use Codex to boost coding efficiency and quality.

Orca Multi-Agent Orchestration in Practice: A Guide to Parallel Collaboration with Claude and Codex
Orca is Stable AI's free open-source agent workbench supporting 34 agents like Claude Code and Codex in parallel. Learn its Git worktree isolation, multi-model orchestration, and mobile management.