Knowledge graph-driven industrial equipment fault diagnosis question and answer method and system
By constructing a knowledge graph-driven question-and-answer system for industrial equipment fault diagnosis, and utilizing a hybrid BERT-BiLSTM-CRF model and a large language model, the system addresses the lag in knowledge management and the shortcomings of large language models in vertical domains in industrial equipment fault diagnosis, achieving efficient and interpretable fault diagnosis and intelligent question answering.
Patent Information
- Application Number
- CN202511335471.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-18
- Publication Date
- 2025-12-23
AI Technical Summary
Existing methods for diagnosing faults in industrial equipment suffer from outdated knowledge management, high dependence on experience, and difficulty in integrating multi-source information. Furthermore, large language models exhibit problems such as knowledge illusion, lack of reasoning, and poor interpretability in vertical domain applications, and lack intelligent question-answering systems.
A knowledge graph-driven question-and-answer system for industrial equipment fault diagnosis is constructed. Fault knowledge is extracted through a BERT-BiLSTM-CRF hybrid model, and combined with the ChatGLM3-6B large language model and the Text2Vec model to achieve natural language interaction and multimodal knowledge fusion, generate accurate Cypher query statements and perform knowledge retrieval.
It enables precise and intelligent diagnosis of industrial equipment faults, improves the efficiency and interpretability of fault diagnosis, supports efficient retrieval and query of equipment faults in blast furnace systems, and provides a convenient human-computer interaction method.
Smart Images

Figure CN121189447A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of artificial intelligence, and particularly relates to a knowledge graph driven industrial equipment fault diagnosis question and answer method and system. BACKGROUND
[0002] Industrial equipment is complex, has strong coupling, nonlinearity and fault concealment, and the like, and once a fault occurs, it will directly lead to production interruption and can also cause major safety hazards. At present, the industry has accumulated a large amount of fault case experience, but the traditional industrial equipment fault knowledge is scattered in the form of fragmentation in maintenance cases, literature and production records, lacks systematic integration, and causes safety management personnel to spend a lot of time to cross-departmentally call up information, which seriously restricts the fault response efficiency. Taking the blast furnace ironmaking equipment as an example, as the core production device of the steel industry, it has complex equipment composition and harsh operating environment, and includes six subsystems of feeding, air supply, blast furnace body, coal gas dust removal, slag iron treatment and fuel injection. The synergistic effect between the devices of each subsystem directly affects the stable operation and production efficiency of the blast furnace. However, factors such as equipment aging, improper operation and raw material quality fluctuation of the industrial equipment fault diagnosis system can easily cause equipment failure, leading to unplanned shutdown and even safety accidents. In the occurred blast furnace accidents, the fault diagnosis timeliness is one of the main causes. The current industrial equipment fault diagnosis methods are mainly divided into two categories: data-driven monitoring methods and expert experience-based maintenance strategies. The data-driven method realizes fault detection by analyzing the time series signals and process parameters of the sensors, such as principal component analysis, support vector machine and Bayesian network technology. Although these methods have made progress in feature extraction and model generalization, they are severely dependent on large-scale labeled data, and the blast furnace major fault has the characteristics of low occurrence rate, which leads to a significant decline in the generalization ability of the model in the data scarce scene. In addition, the data-driven method is difficult to capture the implicit fault correlation between the devices, and the diagnosis result has poor interpretability, which is difficult to support dynamic decision-making. The expert experience-based method relies on manual analysis of fault cases and rule bases, but the knowledge update is lagging behind and is difficult to cope with complex fault scenarios.
[0003] To solve the above problems, the fault knowledge in industrial equipment is mined and integrated to build a fault knowledge base of an industrial equipment fault diagnosis system, and the systematized integration and intelligent application of the knowledge of the industrial equipment fault diagnosis system become a new solution. In recent years, the knowledge graph (KG) technology has shown significant advantages in the medical and financial fields due to its structured knowledge representation and reasoning ability. The knowledge graph can realize multi-dimensional association and dynamic updating of fault knowledge by constructing a semantic network between entities. However, the construction of an industrial domain knowledge graph faces multiple challenges: the integration of multi-source heterogeneous data (such as device logs and process documents) of the industrial equipment fault diagnosis system is difficult; the expression of fault entities is diverse and the disambiguation of redundant relationships is complex; and the existing graph reasoning ability cannot meet the real-time diagnosis requirements. Although some studies attempt to combine deep learning to improve knowledge extraction efficiency, traditional methods still have problems of insufficient precision in long-distance dependency modeling and domain-specific name recognition. At the same time, the large language model (LLM) provides a new idea for intelligent question-answering systems with its powerful natural language understanding and generation capabilities. However, the LLM has three major bottlenecks in vertical field applications: first, the semantic deviation between pre-training corpus and blast furnace professional knowledge leads to low credibility of generated answers; second, the LLM parameter update lags behind, making it difficult to dynamically adapt to the iteration of equipment operation and maintenance knowledge; third, the model's "black box" nature makes it impossible to verify the fault reasoning path, and existing solutions mostly use the strategy of retraining the model to inject domain knowledge, but the scale of industrial equipment fault corpus is limited, and the cost of training the fine-tuned model is high and the effect is limited.
[0004] To solve the above problems, the academic community has begun to explore the fusion method of knowledge graph and large language model. The knowledge graph can provide structured knowledge support for the LLM, while the LLM can make up for the deficiencies of the graph in semantic understanding and interaction capabilities. However, the existing fusion technology still has two major defects: first, the coordination mechanism of knowledge retrieval and language generation is imperfect, leading to a high error rate of query statement generation (such as the lack of Cypher statement availability); second, the dynamic knowledge updating capability is weak, and it cannot adapt to the real-time state changes of industrial equipment. In addition, the industrial field has not formed a complete industrial equipment fault intelligent question-answering system, and existing platforms are mostly limited to rule matching or single retrieval functions, making it difficult to support natural language interaction and multi-modal knowledge fusion. SUMMARY
[0005] To solve the problems of the prior art, the present application provides a knowledge graph driven industrial equipment fault diagnosis question-answering method and system, to solve the problems of knowledge management lag, high experience dependence, and multi-source information fusion difficulty in traditional industrial equipment fault diagnosis methods, to realize bidirectional enhanced reasoning of data-driven and knowledge-guided, and to support natural language interaction query.
[0006] The technical scheme of the present application is:
[0007] In one aspect, the present application provides a knowledge graph driven industrial equipment fault diagnosis question and answer method, comprising the following steps:
[0008] Obtain industrial equipment fault records, and construct an industrial equipment fault knowledge graph based on the industrial equipment fault records;
[0009] Link the industrial equipment fault knowledge graph to the ChatGLM3-6B large language model, and train the ChatGLM3-6B large language model to obtain a trained ChatGLM3-6B large language model;
[0010] Combine the trained ChatGLM3-6B large language model with the pre-trained Text2Vec model to construct an industrial equipment fault question and answer large language model that fuses knowledge graphs, and use the industrial equipment fault question and answer large language model that fuses knowledge graphs to generate a final answer according to a natural language question input by a user.
[0011] Further, the obtaining of the industrial equipment fault records and the construction of the industrial equipment fault knowledge graph based on the industrial equipment fault records specifically comprises the following steps:
[0012] A1: Obtain a plurality of industrial equipment fault records; the industrial equipment fault records are texts that record the fault conditions of industrial equipment;
[0013] A2: Perform text segmentation and data cleaning on the industrial equipment fault records to obtain preprocessed industrial equipment fault records;
[0014] A3: Construct a BERT-BiLSTM-CRF hybrid model and train it, and use the trained BERT-BiLSTM-CRF hybrid model to extract industrial equipment fault triples from the preprocessed industrial equipment fault records; the format of the industrial equipment fault triples is <entity, relationship, entity>, which is used to represent the fault domain knowledge of industrial equipment;
[0015] The BERT-BiLSTM-CRF hybrid model comprises a BERT model, a bidirectional long short-term memory network, and a conditional random field (CRF) connected in sequence;
[0016] A4: Based on the extracted industrial equipment fault triplets, a knowledge fusion method is used to eliminate redundancy and ambiguity of the industrial equipment fault triplets, to obtain fused industrial equipment fault triplets and store them in the Neo4j graph database, and at the same time, to construct an industrial equipment fault knowledge graph according to the fused industrial equipment fault triplets; the points in the industrial equipment fault knowledge graph represent an entity, and the edges between the nodes represent the relationship between the entities.
[0017] Further, the BERT-BiLSTM-CRF hybrid model trained is used to extract industrial equipment fault triplets from the preprocessed industrial equipment fault records, specifically: the pre-trained BERT model is used as an encoder to vector encode the preprocessed industrial equipment fault records, and the characters, words and sentence structures therein are converted into high-dimensional vector representations; then, the high-dimensional vector representations generated by the BERT model are input into the bidirectional long short-term memory network BiLSTM, and the context modeling of the industrial equipment fault records is performed in both forward and reverse directions to extract feature sequences; finally, the conditional random field CRF is used to jointly decode the feature sequences output by the BiLSTM, realizing the sequence labeling of entities and relationships in the industrial equipment fault triplets <entity, relationship, entity>, so as to extract accurate industrial equipment fault triplets.
[0018] Further, the knowledge fusion method specifically includes: first, using a graph neural network to generate an embedding vector for each entity in the industrial equipment fault triplets, calculating the cosine similarity between the embedding vectors of each two entities, selecting the M entities with the largest cosine similarity for each entity to form a similar entity set, and grouping each entity and one entity in the similar entity set of the corresponding entity to form a candidate pair, thereby obtaining a candidate pair set composed of a plurality of candidate pairs; then, based on the candidate pair set, the Jaccard coefficient is calculated, and the entities describing similar or the same fault are fused according to the Jaccard coefficient, and a plurality of redundant industrial equipment fault triplets are merged; using context correlation analysis, the semantic disambiguation of the industrial equipment fault triplets is performed, and the fused industrial equipment fault triplets are obtained; the entities describing similar or the same fault are entities with a Jaccard coefficient greater than a set threshold.
[0019] Further, the industrial equipment fault knowledge graph is linked to the ChatGLM3-6B large language model, and the ChatGLM3-6B large language model is trained to obtain a trained ChatGLM3-6B large language model, specifically including the following steps:
[0020] B1: using Langchain technology to link the industrial equipment fault knowledge graph existing in the Neo4j graph database to the ChatGLM3-6B large language model;
[0021] B2: design a special prompt template and train the ChatGLM3-6B large language model using the special prompt template to obtain a trained ChatGLM3-6B large language model; the trained ChatGLM3-6B large language model is used to parse a natural language question input by a user into a structured Cypher query statement and execute the structured Cypher query statement to obtain a query result;
[0022] The special prompt template includes system role information, data type introduction, task description, output template, and task example;
[0023] For different types of fault query problems, corresponding output templates are designed, and after parsing the user input question, the most suitable output template is matched to generate the corresponding Cypher query statement; specifically, a keyword-output template mapping table is established using a conditional trigger type template matching mechanism, and each keyword triggers a different output template.
[0024] Further, the trained ChatGLM3-6B large language model and the pre-trained Text2Vec model are combined to construct an industrial equipment fault question and answer large language model fused with a knowledge graph, and the industrial equipment fault question and answer large language model fused with the knowledge graph is used to generate a final answer according to the natural language question input by the user, specifically including the following steps:
[0025] C1: using the trained ChatGLM3-6B large language model to generate a Cypher query statement according to the natural language question input by the user, using a Py2neo tool to execute the query in a Neo4j graph database to obtain a query result;
[0026] C2: using the pre-trained Text2Vec model to vectorize the natural language question input by the user, calculating the cosine similarity with the knowledge text in the preset knowledge base to realize semantic matching to obtain a retrieval result;
[0027] C3: using an attention mechanism to weight and integrate the retrieval result obtained by the Text2Vec model and the query result obtained by the ChatGLM3-6B large language model, then using convolution operation to fuse and optimize to obtain a structured result, then converting the structured result into a natural language response through a prompt template to obtain a final fault question and answer response output, i.e., the final answer.
[0028] On the other hand, the application also provides a knowledge graph driven industrial equipment fault diagnosis question and answer system for realizing a knowledge graph driven industrial equipment fault diagnosis question and answer method, including a front end and a back end;
[0029] The front end is a visual interactive interface for a user to input a natural language question and serve as an input of the back end, and display a final answer generated by the back end.
[0030] The back end is configured to generate a final answer according to a natural language question input by a user and send the final answer to the front end.
[0031] Further, the back end comprises a question analysis module, a knowledge base retrieval module, a graph retrieval module and an answer generation module.
[0032] The question analysis module is configured to call a pre-trained ChatGLM3-6B model, combine a special prompt template and perform semantic depth analysis on a natural language question input by a user to generate a Cypher query statement, and call a Text2Vec model to vectorize the natural language question input by the user to obtain a vector representation of the question.
[0033] The knowledge base retrieval module calls the Text2Vec model to vectorize knowledge texts in a preset knowledge base to obtain a vector representation of the knowledge texts, calculates a cosine similarity between the vector representation of the question and the vector representation of the knowledge texts, performs Top-K similarity retrieval to obtain a retrieval result.
[0034] The graph retrieval module is configured to perform a query in an industrial equipment fault knowledge graph of a Neo4j graph database by using a Py2neo tool according to the Cypher query statement to obtain a query result.
[0035] The answer generation module adopts an attention mechanism to weight the retrieval result and the query result according to a confidence level, performs fusion optimization by using a convolution operation to obtain a structured result, converts the structured result into a natural language response by using a prompt template to obtain a final answer.
[0036] Further, the knowledge graph driven industrial equipment fault diagnosis question and answer system further comprises a visualization module configured to display an industrial equipment fault knowledge graph in the Neo4j graph database in real time.
[0037] In a third aspect, the present application provides an electronic device, comprising one or more processors and a memory, wherein the memory is configured to store instructions, and when the instructions are executed by the one or more processors, the one or more processors are caused to execute the knowledge graph driven industrial equipment fault diagnosis question and answer method.
[0038] In a fourth aspect, the present application provides a computer readable storage medium, which stores executable instructions, and when the instructions are executed, the processor executes the knowledge graph driven industrial equipment fault diagnosis question and answer method.
[0039] In a fifth aspect, the present application provides a computer program product comprising a computer program or instructions, which, when executed by a processor, implement the knowledge graph driven industrial equipment fault diagnosis question and answer method.
[0040] Compared with the prior art, the present application has the following advantages:
[0041] The method of the present application aims at the problem of insufficient representation of industrial equipment fault knowledge at present, proposes a method of extracting industrial equipment fault knowledge using a BERT-BiLSTM-CRF hybrid model, solves the problems of industrial equipment fault entity recognition and complex relationship extraction, proposes a construction method of an industrial equipment fault question and answer large language model fused with a knowledge graph, links the knowledge base constructed based on the knowledge graph to the LLM by using Langchain technology, solves the problem of professionalization of LLM in the vertical field, then based on the prompt template fine-tuning model fused with the blast furnace fault knowledge graph, enables the model to generate accurate Cypher query statements to retrieve in the knowledge graph, solves the problem of lack of explainability of LLM. In addition, in view of the problem of lack of industrial equipment fault intelligent question and answer system, a fault question and answer system is built; the blast furnace fault knowledge question and answer service system built based on Python, Flask and Neo4j technology supports natural language interactive query and can realize retrieval and query of related equipment faults of the blast furnace system, providing a convenient and efficient human-computer interaction way for safety management personnel to obtain related fault information. BRIEF DESCRIPTION OF DRAWINGS
[0042] Figure 1 is a flowchart of a knowledge graph driven industrial equipment fault diagnosis question and answer method in the present embodiment;
[0043] Figure 2 is a flowchart of the construction of an industrial equipment fault knowledge graph in the present embodiment;
[0044] Figure 3 is an example graph of a knowledge graph in the present embodiment;
[0045] Figure 4 is an example of the query effect of the model after prompting in the present embodiment;
[0046] Figure 5 is an example of an output template in the present embodiment;
[0047] Figure 6 is a test flowchart of a knowledge graph driven industrial equipment fault diagnosis large language model in the present embodiment;
[0048] Figure 7is a structural diagram of an industrial equipment fault diagnosis large language model in an embodiment of the present application. DETAILED DESCRIPTION
[0049] The present application will be described in detail below in conjunction with the drawings and embodiments.
[0050] Embodiment 1:
[0051] The present application proposes a knowledge graph driven industrial equipment fault diagnosis question and answer method and system, the core idea of which is to use deep learning, natural language processing and graph database technology to automatically extract, structure and store the scattered fault information in the industrial equipment fault diagnosis system, and realize intelligent question and answer of fault information through a large language model.
[0052] The method of the present application proposes a knowledge graph driven industrial equipment fault diagnosis question and answer method, which innovatively combines structured knowledge reasoning and semantic understanding ability, and realizes the precision and intelligence of industrial equipment fault diagnosis through hybrid knowledge extraction, knowledge enhancement modeling and dynamic fusion mechanism. The method uses a BERT-BiLSTM-CRF three-stage model to construct an industrial equipment fault intelligent diagnosis field knowledge graph, and deeply integrates the semantic generation ability of ChatGLM-6B large language model, effectively solving the problems of knowledge fragmentation and diagnosis response lag in industrial scenarios, and breaking through the bottleneck of knowledge illusion and reasoning deficiency of large language models in professional fields. The method of the present application realizes the deep decoupling and efficient use of industrial equipment fault knowledge through hierarchical architecture design.
[0053] In the knowledge extraction stage, the BERT pre-training model is used to perform 768-dimensional semantic coding on the industrial equipment fault intelligent diagnosis field text, and the BiLSTM bidirectional gate mechanism is used to capture long-distance context dependence, and finally the sequence labeling constraint of the CRF layer is used to complete the joint extraction of four types of entities (fault type, phenomenon, reason, and preventive measures) and five types of relationships (performance / cause / corresponding measures, etc.). In the knowledge fusion stage, an entity disambiguation algorithm is constructed based on cosine similarity and Jaccard coefficient, redundant expressions in multi-source heterogeneous data are normalized into 1067 standardized entity nodes, and a high-quality knowledge graph containing 1249 semantic associations is formed, providing a structured knowledge base for subsequent intelligent question and answer.
[0054] The method innovatively constructs a knowledge-enhanced large language model architecture. The Langchain framework is used to vectorize and embed the knowledge graph into the ChatGLM-6B model, a five-layer prompt engineering system including role definition, data type, task description, rule template and task example is designed to guide the model to generate Cypher query statements conforming to the Neo4j specification. In addition, the method adopts a double-path retrieval mechanism, realizes semantic retrieval of the knowledge base based on the vector similarity matching of the Text2Vec model (text2vec-large-chinese model), combines the Cypher statement to accurately locate the structured reasoning path in the graph, and finally generates a composite answer through confidence weighted fusion and instruction fine-tuning of the GLM model.
[0055] A knowledge graph driven industrial equipment fault diagnosis question and answer method, as shown in Figure 1 , comprising the following steps:
[0056] Step 1: Obtain industrial equipment fault records, and construct an industrial equipment fault knowledge graph based on the industrial equipment fault records;
[0057] As shown in Figure 2 , specifically comprising:
[0058] Step 1.1: Obtain a plurality of industrial equipment fault records; the industrial equipment fault records are texts recording industrial equipment fault conditions;
[0059] The multi-source heterogeneous industrial equipment fault records obtained in this embodiment include industrial equipment fault records collected from PDF format maintenance case texts of actual industrial equipment, related technical literature, process documents and Internet public data (such as fault papers on platforms such as CNKI and fault explanations on various websites); since there are two cases of unstructured and semi-structured data formats, the method uses OCR recognition technology to extract text from PDF documents, and uses Python crawler program to automatically collect literature and web data.
[0060] Step 1.2: Text segmentation and data cleaning are performed on the industrial equipment fault records to obtain preprocessed industrial equipment fault records;
[0061] In this embodiment, the segmentation and data cleaning technology is used to eliminate noise and redundant data, and the content of the industrial equipment fault records is standardized and structured; about 4000 industrial equipment fault records are obtained, and these industrial equipment fault records are used as the basic data set for subsequent knowledge extraction and graph construction.
[0062] Step 1.3: Construct and train a BERT-BiLSTM-CRF hybrid model, and use the trained BERT-BiLSTM-CRF hybrid model to extract industrial equipment failure triples from the preprocessed industrial equipment failure records; the format of the industrial equipment failure triples is <entity, relationship, entity>, which is used to represent the failure domain knowledge of industrial equipment, such as (bearing, has_fault_mode, wear);
[0063] The BERT-BiLSTM-CRF hybrid model includes a BERT model, a bidirectional long short-term memory network, and a conditional random field CRF connected in sequence; wherein the BERT model uses Chinese pre-training weights and outputs 768-dimensional semantic vectors; the bidirectional long short-term memory network BiLSTM sets 128 hidden units and uses a bidirectional gating mechanism to capture context features; the conditional random field CRF defines a BIO tagging system and optimizes the consistency of the annotated sequence through an algorithm;
[0064] Specifically: use the pre-trained BERT model as an encoder to vector encode the preprocessed industrial equipment failure records, and convert the characters, words, and sentence structures in them into high-dimensional vector representations to ensure semantic capture of professional terms and complex contexts; then, input the high-dimensional vector representation generated by BERT into the bidirectional long short-term memory network BiLSTM, and model the industrial equipment failure records in both forward and reverse directions to extract more detailed feature sequences. Finally, use the conditional random field CRF to jointly decode the feature sequences output by BiLSTM to realize the sequence labeling of entities and relationships in the industrial equipment failure triples <entity, relationship, entity>, and thus extract accurate industrial equipment failure triples. This process is equivalent to multi-dimensional decoupling and feature extraction of "spatial information and semantic relationship" on the original failure data; the BERT-BiLSTM-CRF hybrid model can automatically identify device names, failure phenomena, failure causes, maintenance measures and other key information, and label the relationships between them, and thus complete the identification of four types of entities: failure type, phenomenon, cause and preventive measures, and the extraction of "performance / cause / countermeasure" relationships;
[0065] Step 1.4: Based on the extracted industrial equipment failure triples, use a knowledge fusion method to solve the problem that the same failure may have differences in description in different data sources, eliminate redundancy and ambiguity, obtain fused industrial equipment failure triples and store them in a Neo4j graph database, and at the same time construct an industrial equipment failure knowledge graph based on the fused industrial equipment failure triples; the points in the industrial equipment failure knowledge graph represent an entity, and the edges between the nodes represent the relationships between the entities;
[0066] Specifically, first, the embedding vectors of each entity in the industrial equipment fault triplets are generated using a graph neural network, the cosine similarity between the embedding vectors of each two entities is calculated, for each entity, the M entities with the largest cosine similarity are selected to form a similar entity set, and each entity and one entity in its corresponding similar entity set form a candidate pair, and then a candidate pair set consisting of a plurality of candidate pairs is obtained, then the Jaccard coefficient is calculated based on the candidate pair set, the entities describing similar or identical faults are fused according to the Jaccard coefficient, and the multiple redundant industrial equipment fault triples are merged to ensure that the same entities and relationships are uniformly represented in structure; the context association analysis is used to perform semantic disambiguation on the fault causes, maintenance measures and other information to ensure that each industrial equipment fault triplet has internal logical consistency, and the fused industrial equipment fault triplets are obtained; finally, the fused industrial equipment fault triplets are stored in the Neo4j graph database, and a structured industrial equipment fault knowledge graph is constructed. The Neo4j graph database precisely encodes the association relationship between nodes and edges, so that the industrial equipment fault information in the graph presents a clear and traceable structure; finally, a knowledge graph containing 1067 entity nodes and 1249 association relationships is constructed.
[0067] As shown in Figure 3 The following is an example of a blast furnace equipment fault knowledge graph. In the blast furnace equipment fault graph, structured knowledge is extracted from fault maintenance cases, related literature and web page data on the Internet, heterogeneous data sources such as blast furnace system field manuals, fault maintenance cases, related literature and web page data on the Internet, sensor time series data (temperature, pressure, airflow) are integrated, entity-relation extraction is performed through BERT-BiLSTM-CRF (such as "abnormal silicon content in molten iron → may cause → furnace condition fluctuation"), a domain knowledge graph covering equipment structure, process parameters and fault chains is constructed, each node of a different color represents a fault-related entity (such as "coal feeder", "blower", "superheater", etc.), and the edges between the nodes represent the semantic relationships between the entities (such as "cause", "due to", "show", etc.).
[0068] Step 2: Link the industrial equipment fault knowledge graph to the ChatGLM3-6B large language model and train the ChatGLM3-6B large language model to obtain the trained ChatGLM3-6B large language model;
[0069] Step 2.1: Use Langchain technology to link the industrial equipment fault knowledge graph existing in the Neo4j graph database to the ChatGLM3-6B large language model;
[0070] Step 2.2: design a special prompt template and train the ChatGLM3-6B large language model using the special prompt template to obtain a trained ChatGLM3-6B large language model; the trained ChatGLM3-6B large language model is used to parse a natural language question input by a user into a structured Cypher query statement and execute the structured Cypher query statement to obtain a query result;
[0071] The special prompt template includes system role information, data type introduction, task description, output template, and task example.
[0072] In this embodiment, the system role information is set as: clearly stating that "you are a Neo4j Cypher query statement expert, responsible for generating accurate Cypher query statements according to user questions".
[0073] The data type introduction provides all entities and relationships in the industrial equipment fault knowledge graph to the ChatGLM3-6B large language model, which covers the naming specification and semantic explanation of each entity category.
[0074] The task description requires the ChatGLM3-6B large language model to complete two tasks: first, extract entities and relationships from the natural language question input by the user, and generate a Cypher query statement according to the extracted entities and relationships based on the pre-set output template, as shown in Figure 4 Then, execute the Cypher query statement to find similar answers with higher similarity from the industrial equipment fault knowledge graph in the Neo4j graph database for output to obtain the query result; if there is no related content in the Neo4j graph database, answer "I don't know", which to some extent controls the imagination of ChatGLM in non-professional fields and outputs a relatively professional language style.
[0075] For different types of fault query problems, corresponding output templates are designed, and after parsing the user input question, the most suitable output template is matched to generate the corresponding Cypher query statement; specifically, a conditional trigger type template matching mechanism is adopted, a keyword-output template mapping table is established, the fault phenomenon query template is triggered when the input question contains "performance", the causal relationship reasoning template is activated when the "cause" keyword is detected, and the countermeasure generation template is called when the "prevention" term is recognized, realizing the precise construction of the query statement, and the output template is as shown in Figure 5 .
[0076] The task example guides the large language model to generate results according to the user's query statement, so that the model can clearly understand its task category, i.e., extracting key data from the information in the user's question and converting it into a concise and clear answer.
[0077] In the model training process of the embodiment, a prompt engineering strategy is used to select appropriate keywords, map the output template of the ChatGLM3-6B large language model with the keywords, so that the ChatGLM3-6B large language model can retain deep semantic understanding ability and also have the accuracy of structured retrieval when answering fault questions and answers; in addition, in order to balance the inference accuracy and response speed of the ChatGLM3-6B large language model in the fault scene, the present application uses L1 loss for pixel-level refinement correction in the training process, and combines the optimizer to dynamically adjust the learning rate, reduces the parameter update ratio every certain period, and the ChatGLM3-6B large language model can still capture subtle fault characteristics in the high-dimensional data complex scene, reduce false positives and omissions, and achieve high-precision question and answer effect.
[0078] Step 3: combine the trained ChatGLM3-6B large language model with the pre-trained Text2Vec model to construct an industrial equipment fault question and answer large language model fused with a knowledge graph, and use the industrial equipment fault question and answer large language model fused with the knowledge graph to generate a final answer according to the user input natural language question sentence;
[0079] Step 3.1: use the trained ChatGLM3-6B large language model to generate a Cypher query statement according to the user input natural language question sentence, use the Py2neo tool to execute the query in the Neo4j graph database, and obtain the query result;
[0080] Step 3.2: use the pre-trained Text2Vec model to vectorize the user input natural language question sentence, calculate the cosine similarity with the knowledge text in the preset knowledge base to realize semantic matching, and obtain the retrieval result;
[0081] Step 3.3: with the technical idea similar to pixel rearrangement, that is, using an attention mechanism to weight and integrate the retrieval result obtained by the Text2Vec model and the query result obtained by the ChatGLM3-6B large language model, then using convolution operation for fusion optimization to obtain structured results, and then converting the structured results into natural language responses through a prompt template, so as to obtain the final fault question and answer response output, that is, the final answer;
[0082] The method of the present application proposes a hybrid knowledge extraction model based on BERT-BiLSTM-CRF, which effectively solves the recognition problem of complex entities and relationships in the field of intelligent diagnosis of industrial equipment failure by fusing the deep semantic representation of BERT, the context dependence modeling of BiLSTM and the sequence labeling constraint of CRF. Compared with traditional methods, the F1 value is improved to 73.68%, supporting accurate extraction of four types of entities and five types of relationships from unstructured maintenance cases, literature and web data, and constructing a high-quality knowledge graph containing 1067 entity nodes and 1249 association edges.
[0083] The method of the present application deeply fuses the knowledge graph and the ChatGLM-6B large language model through the Langchain framework, designs a fine-tuning strategy based on prompt engineering, and guides the model to generate standardized Cypher query statements. Combined with the structured reasoning path of the knowledge graph and the semantic generation ability of the large language model, the "hallucination problem" and the reasoning missing defect of the large model are significantly alleviated. Experiments show that the knowledge graph integrated question and answer model has an accuracy of 83% in the fault question and answer task, which is more than 15% higher than the pure large language model (ChatGPT3.5, Ernie).
[0084] The method of the present application adopts a dual-path retrieval mode of knowledge base and knowledge graph, matches the knowledge base content through vector similarity calculation, and simultaneously uses Cypher query to accurately locate the structured knowledge in the graph. The answer generation module integrates the two retrieval results, generates professional answers combined with the semantic integration ability of the large language model, supports multi-dimensional association analysis of fault type, reason, phenomenon and preventive measures, and significantly improves the explainability and reliability of the answers.
[0085] To verify the performance of the model, a knowledge graph question and answer data set is designed for testing. A semi-automatic method is used to generate initial question and answer pairs through a large language model as shown in Figure 6 After expert verification, a multi-dimensional question and answer data set containing fault type, phenomenon, reason and preventive measures is formed. Through the Text2Vec model, the problem and the knowledge text are vectorized, the cosine similarity is calculated to realize semantic matching, and finally the knowledge graph retrieval result and the vector library matching content are fused to generate natural language answers. This method innovatively constrains the model output logic through the prompt template, combined with a dynamic knowledge retrieval mechanism, so that the model can accurately call the domain knowledge base while maintaining the general semantic understanding ability, effectively solving the knowledge hallucination problem of large language models in vertical fields. Experiments show that the usability of the generated Cypher query statement is 90.28%, and the professional question and answer accuracy is improved by 15% compared with the pure language model, providing an explainable and highly reliable intelligent interaction scheme for industrial fault diagnosis.
[0086] Example 2:
[0087] The application discloses a knowledge graph driven industrial equipment fault diagnosis question and answer system. Figure 7 As shown in the figure, a hierarchical design is adopted, including a front end and a back end.
[0088] The front end is a visual interactive interface developed based on a Bootstrap framework, which is used for inputting a natural language question (such as "what are the fault phenomena of a coal mill?") by a user and serving as an input of the back end, and displaying a final answer generated by the back end.
[0089] The back end is a distributed service engine built on the basis of a Flask framework, which realizes data communication through an API, and is used for generating a final answer and sending the final answer to the front end according to a natural language question input by a user.
[0090] The back end comprises a question analysis module, a knowledge base retrieval module, a graph retrieval module and an answer generation module.
[0091] The question analysis module is used for calling a pre-trained ChatGLM3-6B model, combining a special prompt template, performing semantic depth analysis on a natural language question input by a user, and generating a Cypher query statement (such as "MATCH (n: fault type {name: 'coal mill fault'})-[:performance]->(m: fault phenomenon) RETURN m.name"); and calling a Text2Vec model to vectorize the natural language question input by the user, and obtaining a vector representation of the question.
[0092] The knowledge base retrieval module calls the Text2Vec model to vectorize knowledge texts in a preset knowledge base, obtains a vector representation of the knowledge texts, calculates a cosine similarity between the vector representation of the question and the vector representation of the knowledge texts, performs Top-K similar retrieval, and obtains a retrieval result (a text segment).
[0093] The graph retrieval module is used for performing a query in an industrial equipment fault knowledge graph of a Neo4j graph database by using a Py2neo tool according to the Cypher query statement, and obtaining a query result.
[0094] The answer generation module adopts an attention mechanism to weight the retrieval result and the query result, eliminates redundant information, and then utilizes convolution operation to fuse and optimize the results, obtains a structured result, and then converts the structured result into a natural language response (such as "the fault phenomena of a coal mill include pipe blockage, coal powder leakage and bearing overheating") by using a prompt template, and obtains a final answer.
[0095] The knowledge graph driven industrial equipment fault diagnosis question and answer system further comprises a visualization module for real-time display of the industrial equipment fault knowledge graph in the Neo4j graph database.
[0096] The system innovatively introduces a real-time performance optimization strategy, adopts a cache mechanism to store high-frequency query results in the knowledge retrieval stage, reduces the access delay of the graph database, and the average response time is shortened to 1.2 seconds; meanwhile, an abnormality detection loop is designed, which automatically triggers a rollback mechanism when a Cypher statement execution error occurs, calls a backup rule engine for secondary analysis, and supports dynamic knowledge expansion.
[0097] The application constructs a lightweight service system through modular design, realizes a closed-loop process including natural language input, question analysis, knowledge retrieval and answer generation based on the Flask framework, and uses a data processing server configured with an NVIDIA RTX 4060 GPU and an Intel i7-13700H CPU to be responsible for model training and reasoning; in combination with the SSD storage optimization of the Neo4j graph database, the query throughput is 1200 times per second, and the average response time is compressed to less than 2 seconds; the visualization module displays the dynamic node relationship, makes the fault diagnosis process transparent, and supports real-time access of the mobile terminal; the edge computing terminal integrates an HTML5 interactive interface and supports mobile terminal access in the factory field. Efficient interface protocols are used between the modules of the system to realize efficient transmission of data and information, thereby greatly shortening the question and answer response time and improving the overall service quality.
[0098] Embodiment 3
[0099] The embodiment provides an electronic device, comprising one or more processors and a memory, the memory being configured to store instructions that, when executed by the one or more processors, cause the one or more processors to perform the knowledge graph driven industrial equipment fault diagnosis question and answer method.
[0100] The electronic device can be a mobile phone, a computer or a tablet computer, and the like, comprising a memory and a processor, and the memory stores a computer program, which is executed by the processor to implement the knowledge graph driven industrial equipment fault diagnosis question and answer method as described in the embodiment. It can be understood that the electronic device can further comprise an input / output (I / O) interface and a communication component.
[0101] The processor is configured to execute all or part of the steps of the knowledge graph driven industrial equipment fault diagnosis question and answer method as described in the above embodiment. The memory is configured to store various types of data, which can include, for example, instructions of any application program or method in the electronic device, and application program related data.
[0102] The processor can be an Application Specific Integrated Cricuit (ASIC), a Digital Signal Processor (DSP), a Programmable Logic Device (PLD), a Field Programmable Gate Array (FPGA), a controller, a microcontroller, a microprocessor, or other electronic elements, which are used to execute the knowledge graph driven industrial equipment fault diagnosis question and answer method described in the above embodiments.
[0103] Embodiment 4:
[0104] The embodiment provides a computer readable storage medium storing executable instructions, which, when executed, can be stored in one computer readable storage medium if implemented in the form of a software function unit and sold or used as an independent product.
[0105] The computer software product is stored in a storage medium and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the knowledge graph driven industrial equipment fault diagnosis question and answer method described in various embodiments of the present application.
[0106] The aforementioned storage medium includes a flash memory, a hard disk, a multimedia card, a card-type memory (for example, an SD (Secure Digital Memory Card) or a DX (an abbreviation of Memory Data Register, MDR) memory, etc.), a random access memory (RAM), a static random access memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, a server, an APP (an abbreviation of Application) application store, and the like, which can store a program check code, and stores a computer program thereon, the computer program being executed by a processor to implement each step of the knowledge graph driven industrial equipment fault diagnosis question and answer method described above.
[0107] Embodiment 5:
[0108] The embodiment provides a computer program product, including a computer program or instructions, which are executed by a processor to implement the knowledge graph driven industrial equipment fault diagnosis question and answer method.
[0109] Based on such understanding, the technical solution of the present application can be embodied in the form of a computer program product, essentially or in the part that contributes to the prior art.
[0110] Each embodiment in the present application is described in a progressive manner, and the same or similar parts between each embodiment can be referred to each other. Each embodiment mainly describes the difference from other embodiments.
[0111] The scope of protection of the present application is not limited to the above-described embodiments. Obviously, those skilled in the art can make various modifications and changes to the present disclosure without departing from the scope and spirit of the present disclosure. If these modifications and changes belong to the scope of the present disclosure and its equivalent technology, the present disclosure also includes these modifications and changes.
Claims
1. A knowledge graph-driven question-and-answer method for fault diagnosis of industrial equipment, characterized in that, Includes the following steps: Acquire industrial equipment fault records and construct an industrial equipment fault knowledge graph based on these records; The knowledge graph of industrial equipment faults is linked to the ChatGLM3-6B large language model, and the ChatGLM3-6B large language model is trained to obtain the trained ChatGLM3-6B large language model. The trained ChatGLM3-6B large language model is combined with the pre-trained Text2Vec model to construct a knowledge graph-integrated industrial equipment fault question-answering large language model. The final answer is generated based on the natural language question input by the user using the knowledge graph-integrated industrial equipment fault question-answering large language model.
2. The knowledge graph-driven question-and-answer method for industrial equipment fault diagnosis according to claim 1, characterized in that, The process of acquiring industrial equipment fault records and constructing an industrial equipment fault knowledge graph based on these records specifically includes the following steps: A1: Obtain several industrial equipment fault records; the industrial equipment fault records are texts that record the fault conditions of industrial equipment. A2: Perform text segmentation and data cleaning on the industrial equipment fault records to obtain preprocessed industrial equipment fault records; A3: Construct and train a BERT-BiLSTM-CRF hybrid model, and use the trained BERT-BiLSTM-CRF hybrid model to extract industrial equipment fault triples from the preprocessed industrial equipment fault records; the format of the industrial equipment fault triples is <entity, relation, entity>, which is used to represent the fault domain knowledge of industrial equipment. The BERT-BiLSTM-CRF hybrid model comprises a BERT model, a bidirectional long short-term memory network, and a conditional random field (CRF) connected in sequence. A4: Based on the extracted industrial equipment fault triples, a knowledge fusion method is used to eliminate redundancy and ambiguity in the industrial equipment fault triples, resulting in fused industrial equipment fault triples, which are stored in the Neo4j graph database. At the same time, an industrial equipment fault knowledge graph is constructed based on the fused industrial equipment fault triples; in the industrial equipment fault knowledge graph, a point represents an entity, and the edges between nodes represent the relationships between entities.
3. The knowledge graph-driven question-and-answer method for industrial equipment fault diagnosis according to claim 2, characterized in that, The method of extracting industrial equipment fault triples from preprocessed industrial equipment fault records using a trained BERT-BiLSTM-CRF hybrid model involves the following steps: First, a pre-trained BERT model is used as an encoder to vectorize the preprocessed industrial equipment fault records, converting characters, words, and sentence structures into high-dimensional vector representations. Next, the high-dimensional vector representations generated by the BERT model are input into a bidirectional long short-term memory (BiLSTM) network to perform contextual modeling of the industrial equipment fault records in both forward and reverse directions, thereby extracting feature sequences. Finally, a conditional random field (CRF) is used to jointly decode the feature sequences output by the BiLSTM, achieving sequence labeling of entities and relations in the industrial equipment fault triple <entity, relation, entity>, thus extracting accurate industrial equipment fault triples.
4. The knowledge graph-driven question-and-answer method for industrial equipment fault diagnosis according to claim 2, characterized in that, The knowledge fusion method is as follows: First, a graph neural network is used to generate the embedding vector of each entity in the industrial equipment fault triplet. The cosine similarity between the embedding vectors of every two entities is calculated. For each entity, M entities with the highest cosine similarity are selected to form a similar entity set. Each entity and one entity in its corresponding similar entity set are combined to form a candidate pair, thus obtaining a candidate pair set. Then, the Jaccard coefficient is calculated based on the candidate pair set. Entities describing similar or the same fault are fused according to the Jaccard coefficient, and multiple redundant industrial equipment fault triplets are merged. Context association analysis is used to perform semantic disambiguation on the industrial equipment fault triplets to obtain the fused industrial equipment fault triplets. The entities describing similar or the same fault are entities with a Jaccard coefficient greater than a set threshold.
5. The knowledge graph-driven question-and-answer method for industrial equipment fault diagnosis according to claim 1, characterized in that, The process of linking the industrial equipment fault knowledge graph to the ChatGLM3-6B large language model and training the ChatGLM3-6B large language model to obtain the trained ChatGLM3-6B large language model includes the following steps: B1: Using Langchain technology, the industrial equipment fault knowledge graph existing in the Neo4j graph database is linked to the ChatGLM3-6B large language model; B2: Design a dedicated prompt template and use the dedicated prompt template to train the ChatGLM3-6B large language model to obtain a trained ChatGLM3-6B large language model; the trained ChatGLM3-6B large language model is used to parse the natural language questions input by the user into structured Cypher query statements, and execute the structured Cypher query statements to obtain query results; The dedicated prompt template includes system role information, data type description, task description, output template, and task example; For different types of fault query questions, corresponding output templates were designed. After parsing the user's input question, the most suitable output template was matched to generate the corresponding Cypher query statement. Specifically, a condition-triggered template matching mechanism was adopted to establish a keyword-output template mapping table, and each keyword triggered a different output template.
6. The knowledge graph-driven question-and-answer method for industrial equipment fault diagnosis according to claim 1, characterized in that, The process involves combining the trained ChatGLM3-6B large language model with the pre-trained Text2Vec model to construct a knowledge graph-integrated industrial equipment fault question-answering large language model. This model then generates the final answer based on the user's input natural language question. The specific steps include: C1: Using the trained ChatGLM3-6B large language model, generate Cypher query statements based on the natural language questions input by the user, and use the Py2neo tool to execute the query in the Neo4j graph database to obtain the query results; C2: The pre-trained Text2Vec model is used to vectorize the natural language questions input by the user, and the cosine similarity with the knowledge text in the preset knowledge base is calculated to achieve semantic matching and obtain the retrieval results; C3: An attention mechanism is used to integrate the retrieval results obtained from the Text2Vec model and the query results obtained from the ChatGLM3-6B large language model with confidence weighting. Then, convolution operation is used for fusion optimization to obtain a structured result. Finally, the structured result is converted into a natural language response through a prompt template to obtain the final fault question and answer response output, i.e., the final answer.
7. A knowledge graph-driven question-and-answer system for industrial equipment fault diagnosis, used to implement the knowledge graph-driven question-and-answer method for industrial equipment fault diagnosis as described in any one of claims 1-6, characterized in that, Including front-end and back-end; The front end is a visual interactive interface, used by users to input natural language questions as input to the back end, and the final answer generated by the back end is displayed. The backend is used to generate the final answer based on the user's input of a natural language question and send it to the frontend.
8. The knowledge graph-driven industrial equipment fault diagnosis question-and-answer system according to claim 7, characterized in that, The backend includes a question parsing module, a knowledge base retrieval module, a graph retrieval module, and an answer generation module; The question parsing module is used to call the pre-trained ChatGLM3-6B model, and combine it with a dedicated prompt template to perform semantic deep parsing on the natural language questions input by the user, generating Cypher query statements; at the same time, it calls the Text2Vec model to vectorize the natural language questions input by the user, and obtain the vector representation of the questions; The knowledge base retrieval module calls the Text2Vec model to vectorize the knowledge text in the preset knowledge base, obtain the vector representation of the knowledge text, calculate the cosine similarity between the vector representation of the question and the vector representation of the knowledge text, perform Top-K similarity retrieval, and obtain the retrieval results. The graph retrieval module is used to perform a query in the industrial equipment fault knowledge graph of the Neo4j graph database using the Py2neo tool based on the Cypher query statement, and obtain the query results. The answer generation module uses an attention mechanism to weight the search results and query results with confidence, and then uses convolution operations to fuse and optimize them to obtain a structured result. Finally, the structured result is converted into a natural language response through a prompt template to obtain the final answer.
9. A knowledge graph-driven question-and-answer system for industrial equipment fault diagnosis according to claim 7, characterized in that, The knowledge graph-driven industrial equipment fault diagnosis question-and-answer system also includes a visualization module for real-time display of the industrial equipment fault knowledge graph in the Neo4j graph database.
10. An electronic device, characterized in that, include: One or more processors, and a memory for storing instructions that, when executed by the one or more processors, cause the one or more processors to perform a knowledge graph-driven question-and-answer method for industrial equipment fault diagnosis as described in any one of claims 1-6.
Citation Information
Patent Citations
Knowledge graph construction method based on multi-source entity fusion
CN106250412A
Knowledge graph question and answer method and system based on power grid hidden danger troubleshooting scene
CN116010581A