A knowledge graph multi-hop question answering method fusing a large model and a graph convolution network
Patent Information
- Application Number
- CN202610943983.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-29
- Publication Date
- 2026-09-11
- Estimated Expiration
- 2046-06-29
AI Technical Summary
[0006]本发明提供一种融合大模型与图卷积网络的知识图谱多跳问答方法,以至少解决现有技术中难以理解自然语言描述中并发关系与潜在因果逻辑,返回的文档往往相关度低、信息碎片化,工程师需要人工筛选和拼凑,效率低下的问题
本申请提供的一种融合大模型与图卷积网络的知识图谱多跳问答方法中,利用预训练的多阶段Transformer大模型对包含设备故障描述的自然语言问题进行深度语义解析,精准抽取出核心故障实体和潜在故障关系,解决了传统故障排查系统对现场工程师的问题描述理解肤浅、容易遗漏关键设备实体或并发症状关联的问题,使得系统能够像经验丰富的维修专家一样,深入理解故障描述背后的复合语义和隐含的逻辑链条,为后续在庞大的设备知识图谱中进行精准检索和推理提供了清晰、结构化的起点,从源头上避免了因问题理解偏差导致的排查方向错误,提升了智能诊断辅助的可靠性。
Smart Images

Figure CN122452794B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of equipment fault diagnosis technology, and in particular relates to a knowledge graph multi-hop question answering method that integrates large models and graph convolutional networks. Background Technology
[0002] With the increasing demand for digital transformation and intelligent operation and maintenance in industry, troubleshooting equipment systems has become a crucial link in ensuring production safety and efficiency. Modern industrial equipment is highly integrated and has complex mechanisms; its fault diagnosis often relies on engineers consulting massive amounts of structured and unstructured knowledge scattered across various manuals, drawings, historical work orders, and case libraries. When field engineers are faced with a description containing multiple concurrent phenomena, they need to quickly and accurately connect equipment components, failure modes, possible causes, and standard maintenance procedures within this vast knowledge system, performing multi-step logical reasoning to formulate effective troubleshooting recommendations. This process places extremely high demands on the intelligence level of information retrieval and reasoning.
[0003] To address the challenges of intelligent troubleshooting of equipment faults, existing technologies primarily rely on traditional knowledge base systems that use keyword retrieval. Engineers input keywords related to the fault symptoms, and the system matches these keywords against a full-text database of maintenance manuals, returning a list of relevant documents.
[0004] However, existing keyword-based retrieval systems struggle to understand concurrent relationships and potential causal logic in natural language descriptions. The returned documents are often of low relevance and fragmented information, requiring engineers to manually filter and piece them together, resulting in low efficiency.
[0005] Therefore, this invention provides a multi-hop question answering method for knowledge graphs that integrates large models and graph convolutional networks. Summary of the Invention
[0006] This invention provides a knowledge graph multi-hop question answering method that integrates large models and graph convolutional networks, in order to at least solve the problems in existing technologies that make it difficult to understand concurrent relationships and potential causal logic in natural language descriptions, and that the returned documents are often of low relevance and fragmented information, requiring engineers to manually screen and piece them together, resulting in low efficiency.
[0007] This application provides a multi-hop question answering method for knowledge graphs that integrates large models and graph convolutional networks. The method includes the following steps: Step S1: Receive a natural language question containing a description of the equipment fault. Perform semantic parsing on the question using a pre-trained multi-stage Transformer model to obtain deep semantic reasoning features. Generate a hierarchical semantic embedding vector for the question based on these deep semantic reasoning features. Feature embedding vector of core fault entity Embedding vectors related to potential faults ; Step S2: Based on the hierarchical semantic embedding vector of the question Feature embedding vector of core fault entity Embedding vectors related to potential faults Candidate maintenance step entities are generated through a constrained decoder of a multi-stage Transformer large model, and the candidate maintenance step entities are scored using a semantic-structural dual relevance scoring function to select the top-performing maintenance steps. The high-scoring candidate repair step entities constitute the initial candidate answer set; Step S3: The initial candidate answer set is used as the initial node and input into the pre-trained RE-MGCN relation enhancement graph convolutional network to perform graph information propagation and multi-hop information hierarchical fusion to obtain the graph structure features of each candidate maintenance step entity; Step S4: Fuse the hierarchical semantic embedding vector of the problem, the semantic embedding vector of the candidate maintenance step entity, and the graph structure features of the candidate maintenance step entity to generate the fused features of each candidate maintenance step entity. Step S5: Input the fused features into the pre-trained answer prediction model and output the final maintenance step entity answer corresponding to the equipment fault description question.
[0008] Furthermore, in step S1, the question is semantically parsed using a pre-trained multi-stage Transformer large model to obtain deep semantic reasoning features, and a hierarchical semantic embedding vector for the question is generated based on these deep semantic reasoning features. Feature embedding vector of core fault entity Embedding vectors related to potential faults Specifically, it includes: The multi-stage Transformer large model extracts the core entities in the problem through multi-head weight focusing using a self-attention mechanism. Constraint Entities and potential inference relationships and output structured extraction results. ; The multi-stage Transformer large model is based on a question, identifies the inference hop count corresponding to the question, uses one-hot encoding for the inference hop count, converts the inference hop count into a hop count feature vector through a fully connected layer, and incorporates the hop count feature vector into semantic encoding; Encode the original characters of the problem to generate surface character features; Based on the pre-trained vocabulary of the multi-stage Transformer large model, the question token sequence is lexically encoded. Combined with the multi-head self-attention mechanism of the multi-stage Transformer large model itself, the context-related features between words are extracted to generate mid-level word association features. By using a feedforward neural network, high-order feature fusion is performed on surface character features, mid-level word association features, and jump count feature vectors to extract deep semantic reasoning features of the question. The deep semantic reasoning features are averaged to obtain sentence-level features; based on these features, the core entities are located. Entity-level features are obtained; based on deep semantic reasoning features, reasoning relationships are located. For the corresponding token position, extract the semantic features of that token position to obtain relation-level features; Sentence-level features are used as question-level semantic embedding vectors. Entity-level features are used as feature embedding vectors for core fault entities. Relationship-level features are used as embedding vectors for potential fault relationships. .
[0009] Furthermore, in step S2, based on the hierarchical semantic embedding vector of the question... Feature embedding vector of core fault entity Embedding vectors related to potential faults Candidate maintenance step entities are generated through a constrained decoder of a multi-stage Transformer large model, and the candidate maintenance step entities are scored using a semantic-structural dual relevance scoring function to select the top-performing maintenance steps. The high-scoring candidate repair step entities constitute the initial candidate answer set, specifically including: Step S21: Use question-layer semantic embedding vectors As input to a multi-stage Transformer large model, candidate maintenance step entities are generated under the constraints of the entity set of the equipment fault diagnosis knowledge graph with constraint decoder. Step S22: Score the candidate maintenance step entities using a semantic-structural dual relevance scoring function, and calculate the relevance score between each candidate maintenance step entity and the core entity and the problem hierarchical semantics. The expression is as follows:
[0010] in, Indicates the first One candidate maintenance step entity; Represents the entity of the candidate maintenance step The correlation score; Indicates the weighting coefficient. ; The feature embedding vector representing the core fault entity; The semantic embedding vector representing the candidate maintenance step entity; The cosine similarity between the semantic embedding vector of the candidate maintenance step entity and the feature embedding vector of the core fault entity is represented, with a value ranging from 1 to 2. ; Represents the hierarchical semantic embedding vector of the problem; The cosine similarity between the hierarchical semantic embedding vector of the problem and the semantic embedding vector of the candidate maintenance step entity; Represents the path similarity weight coefficient ; Represents the core entity; Represents the core entity With candidate maintenance step entity The similarity of the shortest paths in a knowledge graph, with values ranging from... Its expression is:
[0011] in, An embedding vector representing a potential fault relationship; Represents the core entity With candidate maintenance step entity The shortest path in a knowledge graph; Embedding vectors representing potential fault relationships in a path The weights; Embedding vectors representing potential fault relationships The number of times it appears in the shortest path in the knowledge graph; Step S23: Sort the relevance scores in descending order and select the top... The candidate repair step entities constitute the initial candidate answer set.
[0012] Furthermore, in step S21, the question-layer semantic embedding vector is used. As input to a multi-stage Transformer large model, candidate maintenance step entities are generated under the constraints of the entity set of the equipment fault diagnosis knowledge graph with constraint decoder. Specifically, these include: Extract all entity sets from the knowledge graph and all relation sets ; The names of entities and relationships are converted into token characters that can be recognized by the constrained decoder of the multi-stage Transformer large model, and a unique ID is assigned to each entity and relationship. Statistical analysis of the frequency of entity occurrence and the frequency of relationships between entities in a knowledge graph; The multi-stage Transformer large model output section embeds a constraint module for entities and relations. The constraint module includes: a token whitelist and prior probability weighting. The token whitelist only allows the generation of token characters corresponding to entities and relations in the knowledge graph, filtering out all token characters outside the whitelist. The prior probability weighting uses the prior distribution of entity-relationship in the knowledge graph as weights to increase the generation probability of entity token characters that are related to the semantics of the question. Sort the token characters by probability from high to low, and accumulate the probabilities until a threshold is reached. Token characters are randomly selected only from this subset; Add the selected Token character to the generation sequence to obtain the Token sequence, and update the hidden state of the multi-stage Transformer large model output; Generation will terminate if any of the following conditions are met: The number of generated token characters reaches the preset number; The token characters generated in two consecutive steps are both duplicate entities; The generated token sequence is concatenated into a complete entity name to obtain a single candidate maintenance step entity.
[0013] Further, in step S3, the initial candidate answer set is used as the initial node and input into the pre-trained RE-MGCN relation enhancement graph convolutional network to perform graph information propagation and multi-hop information hierarchical fusion, thereby obtaining the graph structure features of each candidate maintenance step entity, specifically including: Step S31: Represent the knowledge graph as ,in, For entity sets; For a set of relations; An adjacency matrix for enhanced relationships; Step S32: Through The graph convolutional layer with enhanced layer relationships aggregates and updates the entity features of candidate repair steps. The calculation formula for each convolutional layer is as follows:
[0014] in, Indicates the first The first in the layer Feature embedding of each candidate maintenance step entity; Indicates the first The first in the layer Feature embedding of each candidate maintenance step entity; Indicates the first Initial embedding of candidate maintenance step entities; Indicates the first Each candidate maintenance step entity is embedded through a vector of potential fault relationships. The set of connected neighboring entities; Embedding vectors representing potential fault relationships The corresponding number Layer-learnable weight matrix; This represents the entity self-connection weight matrix; This represents the GELU activation function; Indicates the first Each candidate maintenance step entity is embedded through a vector of potential fault relationships. The set of connected neighboring entities; Indicates the first The first in the layer Feature embedding of each candidate maintenance step entity; Step S33: After each convolutional layer, residual connections and layer normalization are performed, the expression of which is:
[0015] in, Indicates the first The new feature embedding obtained after residual connection and layer normalization of each candidate maintenance step entity; This indicates residual connections and layer normalization processing; Step S34: The entity features from the convolutional layers are concatenated into a multi-hop feature set. The attention weights of features in each layer are calculated using the hop count attention layer, and their expression is as follows:
[0016] in, Indicates the first Layer Feature embedding of each candidate maintenance step entity; Indicates the first Layer attention weights; Represents a learnable weight vector; For bias terms; Represents the learnable weight matrix; Step S35: Obtain the entity's graph structure features through attention weighted fusion, the expression of which is:
[0017] in, Indicates the first The graph structure features of each candidate maintenance step entity.
[0018] Further, in step S4, the hierarchical semantic embedding vector of the problem, the semantic embedding vector of the candidate maintenance step entity, and the graph structure features of the candidate maintenance step entity are fused to generate the fused features of each candidate maintenance step entity, specifically including: A linear transformation maps the hierarchical semantic embedding vector of the problem, the semantic embedding vector of the candidate maintenance step entity, and the graph structure features of the candidate maintenance step entity to the same feature space. The expression for this is:
[0019]
[0020]
[0021] in, , , All are learnable linear transformation matrices. Represents the hierarchical semantic embedding vector of the problem. The semantic embedding vector representing the entity of the candidate maintenance step. The graphical structural features representing candidate maintenance step entities; Using the linearly transformed hierarchical semantic embedding vector of the problem and the linearly transformed semantic embedding vector of the candidate maintenance step entity as queries, and the graph structure features of the linearly transformed candidate maintenance step entity as keys and values, semantically enhanced graph structure features are generated through cross-attention. The expression is as follows:
[0022]
[0023]
[0024] in, For semantically enhanced graph structure features; This is the semantically enhanced graph feature matrix obtained by cross-attention calculation, using semantic features as queries and graph features as keys and values. This is a semantic embedding query matrix; The key matrix represents the structural features of the spectral graph; The value matrix represents the structural features of the graph; The feature dimension after mapping; Using the graph structure features of the linearly transformed candidate maintenance step entities as the query, and the linearly transformed hierarchical semantic embedding vector of the problem and the semantic embedding vector of the linearly transformed candidate maintenance step entities as the key and value, a graph structure-enhanced semantic embedding is generated through cross-attention. Its expression is as follows:
[0025]
[0026]
[0027] in, Semantic embeddings to enhance graph structures; This is a semantic feature matrix with enhanced graph structure, obtained by cross-attention calculation using graph features as queries and semantic features as keys and values. Embed the query matrix into the graph structure features; It is a semantic embedding key matrix; This is a semantic embedding value matrix; By dynamically balancing semantically enhanced graph structure features and graph structure enhanced semantic embeddings through a gating mechanism, fused features of candidate maintenance step entities are generated:
[0028]
[0029] in, The fusion features of candidate maintenance step entities; This is the gate vector; For element-wise dot product; This is the gated weight matrix; This is a bias term.
[0030] Further, in step S5, the answer prediction model is trained based on the total loss function, specifically including: Candidate maintenance step entities are divided into positive sample set and hard negative sample set. Soft negative sample set The answer prediction model is trained using a total loss function, where positive samples are the correct answers. Hard negative sample set These are error candidates that are semantically / structurally similar to positive samples; they are soft negative sample sets. It is a common error candidate; The total loss function is:
[0031] in: ∈[0,1] is the weighting coefficient (value 0.7); To compare the loss items, This is a ranking loss item.
[0032] Furthermore, the expression for the comparison loss term is:
[0033] in, As a positive sample, Features of problem fusion; Cosine similarity; Temperature coefficient; The penalty coefficient for hard negative samples. ; For entities in the hard negative sample set ; For hard negative sample sets; These are hard negative samples; For entities in the soft negative sample set ; For soft negative sample sets; These are soft negative samples.
[0034] Furthermore, the expression for the ranking loss term is:
[0035] in, This represents the ranking margin between positive samples and hard negative samples. This represents the ranking margin between positive samples and soft negative samples. .
[0036] Further, in step S6, the fused features are input into the pre-trained answer prediction model, which outputs the final maintenance step entity answer corresponding to the equipment fault description question, specifically: Calculate the cosine similarity between the fusion features of each candidate maintenance step entity and the fusion features of the problem. Sort the cosine similarity in descending order and select the entity with the highest cosine similarity as the final answer; If multiple entities with the same cosine similarity exist, a second filtering process is performed using the knowledge graph path length, selecting the path length and the number of inference jumps. Consistent entities.
[0037] As can be seen from the above technical solutions, the present invention has the following advantages: This application provides a knowledge graph multi-hop question answering method that integrates large-scale models and graph convolutional networks. It utilizes a pre-trained multi-stage Transformer large-scale model to perform deep semantic parsing on natural language questions containing equipment fault descriptions, accurately extracting core fault entities and potential fault relationships. This solves the problem of traditional fault diagnosis systems having a superficial understanding of on-site engineers' problem descriptions and easily overlooking key equipment entities or associated symptoms. The system can, like an experienced maintenance expert, deeply understand the complex semantics and implicit logical chains behind the fault descriptions, providing a clear and structured starting point for subsequent accurate retrieval and reasoning within the vast equipment knowledge graph. This avoids errors in troubleshooting direction due to misunderstandings of the problem, improving the reliability of intelligent diagnostic assistance.
[0038] Based on the parsed semantic vectors, this application utilizes a constrained decoder of a large model to generate candidate answers under strict constraints of the entity set of the equipment fault diagnosis knowledge graph. It also employs a dual scoring function that integrates semantics and graph paths for filtering, overcoming the shortcomings of traditional fault knowledge bases or search engines that tend to return a large number of irrelevant or non-technical entities. This ensures that each entity in the generated initial candidate set is a feasible maintenance step or diagnostic action, and is highly related to the core fault phenomenon described in terms of semantics and knowledge structure. As a result, the scope of investigation is accurately locked onto the most likely maintenance solutions, significantly improving the efficiency and targeting of fault location.
[0039] This application inputs high-quality candidate entities into a pre-trained relation-enhancing graph convolutional network to perform multi-hop information propagation and fusion on the equipment fault diagnosis knowledge graph. This network can aggregate rich information of the multi-hop neighbors of each candidate maintenance step entity in the knowledge graph, so that the evaluation of candidate maintenance steps is no longer isolated, but comprehensively considers its context in the complete equipment knowledge network, providing strong structured evidence support for the rationality and feasibility of maintenance suggestions. Attached Figure Description
[0040] To more clearly illustrate the technical solution of this application, the accompanying drawings used in the description will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0041] Figure 1 This is a flowchart of the knowledge graph multi-hop question answering method that integrates large models and graph convolutional networks as described in this invention. Detailed Implementation
[0042] To make the purpose, features, and advantages of this application more apparent and understandable, specific embodiments and accompanying drawings will be used to clearly and completely describe the technical solution protected by this application. Obviously, the embodiments described below are only some embodiments of this application, and not all embodiments. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this invention.
[0043] This application provides a knowledge graph multi-hop question answering method that integrates large models and graph convolutional networks, addressing the urgent technical problem of improving the accuracy of knowledge graph multi-hop question answering.
[0044] The technical solutions proposed in the embodiments of this application will be described in detail below with reference to the accompanying drawings.
[0045] Figure 1 This is a flowchart illustrating a multi-hop question-answering method for knowledge graphs that integrates large models and graph convolutional networks, provided as an embodiment of this application. Figure 1 As shown in the embodiment of this application, a multi-hop question answering method for knowledge graphs that integrates large models and graph convolutional networks is provided. The method includes the following steps: Step S1: Receive a natural language question containing a description of the equipment fault. Perform semantic parsing on the question using a pre-trained multi-stage Transformer model to obtain deep semantic reasoning features. Generate a hierarchical semantic embedding vector for the question based on these deep semantic reasoning features. Feature embedding vector of core fault entity Embedding vectors related to potential faults ;in, , , ; Step S2: Based on the hierarchical semantic embedding vector of the question Feature embedding vector of core fault entity Embedding vectors related to potential faults Candidate maintenance step entities are generated through a constrained decoder of a multi-stage Transformer large model, and the candidate maintenance step entities are scored using a semantic-structural dual relevance scoring function to select the top-performing maintenance steps. The high-scoring candidate repair step entities constitute the initial candidate answer set; Step S3: The initial candidate answer set is used as the initial node and input into the pre-trained RE-MGCN relation enhancement graph convolutional network to perform graph information propagation and multi-hop information hierarchical fusion to obtain the graph structure features of each candidate maintenance step entity; Step S4: Through a dual-channel interaction mechanism, the hierarchical semantic embedding vector of the problem, the semantic embedding vector of the candidate maintenance step entity, and the graph structure features of the candidate maintenance step entity are fused to generate the fused features of each candidate maintenance step entity. Step S5: Input the fused features into the pre-trained answer prediction model and output the final maintenance step entity answer corresponding to the equipment fault description question.
[0046] Typically, the training process of a multi-stage Transformer large model is as follows: based on the domain corpus of equipment faults, fine-tuning training is carried out on the basis of a general open-source large language model for fault entity recognition and relation extraction tasks, and then the model is optimized to convergence through a joint loss function.
[0047] The training process of the RE-MGCN relation enhancement graph convolutional network is as follows: the knowledge graph of the equipment fault diagnosis domain is used as training data, which contains fault entities and entity relationships; A relation-enhancing graph convolutional network is constructed based on a graph convolutional architecture, and joint pre-training is performed using link prediction and entity contrast learning tasks. The pre-trained RE-MGCN relation enhancement graph convolutional network is obtained by iteratively optimizing the joint loss function composed of cross-entropy loss and contrastive loss and training until convergence.
[0048] In step S1, the question is semantically parsed using a pre-trained multi-stage Transformer large model to obtain deep semantic reasoning features. Based on these deep semantic reasoning features, a hierarchical semantic embedding vector for the question is generated. Feature embedding vector of core fault entity Embedding vectors related to potential faults Specifically, it includes: The multi-stage Transformer large model extracts the core entities in the problem through multi-head weight focusing using a self-attention mechanism. Constraint Entities and potential inference relationships and output structured extraction results. In this embodiment, the core entity is defined as the fault phenomenon or equipment component; the constraint entity includes environmental conditions; and the potential reasoning relationship corresponds to the cause, manifestation, and need for inspection.
[0049] The multi-stage Transformer large model is based on a question and identifies the inference hop count corresponding to the question. The inference hop count is encoded using one-hot encoding and converted into a hop count feature vector through a fully connected layer (the weights of the connected layer need to be trained). The hop count feature vector is then incorporated into the semantic encoding. The fusion method adopts a feature concatenation approach. Encode the original characters of the problem to generate surface character features; Based on the pre-trained vocabulary of the multi-stage Transformer large model, the question token sequence is lexically encoded. Combined with the multi-head self-attention mechanism of the multi-stage Transformer large model itself, the context-related features between words are extracted to generate mid-level lexical association features (the dimension is consistent with the hidden layer dimension of the large model) to capture the lexical logical relationship of the question. By using a two-layer or single-layer feedforward neural network, high-order feature fusion is performed on surface character features, mid-layer word association features and jump count feature vectors to extract deep semantic reasoning features of the question. The deep semantic reasoning features are averaged to obtain sentence-level features; based on these features, the core entities are located. Entity-level features are obtained; based on deep semantic reasoning features, reasoning relationships are located. For the corresponding token position, extract the semantic features of that token position to obtain relation-level features; Sentence-level features are used as question-level semantic embedding vectors. Entity-level features are used as feature embedding vectors for core fault entities. Relationship-level features are used as embedding vectors for potential fault relationships. .
[0050] Key elements of the problem are extracted using a multi-stage Transformer model to identify the number of reasoning hops. A hierarchical embedding network is then used to perform hierarchical semantic embedding of the problem, yielding deep semantic reasoning features. Based on these features, a hierarchical semantic embedding vector for the problem is generated. Feature embedding vector of core fault entity Embedding vectors related to potential faults .
[0051] In step S2, based on the hierarchical semantic embedding vector of the question... Feature embedding vector of core fault entity Embedding vectors related to potential faults Candidate maintenance step entities are generated through a constrained decoder of a multi-stage Transformer large model, and the candidate maintenance step entities are scored using a semantic-structural dual relevance scoring function to select the top-performing maintenance steps. The high-scoring candidate repair step entities constitute the initial candidate answer set, specifically including: Step S21: Use question-layer semantic embedding vectors As input to a multi-stage Transformer large model, candidate maintenance step entities are generated under the constraints of the entity set of the equipment fault diagnosis knowledge graph with constraint decoder. Step S22: Score the candidate maintenance step entities using a semantic-structural dual relevance scoring function, and calculate the relevance score between each candidate maintenance step entity and the core entity and the problem hierarchical semantics. The expression is as follows:
[0052] in, Indicates the first One candidate maintenance step entity; Represents the entity of the candidate maintenance step The correlation score; Indicates the weighting coefficient. In this embodiment, the value is 0.6; The feature embedding vector representing the core fault entity; The semantic embedding vector representing the entity of the candidate maintenance step ( ); The cosine similarity between the semantic embedding vector of the candidate maintenance step entity and the feature embedding vector of the core fault entity is represented, with a value ranging from 1 to 2. ; Represents the hierarchical semantic embedding vector of the problem; The cosine similarity between the hierarchical semantic embedding vector of the problem and the semantic embedding vector of the candidate maintenance step entity; Represents the path similarity weight coefficient In this embodiment, the value is 0.3; Represents the core entity; Represents the core entity With candidate maintenance step entity The similarity of the shortest paths in a knowledge graph, with values ranging from... Its expression is:
[0053] in, An embedding vector representing a potential fault relationship; Represents the core entity With candidate maintenance step entity The shortest path in a knowledge graph; Embedding vectors representing potential fault relationships in a path The weights; Embedding vectors representing potential fault relationships The number of times it appears in the shortest path in the knowledge graph; Step S23: Sort the relevance scores in descending order and select the top... The candidate repair step entities constitute the initial candidate answer set.
[0054] In step S21, the question-layer semantic embedding vector is used. As input to a multi-stage Transformer large model, candidate maintenance step entities are generated under the constraints of the entity set of the equipment fault diagnosis knowledge graph with constraint decoder. Specifically, these include: Extract all entity sets from the knowledge graph and all relation sets ; The names of entities and relationships are converted into token characters that can be recognized by the constrained decoder of the multi-stage Transformer large model, and a unique ID is assigned to each entity and relationship for easy retrieval. The frequency of entity occurrence and the frequency of relationships between entities in the statistical knowledge graph are used as the basis for probability constraints during decoding. The multi-stage Transformer large model output section embeds a constraint module for entities and relations. The constraint module includes: a token whitelist and prior probability weighting. The token whitelist only allows the generation of token characters corresponding to entities and relations in the knowledge graph, filtering out all token characters outside the whitelist. The prior probability weighting uses the prior distribution of entity-relationship in the knowledge graph as weights to increase the generation probability of entity token characters that are related to the semantics of the question. Sort the token characters by probability from high to low, and accumulate the probabilities until a threshold is reached. Token characters are randomly selected only from this subset; Add the selected Token character to the generation sequence to obtain the Token sequence, and update the hidden state of the multi-stage Transformer large model output; Generation will terminate if any of the following conditions are met: The number of generated token characters reaches a preset number, which is 10 in this embodiment; The token characters generated in two consecutive steps are both duplicate entities; The generated token sequence is concatenated into a complete entity name to obtain a single candidate maintenance step entity.
[0055] Constrained decoder with problem-level semantic embedding vector As input, the entity set of the knowledge graph and relation set Using the prior distribution as a constraint, candidate maintenance step entities are generated only from the knowledge graph, avoiding bias in the generation of free text.
[0056] In step S3, the initial candidate answer set is used as the initial node and input into the pre-trained RE-MGCN relation enhancement graph convolutional network to perform graph information propagation and multi-hop information hierarchical fusion, obtaining the graph structure features of each candidate maintenance step entity, specifically including: Step S31: Represent the knowledge graph as ,in, For entity sets; For a set of relations; Adjacency matrix for relationship enhancement ( In this embodiment, entity set Includes: equipment model, components, failure modes, maintenance tools, and relationship sets. Includes: possessing, possibly, and needing to be adopted.
[0057] Step S32: Through The graph convolutional layer with enhanced layer relationships aggregates and updates the entity features of candidate repair steps. The calculation formula for each convolutional layer is as follows:
[0058] in, Indicates the first The first in the layer Feature embedding of each candidate maintenance step entity; Indicates the first The first in the layer Feature embedding of each candidate maintenance step entity; Indicates the first Initial embedding of candidate maintenance step entities (integrating candidate maintenance step entity embeddings generated by a multi-stage Transformer large model with knowledge graph pre-training embeddings). Indicates the first Each candidate maintenance step entity is embedded through a vector of potential fault relationships. The set of connected neighboring entities; Embedding vectors representing potential fault relationships The corresponding number Layer-learnable weight matrix; This represents the entity self-connection weight matrix; This represents the GELU activation function; Indicates the first Each candidate maintenance step entity is embedded through a vector of potential fault relationships. The set of connected neighboring entities; Indicates the first The first in the layer Feature embedding of each candidate maintenance step entity; Step S33: After each convolutional layer, residual connections and layer normalization are performed to alleviate the oversmoothing problem. The expression is as follows:
[0059] in, Indicates the first The new feature embedding obtained after residual connection and layer normalization of each candidate maintenance step entity; This indicates residual connections and layer normalization processing; Step S34: The entity features from the convolutional layers are concatenated into a multi-hop feature set. The attention weights of features in each layer are calculated using the hop count attention layer, and their expression is as follows:
[0060] in, Indicates the first Layer Feature embedding of each candidate maintenance step entity; Indicates the first Layer attention weights; Represents a learnable weight vector; For bias terms; Represents the learnable weight matrix; Step S35: Obtain the entity's graph structure features through attention weighted fusion, the expression of which is:
[0061] in, Indicates the first The graph structure features of each candidate maintenance step entity.
[0062] In step S4, the hierarchical semantic embedding vector of the problem, the semantic embedding vector of the candidate maintenance step entity, and the graph structure features of the candidate maintenance step entity are fused through a dual-channel interaction mechanism to generate the fused features of each candidate maintenance step entity, specifically including: By using linear transformation, the hierarchical semantic embedding vector of the problem, the semantic embedding vector of the candidate maintenance step entity, and the graph structure features of the candidate maintenance step entity are mapped to the same feature space, achieving dimensionality unification. Its expression is:
[0063]
[0064]
[0065] in, , , All are learnable linear transformation matrices. Represents the hierarchical semantic embedding vector of the problem. The semantic embedding vector representing the entity of the candidate maintenance step. The graph structure features of the candidate maintenance step entities are represented; the mapped feature dimensions are all... ; Using the linearly transformed hierarchical semantic embedding vector of the problem and the linearly transformed semantic embedding vector of the candidate maintenance step entity as queries, and the graph structure features of the linearly transformed candidate maintenance step entity as keys and values, semantically enhanced graph structure features are generated through cross-attention. The expression is as follows:
[0066]
[0067]
[0068] in, For semantically enhanced graph structure features; The semantically enhanced graph feature matrix (semantic→graph) is obtained by using semantic features as queries and graph features as keys and values, and then performing cross-attention calculation. This is a semantic embedding query matrix; The key matrix represents the structural features of the spectral graph; The output is a value matrix of graph structure features; the output is a semantically enhanced graph structure feature matrix. For the above matrix, the first... OK; The feature dimension after mapping; Using the graph structure features of the linearly transformed candidate maintenance step entities as the query, and the linearly transformed hierarchical semantic embedding vector of the problem and the semantic embedding vector of the linearly transformed candidate maintenance step entities as the key and value, a graph structure-enhanced semantic embedding is generated through cross-attention. Its expression is as follows:
[0069]
[0070]
[0071] in, Semantic embeddings to enhance graph structures; This is a semantic feature matrix with enhanced graph structure, obtained by cross-attention calculation using graph features as queries and semantic features as keys and values. Embed the query matrix into the graph structure features; It is a semantic embedding key matrix; The semantic embedding value matrix is the output graph structure-enhanced semantic embedding. For the above matrix, the first... OK; By dynamically balancing semantically enhanced graph structure features and graph structure enhanced semantic embeddings through a gating mechanism, fused features of candidate maintenance step entities are generated:
[0072]
[0073] in, The fusion features of candidate maintenance step entities; This is the gate vector; For element-wise dot product; This is the gated weight matrix; This is a bias term.
[0074] It should be noted that the dual-channel interaction mechanism includes: The semantic-to-structural channel uses semantic features as queries and graph structural features as keys and values, generating semantically enhanced graph structural features through cross-attention. The structure-to-semantic channel uses graph structure features as queries and semantic features as keys and values, generating graph structure-enhanced semantic embeddings through cross-attention. The outputs of the two channels are dynamically fused through a gating mechanism to generate a fusion feature for each candidate maintenance step entity, the expression of which is: , .
[0075] In step S5, the answer prediction model is trained based on the total loss function, specifically including: Candidate maintenance step entities are divided into positive sample set and hard negative sample set. Soft negative sample set The answer prediction model is trained using the total loss function (CRL), where positive samples are the correct answers. Hard negative sample set These are error candidates that are semantically / structurally similar to positive samples; they are soft negative sample sets. It is a common error candidate; The total loss function is:
[0076] in: ∈[0,1] is the weighting coefficient (value 0.7); To compare the loss items, This is a ranking loss item.
[0077] The expression for the contrast loss term is:
[0078] in, As a positive sample, Features of problem fusion; Cosine similarity; Temperature coefficient; The penalty coefficient for hard negative samples. ; For entities in the hard negative sample set ; For hard negative sample sets; These are hard negative samples; For entities in the soft negative sample set ; For soft negative sample sets; These are soft negative samples.
[0079] The expression for the ranking loss term is:
[0080] in, This is the ranking margin between positive samples and hard negative samples (taken as 0.5). A larger value represents a stronger constraint (requiring that the similarity of positive samples must be at least 0.5 higher than that of hard negative samples). This is the ranking margin between positive samples and soft negative samples (taken as 0.2). A smaller value represents the basic constraint (only requiring that the similarity of positive samples is at least 0.2 higher than that of soft negative samples, so as to ensure the reasonableness of the ranking while avoiding excessive constraints on easily distinguishable samples, which would lead to overfitting of the model during training). .
[0081] In step S6, the fused features are input into the pre-trained answer prediction model, which outputs the final maintenance step entity answer corresponding to the equipment fault description question, specifically: Calculate the cosine similarity between the fusion features of each candidate maintenance step entity and the fusion features of the problem. Sort the cosine similarity in descending order and select the entity with the highest cosine similarity as the final answer; If multiple entities with the same cosine similarity exist, a second filtering process is performed using the knowledge graph path length, selecting the path length and the number of inference jumps. Consistent entities.
[0082] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
[0083] Any changes, modifications, substitutions, and variations made to the embodiments without departing from the principles and spirit of the present invention still fall within the protection scope of the present invention.
Claims
1. A multi-hop question answering method for knowledge graphs that integrates large models and graph convolutional networks, characterized in that, The method includes the following steps: Step S1: Receive a natural language question containing a description of the equipment fault. Perform semantic parsing on the question using a pre-trained multi-stage Transformer model to obtain deep semantic reasoning features. Generate a hierarchical semantic embedding vector for the question based on these deep semantic reasoning features. Feature embedding vector of core fault entity Embedding vectors related to potential faults ; Step S2: Based on the hierarchical semantic embedding vector of the question Feature embedding vector of core fault entity Embedding vectors related to potential faults Candidate maintenance step entities are generated through a constrained decoder of a multi-stage Transformer large model, and the candidate maintenance step entities are scored using a semantic-structural dual relevance scoring function to select the top-performing maintenance steps. The high-scoring candidate repair step entities constitute the initial candidate answer set, specifically including: Step S21: Use question-layer semantic embedding vectors As input to a multi-stage Transformer large model, candidate maintenance step entities are generated under the constraints of the entity set of the equipment fault diagnosis knowledge graph with constraint decoder. Step S22: Score the candidate maintenance step entities using a semantic-structural dual relevance scoring function, and calculate the relevance score between each candidate maintenance step entity and the core entity and the problem hierarchical semantics. The expression is as follows: in, Indicates the first One candidate maintenance step entity; Represents the entity of the candidate maintenance step The correlation score; Indicates the weighting coefficient. ; The feature embedding vector representing the core fault entity; The semantic embedding vector representing the candidate maintenance step entity; The cosine similarity between the semantic embedding vector of the candidate maintenance step entity and the feature embedding vector of the core fault entity is represented, with a value ranging from 1 to 2. ; Represents the hierarchical semantic embedding vector of the problem; The cosine similarity between the hierarchical semantic embedding vector of the problem and the semantic embedding vector of the candidate maintenance step entity; Represents the path similarity weight coefficient ; Represents the core entity; Represents the core entity With candidate maintenance step entity The similarity of the shortest paths in a knowledge graph, with values ranging from... Its expression is: in, An embedding vector representing a potential fault relationship; Represents the core entity With candidate maintenance step entity The shortest path in a knowledge graph; Embedding vectors representing potential fault relationships in a path The weights; Embedding vectors representing potential fault relationships The number of times it appears in the shortest path in the knowledge graph; Step S23: Sort the relevance scores in descending order and select the top... The candidate repair step entities constitute the initial candidate answer set; Step S3: The initial candidate answer set is used as the initial node and input into the pre-trained RE-MGCN relation enhancement graph convolutional network to perform graph information propagation and multi-hop information hierarchical fusion to obtain the graph structure features of each candidate maintenance step entity; Step S4: Fuse the hierarchical semantic embedding vector of the problem, the semantic embedding vector of the candidate maintenance step entity, and the graph structure features of the candidate maintenance step entity to generate the fused features of each candidate maintenance step entity. Step S5: Input the fused features into the pre-trained answer prediction model and output the final maintenance step entity answer corresponding to the equipment fault description question.
2. The method as described in claim 1, characterized in that, In step S1, the question is semantically parsed using a pre-trained multi-stage Transformer large model to obtain deep semantic reasoning features. Based on these deep semantic reasoning features, a hierarchical semantic embedding vector for the question is generated. Feature embedding vector of core fault entity Embedding vectors related to potential faults Specifically, it includes: The multi-stage Transformer large model extracts the core entities in the problem through multi-head weight focusing using a self-attention mechanism. Constraint Entities and potential inference relationships and output structured extraction results. ; The multi-stage Transformer large model is based on a question, identifies the inference hop count corresponding to the question, uses one-hot encoding for the inference hop count, converts the inference hop count into a hop count feature vector through a fully connected layer, and incorporates the hop count feature vector into semantic encoding; Encode the original characters of the problem to generate surface character features; Based on the pre-trained vocabulary of the multi-stage Transformer large model, the question token sequence is lexically encoded. Combined with the multi-head self-attention mechanism of the multi-stage Transformer large model itself, the context-related features between words are extracted to generate mid-level word association features. By using a feedforward neural network, high-order feature fusion is performed on surface character features, mid-level word association features, and jump count feature vectors to extract deep semantic reasoning features of the question. The deep semantic reasoning features are averaged to obtain sentence-level features; based on these features, the core entities are located. Entity-level features are obtained; based on deep semantic reasoning features, reasoning relationships are located. For the corresponding token position, extract the semantic features of that token position to obtain relation-level features; Sentence-level features are used as question-level semantic embedding vectors. Entity-level features are used as feature embedding vectors for core fault entities. Relationship-level features are used as embedding vectors for potential fault relationships. .
3. The method as described in claim 2, characterized in that, In step S21, the question-layer semantic embedding vector is used. As input to a multi-stage Transformer large model, candidate maintenance step entities are generated under the constraints of the entity set of the equipment fault diagnosis knowledge graph with constraint decoder. Specifically, these include: Extract all entity sets from the knowledge graph and all relation sets ; The names of entities and relationships are converted into token characters that can be recognized by the constrained decoder of the multi-stage Transformer large model, and a unique ID is assigned to each entity and relationship. Statistical analysis of the frequency of entity occurrence and the frequency of relationships between entities in a knowledge graph; The multi-stage Transformer large model output section embeds a constraint module for entities and relations. The constraint module includes: a token whitelist and prior probability weighting. The token whitelist only allows the generation of token characters corresponding to entities and relations in the knowledge graph, filtering out all token characters outside the whitelist. The prior probability weighting uses the prior distribution of entity-relationship in the knowledge graph as weights to increase the generation probability of entity token characters that are related to the semantics of the question. Sort the token characters by probability from high to low, and accumulate the probabilities until a threshold is reached. Token characters are randomly selected only from this subset; Add the selected Token character to the generation sequence to obtain the Token sequence, and update the hidden state of the multi-stage Transformer large model output; Generation will terminate if any of the following conditions are met: The number of generated token characters reaches the preset number; The token characters generated in two consecutive steps are both duplicate entities; The generated token sequence is concatenated into a complete entity name to obtain a single candidate maintenance step entity.
4. The method as described in claim 3, characterized in that, In step S3, the initial candidate answer set is used as the initial node and input into the pre-trained RE-MGCN relation enhancement graph convolutional network to perform graph information propagation and multi-hop information hierarchical fusion, obtaining the graph structure features of each candidate maintenance step entity, specifically including: Step S31: Represent the knowledge graph as ,in, For entity sets; For a set of relations; An adjacency matrix for enhanced relationships; Step S32: Through The graph convolutional layer with enhanced layer relationships aggregates and updates the entity features of candidate repair steps. The calculation formula for each convolutional layer is as follows: in, Indicates the first The first in the layer Feature embedding of each candidate maintenance step entity; Indicates the first The first in the layer Feature embedding of each candidate maintenance step entity; Indicates the first Initial embedding of candidate maintenance step entities; Indicates the first Each candidate maintenance step entity is embedded through a vector of potential fault relationships. The set of connected neighboring entities; Embedding vectors representing potential fault relationships The corresponding number Layer-learnable weight matrix; This represents the entity self-connection weight matrix; This represents the GELU activation function; Indicates the first Each candidate maintenance step entity is embedded through a vector of potential fault relationships. The set of connected neighboring entities; Indicates the first The first in the layer Feature embedding of each candidate maintenance step entity; Step S33: After each convolutional layer, residual connections and layer normalization are performed, the expression of which is: in, Indicates the first The new feature embedding obtained after residual connection and layer normalization of each candidate maintenance step entity; This indicates residual connections and layer normalization processing; Step S34: The entity features from the convolutional layers are concatenated into a multi-hop feature set. The attention weights of features in each layer are calculated using the hop count attention layer, and their expression is as follows: in, Indicates the first Layer Feature embedding of each candidate maintenance step entity; Indicates the first Layer attention weights; Represents a learnable weight vector; For bias terms; Represents the learnable weight matrix; Step S35: Obtain the entity's graph structure features through attention weighted fusion, the expression of which is: in, Indicates the first The graph structure features of each candidate maintenance step entity.
5. The method as described in claim 4, characterized in that, In step S4, the hierarchical semantic embedding vector of the problem, the semantic embedding vector of the candidate maintenance step entity, and the graph structure features of the candidate maintenance step entity are fused to generate the fused features of each candidate maintenance step entity, specifically including: A linear transformation maps the hierarchical semantic embedding vector of the problem, the semantic embedding vector of the candidate maintenance step entity, and the graph structure features of the candidate maintenance step entity to the same feature space. The expression for this is: in, , , All are learnable linear transformation matrices. Represents the hierarchical semantic embedding vector of the problem. The semantic embedding vector representing the entity of the candidate maintenance step. The graphical structural features representing candidate maintenance step entities; Using the linearly transformed hierarchical semantic embedding vector of the problem and the linearly transformed semantic embedding vector of the candidate maintenance step entity as queries, and the graph structure features of the linearly transformed candidate maintenance step entity as keys and values, semantically enhanced graph structure features are generated through cross-attention. The expression is as follows: in, For semantically enhanced graph structure features; This is the semantically enhanced graph feature matrix obtained by cross-attention calculation, using semantic features as queries and graph features as keys and values. This is a semantic embedding query matrix; The key matrix represents the structural features of the spectral graph; The value matrix represents the structural features of the graph; The feature dimension after mapping; Using the graph structure features of the linearly transformed candidate maintenance step entities as the query, and the linearly transformed hierarchical semantic embedding vector of the problem and the semantic embedding vector of the linearly transformed candidate maintenance step entities as the key and value, a graph structure-enhanced semantic embedding is generated through cross-attention. Its expression is as follows: in, Semantic embeddings to enhance graph structures; This is a semantic feature matrix with enhanced graph structure, obtained by cross-attention calculation using graph features as queries and semantic features as keys and values. Embed the query matrix into the graph structure features; It is a semantic embedding key matrix; This is a semantic embedding value matrix; By dynamically balancing semantically enhanced graph structure features and graph structure enhanced semantic embeddings through a gating mechanism, fused features of candidate maintenance step entities are generated: in, The fusion features of candidate maintenance step entities; This is the gate vector; For element-wise dot product; This is the gated weight matrix; This is a bias term.
6. The method as described in claim 5, characterized in that, In step S5, the answer prediction model is trained based on the total loss function, specifically including: Candidate maintenance step entities are divided into positive sample set and hard negative sample set. Soft negative sample set The answer prediction model is trained using a total loss function, where positive samples are the correct answers. Hard negative sample set These are error candidates that are semantically / structurally similar to positive samples; they are soft negative sample sets. It is a common error candidate; The total loss function is: in: ∈[0,1] represents the weighting coefficient. The value is 0.7; To compare the loss items, This is a ranking loss item.
7. The method as described in claim 6, characterized in that, The expression for the contrast loss term is: in, As a positive sample, Features of problem fusion; Cosine similarity; Temperature coefficient; The penalty coefficient for hard negative samples. ; For entities in the hard negative sample set ; For hard negative sample sets; These are hard negative samples; For entities in the soft negative sample set ; For soft negative sample sets; These are soft negative samples.
8. The method as described in claim 7, characterized in that, The expression for the ranking loss term is: in, This represents the ranking margin between positive samples and hard negative samples. This represents the ranking margin between positive samples and soft negative samples. .
9. The method as described in claim 8, characterized in that, In step S6, the fused features are input into the pre-trained answer prediction model, which outputs the final maintenance step entity answer corresponding to the equipment fault description question, specifically: Calculate the cosine similarity between the fusion features of each candidate maintenance step entity and the fusion features of the problem. Sort the cosine similarity in descending order and select the entity with the highest cosine similarity as the final answer; If multiple entities with the same cosine similarity exist, a second filtering process is performed using the knowledge graph path length, selecting the path length and the number of inference jumps. Consistent entities.
Citation Information
Patent Citations
Complex question multi-hop intelligent question answering method based on knowledge graph representation learning
CN115757715A
Intelligent question answering method based on collaboration between large language model and knowledge graph
WO2026056986A1