Defective product root cause analysis method and system based on multi-modal space-time diagram neural network
By using a multimodal spatiotemporal graph neural network and reinforcement learning modules, the problems of lag and interpretability in the root cause analysis of defective products in the pharmaceutical production process have been solved. Transparent root cause explanation and safe and controllable autonomous optimization have been achieved, improving the accuracy of defective product risk prediction and the compliance of optimization strategies, forming a complete closed loop of perception-diagnosis-decision-optimization.
Patent Information
- Application Number
- CN202511790731.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-01
- Publication Date
- 2026-03-10
AI Technical Summary
Existing technologies for analyzing the root causes of defective products in pharmaceutical manufacturing suffer from limitations such as lag, difficulty in integrating multiple factors, lack of interpretability and compliance, making it difficult to pinpoint the root causes of anomalies and making optimization recommendations unreliable and unadvisable.
A dynamic factory knowledge graph is constructed using a multimodal spatiotemporal graph neural network. Combined with a reinforcement learning module, it enables multi-source data fusion, risk prediction, and interpretability optimization of the pharmaceutical production system. Key production units and process parameters are located through graph attention mechanism, and a human-machine collaborative reinforcement learning optimization strategy is designed.
It has achieved transparent root cause explanation of the pharmaceutical production process and safe and controllable autonomous optimization, improved the accuracy of defective product risk prediction and the compliance of optimization strategies, and formed a complete closed loop of perception-diagnosis-decision-optimization.
Smart Images

Figure CN121638896A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the technical field of industrial artificial intelligence and intelligent manufacturing, and particularly relates to a method and system for analyzing the root cause of defective products in a pharmaceutical production process and autonomously optimizing process parameters by using big data analysis, graph neural networks and reinforcement learning. BACKGROUND
[0002] Pharmaceutical production processes are complex and strictly regulated, and quality control is a core challenge for the industry. Currently, for root cause analysis of defective products in the production process, the industry relies on statistical process control (SPC) and traditional machine learning anomaly detection algorithms. However, these methods often have a lag and are difficult to effectively handle high-dimensional, nonlinear production process data. More importantly, they are mostly limited to analysis of a single data source (such as sensor time series data), and cannot integrate the complex correlations between equipment, materials, processes and other factors from a system level, making it difficult to accurately locate the root cause of deep, multi-factor coupled abnormalities.
[0003] Another significant defect of existing technical solutions is the disconnection between "perception" and "decision". Many methods can achieve anomaly early warning, but lack explainable analysis of the causes of anomalies, and cannot provide clear operational guidance for engineers. At the same time, data-driven optimization algorithms are often considered "black boxes", and their decision-making process is difficult to integrate and comply with the rigorous process specifications (such as cGMP) of pharmaceutical production, posing compliance and safety risks, making it difficult for optimization recommendations to be trusted and adopted in real production environments.
[0004] Therefore, there is an urgent need in the industry for a new generation of analysis and decision-making system that can deeply integrate multi-source data, provide transparent root cause explanations, and achieve safe and controllable autonomous optimization. SUMMARY
[0005] The present application aims to overcome the shortcomings of the prior art and provide a method and system for analyzing the root cause of defective products in pharmaceutical production based on a multi-modal spatio-temporal graph neural network. The core of the present application is to abstract the entire pharmaceutical production system as a dynamic "factory knowledge graph", and to use a multi-modal spatio-temporal graph neural network to model the complex spatio-temporal correlations in this graph. On this basis, through a reinforcement learning module that integrates expert knowledge feedback, autonomous and safe optimization of key process parameters is achieved, forming a complete closed loop from "perception-diagnosis-decision-optimization".
[0006] To achieve the above purpose, the present application provides a method for analyzing the root cause of defective products based on a multi-modal spatio-temporal graph neural network, comprising the following steps: S1, constructing a dynamic factory knowledge graph: based on the physical layout and process flow of the pharmaceutical production system, abstracting production units as nodes and material, energy or information flow between units as edges to construct an initial factory topology graph; fusing multi-modal heterogeneous data from the production system, the multi-modal heterogeneous data at least including time series data, relationship data and attribute data to enrich and dynamically update the features of the corresponding nodes and edges in the factory topology graph, forming the dynamic factory knowledge graph; S2, multi-modal spatio-temporal graph neural network modeling and risk prediction: inputting the dynamic factory knowledge graph into a pre-trained multi-modal spatio-temporal graph neural network (ST-GNN) model; the ST-GNN model captures the spatial dependency between nodes at the same time slice through a spatial convolution module, and captures the dynamics of the features of each node over time through a time convolution module, and finally outputs the prediction result of the risk of defective products in the future time window; S3, root cause explanation based on attention mechanism: while the ST-GNN model is predicting the risk, the graph attention mechanism inside the model is used to calculate and output the contribution of each node, edge and / or time step to the prediction result of the risk of defective products, and based on the contribution, the key production units, process parameters and time points that cause the risk of defective products are located; S4, reinforcement learning parameter optimization with human-machine collaboration: inputting the risk prediction result obtained in step S2 and the root cause explanation result obtained in step S3 into a reinforcement learning (RL) agent as a state; the RL agent outputs an optimized action of process parameters according to the current state; an reward function is used to evaluate the optimized action, which integrates the quantitative indicators of defective product risk reduction and the feedback reward provided by domain experts based on process knowledge; the RL agent is trained and iterated to maximize the cumulative reward, thereby generating a parameter optimization strategy that meets both data rules and process compliance.
[0007] Preferably, in step S1, the time series data includes temperature, pressure, pH value and flow rate readings of sensors on the production line; the relationship data includes physical connection relationships and material flow paths between production equipment; the attribute data includes static parameters of production units and supplier, batch number and purity information of material batches.
[0008] Preferably, in step S1, each production batch is mapped to a dynamic graph G(t)=(V,E,X(t)), where V represents a set of production unit nodes, E represents a set of edges representing material or energy flow relationships between units, and X(t) represents a feature vector of each node at time t, which is fused from sensor readings and material attributes related to the unit.
[0009] Preferably, in step S3, a root cause localization report and a visual knowledge graph are generated based on the contribution level; the root cause localization report is used to list the top K production units with the highest contribution levels, sensor parameters, and the time periods in which their anomalies occurred; the visual knowledge graph highlights the anomaly propagation path in an interactive manner.
[0010] Preferably, in step S4, the reward function is specifically R = R_data + β * R_expert, where R_data is the quantitative reward based on the decrease in the defective product risk prediction result, R_expert is the compliance reward based on the rule determination of the process expert knowledge base, and β is a hyperparameter used to balance the data-driven reward and the expert knowledge reward; the process expert knowledge base rules include constraints on the rate of change and numerical range of process parameters.
[0011] Furthermore, this invention also provides a defect root cause analysis system based on a multimodal spatiotemporal graph neural network, the system comprising: The dynamic factory knowledge graph construction module is used to construct an initial factory topology graph based on the physical layout and process flow of the pharmaceutical production system. It abstracts production units as nodes and the material, energy, or information flow between units as edges. It also integrates multimodal heterogeneous data from the production system, which includes at least time-series data, relational data, and attribute data, to enrich and dynamically update the features of corresponding nodes and edges in the factory topology graph, thus forming the dynamic factory knowledge graph. The multimodal spatiotemporal graph neural network modeling and risk prediction module is used to input the dynamic factory knowledge graph into a pre-trained multimodal spatiotemporal graph neural network (ST-GNN) model. The ST-GNN model captures the spatial dependencies between nodes in the same time slice through the spatial convolution module, and captures the dynamics of the changes in the features of each node over time through the temporal convolution module, and finally outputs the prediction results of the risk of defective products in the future time window. The root cause explanation module based on the attention mechanism is used to calculate and output the contribution of each node, edge and / or time step to the defective product risk prediction result while the ST-GNN model is performing risk prediction. Based on the contribution, the key production unit, process parameter and time point that leads to the defective product risk are located. A human-machine collaborative reinforcement learning parameter optimization module is used to input the risk prediction results and root cause explanation results as state inputs to a reinforcement learning (RL) agent; the RL agent outputs optimization actions for process parameters based on the current state; the optimization actions are evaluated using a reward function, which integrates quantitative indicators of defective product risk reduction and feedback rewards provided by domain experts based on process knowledge; the RL agent is trained and iterated with the goal of maximizing cumulative rewards, thereby generating parameter optimization strategies that conform to data patterns and meet process compliance requirements.
[0012] Preferably, in the dynamic factory knowledge graph construction module, the time-series data includes temperature, pressure, pH value, and flow rate readings of sensors on the production line; the relational data includes the physical connection relationships between production equipment and material flow paths; and the attribute data includes the static parameters of the production unit and the supplier, batch number, and purity information of the material batch.
[0013] Preferably, the dynamic factory knowledge graph construction module is further configured to map each production batch to a dynamic graph G(t)=(V,E,X(t)), where V represents the set of production unit nodes, E represents the set of edges relating material or energy flow between units, and X(t) represents the feature vector of each node at time t, which is formed by fusing sensor readings and material properties related to that unit.
[0014] Preferably, the root cause explanation module based on the attention mechanism is further configured to: generate a root cause localization report and a visualized knowledge graph based on the contribution; the root cause localization report is used to list the top K production units with the highest contribution, sensor parameters and the time periods in which the anomalies occurred; the visualized knowledge graph interactively highlights the anomaly propagation path.
[0015] Preferably, in the human-machine collaborative reinforcement learning parameter optimization module, the reward function is specifically R = R_data + β * R_expert, where R_data is the quantitative reward based on the decrease in the defective product risk prediction result, R_expert is the compliance reward based on the rule judgment of the process expert knowledge base, and β is a hyperparameter used to balance the data-driven reward and the expert knowledge reward; the process expert knowledge base rules include constraints on the rate of change and numerical range of process parameters.
[0016] The innovation of this invention is mainly reflected in the following aspects: First, by fusing multimodal heterogeneous data, time-series, relational, and attribute data are unified under the knowledge graph framework, breaking down data silos; second, spatiotemporal graph neural networks are used for modeling to explicitly capture the spatial topological dependencies and temporal dynamic evolution patterns between production units; third, an attention-based root cause explanation mechanism is introduced, which not only predicts risks but also accurately locates the key production factors and time points that lead to anomalies, greatly improving the interpretability of the model; finally, a human-machine collaborative reinforcement learning optimization strategy is designed, combining data-driven decision-making with strict process rules to ensure that the optimization process is both efficient and fully compliant, fundamentally solving the application risks of "black box" optimization in the pharmaceutical field. Attached Figure Description
[0017] Figure 1 This is a flowchart of the defect root cause analysis method based on multimodal spatiotemporal graph neural network provided by the present invention; Figure 2 This is a flowchart of the spatiotemporal graph neural network (ST-GNN) model provided by the present invention; Figure 3 This is an architecture diagram of a defect root cause analysis system based on a multimodal spatiotemporal graph neural network provided by the present invention. Detailed Implementation
[0018] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are merely some examples or embodiments of this application. For those skilled in the art, these drawings can be applied to other similar scenarios without creative effort. Unless obvious from the context or otherwise specified, the same reference numerals in the drawings represent the same structures or operations.
[0019] It should be understood that the terms “system,” “device,” “unit,” and / or “module” used herein are one way to distinguish different components, elements, parts, sections, or assemblies at different levels. However, if other terms can achieve the same purpose, they may be replaced by other expressions.
[0020] As indicated in this application and claims, unless the context clearly indicates otherwise, the words "a," "an," "an," and / or "the" do not specifically refer to the singular and may also include the plural. Generally speaking, the terms "comprising" and "including" only indicate the inclusion of explicitly identified steps and elements, which do not constitute an exclusive list, and the method or apparatus may also include other steps or elements.
[0021] Flowcharts are used in this application to illustrate the operations performed by the system according to embodiments of this application. It should be understood that the preceding or following operations are not necessarily performed precisely in sequence. Instead, the steps can be processed in reverse order or simultaneously. Furthermore, other operations can be added to these processes, or one or more steps can be removed from them.
[0022] Figure 1 This is a flowchart of a method for root cause analysis of defective products based on a multimodal spatiotemporal graph neural network according to the present invention. The method includes the following steps: S1. Constructing a Dynamic Factory Knowledge Graph: Based on the physical layout and process flow of the pharmaceutical production system, production units are abstracted as nodes, and the material, energy, or information flow between units is abstracted as edges, constructing an initial factory topology graph. Multimodal heterogeneous data from the production system is then integrated. This multimodal heterogeneous data includes at least time-series data, relational data, and attribute data to enrich and dynamically update the features of corresponding nodes and edges in the factory topology graph, forming the dynamic factory knowledge graph. Specifically, time-series data includes temperature, pressure, pH, and flow rate readings from sensors on the production line; relational data includes physical connections between production equipment and material flow paths; attribute data includes static parameters of production units and supplier, batch number, and purity information for material batches; and tag data includes the final quality inspection results for each batch of products.
[0023] In some embodiments, the construction of a dynamic factory knowledge graph is the data foundation of the entire method. Its core lies in mapping the physical pharmaceutical production system to a structured graph model in the digital space. In specific implementation, the production system first needs to undergo topological analysis: specific production equipment such as reactors, centrifuges, dryers, and storage tanks are abstracted as nodes in the graph structure, while the physical connections between these devices via pipes, conveyor belts, etc., and the actual transmission paths of materials, energy, or control signals are abstracted as edges. The initial factory topology graph formed by this process is a static skeleton that defines the basic spatial structure of the system. For example, a directed edge can be constructed from "Reactor A" to "Condenser B" and then to "Receiving Tank C," clearly representing the flow of materials. Based on this, multimodal heterogeneous data from Manufacturing Execution Systems (MES), Laboratory Information Management Systems (LIMS), sensor networks, and historical databases needs to be integrated to give this skeleton dynamic vitality. The time-series data (T) primarily originates from sensors deployed on the equipment, continuously recording process parameters such as temperature, pressure, pH value, flow rate, and stirring speed at a fixed sampling frequency (e.g., once per second), forming a time series associated with each equipment node. Relational data (R) not only includes the aforementioned equipment connection topology but also incorporates compositional relationships from the Bill of Materials (BOM), such as "raw materials for batch X are provided by supplier Y"; it mainly originates from the connection relationships between production equipment (e.g., "reactor A - outlet -> pipe B - inlet -> storage tank C") and material flow paths, thus forming the edges of the graph. Attribute data (A) covers the static parameters of the equipment (e.g., rated volume, material) and the batch attributes of the materials (e.g., supplier, batch number, initial purity, moisture content, etc.), thus forming the node features of the graph. Tag data (L) mainly includes the final quality inspection results (qualified / defective, and specific defect codes) for each batch of products. These multi-source data are associated and aligned through equipment identifiers, batch numbers, and timestamps, collectively forming the rich features of the nodes and edges in the graph.
[0024] After obtaining the aforementioned multi-source data, the system dynamically constructs and updates the knowledge graph through a data fusion engine. During implementation, each production batch is mapped to a dynamic graph sequence that evolves over time, formally represented as G(t) = (V, E, X(t)). Here, V represents the set of production unit nodes, E represents the set of edges indicating material or energy flow relationships between units, and X(t) is a dynamic feature matrix representing the feature state vector of all nodes in the graph at time t. The construction of this vector is crucial for data fusion: for a reactor node, its feature vector X_i(t) at time t might be a composite vector that integrates real-time sensor readings (time-series data), information on the currently processed material batch (attribute data), and its own equipment specifications. The system establishes a time-sliding window, taking a snapshot of the sensor data and batch status of the entire plant at a preset period (e.g., every 5 minutes) and updating the X(t) of all nodes. This process unifies data that originally existed in isolation across different systems, organizing and representing it within a graph structure with clear physical meaning. This allows for the explicit modeling of the potentially complex relationships between raw material properties, equipment status, process parameters, and product quality. Ultimately, this continuously updated dynamic factory knowledge graph provides subsequent spatiotemporal deep learning models with inputs that are both semantically rich and physically consistent.
[0025] S2. Multimodal Spatiotemporal Graph Neural Network Modeling and Risk Prediction: The dynamic factory knowledge graph is input into a pre-trained multimodal spatiotemporal graph neural network (ST-GNN) model. The ST-GNN model captures the spatial dependencies between nodes in the same time slice through the spatial convolution module, and captures the dynamics of the changes in the characteristics of each node over time through the temporal convolution module, and finally outputs the prediction results of the risk of defective products in the future time window.
[0026] See Figure 2 , Figure 2 This is a flowchart of the Spatiotemporal Graph Neural Network (ST-GNN) model. ST-GNN is a deep learning model capable of processing spatiotemporal data, capturing the spatiotemporal relationships between different devices in a dynamic factory knowledge graph. Specifically, Gated GAT is used to capture spatial correlations, while LSTM, GRU, and CNN are used to capture temporal correlations. Different spatiotemporal network architectures are constructed using these two methods to effectively capture the spatiotemporal correlations of dynamic factory knowledge graph data. First, location information and temporal information form the foundation of the spatiotemporal graph. Location information typically represents the physical location of devices in the dynamic factory knowledge graph, while temporal information reflects the changes in the dynamic factory knowledge graph data at different points in time, including not only specific timestamps but also periodic features. By combining this information, a dynamic spatiotemporal graph structure is formed.
[0027] Then, the spatiotemporal graph is represented by an adjacency matrix and a feature matrix, and input into the spatiotemporal network architecture. This architecture includes gated attention graph convolutions and a temporal prediction model. Gated GAT not only learns the importance of neighboring nodes but also controls information flow through a gating mechanism, enhancing the model's robustness to noise. The temporal prediction model, including LSTM, GRU, and CNN, extracts temporal correlations in the time dimension to predict future values. Finally, the data processed by the spatiotemporal network architecture is used for specific downstream tasks, such as defective product quality prediction. Through this process, ST-GNN can effectively fuse location and temporal information, construct a spatiotemporal graph, and capture spatiotemporal correlations using GNN variants and temporal prediction models, thereby achieving modeling and prediction of IoT spatiotemporal data.
[0028] The goal of the spatiotemporal graph neural network ST-GNN of this invention is to learn a function f: G(t)->(y_pred, A_importance), that is, to predict the probability y_pred of the final defective product based on the current production state graph, and output the attention weight A_importance of the node / edge to identify the root cause. In some embodiments, the temporal encoder (temporal convolutional layer) uses causal dilated convolution instead of LSTM, GRU / CNN, which has high parallelism, can capture longer temporal dependencies, and avoids gradient vanishing. The output layer of the model performs global pooling on the final state of the graph sequence, and then inputs it into a classifier to obtain the batch defective probability y_pred. At the same time, it backtracks the attention weights alpha throughout the network to generate the importance score matrix A_importance for each node and each time step. The pseudocode example is shown below: Python #Pseudocode Example class GatedGATConv(nn.Module): def forward(self,x,edge_index): alpha = compute_attention_scores(x, edge_index) # Calculate attention score messages = aggregate(alpha * x[edge_index[1]]) # Aggregate neighbor information gate = torch.sigmoid(self.gate_linear(x)) # Generate the gate signal return gate*x+(1-gate)*messages # Combine self-information and neighbor information S3. Root Cause Explanation Based on Attention Mechanism: While the ST-GNN model performs risk prediction, its internal graph attention mechanism is used to calculate and output the contribution of each node, edge, and / or time step to the defect risk prediction result. Based on the contribution, the key production unit, process parameter, and time point leading to the defect risk are located. A root cause localization report and a visualized knowledge graph are generated based on the contribution. The root cause localization report lists the top K production units with the highest contribution, sensor parameters, and the time periods in which their anomalies occurred. The visualized knowledge graph interactively highlights the anomaly propagation path.
[0029] In some embodiments, one of the core advantages of this invention lies in its superior interpretability, achieved through a gated graph attention mechanism (GAT) embedded within the ST-GNN model. While the model performs forward propagation and outputs risk prediction results, the attention weight matrix in its spatial convolutional module is simultaneously recorded and extracted. This weight matrix quantitatively characterizes the "degree of attention" a node gives to the features of its neighboring nodes during information aggregation, directly reflecting the strength of the influence relationship between production units. For example, when the model predicts a high risk at the final product tank node, tracing back its attention weights reveals that the risk primarily stems from a reactor node assigning an extremely high attention score to a pipeline node several hours earlier. To transform these dispersed, temporal weights into global, understandable root cause contributions, the system implements a post-processing procedure: First, the attention weights of each node and edge are aggregated along the time dimension (e.g., summed or maximized) to obtain a total importance score over the entire prediction time window; subsequently, these scores are normalized across nodes so that the sum of the contributions of all nodes and edges is 1. Finally, the system outputs a list sorted in descending order of contribution, accurately locating the key production unit (such as "reactor"), specific process parameters (such as "temperature sensor"), and the core time period of the anomaly (such as "time interval from t1 to t2") that caused the risk of defective products.
[0030] Building upon the generated structured data, the system further transforms the root cause analysis results into two more intuitive forms: a root cause localization report and a visualized knowledge graph. The root cause localization report is an automated analysis document for process engineers. It not only lists the top K contributing root causes but also correlates and displays the original sensor data curves of these key nodes during the abnormal time period, comparing them with historical benchmark data from normal production batches to provide data support for determining "why it was determined to be the root cause." More innovative is the visualized knowledge graph. Based on the initial plant topology map, the system maps the calculated node and edge contributions to visual elements. For example, it uses a color gradient from light to dark red to represent contributions from low to high, and dynamic arrow widths to characterize the propagation intensity and direction of the abnormal impact. In an interactive interface, engineers can clearly see how an abnormal event starts from a root cause node (such as a temperature-runaway reactor), gradually propagates along a highlighted path (such as pipes and valves) to the end of the system, and ultimately affects product quality. This visual representation of "source-propagation" greatly lowers the threshold for understanding the causal relationships of complex systems, enabling engineers to quickly focus on the core of the problem rather than getting lost in a sea of alerts. It fully meets the stringent requirements of the pharmaceutical industry for transparency in the production process and audit trails.
[0031] S4. Human-Machine Collaborative Reinforcement Learning Parameter Optimization: The risk prediction result obtained in step S2 and the root cause explanation result obtained in step S3 are used as state inputs to a reinforcement learning (RL) agent. The RL agent outputs optimization actions for process parameters based on the current state. The optimization actions are evaluated using a reward function, which integrates quantitative indicators of defective product risk reduction and feedback rewards provided by domain experts based on process knowledge. The RL agent is trained and iterated with the goal of maximizing cumulative rewards, thereby generating parameter optimization strategies that conform to data patterns and meet process compliance requirements. Specifically, the reward function is R = R_data + β * R_expert, where R_data is the quantitative reward based on the decrease in defective product risk prediction results, R_expert is the compliance reward based on the rules of the process expert knowledge base, and β is a hyperparameter used to balance data-driven rewards and expert knowledge rewards. The process expert knowledge base rules include constraints on the rate of change and numerical range of process parameters.
[0032] In some embodiments, after completing risk prediction and root cause diagnosis, the system enters the autonomous optimization phase of process parameters. This phase is driven by a reinforcement learning (RL) agent, whose core task is to explore optimization strategies that can both reduce the risk of defective products and comply with process specifications. Specifically, the RL agent's state is a carefully constructed feature vector that deeply integrates the global risk prediction results from S2 (such as the probability of defective products in future time windows) and the refined root cause explanation results from S3 (such as the top K nodes with the highest contribution and their corresponding time periods and parameter types). For example, a typical state description might be: "The current batch has a 35% defect risk in the remaining cycle, mainly due to the high temperature of 'reactor A' in the last 30 minutes and the flow rate fluctuation of 'feed pump B'." This state representation ensures that the agent has a comprehensive understanding of the health status and problem issues of the production system. Based on the current state, the agent outputs an action through its policy network, which proposes fine-tuning suggestions for one or more process parameters identified as key factors (such as the temperature setpoint of reactor A and the flow rate of feed pump B). Action spaces are typically designed to vary continuously or discretely in increments to ensure smooth operation. This implementation preferably employs efficient RL algorithms, such as the Soft Actor-Critic (SAC), which are suitable for continuous action spaces, to learn complex optimal control strategies.
[0033] To ensure the safety and compliance of the optimization strategy, the core innovation of this invention lies in designing a composite reward function R = R_data + β * R_expert. Here, R_data is a fully data-driven reward component directly linked to the optimization objective. For example, if the model-predicted risk of defective products significantly decreases after the action is performed, a positive reward is given; if the risk increases or remains high, a negative or zero reward is given. More distinctive is the R_expert component, which acts as an "AI coach," connected to an expert knowledge base predefined and maintained by process experts. This knowledge base encapsulates cGMP specifications, standard operating procedures (SOPs), and deep domain experience, concretizing them into a series of computable rules. For example, rules might stipulate: "The adjustment range of any temperature setpoint must not exceed ±2°C / min," "The pH value must be strictly controlled between 6.5 and 7.5," or "Increasing the stirring rate is not allowed during the crystallization stage." When the optimization action proposed by the RL agent violates any of these rules, R_expert immediately returns a large negative reward, as if a stern expert is rejecting an unsafe operation on-site. The hyperparameter β is set by the system administrator to dynamically adjust the weight of expert experience in the total reward. A higher β value can be set in the early stages of optimization to ensure safe exploration, and then appropriately reduced after the strategy stabilizes to give data-driven optimization greater flexibility. In this way, the RL agent, in pursuing the maximization of long-term cumulative rewards, is forced to search within a safe and feasible domain that conforms to data patterns and strictly adheres to process knowledge. The resulting optimization strategy fundamentally avoids the compliance and security risks that may arise from "black box" decision-making, achieving true human-machine collaboration and reliable autonomous optimization.
[0034] Furthermore, this invention also relates to a root cause analysis system for defective products based on a multimodal spatiotemporal graph neural network. See also... Figure 3 The defect root cause analysis system based on multimodal spatiotemporal graph neural network specifically includes: The dynamic factory knowledge graph construction module is used to construct an initial factory topology graph based on the physical layout and process flow of the pharmaceutical production system. It abstracts production units as nodes and the material, energy, or information flow between units as edges. It also integrates multimodal heterogeneous data from the production system, which includes at least time-series data, relational data, and attribute data, to enrich and dynamically update the features of corresponding nodes and edges in the factory topology graph, thus forming the dynamic factory knowledge graph. The multimodal spatiotemporal graph neural network modeling and risk prediction module is used to input the dynamic factory knowledge graph into a pre-trained multimodal spatiotemporal graph neural network (ST-GNN) model. The ST-GNN model captures the spatial dependencies between nodes in the same time slice through the spatial convolution module, and captures the dynamics of the changes in the features of each node over time through the temporal convolution module, and finally outputs the prediction results of the risk of defective products in the future time window. The root cause explanation module based on the attention mechanism is used to calculate and output the contribution of each node, edge and / or time step to the defective product risk prediction result while the ST-GNN model is performing risk prediction. Based on the contribution, the key production unit, process parameter and time point that leads to the defective product risk are located. A human-machine collaborative reinforcement learning parameter optimization module is used to input the risk prediction results and root cause explanation results as state inputs to a reinforcement learning (RL) agent; the RL agent outputs optimization actions for process parameters based on the current state; the optimization actions are evaluated using a reward function, which integrates quantitative indicators of defective product risk reduction and feedback rewards provided by domain experts based on process knowledge; the RL agent is trained and iterated with the goal of maximizing cumulative rewards, thereby generating parameter optimization strategies that conform to data patterns and meet process compliance requirements.
[0035] The input data for the dynamic factory knowledge graph construction module includes: time series data (T): all production line sensor data (temperature, pressure, pH value, flow rate, etc.), time series; relational data (R): connection relationships between production equipment (e.g., "reactor A-outlet -> pipe B-inlet -> storage tank C"), material flow paths, and edges that constitute the graph; attribute data (A): static parameters of each production unit (equipment), attributes of each batch of materials (supplier, batch number, purity, etc.), and node features that constitute the graph; and tag data (L): the final quality inspection results of each batch of products (qualified / defective, and specific defect codes).
[0036] The data is then processed to map each production batch into a dynamic graph G(t) = (V, E, X(t)). Here, V represents the set of nodes, each node representing a production unit (e.g., a reactor, centrifuge); E represents the set of edges, representing the material / energy flow relationships between units; and X(t) represents the feature vector of each node at time t, which is formed by fusing sensor readings and material properties related to that unit.
[0037] The network objective of the multimodal spatiotemporal graph neural network modeling and risk prediction module is to learn a function f: G(t)->(y_pred, A_importance), which predicts the probability y_pred of the final defective product based on the current production state graph, and outputs the attention weights A_importance of nodes / edges to identify the root cause. The spatial encoder (graph convolutional layer) in the model structure uses gated attention graph convolution (Gated GAT), which not only learns the importance of neighboring nodes but also controls the information flow through a gating mechanism, enhancing the model's robustness to noise.
[0038] The temporal encoder (temporal convolutional layer) uses causal dilated convolution instead of GRU and CNN / LSTM, which offers high parallelism, captures longer temporal dependencies, and avoids gradient vanishing. The output layer globally pools the final state of the graph sequence and then inputs it into a classifier to obtain the batch defect probability y_pred. Simultaneously, it backtracks the attention weights alpha throughout the network to generate an importance score matrix A_importance for each node and each time step.
[0039] The root cause analysis module, based on an attention mechanism, takes the attention weights A_importance output by the ST-GNN model as input. It then normalizes and performs temporal aggregation on these weights, finally outputting a root cause localization report. This report lists the top K production units with the highest contributions, their sensor parameters, and the time periods in which the anomalies occurred. The module can also construct a visual knowledge graph: highlighting the anomaly propagation path in an interactive graph format, gradually spreading from the root cause node to the final quality node.
[0040] The network objective of the human-machine collaborative reinforcement learning parameter optimization module is to automatically provide optimization suggestions for identified key process parameters. The model employs a soft actor-critic (SAC) reinforcement learning algorithm, but its reward function R is designed as a composite function: R = R_data + β * R_expert, where R_data represents a positive reward based on prediction results, such as a decrease in the defect probability; R_expert represents a reward based on an expert knowledge base. The system has a rule base maintained by process engineers (e.g., "temperature increase rate must not exceed X°C / min", "pH value must be within the YZ range"). If the optimization action proposed by the AI violates these rules, it will receive a large negative reward R_expert; β represents the balancing hyperparameter. The overall process is roughly as follows: the AI agent takes the current production state as the state, proposes fine-tuning process parameters as an action, and the environment (simulator or real production line) executes the action and returns a reward (R) and a new state. Through training, the AI learns to maximize long-term rewards (i.e., minimize the defect rate) while adhering to expert rules.
[0041] In summary, the algorithm flow involved in this invention is as follows (taking a production batch as an example): Data Acquisition and Graph Construction: Collect all time-series data (T), relational data (R), and attribute data (A) of this batch to construct a spatiotemporal graph sequence G(1), G(2), ..., G(T).
[0042] Real-time prediction and early warning: Input real-time data into the pre-trained ST-GNN model. If y_pred>threshold, the system will issue an early warning of defective products.
[0043] Root cause analysis: For batches that have been flagged as problematic or have already occurred, activate the root cause explanation module to generate an analysis report.
[0044] Optimization Decision: Root cause analysis results trigger the RL optimization module. The RL module proposes optimization actions based on the problem parameters, displays them to engineers for confirmation, or, after approval, directly issues them to the PLC / DCS system for closed-loop control.
[0045] Continuous learning: The results of engineers' adoption or rejection of AI suggestions will be stored as new feedback signals in the expert knowledge base, which will be used to update the R_expert function of RL, so as to realize the continuous evolution of the model.
[0046] This algorithm has at least the following advantages compared with existing technologies: Deeper causal relationship mining: Compared with only analyzing temporal correlation, this invention explicitly models the topology of the production system through graph structure, which can more accurately identify the root cause of anomaly propagation rather than just the phenomenon.
[0047] Greater interpretability: The attention mechanism provides a basis for model decision-making, meeting the stringent requirements of the pharmaceutical industry for audit trails and algorithmic transparency.
[0048] Human-machine collaborative safety optimization: By embedding human expert knowledge into the RL loop, the optimization process is always kept within a known safe and compliant space, solving the biggest trust and security risks in the application of AI in industrial scenarios.
[0049] End-to-end integration: Integrating "perception-diagnosis-decision-optimization" into a single framework forms a closed loop from problem discovery to problem resolution, improving overall efficiency.
[0050] The implementation of this invention requires the collection of sensor data, material data, equipment relationship data, and quality inspection data. All data must be encrypted and anonymized during transmission and storage to ensure the protection of trade secrets and data security.
[0051] Unless expressly stated in the claims, the order of processing elements and sequences, the use of numbers and letters, or other names described in this application are not intended to limit the order of the processes and methods of this application. Although various examples have been discussed in the foregoing disclosure of some embodiments that are currently considered useful, it should be understood that such details are for illustrative purposes only, and the appended claims are not limited to the disclosed embodiments. Rather, the claims are intended to cover all modifications and equivalent combinations that conform to the substance and scope of the embodiments of this application. For example, while the system components described above can be implemented by hardware devices, they can also be implemented solely by software solutions, such as installing the described system on existing servers or mobile devices.
[0052] Similarly, it should be noted that, in order to simplify the description of the present application and thus aid in the understanding of one or more embodiments of the invention, the foregoing description of the embodiments of the present application sometimes combines multiple features into a single embodiment, drawing, or description thereof. However, this disclosure method does not imply that the subject matter of the application requires more features than those mentioned in the claims. In fact, the embodiments contain fewer features than all the features of the single embodiments disclosed above.
[0053] For each patent, patent application, patent application publication, and other material such as articles, books, specifications, publications, and documents referenced in this application, the entire contents of that material are incorporated herein by reference. This excludes historical application documents that are inconsistent with or conflict with the content of this application, as well as documents that limit the broadest scope of the claims in this application (currently or subsequently appended to this application). It should be noted that if there is any inconsistency or conflict between the descriptions, definitions, and / or terminology used in the supplementary materials of this application and the content of this application, the descriptions, definitions, and / or terminology used in this application shall prevail.
[0054] Finally, it should be understood that the embodiments described in this application are merely illustrative of the principles of the embodiments of this application. Other modifications may also fall within the scope of this application. Therefore, alternative configurations of the embodiments of this application are considered as examples and not limitations, and are regarded as consistent with the teachings of this application. Accordingly, the embodiments of this application are not limited to the embodiments explicitly described and illustrated in this application.
Claims
1. A method for bad product root cause analysis based on a multi-modal spatio-temporal graph neural network, characterized in that, The method comprises the following steps: S1, constructing a dynamic factory knowledge graph: based on the physical layout and process flow of the pharmaceutical production system, abstracting production units as nodes and material, energy or information flow between units as edges to construct an initial factory topology graph; Fusing multi-modal heterogeneous data from the production system, including at least time series data, relational data and attribute data, to enrich and dynamically update the features of the corresponding nodes and edges in the factory topology graph, forming the dynamic factory knowledge graph; S2, multi-modal spatio-temporal graph neural network modeling and risk prediction: input the dynamic factory knowledge graph into a pre-trained multi-modal spatio-temporal graph neural network (ST-GNN) model; the ST-GNN model captures the spatial dependency between nodes at the same time slice through a spatial convolution module, and captures the dynamics of the characteristics of each node over time through a time convolution module, and finally outputs the prediction result of the risk of defective products in the future time window; S3, root cause explanation based on attention mechanism: while the ST-GNN model is predicting the risk, the graph attention mechanism inside the model is used to calculate and output the contribution of each node, edge and / or time step to the prediction result of the risk of defective products, and based on the contribution, the key production units, process parameters and time points that cause the risk of defective products are located; S4, reinforcement learning parameter optimization based on human-machine collaboration: input the risk prediction result obtained in step S2 and the root cause explanation result obtained in step S3 into a reinforcement learning (RL) agent as a state; the RL agent outputs an optimized action of the process parameter according to the current state; an reward function is used to evaluate the optimized action, which integrates the quantitative indicators of the reduction of the risk of defective products and the feedback reward provided by the domain experts based on the process knowledge; The RL agent is trained and iterated to maximize the cumulative reward, thereby generating a parameter optimization strategy that meets both the data rules and the process compliance.
2. The multi-modal spatio-temporal graph neural network based bad product root cause analysis method according to claim 1, characterized in that, In step S1, the time series data includes temperature, pressure, pH value and flow rate readings of sensors on the production line; the relational data includes the physical connection relationship between production equipment and the material flow path; the attribute data includes the static parameters of the production unit and the supplier, batch number and purity information of the material batch.
3. The multi-modal spatio-temporal graph neural network based bad product root cause analysis method according to claim 2, characterized in that, In step S1, each production batch is mapped to a dynamic graph G(t)=(V,E,X(t)), where V represents the set of production unit nodes, E represents the set of edges representing the material or energy flow relationship between units, and X(t) represents the feature vector of each node at time t, which is fused from the sensor readings and material attributes related to the unit.
4. The multi-modal spatio-temporal graph neural network based bad product root cause analysis method according to claim 1, characterized in that, In step S3, a root cause positioning report and a visual knowledge graph are generated based on the contribution; the root cause positioning report is used to list the top K production units, sensor parameters and time periods of abnormal occurrence with the highest contribution; the visual knowledge graph highlights the abnormal propagation path in an interactive form.
5. The multi-modal spatio-temporal graph neural network based bad product root cause analysis method according to claim 1, characterized in that, In step S4, the reward function is specifically R=R_data+β*R_expert, where R_data is a quantitative reward based on the decrease of the prediction result of the risk of defective products, R_expert is a compliance reward based on the determination of the process expert knowledge base rule, and β is a hyperparameter for balancing the data-driven reward and the expert knowledge reward; the process expert knowledge base rule includes constraints on the change rate and value range of the process parameters.
6. A bad product root cause analysis system based on a multi-modal spatio-temporal graph neural network, characterized in that, The system is used to implement the method according to any one of claims 1 to 5, and comprises: a dynamic factory knowledge graph construction module, configured to abstract production units as nodes and material, energy or information flow between units as edges based on the physical layout and process flow of the pharmaceutical production system, to construct an initial factory topology graph, and to fuse multi-modal heterogeneous data from the production system, the multi-modal heterogeneous data at least including time series data, relationship data and attribute data, to enrich and dynamically update the features of the corresponding nodes and edges in the factory topology graph, and to form the dynamic factory knowledge graph; a multi-modal spatio-temporal graph neural network modeling and risk prediction module, configured to input the dynamic factory knowledge graph into a pre-trained multi-modal spatio-temporal graph neural network (ST-GNN) model; the ST-GNN model captures the spatial dependency between nodes at the same time slice through a spatial convolution module, and captures the dynamics of the features of each node over time through a time convolution module, and finally outputs the prediction result of the risk of defective products in a future time window; a root cause explanation module based on an attention mechanism, configured to calculate and output the contribution of each node, edge and / or time step to the prediction result of the risk of defective products by using the graph attention mechanism inside the ST-GNN model while the ST-GNN model is performing risk prediction, and to locate the key production units, process parameters and time points that cause the risk of defective products based on the contribution; a human-machine collaborative reinforcement learning parameter optimization module, configured to input the risk prediction result and root cause explanation result as a state into a reinforcement learning (RL) agent; the RL agent outputs an optimized action of a process parameter according to the current state; an reward function is used to evaluate the optimized action, the reward function integrates a quantitative indicator of the reduction of the risk of defective products and a feedback reward provided by a domain expert based on process knowledge; the RL agent is trained and iterated to generate a parameter optimization strategy that meets both data rules and process compliance, with the goal of maximizing the cumulative reward.
7. The multimodal spatio-temporal graph neural network-based bad product root cause analysis system according to claim 6, wherein, In the dynamic factory knowledge graph construction module, the time series data includes temperature, pressure, pH value and flow rate readings of sensors on the production line; the relationship data includes physical connection relationships and material flow paths between production devices; and the attribute data includes static parameters of production units and supplier, batch number and purity information of material batches.
8. The multimodal spatio-temporal graph neural network-based bad product root cause analysis system according to claim 7, wherein, The dynamic factory knowledge graph construction module is further configured to map each production batch as a dynamic graph G(t)=(V,E,X(t)), where V represents a set of production unit nodes, E represents a set of edge sets of inter-unit material or energy flow relationships, and X(t) represents a feature vector of each node at time t, which is fused from the unit-related sensor readings and material attributes.
9. The multimodal spatio-temporal graph neural network based bad product root cause analysis system of claim 6, wherein, The root cause explanation module based on the attention mechanism is further configured to generate a root cause positioning report and a visual knowledge graph based on the contribution degree; the root cause positioning report is used to list the top K production units with the highest contribution degree, sensor parameters and time periods of abnormal occurrence; and the visual knowledge graph highlights the abnormal propagation path in an interactive form.
10. The multimodal spatio-temporal graph neural network based bad product root cause analysis system of claim 6, wherein, In the human-computer collaborative reinforcement learning parameter optimization module, the reward function is specifically R=R_data+β*R_expert, where R_data is a quantitative reward based on a decrease in the risk prediction result of defective products, R_expert is a compliance reward based on a rule determination of a process expert knowledge base, and β is a hyperparameter for balancing the data-driven reward and the expert knowledge reward; and the process expert knowledge base rule includes a constraint on a process parameter change rate and a numerical range.
Citation Information
Cited By
Power system data anomaly identification and active protection method and system based on deep learning
CN121980481A
Power system data anomaly identification and active protection method and system based on deep learning
CN121980481B