Large language models (LLMs) are increasingly used to automate power-system analysis, but many utilities and energy-research labs require on-premise serving for confidentiality, regulatory, reproducibility, and cost reasons. This makes the reliability of open-weight models a deployment issue. We show that first-pass failures in power-system code generation are dominated not by reasoning alone, but by structured API-knowledge boundary errors: hallucinated function names, misused parameters, and mishandled result tables in versioned simulation libraries. We introduce PowerCodeBench, an execution-validated benchmark generator that pairs natural-language operator queries with pandapower code and numerical ground truth; an L0-L3 documentation-driven probing procedure that measures per-model API knowledge profiles; and a boundary-aware intervention that combines query-side API demand estimation with targeted proactive documentation injection and routed reactive correction. On a 2,000-task frozen release, we evaluate ten open-weight LLMs (1.5B-480B parameters) and four commercial mid-tier APIs. The intervention improves every evaluated open-weight model of at least 7B parameters and every commercial API by 32 to 56 accuracy points. Open-weight models in the 70B-120B range match the commercial mid-tier accuracy range, while Llama-3.1-405B and Qwen3-Coder-480B lead the panel. The targeted prompts preserve the full-context accuracy ceiling while using 41% of the prompt-token cost. The result is an accuracy-side, deployment-time path toward reliable on-premise LLM assistance for grid-analysis workflows without fine-tuning or cloud inference.


翻译:大语言模型(LLM)正日益被用于自动化电力系统分析,但许多公用事业公司和能源研究实验室出于保密性、合规性、可复现性和成本考量,需要采用本地化部署。这使得开放权重模型的可靠性成为一个部署难题。我们首先证明,电力系统代码生成中的初次失败并非仅由推理能力不足主导,而是源于结构化的API知识边界错误:在版本化的仿真库中出现虚构函数名、参数误用以及结果表格处理失当等问题。为此,我们提出了PowerCodeBench——一个经执行验证的基准测试生成器,它能够将自然语言算子查询与pandapower代码及数值基准真相进行配对;一套L0-L3级别的文档驱动探测流程,用于测量每个模型的API知识分布;以及一种边界感知干预机制,将查询端的API需求估计与有针对性的主动文档注入和路由式纠错相结合。在包含2000个任务的冻结版本上,我们评估了十个开放权重LLM(参数规模1.5B至480B)以及四个商业中端API。该干预措施使得所有参数大于等于7B的经评估开放权重模型以及所有商业API的性能提升了32至56个准确率百分点。参数规模在70B至120B之间的开放权重模型达到了与商业中端API相当的准确率水平,而Llama-3.1-405B与Qwen3-Coder-480B在整体评估中表现最优。所提出的目标提示词在仅使用41%的提示词成本的情况下,保持了全上下文准确率的上限。该成果为在电网分析工作流中实现无需微调或云端推理的可靠本地化LLM辅助,提供了一条兼顾准确率与部署效率的可行路径。

0
下载
关闭预览

相关内容

应用程序接口(简称 API),又称为应用编程接口,就是软件系统不同组成部分衔接的约定。
大语言模型在电力系统中的应用初探
专知会员服务
25+阅读 · 2025年4月7日
《大型语言模型代码生成》综述
专知会员服务
70+阅读 · 2024年6月4日
基于模型系统的系统设计
科技导报
10+阅读 · 2019年4月25日
自然语言处理中的语言模型预训练方法
PaperWeekly
14+阅读 · 2018年10月21日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
4+阅读 · 2014年12月31日
国家自然科学基金
2+阅读 · 2014年12月31日
国家自然科学基金
26+阅读 · 2012年12月31日
VIP会员
最新内容
反制无人机:乌克兰提供的五点启示
专知会员服务
4+阅读 · 9月23日
《各指挥层级均亟需红队能力》报告
专知会员服务
6+阅读 · 9月23日
《航电任务系统框架(FAMOS)》50页报告
专知会员服务
4+阅读 · 9月22日
《对抗行动中的人工智能与自主性》智库报告
专知会员服务
7+阅读 · 9月22日
《从数据到胜利:战争中的分析优势之争》
专知会员服务
10+阅读 · 9月22日
战争不仅需要机器人:人类仍不可或缺
专知会员服务
5+阅读 · 9月21日
《描绘美国防部创新基础设施的未来蓝图》100页
专知会员服务
10+阅读 · 9月21日
相关基金
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
4+阅读 · 2014年12月31日
国家自然科学基金
2+阅读 · 2014年12月31日
国家自然科学基金
26+阅读 · 2012年12月31日
Top
微信扫码咨询专知VIP会员