← Latest papers
⚡ electrical engineering

A Rule-Aware Prompt Framework for Structured Numeric Reasoning in Cyber-Physical Systems

This paper proposes a modular, rule-aware prompt framework that integrates power system domain context, numeric normalization, and explicit operating rules to enhance large language models' ability to perform structured numeric reasoning and anomaly detection in cyber-physical systems like smart grids.

Original authors: Yichen Liu, Hongyu Wu, Bo Liu

Published 2026-05-06
📖 5 min read🧠 Deep dive

Original authors: Yichen Liu, Hongyu Wu, Bo Liu

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine a Smart Grid as a massive, high-speed orchestra playing a complex symphony of electricity. Every instrument (power lines, transformers, sensors) is constantly sending back notes about its performance—voltage levels, power flow, and speed. Under normal conditions, these notes follow a strict, mathematical sheet music (the "operating rules"). If an instrument starts playing a note that is too loud or too quiet, it's a sign of trouble, like a broken violin string or a cyber-attack.

The problem is that the "conductors" of this orchestra (the computer systems) are usually very rigid. They can only read the raw numbers. If the numbers change slightly, the system might get confused or miss the error.

Recently, scientists have started using Large Language Models (LLMs)—the same kind of AI that can write poems or chat with you—to help conduct this orchestra. They thought, "If the AI can understand human language, maybe it can understand the grid's data too." But there was a catch: if you just feed the AI a giant list of raw numbers, it gets overwhelmed. It starts guessing instead of following the strict rules of the grid, which is dangerous when you are dealing with electricity.

The Solution: A "Rule-Aware" Prompt Framework

The authors of this paper built a special "translator" or a structured prompt framework. Think of this framework as a customized instruction manual that you give to the AI before it looks at the data. Instead of just saying, "Here are some numbers, tell me if they are weird," the framework breaks the task down into six clear, modular steps, like a recipe:

  1. The Role (R): "You are a power system analyst." (Sets the AI's mindset).
  2. The Context (C): "Here is the map of the grid and what these numbers mean." (Explains the physics).
  3. The Normalization (N): "Don't look at the raw numbers. Convert them into 'Z-scores'."
    • Analogy: Imagine you are judging a race. Instead of telling the AI the exact time in seconds (which varies wildly between a sprinter and a marathon runner), you tell it, "How many seconds slower than the average runner is this person?" This makes it easy to compare a 100-meter dash with a 10-mile run. The "Z-score" is that standardized comparison.
  4. The Rule (S): "Here is the rule: If a number is more than 3 standard deviations away from the average, it's an anomaly." (This is the "Three-Sigma" rule, a standard statistical safety net).
  5. The Value Block (V): The actual data, presented in a clean, compact list of those standardized "Z-scores."
  6. The Output (O): "Tell me 'Normal' or 'Anomaly' and give a one-sentence reason why."

The Experiment: Testing the Orchestra

The researchers tested this framework on a famous, complex electrical network called the IEEE 118-bus system (which is like a miniature city's power grid). They used a specific open-source AI model (GPT-OSS-20B) and tried different ways of feeding it data:

  • The "Raw Data" Mistake: When they just fed the AI raw numbers (like "Voltage is 115.4"), the AI struggled. It was like asking a human to find a needle in a haystack without a magnet. It got the answer right only about 36% of the time.
  • The "Standardized" Success: When they used their framework to convert the data into Z-scores (the "how far off from average" metric) and gave it the strict "3-sigma" rule, the AI's performance skyrocketed. It became much better at spotting the "broken violin strings."
  • The "Hybrid" Champion: The best result came from a Hybrid Team. In this setup, the AI acted as a smart filter. It looked at the data, used its reasoning to pick out the most suspicious instruments, and then passed just those few to a traditional, super-fast computer detector for the final verdict.
    • Result: This team achieved near-perfect precision (100% of the alarms they raised were real) and caught 88% of all real problems. It was faster and more accurate than the AI working alone or the traditional computer working alone.

Key Takeaways

  1. Structure Matters More Than Size: The AI didn't need more data; it needed better data. By stripping away the raw numbers and giving the AI standardized "Z-scores" and clear rules, the AI could reason much better. It's like giving a detective a clear suspect profile rather than a pile of unsorted evidence.
  2. The "Rule-Aware" Approach Works: By explicitly telling the AI the mathematical rules of the grid, the AI stopped guessing and started following the "sheet music."
  3. Efficiency: The best prompts were actually the shortest. By removing unnecessary raw data, the AI processed the information faster and used less computer power (fewer "tokens").

Conclusion

This paper shows that we don't need to replace the old, reliable safety systems of the power grid with AI. Instead, we can use AI as a smart assistant that understands the rules and speaks the language of the grid. By organizing the data into a clear, rule-based format (the "Rule-Aware Prompt"), we can make AI a reliable partner in keeping our electricity safe and stable, without it getting confused by the sheer volume of numbers.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →