Question answering processing method, device, equipment and readable medium for multilingual reasoning model
Through translation and inference training on the translated data set and knowledge graph, the number of statistical edges is weighted and fusion is solved, and the problem of inference in multilingual question-and-answer in the existing technology is low, achieving efficient and accurate multilingual question-and-answer in multilingual question-and-answer in the existing technology is achieved. deal with.
Patent Information
- Application Number
- CN202111251539.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-21
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2041-10-21
AI Technical Summary
The existing question-and-answer system trained on the English dataset cannot be directly applied to intelligent question-and-answer business scenarios in other languages. Due to the high cost of labeling, the efficiency and accuracy of using the English question-and-answer model to process after simple translation are insufficient.
By selecting the question-answer dataset and knowledge graph of the specified language, the translation is carried out inference training on the translated dataset and knowledge graph, and the edges of the knowledge graph are counted as weights, and the edges of the knowledge graph are weighted and fusion are generated and applied. multilingual reasoning model.
There is no need to collect data sets for each language, which improves the efficiency and accuracy of multilingual Q&A reasoning. The generated inference model is suitable for Q&A inference scenarios in various languages.
Smart Images

Figure CN113987121B_ABST
Abstract
Description
Background Art
[0002] At present, the research on intelligent question answering technology has made long-term development under the application background of deep learning architecture, among which the research on English intelligent question answering system is particularly popular.
[0003] In related technologies, considering the universality of language, most data sets are written in English, which undoubtedly provides sufficient support for the research of English intelligent question-answering systems. However, these question-answering reasoning systems trained on English data sets cannot be directly applied to intelligent question-answering business scenarios in other languages.
[0004] However, in reality, there are still a large number of intelligent question-answering business scenarios in low-resource languages, which has given rise to the need for question-answering reasoning systems in different languages. Due to the high annotation cost, it is unrealistic to collect data sets for each language to train models. In addition, simply translating questions and answers into English and then using the English question-answering reasoning model to process them cannot guarantee the efficiency and accuracy of intelligent question-answering.
[0005] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention
[0006] The purpose of the present disclosure is to provide a question-answering processing method, apparatus, device and readable medium for a multilingual reasoning model, which is used to overcome the problem of low efficiency of multilingual question-answering reasoning caused by limitations and defects of related technologies at least to a certain extent.
[0007] According to a first aspect of an embodiment of the present disclosure, a question-answering processing method for a multilingual reasoning model is provided, comprising: selecting a question set described in a specified language; selecting a question-answering dataset and a knowledge graph in the same language; translating the question-answering dataset and the knowledge graph according to a plurality of translation grammars of the specified language to obtain i translated question-answering datasets and j translated knowledge graphs; performing reasoning training on the i translated question-answering datasets and the j translated knowledge graphs; counting the number of edges of the knowledge reasoning path for finding a specified answer on the translated knowledge graph according to the training results; and performing weighted fusion on the corresponding edges in the j translated knowledge graphs with the number as a weight to obtain a translated reasoning model, wherein the translated reasoning model is suitable for answering questions in the question set described in the specified language.
[0008] In an exemplary embodiment of the present disclosure, performing reasoning training on the i translated question and answer datasets and the j translated knowledge graphs includes: combining the i translated question and answer datasets with the j translated knowledge graphs in pairs to obtain i×j training sample combinations; and performing reasoning training on any training sample combination of the i×j training sample combinations in turn.
[0009] In an exemplary embodiment of the present disclosure, performing reasoning training on any training sample combination among the i×j training sample combinations in sequence includes: determining a first question and answer data set and a first knowledge graph in the first training sample combination; determining that the first question and answer data set includes k questions; extracting a sub-knowledge graph in the first knowledge graph according to any question in the first question and answer data set; taking any question in the first question and answer data set as a question node, and splicing it with the sub-knowledge graph to form a working graph; using a neural network to perform association information training on the working graph; starting from the question node in the trained working graph, determining a node whose weight meets a threshold requirement as an alternative answer node, and recording an inference path between the question node and the alternative answer node; and recording the question node, the alternative answer node and the inference path of the i×j training sample combinations.
[0010] In an exemplary embodiment of the present disclosure, counting the number of edges of the knowledge reasoning path that finds a specified answer on the translated knowledge graph based on the training results includes: writing the alternative answer node into an answer set; determining an alternative answer node that appears most frequently in the answer set as the specified answer; and counting the number of edges of the knowledge reasoning path that corresponds to the specified answer node.
[0011] In an exemplary embodiment of the present disclosure, it also includes: determining the two nodes of the p-th edge in the first knowledge graph, respectively recorded as the first node and the second node; determining the number of times the reasoning path recorded for the p-th edge passes; determining the association strength between the first node and the second node based on the number of times the reasoning path passes, and the association strength is positively correlated with the weight value of the weighted fusion.
[0012] In an exemplary embodiment of the present disclosure, it also includes: determining the association strength between two nodes on any edge in the knowledge graph; judging whether the association strength is less than a preset association strength; if it is determined that the association strength is less than the preset association strength, deleting the edge corresponding to the association strength.
[0013] In an exemplary embodiment of the present disclosure, the translation results of entities at corresponding positions in the j knowledge graphs are different.
[0014] According to a second aspect of an embodiment of the present disclosure, a question-answering processing device of a multilingual reasoning model is provided, comprising: a selection module, configured to select a question set described in a specified language; the selection module is further configured to select a question-answering dataset and a knowledge graph in the same language; a translation module, configured to translate the question-answering dataset and the knowledge graph according to a plurality of translation grammars of the specified language to obtain i translated question-answering datasets and j translated knowledge graphs; an inference module, configured to perform inference training on the i translated question-answering datasets and the j translated knowledge graphs; a statistics module, configured to count the number of edges of a knowledge inference path that finds a specified answer on the translated knowledge graph according to the training results; and a fusion module, configured to perform weighted fusion of corresponding edges in the j translated knowledge graphs with the number as a weight to obtain a translated inference model, wherein the translated inference model is suitable for answering questions in the question set described in the specified language.
[0015] According to a third aspect of the present disclosure, there is provided an electronic device, comprising: a memory; and a processor coupled to the memory, wherein the processor is configured to execute any one of the methods described above based on instructions stored in the memory.
[0016] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided, on which a program is stored, and when the program is executed by a processor, the question-answering processing method of the multilingual reasoning model as described in any one of the above items is implemented.
[0017] In the disclosed embodiment, the question-answering dataset and the knowledge graph are translated according to a plurality of translation grammars of the specified language to obtain i translated question-answering datasets and j translated knowledge graphs, and reasoning training is performed on the i translated question-answering datasets and the j translated knowledge graphs. There is no need to collect datasets for each language, and the number of edges of the knowledge reasoning path for finding the specified answer on the translated knowledge graph is counted through the training results, and the corresponding edges in the j translated knowledge graphs are weightedly fused with the number as the weight, that is, the association strength of the edges of the knowledge graphs corresponding to all reasoning models are weighted averaged according to the number of times counted, thereby merging different versions of knowledge graphs and generating a reliable reasoning model, thereby improving the efficiency and accuracy of multi-language question-answering reasoning.
[0018] Furthermore, the translated reasoning model is suitable for answering questions in the question set described in the specified language, and is widely applicable to question-answering reasoning scenarios in various languages.
[0019] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification are used to explain the principles of the present disclosure. Obviously, the accompanying drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without creative work.
[0021] Figure 1 A flowchart showing a question-answering processing method of a multilingual reasoning model in an exemplary embodiment of the present disclosure is shown;
[0022] Figure 2 A flowchart showing a question-answering processing method of a multilingual reasoning model in another exemplary embodiment of the present disclosure is shown;
[0023] Figure 3 A flowchart showing a question-answering processing method of a multilingual reasoning model in another exemplary embodiment of the present disclosure is shown;
[0024] Figure 4 A flowchart showing a question-answering processing method of a multilingual reasoning model in another exemplary embodiment of the present disclosure is shown;
[0025] Figure 5 A flowchart showing a question-answering processing method of a multilingual reasoning model in another exemplary embodiment of the present disclosure is shown;
[0026] Figure 6 A flowchart showing a question-answering processing method of a multilingual reasoning model in another exemplary embodiment of the present disclosure is shown;
[0027] Figure 7 A flowchart showing a question-answering processing method of a multilingual reasoning model in another exemplary embodiment of the present disclosure is shown;
[0028] Figure 8 A flowchart showing a question-answering processing method of a multilingual reasoning model in another exemplary embodiment of the present disclosure is shown;
[0029] Fig. 9 A flowchart showing a question-answering processing method of a multilingual reasoning model in another exemplary embodiment of the present disclosure is shown;
[0030] Fig.10 A block diagram of a question-answering processing device of a multilingual reasoning model in an exemplary embodiment of the present disclosure is shown;
[0031] Fig.11 A block diagram of an electronic device in an exemplary embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0032] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as being limited to the examples set forth herein; on the contrary, these embodiments are provided so that the present disclosure will be more comprehensive and complete, and the concepts of the example embodiments are fully conveyed to those skilled in the art. The described features, structures, or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced while omitting one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known technical solutions are not shown or described in detail to avoid obscuring various aspects of the present disclosure.
[0033] In addition, the accompanying drawings are only schematic diagrams of the present disclosure, and the same reference numerals in the drawings represent the same or similar parts, so their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities, which do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.
[0034] The embodiments of the present disclosure are implemented based on a knowledge graph, and the knowledge graph is explained in detail below.
[0035] Knowledge graph: A data structure based on a directed graph, consisting of nodes and directed edges. Each node in the graph is called an entity, and the edges represent the logical relationships between entities.
[0036] Knowledge graphs can be represented by triples (entity-1, relation, entity-2). Each record describes a fact. For example, (Five Mountains, One of the Five Mountains, Mount Tai) represents the fact that "Mount Tai is one of the Five Mountains". It should be noted that if the relation is fixed, the positions of entity-1 and entity-2 cannot be reversed. A triple describes a directed edge (fact). An entity does not necessarily have to be a specific thing in real life, but can also be an attribute value of a thing. In this case, the relationship is the attribute.
[0037] The exemplary embodiments of the present disclosure are described in detail below with reference to the accompanying drawings.
[0038] Figure 1 4 is a flowchart of a question-answering processing method of a multilingual reasoning model in an exemplary embodiment of the present disclosure.
[0039] refer to Figure 1 , the question answering processing methods of the multilingual reasoning model can include:
[0040] Step S102, selecting a set of questions described in a specified language.
[0041] Step S104, select the question-answering dataset and knowledge graph in the same language.
[0042] Step S106, translating the question and answer dataset and the knowledge graph according to multiple translation grammars of the specified language to obtain i translated question and answer datasets and j translated knowledge graphs.
[0043] Step S108, performing reasoning training on the i translated question-answer data sets and the j translated knowledge graphs.
[0044] In an exemplary embodiment of the present disclosure, after the reasoning training on the i translated question-answering datasets and the j translated knowledge graphs is completed, a total of i×j question-answering reasoning models RM can be obtained. i,j ,The purpose of training these question and answer reasoning models is to obtain updated parameters such as the ,association strength between entities and the counting matrix of edges to achieve ,reliable question and answer reasoning.
[0045] Step S110, counting the number of edges of the knowledge reasoning path that finds the specified answer on the translated knowledge graph according to the training results.
[0046] Step S112, weighted fusion is performed on the corresponding edges in the j translated knowledge graphs with the number of times as weight to obtain a translated reasoning model, and the translated reasoning model is suitable for answering questions in the question set described in the specified language.
[0047] In the disclosed embodiment, the question-answering dataset and the knowledge graph are translated according to a plurality of translation grammars of the specified language to obtain i translated question-answering datasets and j translated knowledge graphs, and reasoning training is performed on the i translated question-answering datasets and j translated knowledge graphs. It is not necessary to collect datasets for each language, and the number of edges of the knowledge reasoning path for finding the specified answer on the translated knowledge graph is counted through the training results, and the corresponding edges in the j translated knowledge graphs are weightedly fused with the number as the weight, that is, the correlation strength of the edges of the knowledge graphs corresponding to all reasoning models is weighted averaged according to the number of times counted, and different versions of the knowledge graphs are fused to generate a reliable reasoning model, thereby improving the efficiency and accuracy of multilingual question-answering reasoning. Furthermore, the translated reasoning model is suitable for answering questions in the question set described in the specified language, and is widely applicable to question-answering reasoning scenarios in various languages.
[0048] Among them, the question-answering reasoning in the above-mentioned embodiment is implemented based on the knowledge graph, and the reasoning model obtained through the disclosed scheme is a plurality of sets of parameters obtained through training based on the knowledge graph and the question-answering data set, and the parameters include the association strength between entities and the counting strength of edges, etc.
[0049] Combine the following Figures 2 to 9 , each step of the question-answering processing method for the multilingual reasoning model is explained in detail.
[0050] In an exemplary embodiment of the present disclosure, Figure 2 As shown, performing reasoning training on the i translated question-answering datasets and the j translated knowledge graphs includes:
[0051] Step S202: combine the i translated question-answer data sets with the j translated knowledge graphs in pairs to obtain i×j training sample combinations.
[0052] Step S204: perform inference training on any training sample combination among the i×j training sample combinations in sequence.
[0053] In an exemplary embodiment of the present disclosure, language has characteristics such as polysemy and ambiguity. If the question is directly translated, it is easy to tamper with or lose the original information in the sentence, affecting the accuracy of question-answering reasoning. The present disclosure constructs a cross-language question-answering reasoning system, combines i translated question-answering data sets with j translated knowledge graphs in pairs to obtain i×j training sample combinations, that is, training on a language with high resource volume (such as English), and performing question-answering reasoning on other target languages. No sample annotation or preprocessing is required, and a reasoning model suitable for multiple languages can be obtained, thereby improving the accuracy and efficiency of multilingual question-answering reasoning.
[0054] In an exemplary embodiment of the present disclosure, Figure 3 As shown, sequentially performing inference training on any training sample combination among the i×j training sample combinations includes:
[0055] Step S302, determining the first question-and-answer data set and the first knowledge graph in the first training sample combination.
[0056] Step S304: determine whether the first question-and-answer data set includes k questions.
[0057] Step S306: extract a sub-knowledge graph in the first knowledge graph according to any question in the first question and answer dataset.
[0058] Step S308: Use any question in the first question-and-answer data set as a question node and splice it with the sub-knowledge graph to form a working graph.
[0059] Step S310: Use a neural network to perform association information training on the work graph.
[0060] Step S312, starting from the problem node in the trained working graph, determine the node whose weight meets the threshold requirement as the candidate answer node, and record the reasoning path between the problem node and the candidate answer node.
[0061] In an exemplary embodiment of the present disclosure, after the training of i×j training sample combinations is completed, a total of i×j question-answering reasoning models RM can be obtained. i,j ,The purpose of training these question and answer reasoning models is to obtain updated parameters such as the ,association strength between entities and the counting matrix of edges to achieve ,reliable question and answer reasoning.
[0062] For example, remember KG j The two nodes in KG j Zhongcong arrive The oth edge of the statistically determined inference model RM i,j The edge Total The correct reasoning path goes through, record For Entity and entities The relationship between o (i.e., edge ), then we can use Represents edge The strength of association The weight of (unnormalized), The larger the value, the more correct reasoning depends on the edge Therefore, the relationship of this edge is more worthy of being retained.
[0063] Step S314, recording the question nodes, the candidate answer nodes and the reasoning paths of the i×j combinations of the training samples.
[0064] In an exemplary embodiment of the present disclosure, Figure 4 As shown, according to the training results, the number of edges of the knowledge reasoning path that finds the specified answer on the translated knowledge graph includes:
[0065] Step S402: writing the candidate answer node into an answer set.
[0066] Step S404: determine the candidate answer node with the highest frequency of occurrence in the answer set as the designated answer.
[0067] Step S406, counting the number of edges of the knowledge reasoning path corresponding to the designated answer node.
[0068] In an exemplary embodiment of the present disclosure, Figure 5 As shown, the question answering processing method of the multilingual reasoning model also includes:
[0069] Step S502, determine the two nodes of the pth edge in the first knowledge graph, and record them as the first node and the second node respectively.
[0070] Step S504, determining the number of times the recorded reasoning path of the p-th edge passes through.
[0071] Step S506: determining the association strength between the first node and the second node according to the number of times the reasoning path passes through, wherein the association strength is positively correlated with the weight value of performing the weighted fusion.
[0072] In an exemplary embodiment of the present disclosure, the knowledge graph KG j Any two nodes in n a 、n b , n a to n b The oth edge of RM i,j The edge counting matrix of i,j ,side The count is If a ,n b ∈P i,j:k (n,e), but The number of times an edge's reasoning path is completed is counted, and based on the statistical results, the number of correct knowledge reasonings contributed by each edge in each reasoning model is obtained. The greater the number, the more attention the relationship and association strength of this edge in this reasoning model deserves.
[0073] In the above exemplary embodiment, the association strength indicates the closeness of the association relationship between entities, which is related to factors such as entity type and relationship between entities. It is continuously updated during the training process and the knowledge graph KG is recorded. j The entity set is N j , the relation set is E j , namely KG j = {N j ,E j}, then the fused knowledge graph KG′={∪ j∈(1,2,…,J) N j ,∪ j∈(1,2,…,J) E j}.
[0074] Based on this, the inference model RM′ is generated and the weighted edge The method of calculating the association strength is shown in formula (1):
[0075]
[0076] In an exemplary embodiment of the present disclosure, Figure 6 As shown, the question answering processing method of the multilingual reasoning model also includes:
[0077] Step S602, determining the association strength between two nodes on any side of the knowledge graph.
[0078] Step S604, determining whether the association strength is less than a preset association strength, if so, executing step S606, if not, executing step S608.
[0079] Step S606: If it is determined that the association strength is less than the preset association strength, the edge corresponding to the association strength is deleted.
[0080] Step S608: If it is determined that the association strength is less than the preset association strength, the edge corresponding to the association strength is deleted.
[0081] In an exemplary embodiment of the present disclosure, the fused knowledge graph KG′ is pruned: if the edge The strength of association If the association strength is less than the preset one, the edge will be deleted from the knowledge graph. Based on this, the meaningless relationships between entities introduced during the translation process are eliminated.
[0082] In an exemplary embodiment of the present disclosure, the translation results of entities at corresponding positions in the j knowledge graphs are different.
[0083] In an exemplary embodiment of the present disclosure, by translating the same entity in different versions of the knowledge graph into different semantic meanings (preferably taking noun semantic meanings), all possible semantic meanings of the entity are retained as much as possible.
[0084] However, translation may cause the relationships between entities (represented as edges in the knowledge graph) to become invalid. For example, the relationship between the "book" entity and the "copyright" entity only exists between the "book" entity and the "copyright" entity. If "book" is translated as "notebook", it seems meaningless to retain the relationship between the "notebook" entity and the "copyright" entity. Therefore, synonymous entities are merged. For example, the "notebook" entity obtained by translating the "notebook" entity and the "notebook" entity obtained by translating the "book" entity are merged.
[0085] For another example, let the set of edges connecting the "notebook" entity be ε1, the set of edges connecting the "book" entity be ε2, and the set of edges connecting the "notebook" entity be ε3. It is required that: ε3 = ε1 ∪ ε2.
[0086] In addition, if any edge in the knowledge graph has never been used during the training process, it is not introduced into the fused knowledge graph to eliminate the "unreasonable" relationships caused by translation.
[0087] The following combines Figures 7 to 9 to illustrate the question-answering reasoning process of the reasoning model in the embodiments of the present disclosure:
[0088] As Figure 7 shown, the question-answering processing process of a multilingual reasoning model according to an exemplary embodiment of the present disclosure includes:
[0089] Step S702, read the question set Q described in language L.
[0090] Step S704, select a valid question-answering data set as the original data set, denoted as D S0 , select the knowledge graph in the same language as D S0 , denoted as K G0 .
[0091] Identify the language type of the question set Q, and use multiple methods to translate D S0 and K G0 .
[0092] Step S706, generate i question-answering data sets D Si in language L version and j knowledge graphs K Gj, where \(i\in(1,2,\ldots,I)\) and \(j\in(1,2,\ldots,J)\), allowing differences between datasets and knowledge graphs to exist.
[0093] Step S708, on the \(D\) Si and \(K\) Gj train the question-answering inference model \(RM\) i,j , where \(i\in(1,2,\ldots,I)\) and \(j\in(1,2,\ldots,J)\), count the edges passed by the knowledge inference path that can find the correct answer each time.
[0094] Step S710, using the count of the edges of the inference model \(RM\) i,j as the weight, weighted-average the association strength between nodes, and fuse \(K\) Gj to obtain \(K\) G' , and generate the question-answering inference model \(RM'\) for processing language \(L\).
[0095] As Figure 8 shown, training the question-answering inference model \(RM\) on the \(D\) Si and \(K\) Gj specifically includes the following steps: i,j Specifically includes the following steps:
[0096] Step S802, initialize \(i = 1\) and \(j = 1\).
[0097] Step S804, call the \(RM\) training subroutine, input the question-answering dataset \(D\) Si and the knowledge graph \(K\) Gj , and train the question-answering inference model \(RM\) i,j .
[0098] Step S806, determine whether \(j < J\) holds. If so, execute Step S808; if not, execute Step S810.
[0099] Step S808, \(j++\).
[0100] Step S810, \(i++\) and \(j = 0\).
[0101] Step S812, determine whether \(i < I\) holds. If so, execute Step S804; if not, end.
[0102] As Fig. 9 shown, call the \(RM\) training subroutine, input the question-answering dataset \(D\) Si and the knowledge graph \(K\) Gj , and train the question-answering inference model \(RM\) i,j specifically includes the following steps:
[0103] Step S902, initialize \(k = 0\), receive the question-answering dataset \(D\) Si and the knowledge graph \(K\) Gj .
[0104] Step S904: From the question-answering dataset D Si Read the kth question, denoted as Q i:k .
[0105] Step S906, according to question Q i:k Extract KG subgraph.
[0106] Step S908, generating node association scores of the KG subgraph based on the pre-trained LM network.
[0107] Step S910, obtain question Q based on language model LM i:k The expression (encoding the question sentence and obtaining the feature vector) is represented as node z.
[0108] Step S912: concatenate node z with the KG subgraph to form a working graph, and use GAT to learn and correct the overall association information of the working graph.
[0109] Step S914: Starting from the question node, select a node whose weight is within the first threshold range as the answer, denoted as A. i:k , and enter it into the answer set A of this question :k , and record the reasoning path for this answer.
[0110] Step S916, in answer set A :k Among the I×J elements, select the element with the highest frequency as the correct answer. i:k Correct, then it is A i:k The number of reasoning paths.
[0111] Step S918, determine D Si All questions in have been used. If so, execute step S922; if not, execute step S920.
[0112] Step S920, k++.
[0113] Step S922: Output the multilingual reasoning model RM i,j
[0114] based on Figures 7 to 9 The multilingual reasoning model RM is obtained as shown i,j In an embodiment, the application of the reasoning model obtained by the embodiment of the present disclosure in a question-answering scenario includes the following steps:
[0115] 1. Obtain the question “What are the benefits of reading books?” through the front-end interface, recorded as question Q.
[0116] 2. The device recognizes that the language type of question Q is Chinese, and calls the Chinese knowledge graph and reasoning model pre-trained by the training method proposed in this patent to reason about the question.
[0117] 3. Use the QA-GNN method to find the answer to question Q:
[0118] Step (1): Encode question Q through the language model and output a 611-dimensional sentence vector V Q .
[0119] Step (2): perform entity matching on question Q and the existing knowledge graph KG′. The matching rules are based on character strings and similar semantics. The matching entity set is denoted as E. Based on the extracted matching entity set E, all related nodes and relationships within a maximum of 5 hops are found to form a subgraph G. The subgraph has a total of 354 nodes and 843 relationships.
[0120] Step (3), let the question Q be Input1, concatenate all entities in the subgraph G extracted in step (2) into Input2, input Input1 and Input2 into the pre-trained language model, and output the word vector; weighted average all word vectors involved in Input1 to obtain the word vector of each entity, and weighted average the subvectors involved in each entity in Input2 to obtain the word vector of each entity; use the cosine similarity judgment formula to calculate the similarity correlation between the word vector corresponding to each entity and the sentence vector corresponding to Input1, and obtain the node correlation score; replace the node with the word vector or sentence vector, and add an attribute to the relationship, the attribute is the cosine similarity.
[0121] Step (4) establishes an association relationship between all entities in the subgraph G obtained in step (2) and the node z converted from the question Q obtained in step (1), thereby forming a working subgraph.
[0122] Step (5), output the working subgraph with initial association weights from step (4) Input the GAT network, perform overall correction and update of the associated information, and output the working subgraph after updating the associated weights
[0123] Step (6), the working subgraph output in step (5) The tail node corresponding to the edge with weight in the interval [0.8, 1] is found and defined as the answer to question Q. The entities in the tail node are concatenated through a preset answer template to return the answer.
[0124] In summary, the question-answering processing method of the multilingual reasoning model disclosed in the present invention retains the ambiguity of language through translation and generates different versions of question-answering datasets and knowledge graphs, determines the correct answer to the question-answering dataset with the help of a question-answering reasoning method based on the knowledge graph, records the reasoning path of each correct reasoning in the knowledge graph, and thereby fuses different versions of knowledge graphs to determine the closeness of the association relationship between entities, thereby generating a question-answering reasoning model that can be used to process the translated language.
[0125] Corresponding to the above method embodiment, the present disclosure also provides a question-answering processing device of a multilingual reasoning model, which can be used to execute the above method embodiment.
[0126] Fig.10 It is a block diagram of a question-answering processing device of a multilingual reasoning model in an exemplary embodiment of the present disclosure.
[0127] refer to Fig.10 , the question-answering processing device 1000 of the multilingual reasoning model may include:
[0128] The selection module 1002 is configured to select a set of questions described in a specified language.
[0129] The selection module 1002 is further configured to select a question-answering dataset and a knowledge graph in the same language.
[0130] The translation module 1004 is configured to translate the question and answer dataset and the knowledge graph according to multiple translation grammars of the specified language to obtain i translated question and answer datasets and j translated knowledge graphs.
[0131] The reasoning module 1006 is configured to perform reasoning training on the i translated question-answer data sets and the j translated knowledge graphs.
[0132] The statistical module 1008 is configured to count the number of edges of the knowledge reasoning path that find the specified answer on the translated knowledge graph according to the training results.
[0133] The fusion module 1010 is configured to perform weighted fusion on the corresponding edges in the j translated knowledge graphs with the number of times as the weight to obtain a translated reasoning model, and the translated reasoning model is suitable for answering questions in the question set described in the specified language.
[0134] In an exemplary embodiment of the present disclosure, the reasoning module 1006 is further configured to: combine i translated question and answer data sets with j translated knowledge graphs in pairs to obtain i×j training sample combinations; and perform reasoning training on any training sample combination of the i×j training sample combinations in turn.
[0135] In an exemplary embodiment of the present disclosure, the reasoning module 1006 is also configured to: determine the first question and answer data set and the first knowledge graph in the first training sample combination; determine that the first question and answer data set includes k questions; extract a sub-knowledge graph in the first knowledge graph according to any question in the first question and answer data set; use any question in the first question and answer data set as a question node, and splice it with the sub-knowledge graph to form a working graph; use a neural network to perform association information training on the working graph; starting from the question node in the trained working graph, determine the node whose weight meets the threshold requirement as the alternative answer node, and record the reasoning path between the question node and the alternative answer node; record the question node, the alternative answer node and the reasoning path of i×j training sample combinations.
[0136] In an exemplary embodiment of the present disclosure, the statistical module 1008 is also configured to: write the alternative answer node into an answer set; determine an alternative answer node with the highest frequency of occurrence in the answer set as the designated answer; and count the number of edges of the knowledge reasoning path corresponding to the designated answer node.
[0137] In an exemplary embodiment of the present disclosure, the fusion module 1010 is further configured to: determine the two nodes of the p-th edge in the first knowledge graph, respectively recorded as the first node and the second node; determine the number of times the reasoning path recorded for the p-th edge passes; determine the association strength between the first node and the second node based on the number of times the reasoning path passes, and the association strength is positively correlated with the weight value of the weighted fusion.
[0138] In an exemplary embodiment of the present disclosure, the fusion module 1010 is also configured to: determine the association strength between two nodes on any edge in the knowledge graph; determine whether the association strength is less than a preset association strength; if it is determined that the association strength is less than the preset association strength, delete the edge corresponding to the association strength.
[0139] In an exemplary embodiment of the present disclosure, the translation results of entities at corresponding positions in the j knowledge graphs are different.
[0140] Since the functions of the question-answering processing device 1000 of the multilingual reasoning model have been described in detail in the corresponding method embodiments, the present disclosure will not elaborate on them here.
[0141] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into multiple modules or units to be embodied.
[0142] In an exemplary embodiment of the present disclosure, an electronic device capable of implementing the above method is also provided.
[0143] It will be appreciated by those skilled in the art that various aspects of the present invention may be implemented as a system, method or program product. Therefore, various aspects of the present invention may be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software, which may be collectively referred to herein as a "circuit", "module" or "system".
[0144] Refer to the following Fig.11 The electronic device 1100 according to this embodiment of the present invention is described. Fig.11 The electronic device 1100 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0145] like Fig.11 As shown, the electronic device 1100 is in the form of a general computing device. The components of the electronic device 1100 may include but are not limited to: at least one processing unit 1110, at least one storage unit 1120, and a bus 1130 connecting different system components (including the storage unit 1120 and the processing unit 1110).
[0146] The storage unit stores program codes, which can be executed by the processing unit 1110, so that the processing unit 1110 performs the steps according to various exemplary embodiments of the present invention described in the above “Exemplary Method” section of this specification. For example, the processing unit 1110 can perform the method shown in the embodiment of the present disclosure.
[0147] The storage unit 1120 may include a readable medium in the form of a volatile storage unit, such as a random access storage unit (RAM) 11201 and / or a cache storage unit 11202 , and may further include a read-only storage unit (ROM) 11203 .
[0148] The storage unit 1120 may also include a program / utility 11204 having a set (at least one) of program modules 11205, such program modules 11205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0149] Bus 1130 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
[0150] The electronic device 1100 may also communicate with one or more external devices 1140 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may communicate with one or more devices that enable a user to interact with the electronic device 1100, and / or may communicate with any device that enables the electronic device 1100 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (i / O) interface 1150. Furthermore, the electronic device 1100 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 1160. As shown, the network adapter 1160 communicates with other modules of the electronic device 1100 via a bus 1130. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 1100, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAiD systems, tape drives, and data backup storage systems.
[0151] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the implementation of the present disclosure.
[0152] In an exemplary embodiment of the present disclosure, a computer-readable storage medium is also provided, on which a program product capable of implementing the above method of the present specification is stored. In some possible implementations, various aspects of the present invention can also be implemented in the form of a program product, which includes a program code, and when the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps according to various exemplary embodiments of the present invention described in the above "Exemplary Method" section of the present specification.
[0153] The program product for implementing the above method according to an embodiment of the present invention can adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto, and in this document, a readable storage medium can be any tangible medium containing or storing a program, which can be used by or in combination with an instruction execution system, an apparatus or a device.
[0154] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0155] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0156] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.
[0157] Program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).
[0158] In addition, the above-mentioned figures are only schematic illustrations of the processes included in the method according to an exemplary embodiment of the present invention, and are not intended to be limiting. It is easy to understand that the processes shown in the above-mentioned figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.
[0159] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are to be considered exemplary only, and the true scope and concept of the present disclosure are indicated by the claims.
Claims
1. A question-answering processing method for a multilingual reasoning model, characterized in that: include: Select a set of questions described in a specified language; Select the question-answering dataset and knowledge graph in the same language; Translate the question-answering dataset and the knowledge graph according to multiple translation grammars of the specified language to obtain i translated question-answering datasets and j translated knowledge graphs; Performing reasoning training on the i translated question-answering datasets and the j translated knowledge graphs, including: Combine i translated question-answering datasets with j translated knowledge graphs in pairs to obtain i×j training sample combinations; Combine i translated question-answering datasets with j translated knowledge graphs in pairs to obtain i×j training sample combinations; Determine a first question-answering data set and a first knowledge graph in the first training sample combination; Determine that the first question-answering data set includes k questions; Extracting a sub-knowledge graph in the first knowledge graph according to any question in the first question-answering dataset; Taking any question in the first question-answering dataset as a question node, and splicing it with the sub-knowledge graph to form a working graph; Using a neural network to train the working graph on associated information; Starting from the problem node in the trained working graph, determine the node whose weight meets the threshold requirement as the candidate answer node, and record the reasoning path between the problem node and the candidate answer node; Recording the question nodes, the candidate answer nodes and the reasoning paths of i×j combinations of the training samples; According to the training results, the number of edges of the knowledge reasoning path for the specified answer is counted on the translated knowledge graph, including: Writing the candidate answer node into an answer set; Determine the candidate answer node with the highest frequency of occurrence in the answer set as the designated answer; Counting the number of edges of the knowledge reasoning path corresponding to the specified answer node; The corresponding edges in the j translated knowledge graphs are weightedly fused with the number of times as weight to obtain a translated reasoning model, and the translated reasoning model is suitable for answering questions in the question set described in the specified language.
2. The question-answering processing method of a multilingual reasoning model according to claim 1, characterized in that: Also includes: Determine two nodes of the p-th edge in the first knowledge graph, which are respectively recorded as the first node and the second node; Determine the number of times the recorded reasoning path of the pth edge has passed; The association strength between the first node and the second node is determined according to the number of times the reasoning path passes through, and the association strength is positively correlated with the weight value of performing the weighted fusion.
3. The question-answering processing method of a multilingual reasoning model according to claim 1 or 2, characterized in that: Also includes: Determine the strength of association between two nodes on any side of the knowledge graph; Determining whether the association strength is less than a preset association strength; If it is determined that the association strength is less than the preset association strength, the edge corresponding to the association strength is deleted.
4. The question-answering processing method of a multilingual reasoning model according to claim 1 or 2, characterized in that: The translation results of entities at corresponding positions in the j knowledge graphs are different.
5. A question-answering processing device for a multilingual reasoning model, characterized in that: include: A selection module, configured to select a set of questions described in a specified language; The selection module is further configured to select a question-answering dataset and a knowledge graph in the same language; A translation module, configured to translate the question-answering dataset and the knowledge graph according to a plurality of translation grammars of the specified language to obtain i translated question-answering datasets and j translated knowledge graphs; The reasoning module is configured to perform reasoning training on the i translated question-answering datasets and the j translated knowledge graphs, including: Combine i translated question-answering datasets with j translated knowledge graphs in pairs to obtain i×j training sample combinations; Combine i translated question-answering datasets with j translated knowledge graphs in pairs to obtain i×j training sample combinations; Determine a first question-answering data set and a first knowledge graph in the first training sample combination; Determine that the first question-answering data set includes k questions; Extracting a sub-knowledge graph in the first knowledge graph according to any question in the first question-answering dataset; Taking any question in the first question-answering dataset as a question node, and splicing it with the sub-knowledge graph to form a working graph; Using a neural network to train the working graph on associated information; Starting from the problem node in the trained working graph, determine the node whose weight meets the threshold requirement as the candidate answer node, and record the reasoning path between the problem node and the candidate answer node; Recording the question nodes, the candidate answer nodes and the reasoning paths of i×j combinations of the training samples; The statistics module is set to count the number of edges of the knowledge reasoning path that finds the specified answer on the translated knowledge graph based on the training results, including: Writing the candidate answer node into an answer set; Determine the candidate answer node with the highest frequency of occurrence in the answer set as the designated answer; Counting the number of edges of the knowledge reasoning path corresponding to the specified answer node; The fusion module is configured to perform weighted fusion on the corresponding edges in the j translated knowledge graphs with the number of times as the weight to obtain a translated reasoning model, and the translated reasoning model is suitable for answering questions in the question set described in the specified language.
6. An electronic device, characterized in that: include: Memory; as well as A processor coupled to the memory, the processor being configured to execute the question-answering processing method of the multilingual reasoning model according to any one of claims 1 to 4 based on instructions stored in the memory.
7. A computer-readable storage medium having a program stored thereon, which, when executed by a processor, implements the question-answering processing method of a multilingual reasoning model as described in any one of claims 1 to 4.
