Tech Insights

Generative AI Powers Chatbot for Grid Data

March 21, 2024 by Shannon Cuthrell

Inspired by the popular generative AI model ChatGPT, Pacific Northwest National Laboratory developed a tool to retrieve power grid data and return text summaries and interactive maps for grid operators. 

Grid operators often reference data on regional interconnection dynamics and infrastructure when managing power flow, supply, demand, and other critical functions. ChatGrid, a tool inspired by the popular artificial intelligence (AI) chatbot ChatGPT, speeds up this process with a simple Q&A format: A user asks a question, and ChatGrid presents the answer with a geospatial network visualization.

Employing a Generative Pre-trained Transformer (GPT) model from ChatGPT creator OpenAI, Pacific Northwest National Laboratory (PNNL) designed a natural language query tool to answer inputs on generation capacity and location, power flow, voltage, and other facts based on results from a large-scale grid optimization model.


An artistic representation of the ChatGrid concept.

An artistic representation of the ChatGrid concept. Image used courtesy of PNNL/by Cortland Johnson


For example, an operator might ask about the generation capacity of the top wind turbines in California’s portion of the Western Interconnection synchronous grid, which stretches from northwest Canada to Baja California in Mexico. ChatGrid supplies a statewide list of generators and an interactive visualization in an instant. With this data, operators can quickly address weather-related outages, equipment failures, and other disruptions.


ChatGrid’s grid visualization in action

ChatGrid’s grid visualization in action. Image used courtesy of PNNL (converted from video to GIF)


ChatGrid is part of the newly launched Center for AI, which centralizes PNNL’s laboratory-wide AI projects under one roof. 


How ChatGrid Works

ChatGrid is powered by OpenAI’s GPT-3.5-Turbo, a generative AI model allowing developers to create chatbots and accept multiple messages as inputs. PNNL also used LangChain, an integration framework for applications supporting large language models. 

GPT models are trained on websites, books, articles, and other online sources. In fine-tuning its version of the AI model, PNNL considered the sensitivity of national grid infrastructure. As a safety measure, the team compiled an internal database with columns for power plant capacity and locations. They then used a structured query language (SQL) to allow ChatGrid to search the database’s columns and labels rather than access the data directly. 

Aside from security, PNNL found other benefits in using the SQL method. Experiments compared the performance of text-based analysis—storing data in text—and SQL databases. After testing different queries on each data type, they found the SQL database provided more accurate answers than the text-based agent, which tended to only generate a subset of the correct answer for a large dataset due to the limited output token size allowed by GPT-3, with a maximum of 4,096 tokens. 


ChatGrid’s architectural design.

ChatGrid’s architectural design. Image used courtesy of ExaGO


Here’s how it works: A user could ask, “Show me generators in Nevada with at least 600 MW.” The GPT-3 project template references the database labels to list relevant generators across the regional network. From there, the user can ask, “Show me generation units with the highest remaining capacity left.” ChatGrid runs the SQL query and returns more output data visualizing the generating units. Users can also filter transmission line data like voltage and flow. 

ChatGrid features five interactive layers: a geographic network with substations and transmission lines, a power flow animation, a 3D layer with generator information, and two county-level layers showing voltage and load data


Informed by an Exascale Supercomputing Model

For security reasons, ChatGrid’s visualizations don’t show real-world grid data. They only use synthesized information produced by the Exascale Grid Optimization (ExaGO) model, a free software tool developed by the Department of Energy (DOE)’s National Laboratories and Stanford University. ExaGO produces a real-time simulation of the power grid so that grid planners can view disruptions. 

ExaGO, developed under the DOE’s Exascale Computing Project, launched its first run last year on Oak Ridge National Laboratory’s Frontier supercomputer, which performs more than 1 quintillion computations per second. Advanced exascale computing is five times faster than the most powerful supercomputers

ExaGO can solve large-scale grid optimization problems such as alternating current optimal power flow (ACOPF), one of the most critical optimization challenges in managing electric power systems. In AC networks, generators should supply electricity to loads under the relevant constraints, but the nature of power flow equations makes this difficult. 

Deep learning networks can predict ACOPF solutions under different parameters, including multiperiod and contingency-constrained OPF problems. 


ExaGO visualizes the U.S. power grid

ExaGO visualizes the U.S. power grid. Image used courtesy of ExaGO


Since ChatGrid has been integrated into ExaGO, PNNL plans to gather feedback from users interested in testing the tool with different phrasing for prompts. It’s available for download on GitHub. 

The project’s next goal is to build a scaled-down version operators can use in control rooms with standard computers.