arXiv:2511.09122cs.SEcs.AI2025-11被引 2

用检索增强生成技术,在数据少的工业场景下实现安全本地化PLC代码自动生成。

Vendor-Aware Industrial Agents: RAG-Enhanced LLMs for Secure On-Premise PLC Code Generation

  • 通过提示工程与定向检索,让小模型在低数据环境下生成高质量工业代码。
  • 支持多模型竞争、自动纠错和编译验证,代码通过率超90%。
  • 适合注重数据隐私的制造企业,尤其适用于三菱等厂商的专有PLC系统。

可编程逻辑控制器(PLC)使用专有的代码方言,导致难以训练通用编码助手。当前大语言模型虽能直接生成符合IEC 61131-3标准的代码,但缺乏对特定功能块及项目代码的了解。此外,三菱电机等公司及其客户不信任云服务提供商。因此,本地部署的自主编码代理成为理想方案。本研究提出一种面向工业场景的低数据量代码生成解决方案,展示如何在不微调大模型的前提下,通过微调小型本地模型实现在边缘设备上的高效运行。工具支持多个AI模型在聊天界面中相互竞争,具备推理能力、自动修复错误并直接编译验证代码。通过大量评估,包括编译统计与用户评分,我们发现:结合检索增强生成(RAG)与精心设计的提示工程,可在低数据领域实现高质量代码生成。

原文摘要 · Abstract (English)

Programmable Logic Controllers are operated by proprietary code dialects; this makes it challenging to train coding assistants. Current LLMs are trained on large code datasets and are capable of writing IEC 61131-3 compatible code out of the box, but they neither know specific function blocks, nor related project code. Moreover, companies like Mitsubishi Electric and their customers do not trust cloud providers. Hence, an own coding agent is the desired solution to cope with this. In this study, we present our work on a low-data domain coding assistant solution for industrial use. We show how we achieved high quality code generation without fine-tuning large models and by fine-tuning small local models for edge device usage. Our tool lets several AI models compete with each other, uses reasoning, corrects bugs automatically and checks code validity by compiling it directly in the chat interface. We support our approach with an extensive evaluation that comes with code compilation statistics and user ratings. We found that a Retrieval-Augmented Generation (RAG) supported coding assistant can work in low-data domains by using extensive prompt engineering and directed retrieval.

PLC代码生成RAG工业AI本地化部署

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。