Knowledge graph updating method and device, equipment, storage medium and program product

By acquiring and analyzing triple data in the knowledge graph, candidate triples are identified and the knowledge graph is updated, solving the problem of missing triples, improving the query efficiency and accuracy of the knowledge graph, and meeting the needs of intelligent customer service for banks and question-and-answer systems for companies.

CN116431822BActive Publication Date: 2026-06-09INDUSTRIAL AND COMMERCIAL BANK OF CHINA

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
INDUSTRIAL AND COMMERCIAL BANK OF CHINA
Filing Date
2023-03-27
Publication Date
2026-06-09

AI Technical Summary

Technical Problem

The existence of missing triples in existing knowledge graphs makes it impossible to find answers to many questions directly through search. Improving the triple data has become an urgent problem to be solved.

Method used

By obtaining the initial vectors of multiple triples and the question vector of the query question, multiple candidate tail entities corresponding to the question vector are determined. The first candidate triple is determined based on the question vector and the entity vectors in each initial vector. The second candidate triple is determined based on each first relation vector and the question vector. The knowledge graph is then updated using the first and second candidate triples.

Benefits of technology

It increases the probability that users can obtain answers to their questions from the knowledge graph, enabling quick and accurate responses to user questions, reducing the pressure on human customer service, and providing convenient quick Q&A for company rules and regulations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116431822B_ABST
    Figure CN116431822B_ABST
Patent Text Reader

Abstract

The application relates to a knowledge graph updating method and device, equipment, a storage medium and a program product. The method comprises the following steps: acquiring entity vectors of multiple triplets, relation vectors of the multiple triplets and a question vector of a to-be-queried question; determining multiple candidate tail entities corresponding to the question vector according to the question vector and the entity vectors in the initial vectors; determining first candidate triplets according to the multiple candidate tail entities corresponding to the question vector; determining second candidate triplets according to the first relation vectors and the question vector; and finally updating the knowledge graph according to the first candidate triplets and the second candidate triplets. The original knowledge graph triplet data is perfected by using the method, so that the knowledge graph is updated, and the probability of obtaining a question answer from the knowledge graph by a user is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence technology, and in particular to a knowledge graph updating method, apparatus, device, storage medium, and program product. Background Technology

[0002] Knowledge graphs are a crucial foundation in natural language processing; they are a special data structure composed of numerous triples (head entity, relation, tail entity). Recently, knowledge graph-based intelligent question answering has become an important research area, particularly crucial in banking systems. Knowledge graph-based intelligent question answering can be used in scenarios such as intelligent customer service in banks, enabling timely assistance to customers in resolving their problems.

[0003] Existing knowledge graph-based intelligent question answering methods find a triple to answer a question. If the triple exists in the knowledge graph, the answer to the question can be obtained from the tail entity in the triple.

[0004] However, since knowledge graphs always have missing triples, many questions cannot be answered directly by searching. Therefore, how to improve the triple data has become an urgent problem for those skilled in the art. Summary of the Invention

[0005] Therefore, it is necessary to provide a method, apparatus, device, storage medium, and program product that can effectively update knowledge graphs for triplet data, addressing the aforementioned technical problems.

[0006] Firstly, this application provides a method for updating a knowledge graph. The method includes:

[0007] Obtain the initial vector of multiple triples and the question vector of the query question; the initial vector includes the entity vector and the first relation vector.

[0008] Based on the problem vector and the entity vectors in each of the initial vectors, determine multiple candidate tail entities corresponding to the problem vector;

[0009] Based on the multiple candidate tail entities corresponding to the problem vector, determine the first candidate triplet;

[0010] Based on the first relation vector and the question vector, determine the second candidate triplet;

[0011] Update the knowledge graph based on the first candidate triplet and the second candidate triplet.

[0012] In one embodiment, determining the first candidate triplet based on multiple candidate tail entities corresponding to the problem vector includes:

[0013] Based on each candidate tail entity and the head entity vector and second relation vector in the question vector, multiple intermediate triples are determined;

[0014] Determine the quantization value of each intermediate triplet;

[0015] Based on the quantization value of each intermediate triplet, the first candidate triplet is determined from each intermediate triplet.

[0016] In one embodiment, determining the first candidate triplet from each of the intermediate triplets based on the quantized values ​​of each of the intermediate triplets includes:

[0017] The middle triplet whose quantization value is greater than or equal to the preset quantization value threshold is selected as the first candidate triplet.

[0018] In one embodiment, determining the second candidate triplet based on the first relation vector in the initial vector and the question vector includes:

[0019] Determine the similarity between the second relation vector in the problem vector and the first relation vector in each of the initial vectors;

[0020] The second candidate triplet is determined based on the similarity between the second relation vector and the first relation vector in each of the initial vectors.

[0021] In one embodiment, determining the second candidate triplet based on the similarity between the second relation vector and the first relation vectors in each of the initial vectors includes:

[0022] The first relation vector corresponding to a similarity score greater than a preset similarity threshold is used as the target relation vector;

[0023] The initial vector corresponding to the target relation vector is taken as the second candidate triplet.

[0024] In one embodiment, updating the knowledge graph based on the first candidate triplet and the second candidate triplet includes:

[0025] Determine the intersection between the first candidate triplet and the second candidate triplet;

[0026] Update the knowledge graph based on the intersection and the multiple triples.

[0027] In one embodiment, determining multiple candidate tail entities corresponding to the problem vector based on the problem vector and the entity vectors in each of the initial vectors includes:

[0028] Identify the entity vectors in each entity vector, excluding the head entity vector in the question vector;

[0029] The entity vectors in each entity vector, excluding the head entity vector in the question vector, are taken as the multiple candidate tail entities.

[0030] In one embodiment, obtaining the initial vector of multiple triples and the question vector of the query question includes:

[0031] Retrieve the query question and the corresponding answer from the corpus;

[0032] Based on the query question and the corresponding answer, the multiple triples are obtained;

[0033] Based on the multiple triples and the first target model, the initial vectors of the multiple triples are obtained;

[0034] Based on the query question and the second target model, the question vector is obtained.

[0035] Secondly, this application also provides a knowledge graph updating device. The device includes:

[0036] The acquisition module is used to acquire the initial vector of multiple triples and the question vector of the query question; the initial vector includes the entity vector and the first relation vector.

[0037] The first determining module is used to determine multiple candidate tail entities corresponding to the problem vector based on the problem vector and the entity vectors in each of the initial vectors;

[0038] The second determining module is used to determine the first candidate triplet based on the multiple candidate tail entities corresponding to the problem vector;

[0039] The third determining module is used to determine the second candidate triplet based on each of the first relation vectors and the question vector;

[0040] The update module is used to update the knowledge graph based on the first candidate triplet and the second candidate triplet.

[0041] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the steps of the above-described method.

[0042] Fourthly, this application also provides a computer-readable storage medium. This computer-readable storage medium stores a computer program thereon, which, when executed by a processor, implements the steps of the above-described method.

[0043] Fifthly, this application also provides a computer program product. This computer program product includes a computer program that, when executed by a processor, implements the steps of the above-described methods.

[0044] The aforementioned knowledge graph updating method, apparatus, device, storage medium, and program product first obtain entity vectors of multiple triples, relation vectors of multiple triples, and question vectors of the query question. Then, based on the question vectors and entity vectors in each initial vector, multiple candidate tail entities corresponding to the question vector are determined. Next, based on these candidate tail entities, a first candidate triple is determined. Based on each first relation vector and the question vector, a second candidate triple is determined. Finally, the knowledge graph is updated based on the first and second candidate triples. Traditional knowledge graphs often have missing triples, making it impossible to directly search for answers to many questions. However, in this embodiment, the initial vectors and the question vector of the query question are used to determine the first and second candidate triples. These first and second candidate triples are then used to complete the triple data of the original knowledge graph, thereby updating the knowledge graph and increasing the probability of users obtaining answers from it. Attached Figure Description

[0045] Figure 1 This is one of the flowcharts illustrating a knowledge graph updating method provided in an embodiment of this application;

[0046] Figure 2 A flowchart illustrating a method for determining a first candidate triplet provided in an embodiment of this application;

[0047] Figure 3 One of the flowcharts for a method to determine a second candidate triplet provided in an embodiment of this application;

[0048] Figure 4 A second schematic flowchart illustrating a method for determining a second candidate triplet provided in an embodiment of this application;

[0049] Figure 5 A second schematic flowchart illustrating a knowledge graph updating method provided in this application embodiment;

[0050] Figure 6 A flowchart illustrating a method for determining candidate tail entities provided in an embodiment of this application;

[0051] Figure 7 A flowchart illustrating an acquisition method provided in an embodiment of this application;

[0052] Figure 8 A structural block diagram of a knowledge graph updating device provided in an embodiment of this application;

[0053] Figure 9 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0054] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0055] In one embodiment, Figure 1 This is one of the flowcharts illustrating a knowledge graph updating method provided in this application. The method includes the following steps:

[0056] S101. Obtain the initial vector of multiple triples and the question vector of the query question; the initial vector includes the entity vector and the first relation vector.

[0057] In this embodiment of the application, the computer device can obtain multiple triples and a query question from a knowledge graph related dataset, obtain the entity vectors and first relation vectors of the multiple triples based on the obtained triples, and obtain the question vector of the query question using the obtained query question.

[0058] S102. Based on the problem vector and the entity vectors in each initial vector, determine multiple candidate tail entities corresponding to the problem vector.

[0059] The computer device can determine the relevant entity vectors in each entity vector based on the problem vector and the entity vectors in each initial vector, thereby obtaining the entity vectors in each relevant entity vector excluding the head entity vector in the problem vector. These entity vectors are then used as multiple candidate tail entities. The relevant entity vectors are those entity vectors that are most suitable as candidate tail entities.

[0060] S103. Determine the first candidate triplet based on the multiple candidate tail entities corresponding to the problem vector.

[0061] In this embodiment, the quantized value of each intermediate triplet is multiplied by a preset correction value to obtain the corrected quantized value of each intermediate triplet. The corrected quantized value of each intermediate triplet is compared with a preset quantized value threshold, and the intermediate triplet whose corrected quantized value is greater than the preset quantized value threshold is selected as the first candidate triplet.

[0062] S104. Determine the second candidate triplet based on each first relation vector and the question vector.

[0063] In this embodiment of the application, the computer device can determine the similarity between the first relation vector and the second relation vector in the question vector based on each first relation vector and the question vector. The similarity between the second relation vector and the first relation vector in each initial vector is multiplied by a preset similarity correction value to obtain each corrected similarity. It can then determine whether each corrected similarity is greater than or equal to a preset similarity threshold. The first relation vector corresponding to the similarity that is greater than or equal to the preset similarity threshold is taken as the target relation vector. The second candidate triplet is determined based on each target relation vector.

[0064] S105. Update the knowledge graph based on the first candidate triplet and the second candidate triplet.

[0065] In this embodiment of the application, the computer device can obtain the target triplet based on the intersection of the first candidate triplet and the second candidate triplet, and put the target triplet into the knowledge graph to complete the knowledge graph update.

[0066] It should be noted that the methods provided in this application can be applied to intelligent customer service in banks, and responding to user questions quickly and accurately can effectively alleviate the pressure on human customer service. Furthermore, the quick Q&A function for company rules and regulations can provide great convenience to company employees. For example, regarding leave application and cancellation policies, employees don't need to specifically ask their superiors or search through documents; they can simply ask questions online and get answers.

[0067] In the above embodiment, firstly, entity vectors of multiple triples, relation vectors of multiple triples, and question vectors of the query question are obtained. Then, based on the question vectors and entity vectors in each initial vector, multiple candidate tail entities corresponding to the question vector are determined. Next, based on the multiple candidate tail entities corresponding to the question vector, a first candidate triple is determined. Based on each first relation vector and the question vector, a second candidate triple is determined. Finally, the knowledge graph is updated based on the first and second candidate triples. Traditional knowledge graphs often have missing triples, making it impossible to directly search for answers to many questions. However, in this embodiment, the initial vectors and question vectors of the query question can be used to determine the first and second candidate triples. By using the first and second candidate triples to improve the triple data of the original knowledge graph, the knowledge graph is updated, increasing the probability that users can obtain answers to their questions from the knowledge graph.

[0068] In one embodiment, Figure 2 This is a flowchart illustrating a method for determining a first candidate triplet, provided in an embodiment of this application. This embodiment relates to a possible implementation of how to determine a first candidate triplet based on multiple candidate tail entities corresponding to a question vector. Based on the above embodiment, step S103 includes:

[0069] S201. Based on each candidate tail entity and the head entity vector and second relation vector in the problem vector, determine multiple intermediate triples.

[0070] In this embodiment, the computer device can place each candidate tail entity into a triplet of the head entity vector and the second relation vector in the question vector to form multiple intermediate triplets. For example, if the head entity vector in the question vector is "Log out of account", the second relation vector is "where", and the candidate tail entities are "system page", "slogan", and "settings page", then an intermediate triplet with the content "(Log out of account, at, system page)", "(Log out of account, at, slogan)" can be formed.

[0071] S202. Determine the quantization value of each intermediate triplet.

[0072] In this embodiment, the computer device can determine the quantization value of each intermediate operand using a preset algorithm. For example, the computer device can obtain the scoring function value of each intermediate operand based on a scoring function, and the scoring function value is the quantization value of each intermediate triplet.

[0073] S203. Based on the quantization values ​​of each intermediate triplet, determine the first candidate triplet from each intermediate triplet.

[0074] In this embodiment of the application, the computer device can compare the quantized value of the intermediate triplet with a preset quantized value threshold, and select the intermediate triplet whose quantized value is greater than the preset quantized value threshold as the first candidate triplet T1.

[0075] In the above embodiment, multiple intermediate triples are determined based on the candidate tail entities and the head entity vector and second relation vector in the question vector. Then, the quantization value of each intermediate triple is determined. Finally, based on the quantization value of each intermediate triple, the first candidate triple is determined from the intermediate triples. This provides a preliminary first candidate triple for completing the knowledge graph, which is beneficial for updating and improving the existing knowledge graph.

[0076] In one embodiment, this embodiment relates to a possible implementation of how to determine a first candidate triplet from each intermediate triplet based on the quantization value of each intermediate triplet. Based on the above embodiment, S203 includes:

[0077] The middle triplet whose quantization value is greater than or equal to the preset quantization value threshold is selected as the first candidate triplet.

[0078] The preset quantization threshold can be set according to requirements; for example, it can be set to 0.5.

[0079] In this embodiment, the computer device designates intermediate triplets whose quantization values ​​are greater than or equal to a preset quantization threshold as first candidate triplets. For example, if the quantization value of intermediate triplet A is 0.2, the quantization value of intermediate triplet B is 0.52, and the quantization value of intermediate triplet C is 0.6, and the preset quantization threshold is 0.5, then intermediate triplet B and intermediate triplet C are designated as first candidate triplets. That is, the first candidate triplet can be obtained using the following formula:

[0080]

[0081] Where E is the set of all entities, This represents the second relation vector in the problem vector. This represents the head entity vector in the problem vector. This indicates the tail entity.

[0082] The formula above indicates that intermediate triples with a quantization value greater than 0.5 are selected as the first candidate triples, denoted as T1. This method effectively supplements missing triples in the knowledge graph.

[0083] In the above embodiments, by using intermediate triples whose quantization values ​​are greater than or equal to a preset quantization value threshold as the first candidate triples, the redundancy rate of missing triples in the supplementary knowledge graph can be reduced.

[0084] In one embodiment, Figure 3 This is one of the flowcharts illustrating a method for determining a second candidate triplet provided in this application. This embodiment relates to a possible implementation of how to determine a second candidate triplet based on a first relation vector and a question vector in an initial vector. Based on the above embodiment, S104 includes:

[0085] S301. Determine the similarity between the second relation vector in the problem vector and the first relation vector in each initial vector.

[0086] In this embodiment, the computer device can calculate the similarity between the second relation vector in the problem vector and the first relation vector in each initial vector using a preset method. For example, if the preset method is a relation matching algorithm, the similarity between the second relation vector in the problem vector and the first relation vector in each initial vector can be calculated using the following formula:

[0087]

[0088] Where R represents the set of the first relation vectors in the initial vector; This represents the first relation vector among the initial vectors. This represents the second relation vector in the problem vector. express transpose and The product of.

[0089] S302. Determine the second candidate triplet based on the similarity between the second relation vector and the first relation vector in each initial vector.

[0090] In this embodiment of the application, the computer device can determine the second candidate triplet based on the similarity between the second relation vector and the first relation vector in each initial vector.

[0091] Specifically, the computer device can determine whether each similarity is greater than or equal to a preset similarity threshold based on the similarity between the second relation vector and the first relation vector in each initial vector. The first relation vector corresponding to the similarity that is greater than or equal to the preset similarity threshold is taken as the target relation vector, and the second candidate triplet is determined based on each target relation vector.

[0092] For example, when using the relation matching algorithm exemplified in S301 to find the similarity value between the second relation vector in the problem vector and the first relation vector in each initial vector, a preset similarity threshold of 0.5 can be set, and a preset similarity correction value of 0.98 can be used. Assuming the similarity value of the first relation vector A is 0.6, the similarity value of the first relation vector B is 0.4, and the similarity value of the first relation vector C is 0.8, then the corrected similarity value of the first relation vector A is 0.588, the corrected similarity value of the first relation vector B is 0.588, and the corrected similarity value of the first relation vector C is 0.784. Therefore, the first relation vectors A and C can be used as target relation vectors, and the initial vectors corresponding to the first relation vector A and C can be used as second candidate triples.

[0093] In the above embodiment, by determining the similarity between the second relation vector in the problem vector and the first relation vector in each initial vector, and then determining the second candidate triplet based on the similarity between the second relation vector and the first relation vector in each initial vector, it is beneficial to filter out redundant triplets.

[0094] In one embodiment, Figure 4 This is a second flowchart illustrating a method for determining a second candidate triplet, provided in an embodiment of this application. This embodiment relates to a possible implementation of determining a second candidate triplet based on the similarity between the second relation vector and the first relation vector in each initial vector. Based on the above embodiment, step S302 includes:

[0095] S401. Take the first relation vector corresponding to the similarity greater than the preset similarity threshold as the target relation vector.

[0096] The preset similarity threshold can be set according to requirements.

[0097] In this embodiment of the application, the computer device can use a first relation vector with a similarity greater than a preset similarity threshold as the target relation vector. For example, when using the relation matching algorithm exemplified in S301 to find the similarity value between the second relation vector in the question vector and the first relation vector in each initial vector, 0.5 can be set as the preset similarity threshold. Assuming that the similarity value of the first relation vector A is 0.6, the similarity value of the first relation vector B is 0.4, and the similarity value of the first relation vector C is 0.8, then the first relation vector A and the first relation vector C can be used as the target relation vectors.

[0098] S402. Use the initial vector corresponding to the target relation vector as the second candidate triplet.

[0099] In this embodiment of the application, the computer device may use the initial vector corresponding to the target relation vector as the second candidate triplet.

[0100] Following the example in S401, if the first relation vector A and the first relation vector C are the target relation vectors, then the initial vector corresponding to the first relation vector A can be used as one of the second candidate triples, and the initial vector corresponding to the first relation vector C can also be used as one of the second candidate triples. The initial vector corresponding to the target relation vector used as the second candidate triple can take the form: (Logout account, on the system page), and this initial vector is denoted as T2.

[0101] In the above embodiments, by using the first relation vector corresponding to the similarity greater than the preset similarity threshold as the target relation vector, and then using the initial vector corresponding to the target relation vector as the second candidate triplet, it is beneficial to filter out redundant triplets.

[0102] In one embodiment, Figure 5 This is a second flowchart illustrating a knowledge graph updating method provided in this application. This embodiment relates to a possible implementation of how to update a knowledge graph based on a first candidate triplet and a second candidate triplet. Based on the above embodiment, S105 includes:

[0103] S501. Determine the intersection between the first candidate triplet and the second candidate triplet.

[0104] In this embodiment of the application, the computer device can determine the intersection between the first candidate triplet and the second candidate triplet, and the obtained intersection can be represented as T.a =T1∩T2.

[0105] S502. Update the knowledge graph based on the intersection and multiple triples.

[0106] In this embodiment of the application, a computer device can obtain the union of the intersection and the multiple triples extracted from the corpus based on the intersection and multiple triples, so as to update the knowledge graph.

[0107] It should be noted that the intersection and the union of multiple triples, T = T, can be used. a ∪T s The algorithm uses a pre-defined knowledge graph to answer user questions, yielding the answers accordingly. For example, the answer can be predicted using the following formula:

[0108]

[0109] in, This represents a vector representing a relation r′ in the updated knowledge graph. Let e' be a vector representing an entity. Predicting the answer essentially involves finding a tail entity e' that makes the triple (h, a, e') true. This expression represents finding the tail entity that maximizes the value of the scoring function and the value of the relation match.

[0110] In the above embodiments, the knowledge graph is updated by determining the intersection between the first candidate triplet and the second candidate triplet, and then based on the intersection and multiple triplets. Users can then obtain the answer to their questions based on the updated knowledge graph.

[0111] In one embodiment, Figure 6 This is a flowchart illustrating a method for determining candidate tail entities according to an embodiment of this application. This embodiment relates to a possible implementation of how to determine multiple candidate tail entities corresponding to a problem vector based on a problem vector and entity vectors in each initial vector. Based on the above embodiment, S102 includes:

[0112] S601. Determine the entity vectors in each entity vector except for the head entity vector in the problem vector.

[0113] In this embodiment, the computer device can determine the entity vectors in each entity vector other than the header entity vector in the question vector. For example, if the question vector contains vector content such as (log out account, in, ?), and the entity vectors contain: log out account, system page, slogan, settings page, etc., and the header entity vector in the question vector is log out account, then log out account will be removed, and the entity vectors in each entity vector other than the header entity vector in the question vector will be determined to be: system page, slogan, and settings page.

[0114] S602. Take the entity vectors other than the head entity vector in the problem vector as multiple candidate tail entities.

[0115] In this embodiment, the computer device can use entity vectors other than the head entity vector in the problem vector as multiple candidate tail entities. Following the example in S601, system pages, slogans, and settings pages can be used as candidate tail entities.

[0116] In the above embodiments, by determining the entity vectors in each entity vector other than the head entity vector in the question vector, and then taking the entity vectors in each entity vector other than the head entity vector in the question vector as multiple candidate tail entities, it is helpful to obtain triples for updating the knowledge graph.

[0117] In one embodiment, Figure 7 This is a flowchart illustrating a method for obtaining data according to an embodiment of this application. This embodiment relates to a possible implementation of how to obtain the initial vector of multiple triples and the question vector of the query question. Based on the above embodiment, S101 includes:

[0118] S701. Obtain the query question and the corresponding answer from the corpus.

[0119] The corpus can be a corpus containing banking terminology and operational content. Specifically, the type of corpus needs to be selected based on the requirements of intelligent question answering; this embodiment does not restrict the type of corpus. The corpus can contain common query questions and their corresponding answers.

[0120] In this embodiment of the application, the computer device can obtain query questions and corresponding answers from a corpus.

[0121] S702. Based on the query question and the corresponding answer, obtain multiple triples.

[0122] In this embodiment, a computer device can construct a dataset based on a query question and the corresponding answer, and extract multiple triples from the dataset. For example, multiple triples can be extracted from the dataset, and the triples can be in the form of (h, r, e) (Logout account, on the system page).

[0123] S703. Based on multiple triples and the first objective model, obtain the initial vectors of multiple triples.

[0124] The first target model may include ComplEx (Complex Embedding). The initial vectors include entity vectors and relation vectors.

[0125] In this embodiment of the application, the computer device can obtain entity vectors and relation vectors of multiple triples based on multiple triples and pre-trained ComplEx.

[0126] Specifically, multiple triples can be used as a training dataset to build an initial ComplEx model. This initial ComplEx model is then trained using multiple triples and a predefined loss function to obtain the trained ComplEx model, i.e., the first target model. Multiple triples can be input into the first target model to obtain initial vectors for the triples. For example, the predefined loss function can be a contrastive loss function, as follows:

[0127]

[0128] in, Let N represent the scoring function. N represents the negative samples. The triples in the negative samples... These are incorrect triples; these triples do not exist in the training set. The contrastive loss training method described above can improve the representation quality of entity embeddings and enhance the method's performance. The parameters trained through contrastive learning are all the model's parameters, including all entity vectors, relation vectors, and the scoring function, etc.

[0129] S704. Based on the query question and the second target model, obtain the question vector.

[0130] The second target model may include the BERT model (Bidirectional Encoder Representations from Transformer).

[0131] In this embodiment, the computer device can obtain a question vector based on the query question and the BERT model. For example, the query question can be input into a pre-trained BERT model to obtain a question vector. The question vector can be represented as follows: in, It can contain header entities and relational content. i It can be done through Q = {q i |i=1,...,M} represents, where q i This represents the query to be performed, and M represents the total number of queries to be performed.

[0132] In the above embodiments, by obtaining the query question and the corresponding answer from the corpus, multiple triples are obtained based on the query question and the corresponding answer. Then, based on the multiple triples and the first target model, the initial vectors of the multiple triples are obtained. Finally, based on the query question and the second target model, the question vector is obtained. This can complete the embedding of the knowledge graph and the query, which is beneficial for updating the knowledge graph.

[0133] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0134] Based on the same inventive concept, this application also provides a knowledge graph updating apparatus for implementing the knowledge graph updating method described above. The solution provided by this apparatus is similar to the implementation scheme described in the above method; therefore, the specific limitations in one or more knowledge graph updating apparatus embodiments provided below can be found in the limitations of the knowledge graph updating method described above, and will not be repeated here.

[0135] In one embodiment, Figure 8 This is a structural block diagram of a knowledge graph updating device provided in an embodiment of this application, with reference to... Figure 8 The knowledge graph updating device 800 includes: an acquisition module 801, a first determination module 802, a second determination module 803, a third determination module 804, and an update module 805, wherein:

[0136] The acquisition module 801 is used to acquire the initial vector of multiple triples and the question vector of the query question; the initial vector includes the entity vector and the first relation vector.

[0137] The first determining module 802 is used to determine multiple candidate tail entities corresponding to the problem vector based on the problem vector and the entity vectors in each initial vector.

[0138] The second determining module 803 is used to determine the first candidate triplet based on the multiple candidate tail entities corresponding to the problem vector.

[0139] The third determining module 804 is used to determine the second candidate triplet based on each first relation vector and the question vector.

[0140] Update module 805 is used to update the knowledge graph based on the first candidate triplet and the second candidate triplet.

[0141] In one embodiment, the second determining module 803 includes:

[0142] The first determination submodule is used to determine multiple intermediate triples based on each candidate tail entity and the head entity vector and second relation vector in the problem vector.

[0143] The second determination submodule is used to determine the quantization value of each intermediate triplet.

[0144] The third determination submodule is used to determine the first candidate triplet from each intermediate triplet based on the quantization value of each intermediate triplet.

[0145] In one embodiment, the third determining submodule includes:

[0146] The first determining unit is used to select the middle triplet whose quantization value is greater than or equal to a preset quantization value threshold as the first candidate triplet.

[0147] In one embodiment, the third determining module 804 includes:

[0148] The fourth determination submodule is used to determine the similarity between the second relation vector in the problem vector and the first relation vector in each initial vector.

[0149] The fifth determination submodule is used to determine the second candidate triplet based on the similarity between the second relation vector and the first relation vector in each initial vector.

[0150] In one embodiment, the fifth determining submodule includes:

[0151] The second determining unit is used to take the first relation vector corresponding to the similarity greater than the preset similarity threshold as the target relation vector.

[0152] The third determining unit is used to take the initial vector corresponding to the target relation vector as the second candidate triplet.

[0153] In one embodiment, the update module 805 includes:

[0154] The sixth determination submodule is used to determine the intersection between the first candidate triplet and the second candidate triplet.

[0155] The update submodule is used to update the knowledge graph based on the intersection and multiple triples.

[0156] In one embodiment, the first determining module 802 includes:

[0157] The seventh determination submodule is used to determine the entity vectors in each entity vector, excluding the head entity vector in the problem vector.

[0158] The eighth determination submodule is used to select entity vectors other than the head entity vector in the problem vector as multiple candidate tail entities.

[0159] In one embodiment, the acquisition module 801 includes:

[0160] The `get` submodule is used to retrieve query questions and their corresponding answers from the corpus.

[0161] The ninth submodule is used to obtain multiple triples based on the query question and the corresponding answer.

[0162] The tenth determination submodule is used to obtain the initial vectors of multiple triples based on multiple triples and the first target model.

[0163] The eleventh determination submodule is used to obtain the question vector based on the query question and the second target model.

[0164] Each module in the aforementioned knowledge graph update device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.

[0165] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 9 As shown, the computer device includes a processor, memory, communication interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it implements a knowledge graph update method. The display screen can be an LCD screen or an e-ink screen. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad mounted on the computer device casing, or an external keyboard, touchpad, or mouse.

[0166] Those skilled in the art will understand that Figure 9 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0167] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:

[0168] Obtain the initial vectors of multiple triples and the question vector of the query question; the initial vectors include the entity vector and the first relation vector.

[0169] Based on the problem vector and the entity vectors in each initial vector, determine multiple candidate tail entities corresponding to the problem vector;

[0170] Based on the multiple candidate tail entities corresponding to the problem vector, determine the first candidate triplet;

[0171] Based on each first relation vector and the question vector, determine the second candidate triplet;

[0172] Update the knowledge graph based on the first and second candidate triplet pairs.

[0173] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0174] Based on each candidate tail entity and the head entity vector and second relation vector in the question vector, multiple intermediate triples are determined;

[0175] Determine the quantization value of each intermediate triplet;

[0176] Based on the quantization value of each intermediate triplet, the first candidate triplet is determined from each intermediate triplet.

[0177] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0178] The middle triplet whose quantization value is greater than or equal to the preset quantization value threshold is selected as the first candidate triplet.

[0179] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0180] Determine the similarity between the second relation vector in the problem vector and the first relation vector in each initial vector;

[0181] The second candidate triplet is determined based on the similarity between the second relation vector and the first relation vector in each initial vector.

[0182] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0183] The first relation vector corresponding to a similarity score greater than a preset similarity threshold is used as the target relation vector;

[0184] The initial vector corresponding to the target relation vector is used as the second candidate triplet.

[0185] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0186] Determine the intersection between the first candidate triplet and the second candidate triplet;

[0187] Update the knowledge graph based on the intersection and multiple triples.

[0188] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0189] Identify the entity vectors in each entity vector, excluding the head entity vector in the problem vector;

[0190] The entity vectors in each entity vector, excluding the head entity vector in the problem vector, are considered as multiple candidate tail entities.

[0191] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0192] Retrieve query questions and their corresponding answers from the corpus;

[0193] Based on the query question and the corresponding answer, multiple triples are obtained;

[0194] Based on multiple triples and the first objective model, the initial vectors of multiple triples are obtained;

[0195] Based on the query question and the second objective model, the question vector is obtained.

[0196] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:

[0197] Obtain the initial vectors of multiple triples and the question vector of the query question; the initial vectors include the entity vector and the first relation vector.

[0198] Based on the problem vector and the entity vectors in each initial vector, determine multiple candidate tail entities corresponding to the problem vector;

[0199] Based on the multiple candidate tail entities corresponding to the problem vector, determine the first candidate triplet;

[0200] Based on each first relation vector and the question vector, determine the second candidate triplet;

[0201] Update the knowledge graph based on the first and second candidate triplet pairs.

[0202] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0203] Based on each candidate tail entity and the head entity vector and second relation vector in the question vector, multiple intermediate triples are determined;

[0204] Determine the quantization value of each intermediate triplet;

[0205] Based on the quantization value of each intermediate triplet, the first candidate triplet is determined from each intermediate triplet.

[0206] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0207] The middle triplet whose quantization value is greater than or equal to the preset quantization value threshold is selected as the first candidate triplet.

[0208] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0209] Determine the similarity between the second relation vector in the problem vector and the first relation vector in each initial vector;

[0210] The second candidate triplet is determined based on the similarity between the second relation vector and the first relation vector in each initial vector.

[0211] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0212] The first relation vector corresponding to a similarity score greater than a preset similarity threshold is used as the target relation vector;

[0213] The initial vector corresponding to the target relation vector is used as the second candidate triplet.

[0214] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0215] Determine the intersection between the first candidate triplet and the second candidate triplet;

[0216] Update the knowledge graph based on the intersection and multiple triples.

[0217] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0218] Identify the entity vectors in each entity vector, excluding the head entity vector in the problem vector;

[0219] The entity vectors in each entity vector, excluding the head entity vector in the problem vector, are considered as multiple candidate tail entities.

[0220] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0221] Retrieve query questions and their corresponding answers from the corpus;

[0222] Based on the query question and the corresponding answer, multiple triples are obtained;

[0223] Based on multiple triples and the first objective model, the initial vectors of multiple triples are obtained;

[0224] Based on the query question and the second objective model, the question vector is obtained.

[0225] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, performs the following steps:

[0226] Obtain the initial vectors of multiple triples and the question vector of the query question; the initial vectors include the entity vector and the first relation vector.

[0227] Based on the problem vector and the entity vectors in each initial vector, determine multiple candidate tail entities corresponding to the problem vector;

[0228] Based on the multiple candidate tail entities corresponding to the problem vector, determine the first candidate triplet;

[0229] Based on each first relation vector and the question vector, determine the second candidate triplet;

[0230] Update the knowledge graph based on the first and second candidate triplet pairs.

[0231] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0232] Based on each candidate tail entity and the head entity vector and second relation vector in the question vector, multiple intermediate triples are determined;

[0233] Determine the quantization value of each intermediate triplet;

[0234] Based on the quantization value of each intermediate triplet, the first candidate triplet is determined from each intermediate triplet.

[0235] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0236] The middle triplet whose quantization value is greater than or equal to the preset quantization value threshold is selected as the first candidate triplet.

[0237] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0238] Determine the similarity between the second relation vector in the problem vector and the first relation vector in each initial vector;

[0239] The second candidate triplet is determined based on the similarity between the second relation vector and the first relation vector in each initial vector.

[0240] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0241] The first relation vector corresponding to a similarity score greater than a preset similarity threshold is used as the target relation vector;

[0242] The initial vector corresponding to the target relation vector is used as the second candidate triplet.

[0243] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0244] Determine the intersection between the first candidate triplet and the second candidate triplet;

[0245] Update the knowledge graph based on the intersection and multiple triples.

[0246] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0247] Identify the entity vectors in each entity vector, excluding the head entity vector in the problem vector;

[0248] The entity vectors in each entity vector, excluding the head entity vector in the problem vector, are considered as multiple candidate tail entities.

[0249] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0250] Retrieve query questions and their corresponding answers from the corpus;

[0251] Based on the query question and the corresponding answer, multiple triples are obtained;

[0252] Based on multiple triples and the first objective model, the initial vectors of multiple triples are obtained;

[0253] Based on the query question and the second objective model, the question vector is obtained.

[0254] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0255] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0256] The above embodiments are merely illustrative of several implementation methods of this application, and their descriptions are relatively specific and detailed. However, they should not be construed as limiting the scope of this application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A knowledge graph update method, characterized in that, The method includes: Obtain the initial vectors of multiple triples and the question vector of the query question; the initial vectors include entity vectors and first relation vectors. Based on the problem vector and the entity vectors in each of the initial vectors, determine multiple candidate tail entities corresponding to the problem vector; Based on the multiple candidate tail entities corresponding to the problem vector, the first candidate triplet is determined; Determine the similarity between the second relation vector in the problem vector and the first relation vector in each of the initial vectors; The second candidate triplet is determined based on the similarity between the second relation vector and the first relation vector in each of the initial vectors; Determine the intersection between the first candidate triplet and the second candidate triplet; The knowledge graph is updated based on the intersection and the multiple triples; The step of determining the first candidate triplet based on the multiple candidate tail entities corresponding to the problem vector includes: Based on each of the candidate tail entities and the head entity vector and the second relation vector in the question vector, multiple intermediate triples are determined; Determine the quantization value of each of the aforementioned intermediate triplets; The first candidate triplet is determined from the intermediate triplets based on the quantization value of each intermediate triplet.

2. The method according to claim 1, characterized in that, The step of determining the first candidate triplet from each of the intermediate triplets based on the quantized values ​​of each intermediate triplet includes: The middle triplet whose quantization value is greater than or equal to the preset quantization value threshold is selected as the first candidate triplet.

3. The method according to claim 1, characterized in that, The step of determining the second candidate triplet based on the similarity between the second relation vector and the first relation vector in each of the initial vectors includes: The first relation vector corresponding to a similarity score greater than a preset similarity threshold is used as the target relation vector; The initial vector corresponding to the target relation vector is used as the second candidate triplet.

4. The method according to any one of claims 1-3, characterized in that, The step of determining multiple candidate tail entities corresponding to the problem vector based on the problem vector and the entity vectors in each of the initial vectors includes: Identify the entity vectors in each of the entity vectors, excluding the head entity vector in the problem vector; The entity vectors other than the head entity vector in the problem vector are taken as the plurality of candidate tail entities.

5. The method according to any one of claims 1-3, characterized in that, The process of obtaining the initial vector of multiple triples and the question vector of the query question includes: Retrieve the query question and the corresponding answer from the corpus; Based on the query question and the corresponding answer, the plurality of triples are obtained; Based on the plurality of triples and the first target model, the initial vectors of the plurality of triples are obtained; The question vector is obtained based on the query question and the second target model.

6. A knowledge graph updating device, characterized in that, The device includes: The acquisition module is used to acquire the initial vector of multiple triples and the question vector of the query question; the initial vector includes an entity vector and a first relation vector. The first determining module is used to determine multiple candidate tail entities corresponding to the problem vector based on the problem vector and the entity vectors in each of the initial vectors; The second determining module is used to determine the first candidate triplet based on the multiple candidate tail entities corresponding to the problem vector; The third determining module is used to determine the similarity between the second relation vector in the problem vector and the first relation vector in each of the initial vectors; and to determine the second candidate triplet based on the similarity between the second relation vector and the first relation vector in each of the initial vectors. The update module is used to determine the intersection between the first candidate triplet and the second candidate triplet; and update the knowledge graph based on the intersection and the multiple triplets. The second determining module is specifically used for: Based on each of the candidate tail entities and the head entity vector and the second relation vector in the question vector, multiple intermediate triples are determined; Determine the quantization value of each of the aforementioned intermediate triplets; The first candidate triplet is determined from the intermediate triplets based on the quantization value of each intermediate triplet.

7. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 5.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 5.

9. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 5.