Distribution networks face mounting complexity as distributed energy resources proliferate. Solar rooftops, wind turbines, and battery storage create dynamic scenarios that traditional optimization algorithms—whether exact solvers or heuristics—handle inefficiently. Exact methods become computationally prohibitive as network size grows. Machine learning approaches, meanwhile, often fail to generalize across different operational conditions.
GridRAG tackles this dual challenge through a novel "retrieve-and-refine" workflow. The system first embeds both operational scenarios and their corresponding optimal solutions into a shared mathematical space, ensuring that similar grid conditions map to similar solutions. When a new optimization problem arrives, GridRAG retrieves the most relevant historical cases from a pre-built database of solved scenarios.
These retrieved solutions serve as starting points rather than final answers. A diffusion-based refinement module then iteratively improves them by modeling conditional probability distributions constrained to near-feasible and near-optimal regions of the solution space. This process is analogous to gradually denoising an image, but applied to optimization solutions. The refined solution provides high-quality initialization for a standard solver, which then converges rapidly to the final answer.
Validation across three optimization tasks—including voltage regulation, optimal power flow, and DER dispatch—demonstrated the framework's effectiveness on four standard test networks. GridRAG consistently outperformed both pure learning-based methods and conventional model-based solvers in computation time and solution quality, while maintaining strong generalization to unseen scenarios.
For grid operators managing networks with high renewable penetration, this approach offers practical benefits: faster decision-making during operational planning, reduced computational infrastructure requirements, and improved adaptability to changing conditions. By combining retrieval methods with generative refinement, GridRAG represents progress toward AI systems that enhance—rather than replace—traditional optimization tools for power systems.



