Introduction and Motivation
Process Flow Diagrams (PFDs) and Piping & Instrumentation Diagrams (P&IDs) form the foundation of chemical process design, supporting workflow visualization, operational safety, and compliance with regulations. However, manually generating these diagrams for intricate processes is prone to errors, consumes significant time, and poses a major challenge in advancing industrial digitalization. Despite generative AI revolutionizing related domains (e.g. autonomous material discovery), its application in automating process design, particularly PFD/P&ID generation, remains largely unexplored. This limits the conversion of theoretical advancements into practical, cost-effective solutions.
To address this limitation, we propose a specialized foundational AI model trained on chemical engineering corpora to automate the creation of PFDs and P&IDs. The framework significantly reduces manual input by leveraging structured text generation, thereby streamlining the design process. It also enhances precision by minimizing human-induced errors in designs that are critical for regulatory compliance. Additionally, the system accelerates decision-making by incorporating real-time, iterative feedback through an agent-driven workflow.
By combining large language models (LLMs), ontological knowledge graphs, and retrieval-augmented generation (RAG), this approach tackles a major gap in chemical engineering: enabling scalable automation of process design. Experimental results demonstrate the model's capacity to produce compliant diagrams descriptions with limited expert input, making it immediately valuable for industrial use.
Methodology
Our work adopts a multi-stage approach to enable automated generation of Process Flow Diagrams (PFDs) and Piping & Instrumentation Diagrams (P&IDs) using a small foundational language model tailored for chemical engineering tasks. The training pipeline begins with the creation of a high-quality, instruction-tuning dataset. Using large language models such as GPT-4o, we synthesized over 20,000 domain-specific question-answer pairs covering diverse topics like process synthesis, instrumentation planning, logical reasoning, and error correction. These samples were validated and filtered using NVIDIA Nemotron-4-340B reward model to ensure alignment with engineering reasoning and response quality.
This dataset was used to fine-tune smaller models such as Llama via a teacher-student learning paradigm enhanced by Direct Preference Optimization (DPO), enabling the small model to deliver accurate and preference-aligned responses while maintaining computational efficiency.
To support contextual reasoning and domain adaptability, we integrated a two-tier Retrieval-Augmented Generation (RAG) system. The local RAG module retrieves and processes content from individual technical documents, while the global RAG module aggregates knowledge from multiple structured and unstructured sources to enable comprehensive understanding during generation.
A key component of the framework is its use of ontological knowledge graphs constructed using Neo4j. These graphs capture relationships between chemical compounds, unit operations, process parameters, and instrumentation components. Unlike traditional manual approaches, the information for the graphs is inferred and structured through language models analyzing technical literature and process descriptions. This structured representation significantly improves the model’s ability to retrieve relevant domain-specific knowledge during generation and reinforces logical consistency in the outputs.
The system is organized as a multi-agent architecture, where a meta-agent coordinates the workflow of specialized agents responsible for critique, reward modeling, and feedback integration. This setup supports iterative refinement of outputs through preference-based learning and expert intervention. Furthermore, to reduce latency during deployment, we applied width and depth pruning techniques to optimize model performance without compromising the quality of results.
Validation and benchmarking
We conducted comprehensive validation to assess the performance, generalization ability, and real-world applicability of our framework. A benchmark dataset comprising test questions related to known chemicals was developed to evaluate model reasoning, retrieval, and diagram-generation accuracy. To test robustness beyond the training distribution, the model was further evaluated on an additional set of unseen chemicals. For quantitative benchmarking, we employed the NVIDIA Nemotron reward model, using metrics such as helpfulness, correctness, coherence, complexity, and verbosity. Results show that our Llama foundational model achieved competitive performance compared to large-scale LLMs, while being significantly more efficient and easier to deploy.
To further confirm engineering validity, selected process flow diagrams generated by the model were verified using first-principles simulations in DWSIM. These simulations affirmed thermodynamic and mass balance consistency, reinforcing the framework’s reliability for real-world applications. Moreover, structured knowledge integration via ontological graphs and retrieval-augmented generation (RAG) proved critical in improving contextual accuracy and technical relevance.
Conclusions and future work
This work demonstrates how small, specialized AI models can transform chemical process design by automating diagram generation. By cutting down on manual work and boosting accuracy, our framework makes engineering workflow faster and more reliable. The system’s smart use of multi-agent framework, adaptive learning, and targeted information retrieval ensures it can handle real-world industrial challenges. Crucially, we show that compact, domain-specific models can match the performance of much larger AI systems while being far more practical for chemical engineering tasks.
Looking ahead, we plan to integrate our framework with widely adopted industry tools such as Aspen Plus, allowing seamless workflow adoption in existing engineering environments. Additionally, enhancing the system's responsiveness to dynamic process changes and its ability to suggest process improvements will further its utility in design optimization. These advancements will strengthen the framework’s role as a practical AI assistant for process engineers—supporting safer, smarter, and more compliant plant designs. Our research lays the foundation for scalable AI-driven automation in chemical engineering, marking a step forward toward fully digitized and intelligent process development.