Table of Contents
Fetching ...

PowerGraph-LLM: Novel Power Grid Graph Embedding and Optimization with Large Language Models

Fabien Bernier, Jun Cao, Maxime Cordy, Salah Ghamizi

TL;DR

PowerGraph-LLM introduces a novel framework that solves AC OPF by querying large language models with hybrid graph and tabular embeddings of power grids. The approach combines a grid-embedding pipeline, context-driven LLM inference, and LoRA-based fine-tuning to adapt off-the-shelf LLMs to OPF tasks. An extensive empirical study shows that model size and fine-tuning improve performance, with graph representations becoming more effective post-tuning and larger LLMs approaching the performance of proprietary models on key metrics. The work demonstrates the potential of LLMs for scalable, data-efficient OPF solutions applicable to realistic grids and complex constraints.

Abstract

Efficiently solving Optimal Power Flow (OPF) problems in power systems is crucial for operational planning and grid management. There is a growing need for scalable algorithms capable of handling the increasing variability, constraints, and uncertainties in modern power networks while providing accurate and fast solutions. To address this, machine learning techniques, particularly Graph Neural Networks (GNNs) have emerged as promising approaches. This letter introduces PowerGraph-LLM, the first framework explicitly designed for solving OPF problems using Large Language Models (LLMs). The proposed approach combines graph and tabular representations of power grids to effectively query LLMs, capturing the complex relationships and constraints in power systems. A new implementation of in-context learning and fine-tuning protocols for LLMs is introduced, tailored specifically for the OPF problem. PowerGraph-LLM demonstrates reliable performances using off-the-shelf LLM. Our study reveals the impact of LLM architecture, size, and fine-tuning and demonstrates our framework's ability to handle realistic grid components and constraints.

PowerGraph-LLM: Novel Power Grid Graph Embedding and Optimization with Large Language Models

TL;DR

PowerGraph-LLM introduces a novel framework that solves AC OPF by querying large language models with hybrid graph and tabular embeddings of power grids. The approach combines a grid-embedding pipeline, context-driven LLM inference, and LoRA-based fine-tuning to adapt off-the-shelf LLMs to OPF tasks. An extensive empirical study shows that model size and fine-tuning improve performance, with graph representations becoming more effective post-tuning and larger LLMs approaching the performance of proprietary models on key metrics. The work demonstrates the potential of LLMs for scalable, data-efficient OPF solutions applicable to realistic grids and complex constraints.

Abstract

Efficiently solving Optimal Power Flow (OPF) problems in power systems is crucial for operational planning and grid management. There is a growing need for scalable algorithms capable of handling the increasing variability, constraints, and uncertainties in modern power networks while providing accurate and fast solutions. To address this, machine learning techniques, particularly Graph Neural Networks (GNNs) have emerged as promising approaches. This letter introduces PowerGraph-LLM, the first framework explicitly designed for solving OPF problems using Large Language Models (LLMs). The proposed approach combines graph and tabular representations of power grids to effectively query LLMs, capturing the complex relationships and constraints in power systems. A new implementation of in-context learning and fine-tuning protocols for LLMs is introduced, tailored specifically for the OPF problem. PowerGraph-LLM demonstrates reliable performances using off-the-shelf LLM. Our study reveals the impact of LLM architecture, size, and fine-tuning and demonstrates our framework's ability to handle realistic grid components and constraints.
Paper Structure (15 sections, 1 equation, 4 figures, 2 tables)

This paper contains 15 sections, 1 equation, 4 figures, 2 tables.

Figures (4)

  • Figure 1: The PowerGraph-LLM framework: We generate the power grid embedding in steps 1, 2, 3 where we obtain a description of the topology of the grid, the features of its components ($X_b$, $X_l$, $X_g$, $X_s$, $X_e$ respectively for bus, loads, generators, slack, and lines), and the OPF solution by a solver ($Y_g$, $Y_s$, $Y_b$). We generate thousands of power grid embeddings and we split them into a context and queries. The context (step 4) is the pairs (power grid description + OPF solutions) that will serve for the LLM model as examples, and the query (step 5) is the grid to which we expect the model to perdict an OPF solution.
  • Figure 2: Errors in OPF estimations for gpt-4o-mini and llama-8b. The red bars represent the proportion of invalid inputs.
  • Figure 3: Errors in OPF estimations for graph representations using bigger gpt-4o and llama models. The red bars represent the proportion of invalid inputs.
  • Figure 4: Predicted and real value (Gen 1) with Llama-8b.