Abstract
Large Language Models (LLMs) combined with Retrieval-Augmented Generation (RAG) and knowledge graphs offer new opportunities for interacting with engineering diagrams such as Piping and Instrumentation Diagrams (P&IDs). However, directly processing raw images or smart P&ID files with LLMs is often costly, inefficient, and prone to hallucinations. This work introduces ChatP&ID, an agentic framework that enables grounded and cost-effective natural-language interaction with P&IDs using Graph Retrieval-Augmented Generation (GraphRAG), a paradigm we refer to as GraphRAG for engineering diagrams. Smart P&IDs encoded in the DEXPI standard are transformed into structured knowledge graphs, which serve as the basis for graph-based retrieval and reasoning by LLM agents. This approach enables reliable querying of engineering diagrams while significantly reducing computational cost. Benchmarking across commercial LLM APIs (OpenAI, Anthropic) demonstrates that graph-based representations improve accuracy by 18% over raw image inputs and reduce token costs by 85% compared to directly ingesting smart P&ID files. While small open-source models still struggle to interpret knowledge graph formats and structured engineering data, integrating them with VectorRAG and PathRAG improves response accuracy by up to 40%. Notably, GPT-5-mini combined with ContextRAG achieves 91% accuracy at a cost of only $0.004 per task. The resulting ChatP&ID interface enables intuitive natural-language interaction with complex engineering diagrams and lays the groundwork for AI-assisted process engineering tasks such as Hazard and Operability Studies (HAZOP) and multi-agent analysis.
Abstract (translated)
大语言模型(LLMs)结合检索增强生成(RAG)与知识图谱,为与管道及仪表流程图(P&ID)等工程图纸的交互提供了新机遇。然而,直接使用LLM处理原始图像或智能P&ID文件往往成本高昂、效率低下且易产生幻觉。本研究提出ChatP&ID——一个基于图的检索增强生成(GraphRAG)的智能体框架,我们称之为面向工程图纸的GraphRAG。该框架将符合DEXPI标准的智能P&ID转化为结构化知识图谱,作为LLM智能体进行基于图的检索与推理基础。此方法在显著降低计算成本的同时,实现了对工程图纸的可靠查询。通过对商业LLM API(OpenAI、Anthropic)的基准测试表明,基于图的表示相比原始图像输入将准确率提升了18%,相比直接摄入智能P&ID文件降低了85%的令牌成本。尽管小型开源模型在解读知识图谱格式和结构化工程数据方面仍存在困难,但将其与VectorRAG和PathRAG结合可使响应准确率提升高达40%。值得注意的是,GPT-5-mini结合ContextRAG以每任务仅0.004美元的成本达到了91%的准确率。由此产生的ChatP&ID界面实现了与复杂工程图纸的直观自然语言交互,并为危险与可操作性研究(HAZOP)和多智能体分析等AI辅助工艺工程任务奠定了基础。
URL
https://arxiv.org/abs/2603.22528