Knowledge boundary probing and demand-guided intervention for LLM-based power system code generation
hui wu, Xiaoyang Wang, Zhong Fan
University of Exeter
Key points
From the paper's conclusion- Large language models (LLMs) can turn grid-analysis requests into executable programs for power-system simulation, but utilities and research laboratories often require on-premise deployment. In this setting, first-pass failures frequently arise at an API-knowledge boundary , through hallucinated functions, misused parameters, and mishandled result tables. We present PowerCodeBench , a parameterised benchmark generator released as a frozen 2000-task suite for pandapower , and a deployment-time workflow that requires no weight updates.
- Documentation-driven L0–L3 probes produce per-model API profiles for diagnosis, model comparison, documentation allocation, and backend calibration. A query-side demand estimator selects layered API evidence before generation, while execution feedback routes targeted repair.
- Across ten open-weight LLMs (1.5B–480B) and four mid-tier APIs, the validation-enabled workflow raises scalar-match accuracy by 32–56 percentage points after up to three repair rounds relative to an unassisted first pass, for every model of at least 7B and every API.
Abstract
Large language models (LLMs) can turn grid-analysis requests into executable programs for power-system simulation, but utilities and research laboratories often require on-premise deployment. In this setting, first-pass failures frequently arise at an API-knowledge boundary , through hallucinated functions, misused parameters, and mishandled result tables. We present PowerCodeBench , a parameterised benchmark generator released as a frozen 2000-task suite for pandapower , and a deployment-time workflow that requires no weight updates. Documentation-driven L0–L3 probes produce per-model API profiles for diagnosis, model comparison, documentation allocation, and backend calibration. A query-side demand estimator selects layered API evidence before generation, while execution feedback routes targeted repair. Across ten open-weight LLMs (1.5B–480B) and four mid-tier APIs, the validation-enabled workflow raises scalar-match accuracy by 32–56 percentage points after up to three repair rounds relative to an unassisted first pass, for every model of at least 7B and every API. Open-weight models in the 70B–120B range reach the four-vendor mid-tier accuracy range under matched no-tool conditions. Selective injection approaches the full-layer reference using 41% of its prompt tokens. Among model–item pairs passing numerical checks under both workflows, engineering review confirms the requested analysis in 88% of full-workflow outputs versus 66% under plain repair. Round-0 pilots on OpenDSS and PyPSA motivate staged onboarding from broad retrieval at cold start to calibrated selective injection. Measured throughput, latency, energy, and allocated GPU memory establish a practical on-premise serving envelope.
Read the paper
Discussion · 1
Science Skim's AI key points, plus readers' public thoughts
- Large language models (LLMs) can turn grid-analysis requests into executable programs for power-system simulation, but utilities and research laboratories often require on-premise deployment. In this setting, first-pass failures frequently arise at an API-knowledge boundary , through hallucinated functions, misused parameters, and mishandled result tables. We present PowerCodeBench , a parameterised benchmark generator released as a frozen 2000-task suite for pandapower , and a deployment-time workflow that requires no weight updates.
- Documentation-driven L0–L3 probes produce per-model API profiles for diagnosis, model comparison, documentation allocation, and backend calibration. A query-side demand estimator selects layered API evidence before generation, while execution feedback routes targeted repair.
- Across ten open-weight LLMs (1.5B–480B) and four mid-tier APIs, the validation-enabled workflow raises scalar-match accuracy by 32–56 percentage points after up to three repair rounds relative to an unassisted first pass, for every model of at least 7B and every API.
Readers' thoughts
No reader thoughts yet.
Related papers
- PS-HalluBench: Taxonomy-Driven Benchmarking of LLM Hallucinations in Power SystemsarXiv · 2026
- Automatic Programming for the Optimal Power Flow in Distribution Networks: An Edge-side Adaptive Computing Approach Based on Large Language ModelsCSEE Journal of Power and Energy Systems · 2026
- Evaluating Local Language Model Agents for Reproducible Data Engineering: An Empirical Software Engineering Study of Mobility WorkflowsarXiv · 2026
- PowerFix: Physics-Guided Iterative Repair for LLM-Assisted Power Converter DesignarXiv · 2026
- TuneBench: Benchmarking AI Agents for Power System Dynamic Model CalibrationarXiv · 2026
- On the Role of Large Language Models in Robustness-Guided Requirement FalsificationProceedings of the ACM on Software Engineering · 2026