Question answering system fusing knowledge graph

By employing the collaborative work of knowledge extraction models, natural language understanding, graph convolutional neural networks, and replication networks in the question-answering system, the problems of inaccurate knowledge extraction and insufficient semantic parsing in existing systems are solved, achieving efficient, accurate, and natural answer generation to meet users' question-answering needs.

CN121786152APending Publication Date: 2026-04-03TIBET LANSA ZHIHUI TECHNOLOGY CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-20
Publication Date
2026-04-03

AI Technical Summary

Technical Problem

Existing question-answering systems that integrate knowledge graphs suffer from problems such as inaccurate knowledge extraction, insufficient semantic parsing capabilities, redundant or missing retrieval results, and unnatural answer generation during the knowledge organization and application process, making it difficult to meet users' needs for efficient, accurate, and readable question-answering.

Method used

The system employs a pre-defined knowledge extraction model to extract knowledge from unstructured text, transforms questions into structured queries through a natural language understanding module, performs knowledge retrieval using a graph convolutional neural network, and generates natural and fluent text answers through a copy network mechanism. Combined with visualization, the system enables collaborative work among its modules.

Benefits of technology

It improves the completeness and accuracy of the knowledge graph, enhances the ability to understand user intent, improves the accuracy and efficiency of knowledge retrieval, generates natural, fluent and highly readable answers, and comprehensively optimizes the performance of the question-answering system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121786152A_ABST
    Figure CN121786152A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of knowledge graph question answering, and discloses a knowledge graph fused question answering system which comprises a knowledge graph construction module, a natural language understanding module, a knowledge graph query module and an answer output module which are connected in sequence. The knowledge graph construction module performs knowledge extraction on the unstructured text to obtain triple data to construct a knowledge graph; the natural language understanding module converts a question input by a user in a natural language form into a structured query statement; the knowledge spectrogram query module performs retrieval in a knowledge graph according to the structured query statement and returns knowledge sub-graphs related to the query statement; and the answer output module inputs the knowledge sub-graph into an end-to-end generative model based on a copy network mechanism, generates a natural and smooth text answer and presents the text answer to the user. Through cooperative work of all the modules, efficient knowledge extraction, accurate intention understanding, efficient knowledge retrieval and high-quality answer generation are achieved, and the question and answer requirements of users can be met more efficiently and accurately.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of knowledge graph question answering technology, and in particular to a question answering system that integrates knowledge graphs. Background Technology

[0002] With the rapid development of information technology, knowledge-based intelligent question-answering systems have become an important research direction in the field of information services, and are widely used in scenarios such as intelligent customer service, information retrieval, and educational assistance. Knowledge graphs, as a structured form of knowledge representation, can clearly describe the relationships between entities, providing strong knowledge support for question-answering systems. Therefore, question-answering systems integrating knowledge graphs have become a key technological path to improve the accuracy and efficiency of question answering.

[0003] In existing technologies, question-answering systems integrating knowledge graphs still have many shortcomings in the process of knowledge organization and application. Knowledge graph construction often relies on traditional methods for knowledge extraction from unstructured text, making it difficult to accurately obtain entity and relation information. This results in limited completeness and accuracy of the constructed knowledge graph, affecting subsequent question-answering performance. User-input natural language questions are typically complex and diverse; existing systems lack the ability to effectively parse the semantics of these questions, making it difficult to convert them into a structured form that can be directly used for knowledge graph queries, leading to a mismatch between query intent and knowledge graph retrieval.

[0004] Meanwhile, traditional methods are often limited to simple entity matching and relationship traversal, failing to efficiently locate knowledge subgraphs relevant to the question, and are prone to redundant search results or missing key information. Furthermore, the answers output by existing systems are mostly fragmented pieces of information, lacking the coherence and readability of natural language, and their visualization methods are monotonous, failing to meet users' needs for intuitive understanding of the answers.

[0005] Therefore, how to build a question-answering system that integrates knowledge graphs to achieve efficient knowledge extraction, accurate semantic parsing, intelligent knowledge retrieval, and high-quality answer generation has become a technical problem that urgently needs to be solved in this field. Summary of the Invention

[0006] This invention provides a question-answering system that integrates knowledge graphs. Through the collaborative work of various modules, it achieves efficient knowledge extraction, accurate intent understanding, efficient knowledge retrieval, high-quality answer generation, and visual presentation, comprehensively optimizing system performance and more efficiently and accurately meeting users' question-answering needs.

[0007] This invention provides a question-answering system that integrates knowledge graphs, comprising a knowledge graph construction module, a natural language understanding module, a knowledge graph query module, and an answer output module connected in sequence;

[0008] The knowledge graph construction module is used to extract knowledge from unstructured text using a preset knowledge extraction model to obtain triple data, and to construct a knowledge graph based on the triple data.

[0009] The natural language understanding module is used to convert the questions entered by the user in natural language into structured query statements;

[0010] The knowledge graph query module is used to retrieve information from the knowledge graph based on the structured query statement output by the natural language understanding module, and return a knowledge subgraph related to the query statement.

[0011] The answer output module is used to input the knowledge subgraph output by the knowledge graph query module into an end-to-end generative model based on a replication network mechanism to generate a natural and fluent text answer, and then present the text answer to the user in a visual manner.

[0012] Furthermore, in the knowledge graph construction module, the preset knowledge extraction model includes a sequence pruning layer, an information representation layer, and an entity relation extraction layer. The unstructured text sequence crawled by a web crawler is processed by the sequence pruning layer to obtain sentence x. Sentence x is then fed into the pre-trained model RoBERTa in the information representation layer, where each character in sentence x is converted into a representation vector h with contextual information. N The representation vector h N The entity and relation extraction layer is fed into the entity and relation extraction layer to extract the triple (s,r,o).

[0013] Furthermore, when training the pre-defined knowledge extraction model, a pre-defined dataset is used, and the dataset is preprocessed to convert the original text information into a data format that the model can train, and data that does not meet the requirements is removed. Named entity recognition requires labeling entities in the text, and relation extraction requires labeling triple information in the text. The labeling uses an encoding method to generate an encoded sequence based on the original data. The entity relation extraction task is based on the sequence labeling encoding method. The sequence labeling uses the BIO labeling method, where B represents the start position of the entity name, I represents the middle position of the entity name, and O represents a non-entity name.

[0014] Furthermore, the sequence trimming layer includes:

[0015] Sequence segmentation during model training: In the pre-defined knowledge extraction model training phase, the label information in the dataset is used for segmentation. Specifically, the text sequence is aligned with the BIO label sequence, and the positions of the first "B" from the left and the first "I" from the right in the BIO label sequence are found. Then, the position of the first "." from the left of "B" is found. If found, the sentence beginning is the next position; otherwise, the sentence beginning is the beginning of the entire sequence. Finally, the position of the first "." from the right of "I" is found, and the sentence end position is this position. The sentence x obtained after sequence segmentation is used as the input of the pre-training layer.

[0016] Sequence segmentation in the model prediction stage: In the preset knowledge extraction model prediction stage, the text sequence is split according to ".", and the resulting sentences are sent to the entity relation extraction layer in sequence. If the length of the obtained sentence is greater than the maximum sequence length of the entity relation extraction layer, the sentence is shortened so that the sentence length is less than the maximum sequence length of the information representation layer.

[0017] Furthermore, the input to the pre-trained RoBERTa model of the information representation layer is the sum of three types of vectors: character vectors, text vectors, and position vectors. The character vectors are obtained by converting each character in the text into a one-dimensional vector through a vocabulary. The text vectors are used to characterize the global semantic information of the text and are fused with the semantic information of characters or words. Their values ​​are automatically learned during the model training process. The position vectors are used to enable the RoBERTa model to distinguish between the same characters or words appearing in different positions.

[0018] RoBERTa is composed of multiple stacked Transformer encoders. The output of RoBERTa is a representation vector with contextual information, which is used as the input of the entity relation extraction layer.

[0019] The RoBERTa model employs a dynamic masking mechanism for training, generating a new mask randomly selected for each input sequence in the model. Simultaneously, a FULL-SENTENCE strategy is used when learning relationships between sentences, extending the input sequence length to 512. When RoBERTa is used as a pre-trained model, the original text sequence is directly converted using preprocessing tools provided by the Tensorflow framework as input to the RoBERTa model. The maximum length of the RoBERTa input sequence is 512. For text sequences longer than 512 input to the pre-defined knowledge extraction model, the sequence pruning layer performs sequence pruning operations.

[0020] Furthermore, the entity relation extraction layer consists of a Subject Tagger and several relation-specific Object Taggers; wherein the Subject Tagger marks all entities in the sentence, and then the marked information is mixed with the sentence representation and input to each Object Tagger. If the entities in the sentence have a certain relation, the Object Tagger specific to this relation marks the two entities, thereby obtaining the triple information contained in the sentence.

[0021] Subject Tagger takes the context-informed representation vector from the pre-trained model as input. Let sentence x possibly contain the triple (s, r, o). The formula is derived using the chain rule of conditional probability:

[0022] ∏ (s,r,o)∈T p((s,r,o)|x)=∏ s∈T p(s|x)∏ (r,o)∈T|s p((r,o)|s,x)

[0023] Where T represents the set of triples in the sentence, s∈T represents a partial triple containing entity s in T, and (r,o)∈T|s represents a (r,o) pair related to entity s. If, for a given entity s, a relation r exists in x related to s, then another specific entity o exists in x. Other relations different from r will not have a specific entity in x, resulting in the following formula:

[0024] ∏ (s,r,o)∈T p((s,r,o)|x)=∏ s∈T p(s|x)∏ r∈T|s pr(o|s,x)∏ r∈R\T|s p r (o φ |s,x)

[0025] Where R represents the set of all relations, r∈T|s represents the relations related to entity s, and r∈R\T|s represents all relations except those related to entity s; φ p represents an empty entity. r Let p(s|x) represent the probability specific to relation r. A SubjectTagger is trained based on p(s|x) to learn entities in the sentence. For each relation, p... r(o|s,x) trains a relation-specific object tagger to identify entity o given entity s in a specific relation r; in this way, each relation is modeled as a function of s to o, rather than classifying (s,o) pairs; first, the object tagger is run to check all possible entities in the sentence, and then for each entity found, the relation-specific object tagger is used to find all related relations and entities, thus obtaining the triple information (s,r,o) in the sentence.

[0026] Furthermore, the natural language understanding module uses a pre-trained transformation model based on bidirectional encoder representation to semantically encode the questions, and simultaneously completes intent recognition and slot filling through multi-task learning. The intent recognition task determines the question category to which the question belongs, including query, comparison, and calculation, while the slot filling task extracts key semantic elements such as entities, attributes, relationships, and constraints from the questions.

[0027] The semantic slot sequence is labeled using a biological long short-term memory model (LSTM) combined with a conditional random field (CRF) architecture. First, the question Q is encoded into a context vector E using a transformation model based on a bidirectional encoder representation. Q ={e1,e2,…,e n}, where e i Let E be the d-dimensional vector representation of the i-th character. Q The bidirectional LSTM model is used to extract temporal features, and then the globally optimal label sequence y is obtained through CRF decoding. * Its formula is:

[0028] y * =argmax y∈Y (Q)Score( E Q,y)

[0029]

[0030] Where Y(Q) represents the set of all possible label sequences of Q; T represents the CRF transition matrix; Indicates from label y i-1 Transfer to y i The transition score; P is the LSTM output layer matrix; This indicates that the i-th character is labeled as y. i The launch score.

[0031] Furthermore, the knowledge graph query module employs an embedding method based on graph convolutional neural networks to map entities and relations in the knowledge graph to a low-dimensional continuous vector space. It also incorporates a predicate-level attention mechanism and a path sampling strategy based on reinforcement learning. Specifically, given a knowledge graph, the graph convolutional neural network aggregates the neighbor information of nodes through an aggregation function, iteratively updating the node representation as follows:

[0032]

[0033] in, Let N(v) represent the d-dimensional latent vector of node v at level l; N(v) represent the set of neighboring nodes of v; α uv W represents the attention weights among neighbors. (l) and b (l) Let represent the weight matrix and bias vector of the l-th layer, respectively; σ is the activation function; after obtaining the vector representation of all nodes, for a given structured query, candidate answers related to the query are quickly found by calculating the inner product of the sum of the entity vector and the relation vector with other entity vectors.

[0034] Furthermore, the answer output module adopts an end-to-end generative model based on a replication network mechanism and an answer ranking algorithm based on an attention graph network. It also introduces multimodal heterogeneous information fusion technology to integrate different types of answer information and generate rich media answer pages.

[0035] In the answer generation stage, the replication network model takes the knowledge subgraph as input and generates natural language answers through an encoder-decoder architecture. The encoder uses bidirectional gated recurrent units to encode the node and edge information of the subgraph to obtain semantic vector representations. and The decoder also uses a gated loop unit, which, at each time step t, is based on the current hidden state s. t Attention distribution a t and replication probability Predict target word y t Its formula is:

[0036]

[0037] Where, p vocab (y t ) represents the Softmax probability over the vocabulary; This represents the probability of copying a word from a knowledge subgraph, which is calculated using a gating function. The formula is as follows:

[0038]

[0039] Among them, w c Represents a parameter vector; The context vector at time t is obtained by analyzing the encoder's hidden state. We get the weighted summation; x t Let t be the decoder input word vector;

[0040] Furthermore, the answer output module is designed with an attention-based graph ranking network, treating sentences in the answer as nodes in a graph and semantic dependencies between sentences as directed edges. It learns the optimal ranking path by iteratively calculating the importance scores of sentence nodes; where the i-th sentence node v i The formula for calculating the importance score in the k-th iteration is:

[0041]

[0042] Where q, w1, w2, b1, and b2 represent learnable parameter matrices or vectors; Indicates v i The hidden state after the k-th iteration; e ij For edge (v) j v i ) of d r 3D embedding vector; N(i) is v i The set of neighboring nodes; It can be initialized to sentence v i The transformation model based on bidirectional encoder representation encodes vectors, and finally uses the node with the highest importance score as the starting point to decode the optimal ranking through beam search.

[0043] The beneficial effects of this invention are as follows:

[0044] This invention employs a knowledge graph construction module with a pre-defined knowledge extraction model to effectively extract knowledge from unstructured text and construct a knowledge graph, thereby improving the completeness and accuracy of the knowledge graph. The natural language understanding module accurately converts natural language questions into structured query statements, enhancing the ability to understand user intent. The knowledge graph query module efficiently retrieves relevant knowledge subgraphs, improving the accuracy and efficiency of knowledge retrieval. The answer output module utilizes an end-to-end generative model based on a replication network mechanism to generate natural and fluent text answers and present them visually, improving the readability and user experience. Simultaneously, the collaborative work of these modules comprehensively optimizes the overall performance of the question-and-answer system, enabling it to more efficiently and accurately meet users' question-and-answer needs. Attached Figure Description

[0045] Figure 1 This is a schematic diagram of the question-answering system that integrates knowledge graphs according to the present invention.

[0046] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0047] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.

[0048] like Figure 1 As shown, the present invention provides a question-answering system that integrates knowledge graphs, including a knowledge graph construction module, a natural language understanding module, a knowledge graph query module, and an answer output module connected in sequence.

[0049] (1) Knowledge Graph Construction Module

[0050] The knowledge graph construction module is used to extract knowledge from unstructured text using a preset knowledge extraction model to obtain triple data, and to construct a knowledge graph based on the triple data.

[0051] The pre-defined knowledge extraction model includes a sequence pruning layer, an information representation layer, and an entity relation extraction layer. Unstructured text sequences crawled from the web are processed by the sequence pruning layer to obtain sentence x. Sentence x is then fed into the pre-trained RoBERTa model in the information representation layer, where each character in sentence x is converted into a representation vector h with contextual information. N The representation vector h N The entity and relation extraction layer is fed into the entity and relation extraction layer to extract the triple (s,r,o).

[0052] When training the pre-defined knowledge extraction model, a pre-defined dataset is used and preprocessed to convert the original text information into a trainable data format for the model, and data that does not meet the requirements is removed. Named entity recognition requires labeling entities in the text, and relation extraction requires labeling triples in the text. Labeling uses encoding to generate coded sequences based on the original data. The entity-relation extraction task is based on the sequence labeling encoding method. Sequence labeling uses the BIO annotation method, where B represents the start position of an entity name, I represents the middle position of an entity name, and O represents a non-entity name. For example, in the text sequence "A was held in B on XX year XX month XX day", the sequence labeling result using BIO after named entity recognition is "BIIIIIIOOOOOOOOOOOOOBIIIIIIIIOO", thus identifying "A" and "B". This annotation method is simple to use and has high accuracy.

[0053] ① Sequence clipping layer

[0054] Text sequences may contain a large amount of information unrelated to entities and relationships, and their length may exceed the maximum sequence length that the model's pre-training layers can accept. Excessively long sequences can negatively impact model training and prediction performance, so sequence segmentation is necessary for text sequences with the maximum length. Different sequence segmentation methods are used during model training and prediction.

[0055] a. Sequence Segmentation during Model Training: During model training, since the temporal extraction layer does not involve the data sequence, sequence segmentation can be performed using the label information in the dataset. Specifically, the text sequence is aligned with the BIO label sequence. The positions of the first "B" from the left and the first "I" from the right in the BIO label sequence are found. Then, the position of the first "." from the left of "B" is found. If found, the sentence beginning is the next position; otherwise, the sentence beginning is the beginning of the entire sequence. Finally, the position of the first "." from the right of "I" is found; the sentence ending position is this position. The sentence obtained after sequence segmentation is used as input to the pre-training layer.

[0056] b. Sequence Segmentation in the Model Prediction Stage: In the model prediction stage, excessively long text sequences are first processed through a time extraction layer to obtain their global time information. Then, the text sequence is split into segments ("."), and the resulting sentences are sequentially fed into the entity relation extraction layer. If the length of the resulting sentence is still greater than the maximum sequence length of the entity relation extraction layer, the entire text sequence is discarded. This approach disrupts the contextual semantic relationships between sentences, leading to a decrease in model prediction performance. Therefore, in both the prediction and deployment stages, it is crucial to select sequences shorter than the maximum sequence length of the pre-training layer as the knowledge source for the temporal knowledge graph. Furthermore, if the length of the resulting sentence exceeds the maximum sequence length of the entity relation extraction layer, the sentence is shortened to be less than the maximum sequence length of the information representation layer.

[0057] ② Information Representation Layer

[0058] In natural language processing, the application of pre-trained models has enabled many tasks to achieve excellent results. Pre-trained models learn from massive amounts of data through self-supervised learning. They can obtain context-sensitive representations of input sequences, which can be used in a variety of downstream tasks. This reduces the training workload for downstream tasks and significantly improves their performance.

[0059] The pre-trained model RoBERTa (Robustly Optimized BERT approach) transforms input sentences into representation vectors with contextual information. RoBERTa is a pre-trained model based on BERT (Bidirectional Encoder Representation from Transformers). It adjusts some configurations and mechanisms in the BERT training process and outperforms BERT on multiple tasks.

[0060] The pre-trained RoBERTa model for the information representation layer takes as input the sum of three types of vectors: character vectors, text vectors, and position vectors. Character vectors are obtained by converting each character in the text into a one-dimensional vector using a vocabulary. Text vectors characterize the global semantic information of the text and are fused with the semantic information of characters or words; their values ​​are automatically learned during model training. Position vectors allow the RoBERTa model to distinguish between identical characters or words appearing in different positions, as the same character or word may have different semantic information in different positions within the text. When RoBERTa is used as a pre-trained model, the original text sequence can be directly converted into input using the preprocessing tools provided by the Tensorflow framework. The maximum length of the RoBERTa input sequence is 512, so for text sequences longer than 512 characters input into the pre-defined knowledge extraction model, sequence pruning is required.

[0061] RoBERTa is composed of multiple stacked Transformer encoders. The output of RoBERTa is a representation vector with contextual information, which is used as the input of the entity relation extraction layer. The use of RoBERTa can improve the subsequent performance of the entity relation extraction task.

[0062] The RoBERTa model has the following optimizations compared to the BERT model:

[0063] 1) The RoBERTa model uses a dynamic masking mechanism for training. Each time the input sequence is used in the model, a new mask is randomly selected. Compared with the static masking mechanism of the BERT model, the semantic representation obtained by the RoBERTa model incorporates more information about the input sequence.

[0064] 2) The RoBERTa model uses the “FULL-SENTENCE” strategy when learning relationships between sentences, extending the input sequence length to 512, which can handle longer sequences compared to the BERT model.

[0065] 3) The RoBERTa model uses larger training data and batch size than the BERT model, resulting in better overall training performance than the BERT model.

[0066] In summary, the RoBERTa model outperforms the BERT model overall. The pre-trained knowledge extraction model using RoBERTa significantly improves performance in entity relation extraction.

[0067] ③ Entity Relationship Extraction Layer

[0068] The entity relation extraction layer consists of a SubjectTagger and several relation-specific ObjectTaggers. The SubjectTagger marks all entities in the sentence and then inputs the marked information into the sentence representation into each ObjectTagger. If the entities in the sentence have a certain relation, the ObjectTagger specific to this relation marks the two entities, thereby obtaining the triple information contained in the sentence.

[0069] Subject Tagger takes the context-informed representation vector from the pre-trained model as input. Let sentence x possibly contain the triple (s, r, o). The formula is derived using the chain rule of conditional probability:

[0070] ∏ (s,r,o)∈T p((s,r,o)|x)=∏ s∈T p(s|x)∏ (r,o)∈T|s p((r,o)|s,x)

[0071] Where T represents the set of triples in the sentence, s∈T represents a partial triple containing entity s in T, and (r,o)∈T|s represents a (r,o) pair related to entity s. If, for a given entity s, a relation r exists in x related to s, then another specific entity o exists in x. Other relations different from r will not have a specific entity in x, resulting in the following formula:

[0072] ∏ (s,r,o)∈T p((s,r,o)|x)=∏ s∈T p(s|x)∏ r∈T|s p r (o|s,x)∏ r∈R\T|s p r (o φ |s,x)

[0073] Where R represents the set of all relations, r∈T|s represents the relations related to entity s, and r∈R\T|s represents all relations except those related to entity s; φp represents an empty entity. r Let p(x|s) represent the probability specific to relation r. A SubjectTagger is trained based on p(x|s) to learn entities in the sentence. For each relation, p... r (o|S,x) trains a relation-specific object tagger to identify entity o given entity s in the context of a specific relation r; in this way, each relation is modeled as a function that maps s to o, rather than classifying (s,o) pairs; first, the object tagger is run to check all possible entities in the sentence, and then for each entity found, the relation-specific object tagger is used to find all related relations and entities, thus obtaining the triple information (s,r,o) in the sentence;

[0074] The input to SubjectTagger is the input of the pre-trained model. N It consists of two identical binary classifiers, which detect the start and end positions of entities, respectively, and are denoted by h. N Each vector in the input vector is assigned a binary tag; a tag "1" indicates the start or end position of the corresponding entity. N [i] is operated using the following formula:

[0075]

[0076] in, and This indicates that in the input sequence h N [i] represents the probability of the start and end positions of an entity. If the probability exceeds a certain threshold, the corresponding flag value is assigned as 1; otherwise, it is assigned as 0. i It is the i-th feature representation in the original input sequence, i.e., x i =h N [i];W start and W end b represents the trainable weights. start and b end This represents the bias, where σ is the sigmoid activation function;

[0077] For the detection of multiple entities, the matching principle is to mark the closest start and end positions. The end position cannot be before the start position. The range between the start and end positions is the scope of the entity. This matching strategy can take into account the integrity of the entities.

[0078] Object Taggers are trained based on specific relationships. There is one Object Tagger for each type of relationship. They simultaneously identify various types of relationships between entities detected in the Subject Tagger. Each Object Tagger has the same structure as the Subject Tagger, the difference being that the Subject Tagger directly decodes h. N Object Tagger in decoding h N It also considers the characteristics of the entity. The operations for input in each specific type of Object Tagger are as follows:

[0079]

[0080] in, It is the input of Object Tagger. and These represent the probabilities of recognizing the i-th input as the start and end positions of an entity, respectively. This represents the representation vector of the k-th entity detected in the Subject Tagger module. Entities typically consist of multiple characters. To make x in the above two formulas... i and They can be added, but the dimensions of the two vectors must be kept consistent. Therefore, the average vector representation between the start and end markers of the k-th entity needs to be used as... Each Object Tagger for a specific relationship will process the input in the same way.

[0081] (2) Natural Language Understanding Module

[0082] The natural language understanding module is used to convert user-inputted questions in natural language into structured query statements.

[0083] The natural language understanding module acts as a bridge in the question-answering system, responsible for converting user-submitted questions in natural language into structured queries. This module, based on deep learning, uses a pre-trained transformation model based on bidirectional encoder representation to semantically encode the questions. Through multi-task learning, it simultaneously performs intent recognition and slot filling. The intent recognition task determines the question category (query, comparison, computation), while the slot filling task extracts key semantic elements such as entities, attributes, relationships, and constraints from the questions. Specifically, it uses a long short-term memory (LSTM) model combined with a conditional random field (CRF) architecture to label the semantic slot sequences. First, the question Q is encoded into a context vector E using the transformation model based on bidirectional encoder representation. Q ={e1,e2,…,e n}, where e i Let E be the d-dimensional vector representation of the i-th character. Q The bidirectional LSTM model is used to extract temporal features, and then the globally optimal label sequence y is obtained through CRF decoding. * Its formula is:

[0084] y * =argmax y∈Y (Q)Score(E Q ,y)

[0085]

[0086] Where Y(Q) represents the set of all possible label sequences of Q; T represents the CRF transition matrix; Indicates from label y i-1 Transfer to y i The transition score; P is the LSTM output layer matrix; This indicates that the i-th character is labeled as y. i The launch score.

[0087] By training on a dataset labeled with specific intent slots, the model can accurately understand the semantics of questions, extract key information, and formalize natural language questions into triple queries or multi-hop queries, laying the foundation for subsequent knowledge graph queries.

[0088] (3) Knowledge Graph Query Module

[0089] The knowledge graph query module is used to retrieve information from the knowledge graph based on the structured query statement output by the natural language understanding module, and return a knowledge subgraph related to the query statement.

[0090] The knowledge graph query module is a core component of the question-answering system. Its main function is to retrieve the knowledge graph based on the structured query extracted by the natural language understanding module and return a subgraph related to the query. This module employs an embedding method based on graph convolutional neural networks to map entities and relations in the knowledge graph to a low-dimensional continuous vector space to improve query efficiency and accuracy. To support complex queries, such as multi-hop and constrained queries, the module also incorporates a predicate-level attention mechanism and a path sampling strategy based on reinforcement learning. Specifically, given a knowledge graph, the graph convolutional neural network aggregates the neighbor information of nodes through an aggregation function, iteratively updating the node representation as follows:

[0091]

[0092] in, Let N(v) represent the d-dimensional latent vector of node v at level l; N(v) represent the set of neighboring nodes of v; α uv W represents the attention weights among neighbors. (l) and b (l) Let represent the weight matrix and bias vector of the l-th layer, respectively; σ is the activation function. After obtaining the vector representations of all nodes, for a given structured query, candidate answers related to the query are quickly found by calculating the inner product of the sum of the entity vector and the relation vector with other entity vectors. To further improve recall, for multi-hop queries, this module adopts a path sampling strategy based on the policy gradient algorithm in reinforcement learning. By training a reinforcement learning agent, the optimal query path is explored through trial and error.

[0093] (4) Answer Output Module

[0094] The answer output module is used to input the knowledge subgraph output by the knowledge graph query module into an end-to-end generative model based on a replication network mechanism to generate a natural and fluent text answer, and then present the text answer to the user in a visual manner.

[0095] The answer generation and display module, located at the end of the intelligent question-answering system, is responsible for transforming the structured results obtained from knowledge graph queries into natural and fluent text answers, and presenting them to users in a user-friendly visual format. This module employs an end-to-end generative model based on a replication network mechanism and an answer ranking algorithm based on an attention graph network, aiming to improve the accuracy, completeness, and readability of the answers. Simultaneously, this module also introduces multimodal heterogeneous information fusion technology to integrate different types of answer information, such as text, images, and tables, to generate rich media answer pages.

[0096] In the answer generation stage, the replication network model takes the knowledge subgraph as input and generates natural language answers through an encoder-decoder architecture. The encoder uses bidirectional gated recurrent units to encode the node and edge information of the subgraph to obtain semantic vector representations. and The decoder also uses a gated loop unit, which, at each time step t, is based on the current hidden state s. t Attention distribution a t and replication probability Predict target word y t Its formula is:

[0097]

[0098] Where, p vocab (y t ) represents the Softmax probability over the vocabulary; This represents the probability of copying a word from a knowledge subgraph, which is calculated using a gating function. The formula is as follows:

[0099]

[0100] Among them, w c Represents a parameter vector; The context vector at time t is obtained by analyzing the encoder's hidden state. We get the weighted summation; x t Let t be the decoder input word vector.

[0101] The mechanism combining generation and replication enables the model to flexibly extract key information from background knowledge based on the question, thereby obtaining substantive answers. To optimize the structure and order of the answers, this module also designs an attention-based graph ranking network, treating sentences in the answer as nodes in a graph and semantic dependencies between sentences (such as causal, parallel, etc.) as directed edges. The optimal ranking path is learned by iteratively calculating the importance scores of sentence nodes; where the i-th sentence node v... i The formula for calculating the importance score in the k-th iteration is:

[0102]

[0103] in, w1, w2, b1, b2 represent learnable parameter matrices or vectors; Indicates v i The hidden state after the k-th iteration; e ij For edge (v) j v i ) of d r 3D embedding vector; N(i) is v i The set of neighboring nodes; It can be initialized to sentence v i The transformation model based on bidirectional encoder representation encodes vectors, and finally uses the node with the highest importance score as the starting point to decode the optimal ranking through beam search.

[0104] This invention employs a knowledge graph construction module with a pre-defined knowledge extraction model to effectively extract knowledge from unstructured text and construct a knowledge graph, thereby improving the completeness and accuracy of the knowledge graph. The natural language understanding module accurately converts natural language questions into structured query statements, enhancing the ability to understand user intent. The knowledge graph query module efficiently retrieves relevant knowledge subgraphs, improving the accuracy and efficiency of knowledge retrieval. The answer output module utilizes an end-to-end generative model based on a replication network mechanism to generate natural and fluent text answers and present them visually, improving the readability and user experience. Simultaneously, the collaborative work of these modules comprehensively optimizes the overall performance of the question-and-answer system, enabling it to more efficiently and accurately meet users' question-and-answer needs.

[0105] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, apparatus, article, or method that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, apparatus, article, or method. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, apparatus, article, or method that includes that element.

[0106] The above description is merely a preferred embodiment of the present invention and does not limit the patent scope of the present invention. Any equivalent structural or procedural transformations made based on the content of the present invention's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of the present invention.

Claims

1. A question-answering system integrating knowledge graphs, characterized in that, It includes a knowledge graph construction module, a natural language understanding module, a knowledge graph query module, and an answer output module, which are connected in sequence. The knowledge graph construction module is used to extract knowledge from unstructured text using a preset knowledge extraction model to obtain triple data, and to construct a knowledge graph based on the triple data. The natural language understanding module is used to convert the questions entered by the user in natural language into structured query statements; The knowledge graph query module is used to retrieve information from the knowledge graph based on the structured query statement output by the natural language understanding module, and return a knowledge subgraph related to the query statement. The answer output module is used to input the knowledge subgraph output by the knowledge graph query module into an end-to-end generative model based on a replication network mechanism to generate a natural and fluent text answer, and then present the text answer to the user in a visual manner.

2. The question-answering system integrating knowledge graphs according to claim 1, characterized in that, In the knowledge graph construction module, the preset knowledge extraction model includes a sequence trimming layer, an information representation layer, and an entity relation extraction layer. Unstructured text sequences crawled from web crawlers are processed by the sequence trimming layer to obtain sentence x. Sentence x is then fed into the pre-trained RoBERTa model in the information representation layer, where each character in sentence x is converted into a representation vector h with contextual information. N The representation vector h N The entity and relation extraction layer is fed into the entity and relation extraction layer to extract the triple (s,r,o).

3. The question-answering system integrating knowledge graphs according to claim 2, characterized in that, When training the preset knowledge extraction model, a preset dataset is used, and the preset dataset is preprocessed to convert the original text information into a data form that the model can train, and data that does not meet the requirements is removed. Named entity recognition requires labeling entities in text, while relation extraction requires labeling triple information in text. Labeling uses an encoding method to generate an encoded sequence based on the original data. Entity relation extraction tasks are based on the encoding method of sequence labeling. Sequence labeling uses the BIO labeling method, where B represents the beginning of an entity name, I represents the middle of an entity name, and O represents a non-entity name.

4. The question-answering system integrating knowledge graphs according to claim 3, characterized in that, The sequence trimming layer includes: Sequence segmentation during model training: In the pre-defined knowledge extraction model training phase, the label information in the dataset is used for segmentation. Specifically, the text sequence is aligned with the BIO label sequence, and the positions of the first "B" from the left and the first "I" from the right in the BIO label sequence are found. Then, the position of the first "." from the left of "B" is found. If found, the sentence beginning is the next position; if not found, the sentence beginning is the beginning of the entire sequence. Finally, the position of the first "." from the right of "I" is found, and the sentence end position is this position. The sentence x obtained after sequence segmentation is used as the input of the pre-training layer. Sequence segmentation in the model prediction stage: In the preset knowledge extraction model prediction stage, the text sequence is split according to ".", and the resulting sentences are sequentially sent to the entity relation extraction layer. If the length of the obtained sentence is greater than the maximum sequence length of the entity relation extraction layer, the sentence is shortened so that the sentence length is less than the maximum sequence length of the information representation layer.

5. The question-answering system integrating knowledge graphs according to claim 4, characterized in that, The pre-trained model RoBERTa of the information representation layer takes as input the sum of three types of vectors: character vectors, text vectors, and position vectors. The character vectors are obtained by converting each character in the text into a one-dimensional vector through a vocabulary. The text vectors are used to characterize the global semantic information of the text and are fused with the semantic information of characters or words. Their values ​​are automatically learned during the model training process. The position vector is used to enable the RoBERTa model to distinguish between the same characters or words appearing in different positions; RoBERTa is composed of multiple stacked Transformer encoders. The output of RoBERTa is a representation vector with contextual information, which is used as the input of the entity relation extraction layer. The RoBERTa model employs a dynamic masking mechanism for training, generating a new mask randomly selected for each input sequence in the model. Simultaneously, a FULL-SENTENCE strategy is used when learning relationships between sentences, extending the input sequence length to 512. When RoBERTa is used as a pre-trained model, the original text sequence is directly converted using preprocessing tools provided by the Tensorflow framework as input to the RoBERTa model. The maximum length of the RoBERTa input sequence is 512. For text sequences longer than 512 input to the pre-defined knowledge extraction model, the sequence pruning layer performs sequence pruning operations.

6. The question-answering system integrating knowledge graphs according to claim 5, characterized in that, The entity relation extraction layer consists of a Subject Tagger and several relation-specific Object Taggers. The Subject Tagger marks all entities in the sentence and then inputs the marked information into the sentence representation into each Object Tagger. If the entities in the sentence have a certain relation, the Object Tagger specific to this relation marks the two entities, thereby obtaining the triple information contained in the sentence. Subject Tagger takes the context-informed representation vector from the pre-trained model as input. Let sentence x possibly contain the triple (s, r, o). The formula is derived using the chain rule of conditional probability: ∏ (s,r,o)∈T p((s,r,o)|x)=∏ s∈T p(s|x)∏ (r,o)∈T|s p((r,o)|s,x) Where T represents the set of triples in the sentence, s∈T represents a partial triple containing entity s in T, and (r,o)∈T|s represents a (r,o) pair related to entity s. If, for a given entity s, a relation r exists in x related to s, then another specific entity o exists in x. Other relations different from r will not have a specific entity in x, resulting in the following formula: ∏ (s,r,o)∈T p((s,r,o)|x)=∏ s∈T p(s|x)∏ r∈T|s p r (o|s,x)∏ r∈R\T|s p r (o φ |S,x) Where R represents the set of all relations, r∈T|s represents the relations related to entity s, and r∈R\T|s represents all relations except those related to entity s; φ p represents an empty entity. r Let p(s|x) represent the probability specific to relation r. A Subject Tagger is trained based on p(s|x) to learn entities in the sentence. For each relation, p... r (o|s,x) trains a relation-specific object tagger to identify entity o given entity s in a specific relation r; in this way, each relation is modeled as a function of s to o, rather than classifying (s,o) pairs; first, the object tagger is run to check all possible entities in the sentence, and then for each entity found, the relation-specific object tagger is used to find all related relations and entities, thus obtaining the triple information (s,r,o) in the sentence.

7. The question-answering system integrating knowledge graphs according to claim 1, characterized in that, The natural language understanding module uses a pre-trained transformation model based on bidirectional encoder representation to semantically encode questions, and simultaneously completes intent recognition and slot filling through multi-task learning. The intent recognition task determines the question category to which the question belongs, including query, comparison, and calculation, while the slot filling task extracts key semantic elements such as entities, attributes, relationships, and constraints from the question. The semantic slot sequence is labeled using a biological long short-term memory model (LSTM) combined with a conditional random field (CRF) architecture. First, the question Q is encoded into a context vector E using a transformation model based on a bidirectional encoder representation. Q ={e1,e2,…,e n }, where e i Let E be the d-dimensional vector representation of the i-th character. Q The bidirectional LSTM model is used to extract temporal features, and then the globally optimal label sequence y is obtained through CRF decoding. * Its formula is: y * =argmax y∈Y (Q)Score(E Q ,y) Where Y(Q) represents the set of all possible label sequences of Q; T represents the CRF transition matrix; Indicates from label y i-1 Transfer to y i The transition score; P is the LSTM output layer matrix; This indicates that the i-th character is labeled as y. i The launch score.

8. The question-answering system integrating knowledge graphs according to claim 1, characterized in that, The knowledge graph query module employs an embedding method based on graph convolutional neural networks to map entities and relationships in the knowledge graph to a low-dimensional continuous vector space. It also incorporates a predicate-level attention mechanism and a path sampling strategy based on reinforcement learning. Specifically, given a knowledge graph, the graph convolutional neural network aggregates the neighbor information of nodes through an aggregation function, iteratively updating the node representation as follows: in, Let N(v) represent the d-dimensional latent vector of node v at level l; N(v) represent the set of neighboring nodes of v; α uv W represents the attention weights among neighbors. (l) and b (l) Let represent the weight matrix and bias vector of the l-th layer, respectively; σ is the activation function; after obtaining the vector representation of all nodes, for a given structured query, candidate answers related to the query are quickly found by calculating the inner product of the sum of the entity vector and the relation vector with other entity vectors.

9. The question-answering system integrating knowledge graphs according to claim 1, characterized in that, The answer output module adopts an end-to-end generative model based on a replication network mechanism and an answer ranking algorithm based on an attention graph network. It also introduces multimodal heterogeneous information fusion technology to integrate different types of answer information and generate rich media answer pages. In the answer generation stage, the replication network model takes the knowledge subgraph as input and generates natural language answers through an encoder-decoder architecture. The encoder uses bidirectional gated recurrent units to encode the node and edge information of the subgraph to obtain semantic vector representations. and The decoder also uses a gated loop unit, which, at each time step t, is based on the current hidden state s. t Attention distribution a t and replication probability Predict target word y t Its formula is: Where, p vocab (y t ) represents the Softmax probability over the vocabulary; This represents the probability of copying a word from a knowledge subgraph, which is calculated using a gating function. The formula is as follows: Among them, w c Represents a parameter vector; The context vector at time t is obtained by analyzing the encoder's hidden state. We get the weighted summation; x t Let t be the decoder input word vector.

10. The question-answering system integrating knowledge graphs according to claim 9, characterized in that, The answer output module is designed with an attention-based graph ranking network. Sentences in the answer are treated as nodes in a graph, and semantic dependencies between sentences are treated as directed edges. The optimal ranking path is learned by iteratively calculating the importance scores of sentence nodes; where the i-th sentence node v i The formula for calculating the importance score in the k-th iteration is: in, w1, w2, b1, b2 represent learnable parameter matrices or vectors; Indicates v i The hidden state after the k-th iteration; e ij For edge (v) j v i ) of d r 3D embedding vector; N(i) is v i The set of neighboring nodes; It can be initialized to sentence v i The transformation model based on bidirectional encoder representation encodes vectors, and finally uses the node with the highest importance score as the starting point to decode the optimal ranking through beam search.

Citation Information

Cited By

  • A knowledge question and answer method and device based on a knowledge graph and a medium

    CN122242777A

  • A knowledge question and answer method and device based on a knowledge graph and a medium

    CN122242777B