Method, device, equipment, medium and product for determining relationship information

By combining the entity identifiers, relationship paths and description text vectors in the knowledge graph, and using the relationship prediction model to expand and mine entity relationship information, the problem of the singleness of the knowledge graph is solved and the user experience is improved.

CN119940521BActive Publication Date: 2025-09-19CHINA MOBILEHANGZHOUINFORMATION TECH CO LTD +1
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202510422652.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-04-07
Publication Date
2025-09-19
Estimated Expiration
2045-04-07

AI Technical Summary

Technical Problem

Existing knowledge graphs are relatively simple in determining entity relationship information, which cannot meet the diverse needs of users and affects user experience.

Method used

By combining the positioning of entity identifiers in the knowledge graph, the relationship path and the description information of the entity identifiers and the description text vector corresponding to the cross-description information, the relationship prediction model is used to determine the entity relationship information for expansion and mining.

Benefits of technology

It improves the user experience and can provide users with more diverse and accurate entity relationship information results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119940521B_ABST
    Figure CN119940521B_ABST
Patent Text Reader

Abstract

The present application discloses a method, apparatus, device, medium and product for determining relationship information. The method includes: obtaining entity identification in question information; determining the entity vector corresponding to the entity identification from a preset knowledge graph; obtaining the relationship path of the entity vector in the preset knowledge graph, as well as the description information of the entity identification and the description text vector corresponding to the cross-description information; determining the average vector of the entity vector and the description text vector; inputting the relationship path and the average vector into a relationship prediction model, and using the preset relationship path, the preset average vector and the target relationship information of the preset entity relationship information in the relationship prediction model to determine the target entity relationship information corresponding to the relationship path and the average vector, which is the entity relationship information of the entity identification. It is capable of expanding the entity relationship information in the knowledge graph and mining the entity relationship information of the entity identification, thereby enabling users to obtain the desired results and improving the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of artificial intelligence technology, and in particular relates to a method, apparatus, device, medium and product for determining relationship information. Background Art

[0002] A knowledge graph is a structured semantic network used to represent knowledge in a clear and formal manner. It consists of nodes (identifiers representing entities) and edges (representing the relationships between entities), modeling the various concepts and relationships in human knowledge. Like a vast spider web of knowledge, each node represents a unit of knowledge, and edges are the threads connecting these units. Therefore, a knowledge graph can understand the semantics behind user questions and provide relevant answers.

[0003] Currently, for each user question, we first extract the entity identifiers from the user question based on the knowledge graph. Then, by locating the entity identifiers in the knowledge graph, we determine the entity relationship information between the entities as the corresponding result. However, since the knowledge graph is constructed based on existing entity relationship information, the entity relationship information determined by the knowledge graph is relatively simple and may not be the result the user wants, thus affecting the user experience. Summary of the Invention

[0004] The embodiments of the present application provide a method, apparatus, device, medium, and product for determining relationship information. By locating entity identifiers in a knowledge graph and combining relationship paths with description text vectors corresponding to the entity identifiers' description information and cross-description information, the entity relationship information of the entity identifiers is determined. This method can expand the entity relationship information in the knowledge graph and mine the entity relationship information of the entity identifiers, thereby enabling users to obtain desired results and improving the user experience.

[0005] In a first aspect, an embodiment of the present application provides a method for determining relationship information, including:

[0006] Get the entity identifier in the question information;

[0007] Determine the entity vector corresponding to the entity identifier from the preset knowledge graph;

[0008] Obtain the relationship path of the entity vector in the preset knowledge graph, as well as the description information of the entity identifier and the description text vector corresponding to the cross-description information;

[0009] Determine the average vector of the entity vector and the description text vector;

[0010] The relationship path and the average vector are input into the relationship prediction model, and the target relationship information of the preset relationship path, the preset average vector and the preset entity relationship information in the relationship prediction model are used to determine the target entity relationship information corresponding to the relationship path and the average vector, which is the entity relationship information of the entity identifier.

[0011] In one possible embodiment, obtaining the entity identifier in the question information includes:

[0012] Get problem information;

[0013] Identify entity identifiers in question information.

[0014] In one possible embodiment, after determining that the target entity relationship information corresponding to the relationship path and the average vector is the entity relationship information of the entity identifier, the method further includes:

[0015] Generate response information corresponding to the entity relationship information according to the preset response generation rules.

[0016] In one possible embodiment, after determining that the target entity relationship information corresponding to the relationship path and the average vector is the entity relationship information of the entity identifier, the method further includes:

[0017] Write entity relationship information into the preset knowledge graph.

[0018] In one possible embodiment, the entity identifier includes a first sub-entity identifier and a second sub-entity identifier; the description text vector includes a first vector corresponding to description information of the first sub-entity identifier, a second vector corresponding to description information of the second sub-entity identifier, and a third vector corresponding to cross-description information of the first sub-entity identifier and the second sub-entity identifier; and determining an average vector of the entity vector and the description text vector includes:

[0019] Determine an entity vector corresponding to the first sub-entity identifier and a first sub-average vector of the first vector;

[0020] Determine an entity vector corresponding to the second sub-entity identifier and a second sub-average vector of the second vector;

[0021] The first sub-average vector, the second sub-average vector, and the third vector are concatenated to obtain an average vector.

[0022] In one possible embodiment, before inputting the relationship path and the average vector into the relationship prediction model, the method further includes:

[0023] Obtaining entity identification samples and actual entity relationship information of the entity identification samples;

[0024] Determine the entity vector sample corresponding to the entity identification sample from the preset knowledge graph;

[0025] Obtain entity vector samples, relationship path samples in a preset knowledge graph, and description text vector samples corresponding to the description information and cross-description information of the entity identification samples;

[0026] Determine the average vector sample of the entity vector sample and the description text vector sample;

[0027] Inputting the relationship path samples and the average vector samples into the initial relationship prediction model, and using the preset relationship path, preset average vector and initial relationship information of the preset entity relationship information in the initial relationship prediction model, determining the predicted entity relationship information corresponding to the relationship path samples and the average vector samples, which is the predicted entity relationship information of the entity identification sample;

[0028] According to the actual entity relationship information and the predicted entity relationship information, the loss value of the initial relationship prediction model is determined according to the preset loss relationship information, where the preset loss relationship information includes the mutual information of the relationship path sample and the average vector sample;

[0029] When the loss value does not meet the preset training stop condition, the initial relationship information is updated, and the predicted entity relationship information is updated using the updated initial relationship information. According to the actual entity relationship information and the updated predicted entity relationship information, the loss value of the initial relationship prediction model is updated according to the preset loss relationship information. When the updated loss value meets the preset stop condition, the target relationship information is determined to obtain the relationship prediction model.

[0030] In a second aspect, an embodiment of the present application provides a device for determining relationship information, including:

[0031] The acquisition module is used to obtain the entity identifier in the question information;

[0032] A determination module is used to determine the entity vector corresponding to the entity identifier from a preset knowledge graph;

[0033] The acquisition module is also used to obtain the relationship path of the entity vector in the preset knowledge graph, as well as the description information of the entity identifier and the description text vector corresponding to the cross-description information;

[0034] The determination module is further used to determine the average vector of the entity vector and the description text vector;

[0035] The determination module is also used to input the relationship path and average vector into the relationship prediction model, and use the preset relationship path, preset average vector and preset entity relationship information in the relationship prediction model to determine the target entity relationship information corresponding to the relationship path and average vector, which is the entity relationship information of the entity identifier.

[0036] In a third aspect, an embodiment of the present application provides an electronic device, the device comprising:

[0037] a processor and a memory storing computer program instructions;

[0038] The method for determining any of the above relationship information is implemented when a processor executes computer program instructions.

[0039] In a fourth aspect, an embodiment of the present application provides a computer storage medium, on which computer program instructions are stored. When the computer program instructions are executed by a processor, a method for determining the relationship information of any one of the above items is implemented.

[0040] In a fifth aspect, an embodiment of the present application provides a computer program product, characterized in that when the instructions in the computer program product are executed by a processor of an electronic device, the electronic device is able to execute any of the above-mentioned methods for determining relationship information.

[0041] The method, apparatus, device, medium and product for determining relationship information of the embodiments of the present application include: obtaining entity identifiers in question information; determining entity vectors corresponding to the entity identifiers from a preset knowledge graph; obtaining the relationship path of the entity vectors in the preset knowledge graph, as well as the description information of the entity identifiers and the description text vectors corresponding to the cross-description information; determining the average vector of the entity vectors and the description text vectors; inputting the relationship path and the average vector into a relationship prediction model, and using the preset relationship path, preset average vector and target relationship information of the preset entity relationship information in the relationship prediction model to determine the target entity relationship information corresponding to the relationship path and the average vector, which is the entity relationship information of the entity identifier.

[0042] In this way, by locating the entity identifier in the knowledge graph, and combining the relationship path with the description text vector corresponding to the entity identifier's description information and cross-description information, the entity relationship information of the entity identifier can be determined. This can expand the entity relationship information in the knowledge graph and mine the entity relationship information of the entity identifier, thereby enabling users to obtain the desired results and improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0044] Figure 1 This is a flowchart of a method for determining relationship information provided by an embodiment of the present application;

[0045] Figure 2is a flowchart of a method for determining relationship information provided by another embodiment of the present application;

[0046] Figure 3 is a flowchart of a method for determining relationship information provided by yet another embodiment of the present application;

[0047] Figure 4 is a flowchart of a method for determining relationship information provided in yet another embodiment of the present application;

[0048] Figure 5 is a flowchart of a method for determining relationship information provided in yet another embodiment of the present application;

[0049] Figure 6 is a structural diagram of a device for determining relationship information provided in yet another embodiment of the present application;

[0050] Figure 7 This is a structural diagram of an electronic device provided in yet another embodiment of the present application. DETAILED DESCRIPTION

[0051] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain the present application, rather than to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is merely to provide a better understanding of the present application by illustrating the examples of the present application.

[0052] It should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, the elements defined by the phrase "comprising..." do not exclude the presence of other identical elements in the process, method, article, or device comprising the elements.

[0053] A knowledge graph is a structured semantic network used to represent knowledge in a clear and formal manner. It consists of nodes (identifiers representing entities) and edges (representing the relationships between entities), modeling the various concepts and relationships in human knowledge. Like a vast spider web of knowledge, each node represents a unit of knowledge, and edges are the threads connecting these units. Therefore, a knowledge graph can understand the semantics behind user questions and provide relevant answers.

[0054] Currently, for each user question, we first extract the entity identifiers from the user question based on the knowledge graph. Then, by locating the entity identifiers in the knowledge graph, we determine the entity relationship information between the entities as the corresponding result. However, since the knowledge graph is constructed based on existing entity relationship information, the entity relationship information determined by the knowledge graph is relatively simple and may not be the result the user wants, thus affecting the user experience.

[0055] In order to solve the problems of the prior art, the embodiments of the present application provide a method, apparatus, device, medium and product for determining relationship information. The method for determining relationship information provided in the embodiments of the present application determines the entity relationship information of the entity identifier by locating the entity identifier in the knowledge graph and combining the relationship path with the description text vector corresponding to the description information and cross-description information of the entity identifier. It can expand the entity relationship information in the knowledge graph and mine the entity relationship information of the entity identifier, thereby enabling users to obtain the desired results and improving the user experience.

[0056] The following first introduces the method for determining relationship information provided in the embodiment of the present application. Figure 1 A flow chart of a method for determining relationship information provided by an embodiment of the present application is shown.

[0057] like Figure 1 As shown, the method for determining relationship information provided in the embodiment of the present application includes the following steps.

[0058] S110: Obtain entity identifiers in the question information.

[0059] Here, the question information may be question information input by the user, for example, the question information may be “What is the relationship between character 1 and character 2?”.

[0060] In some embodiments, a preset large language model is used to perform entity recognition on the head and tail entities in the question information to obtain entity identifiers, which are recorded as [h, t]. Here, the preset large language model is set in advance and is not specifically limited here.

[0061] In some embodiments, the entity identifier may also be determined based on the part of speech of the phrase in the question information.

[0062] In some embodiments, entity identifiers may also be extracted from question information based on entity identifiers in a preset knowledge graph.

[0063] It should be noted that the question information includes at least two entity identifiers. In the embodiment provided in this application, two entity identifiers are used for illustration.

[0064] S120. Determine the entity vector corresponding to the entity identifier from the preset knowledge graph.

[0065] Here, the preset knowledge graph is set in advance.

[0066] In some embodiments, a preset knowledge graph is constructed based on existing associated knowledge. The preset knowledge graph is a triple consisting mainly of entity identifiers, and entity relationship information or attribute information. For example, <Person 1, born in, target location> is a triple of entity identifier and entity relationship information type, where "Person 1" and "target location" are person entity identifiers and geographical entity identifiers, and "born in" is a type of entity relationship information. <Person 1, date of birth, 1954> is a triple of entity identifier and attribute information type, where "date of birth, 1954" is attribute information describing the person entity identifier "Person 1".

[0067] Specifically, the type of the preset knowledge graph can be a general encyclopedia type knowledge graph or a vertical field knowledge graph, such as a financial knowledge graph in the vertical field, an e-commerce knowledge graph involving the e-commerce field, etc.

[0068] In some embodiments, the entity vector [h kg , t kg Specifically, the entity identifier is vectorized to obtain a target vector. Based on the similarity between the target vector and the entity vectors in the preset knowledge graph (for example, the entity vector with the greatest similarity is selected), the entity vector corresponding to the entity identifier is determined from the preset knowledge graph.

[0069] In some embodiments, an embedded representation of a knowledge graph is constructed based on a preset knowledge graph. The embedded representation of the knowledge graph can use the TransE representation learning algorithm to generate a low-dimensional vector representation of entity identifiers and entity relationship information. Other knowledge graph representation learning algorithms such as TranH and TranG can also be used instead of the TransE representation learning algorithm. Heterogeneous graph representation learning algorithms such as HetGNN can also be used instead of the TransE representation learning algorithm.

[0070] S130: Obtain the relationship path of the entity vector in the preset knowledge graph, as well as the description information of the entity identifier and the description text vector corresponding to the cross-description information.

[0071] In some embodiments, a random walk algorithm, a depth-first search algorithm, or a breadth-first search algorithm can be used to determine a set of relationship paths between entity identifiers. The relationship path set includes relationship paths p1, p2..., p i …, p m For example, p1: <Person 2, residence, target location, celebrity, person 1>, p2: <Person 2, has son, person 3, has engagement, person 1>, etc.

[0072] In some embodiments, based on a preset rule or a preset logical model, a relationship path that meets a preset condition is screened from the relationship path set. That is, from p1, p2..., p i …, p m Filter out n relationship paths p1,…,p that meet the preset conditions i …, p n (m is greater than or equal to n).

[0073] In some embodiments, each relationship path is represented based on the embedding representation of the knowledge graph. The entity identification and entity relationship information in the embedding representation are vector averaged and recorded as v p1 ,…,v pi …, v pn The final relationship path is represented by v p1 ,…,v pi …, v pn .

[0074] In some embodiments, description information and cross-description information of entity identifiers are obtained from a preset text library and vectorized to obtain a description text vector.

[0075] As an example, based on the preset large language model, the description information h of the character entity identifiers "character 1" and "character 2" are generated respectively. text and t text , generate text that introduces the relationship between the two, that is, cross description information ht text , and vectorize it to get the description text vector, recorded as [h text , t text , ht text ].

[0076] Here, you can use BGE's embedding, doc2vec, word2vec and other text-to-vector tools for vectorization.

[0077] S140: Determine an average vector of the entity vector and the description text vector.

[0078] In some embodiments, since the entity vector only has the vector corresponding to the entity identifier, and the description text vector has one more column than the entity vector, the extra column does not need to be calculated as the average vector, but can be directly spliced ​​into the average vector to obtain the average vector of the entity vector and the description text vector. In other words, [h kg , t kg ] and [h text , t text , ht text ] Take the average vector, the missing part ht text Keep it unchanged and get the average vector of entity vector and description text vector [h vec , t vec , ht vec ]. [h vec , t vec , ht vec ] as entity attribute features.

[0079] In the embodiment provided in this application, the head and tail entity identifiers are subjected to entity recognition, and the description information and cross description information of the corresponding head and tail entity identifiers are obtained. text , t text and ht text , the vectorized [h text , t text , ht text ] and the head and tail entity vectors of the knowledge graph [h kg , t kg ], and after averaging, we get the entity attribute feature [h vec , t vec , ht vec ]. In particular, combined with [h kg , t kg ] and [h text , t text , ht text ], and constructed rich entity attribute features for subsequent prediction of entity relationship information.

[0080] S150. Input the relationship path and the average vector into the relationship prediction model, and use the preset relationship path, preset average vector and target relationship information of the preset entity relationship information in the relationship prediction model to determine the target entity relationship information corresponding to the relationship path and the average vector, which is the entity relationship information of the entity identifier.

[0081] Here, the relationship prediction model is trained in advance. The preset relationship path includes the relationship path, the preset average vector includes the average vector, and the preset entity relationship information includes the target entity relationship information.

[0082] As an example, the relationship prediction model may be a deep neural network (DNN) model.

[0083] In some embodiments, the entity relationship information of the entity identifier is represented by a triple, for example, <person 2, has daughter-in-law, person 1>.

[0084] In this way, by locating the entity identifier in the knowledge graph, and combining the relationship path with the description text vector corresponding to the entity identifier's description information and cross-description information, the entity relationship information of the entity identifier can be determined. This can expand the entity relationship information in the knowledge graph and mine the entity relationship information of the entity identifier, thereby enabling users to obtain the desired results and improving the user experience.

[0085] Based on this, in some embodiments, the above S110 may specifically include:

[0086] Get problem information;

[0087] Identify entity identifiers in question information.

[0088] In some embodiments, a preset large language model is used to perform entity recognition on the head and tail entity identifiers in the question information to obtain entity identifiers, which are recorded as [h, t]. Here, the preset large language model is set in advance and is not specifically limited here.

[0089] In this way, by identifying the entity identifiers in the question information and obtaining the entity identifiers instead of extracting them from the knowledge graph, the entity attribute features can be enriched, thereby improving the accuracy of entity relationship information prediction.

[0090] Based on this, in some embodiments, such as Figure 2 As shown, after the above S150, the method may further include:

[0091] S160: Generate reply information corresponding to the entity relationship information according to preset reply generation rules.

[0092] Here, the preset response generation rule is set in advance. The preset response generation rule can convert triples into sentences.

[0093] As an example, the triplet obtained by the relationship prediction model is <Person 2, has a daughter-in-law, Person 1>. Using the preset large language model and according to the preset response generation rules, the response information for the question "What is the relationship between Person 1 and Person 2" is "Person 1 is Person 2's daughter-in-law."

[0094] In this way, by presetting the reply generation rules, the entity relationship information output by the relationship prediction model is converted into reply information corresponding to the question information, which is convenient for users to understand and improve the user experience.

[0095] Based on this, in some embodiments, such as Figure 3 As shown, after the above S150, the method may further include:

[0096] S170. Write the entity relationship information into the preset knowledge graph.

[0097] In some embodiments, the triples derived from the relationship prediction model are written into the preset knowledge graph as incremental knowledge to update the knowledge and embedding representation in the preset knowledge graph in real time.

[0098] In some embodiments, the triples derived from the relationship prediction model are displayed, and after confirmation by the user, the user's confirmation input is received, and the entity relationship information is written into the preset knowledge graph.

[0099] In this way, by updating the preset knowledge graph in real time and expanding the entity relationship information in the knowledge graph, the diversity of the prediction results is further improved and the user experience is enhanced.

[0100] Based on this, in some embodiments, the entity identifier includes a first sub-entity identifier and a second sub-entity identifier; the description text vector includes a first vector corresponding to the description information of the first sub-entity identifier, a second vector corresponding to the description information of the second sub-entity identifier, and a third vector corresponding to the cross-description information of the first sub-entity identifier and the second sub-entity identifier; Figure 4 As shown, the above S140 may specifically include:

[0101] S141. Determine an entity vector corresponding to a first sub-entity identifier and a first sub-average vector of the first vector;

[0102] S142. Determine the entity vector corresponding to the second sub-entity identifier and the second sub-average vector of the second vector;

[0103] S143 . Concatenate the first sub-average vector, the second sub-average vector, and the third vector to obtain an average vector.

[0104] In some embodiments, since the entity vector only has the entity vectors corresponding to the first sub-entity identifier and the second sub-entity identifier, the description text vector includes the first vector, the second vector, and the third vector, which has one more column than the entity vector. Therefore, the extra column does not need to be calculated as the average vector, but can be directly spliced ​​into the average vector to obtain the average vector of the entity vector and the description text vector. In other words, [h kg , t kg ] and [h text , t text , ht text ] Take the average vector, the missing part ht textKeep it unchanged and get the average vector of entity vector and description text vector [h vec , t vec , ht vec ].

[0105] In this way, for question information with two entity identifiers, the entity relationship information of the entity identifiers can be determined by locating the entity identifiers in the knowledge graph, and combining the relationship path with the description text vectors corresponding to the description information and cross-description information of the entity identifiers. This can expand the entity relationship information in the knowledge graph and mine the entity relationship information of the entity identifiers, thereby enabling users to obtain the desired results and improving the user experience.

[0106] Based on this, in some embodiments, such as Figure 5 As shown, before S150, the method may further include:

[0107] S210: Obtain entity identification samples and actual entity relationship information of the entity identification samples.

[0108] S220: Determine an entity vector sample corresponding to the entity identification sample from a preset knowledge graph.

[0109] In some embodiments, the entity vector sample [h', t'] corresponding to the entity identification sample [h', t'] is determined from the preset knowledge graph. kg , t' kg Specifically, the entity identification sample is vectorized to obtain a target vector sample. Based on the similarity between the target vector sample and the entity vector in the preset knowledge graph (for example, the entity vector with the greatest similarity is selected), the entity vector sample corresponding to the entity identification sample is determined from the preset knowledge graph.

[0110] S230: Obtain entity vector samples, relationship path samples in a preset knowledge graph, and description text vector samples corresponding to the description information and cross-description information of the entity identification samples.

[0111] In some embodiments, description information and cross-description information of entity identification samples are obtained from a preset text library and vectorized to obtain description text vector samples.

[0112] S240: Determine the average vector sample of the entity vector sample and the description text vector sample.

[0113] In some embodiments, since the entity vector sample only has the vector corresponding to the entity identification sample, and the description text vector sample has one more column than the entity vector sample, the extra column does not need to be calculated as the average vector, but is directly spliced ​​into the average vector to obtain the average vector sample of the entity vector sample and the description text vector sample. In other words, [h' kg, t' kg ] and [h' text , t' text , ht' text ] Take the average vector, the missing part ht' text Keep it unchanged and get the average vector sample [h' vec , t' vec , ht' vec ]. [h' vec , t' vec , ht' vec ] as entity attribute features.

[0114] S250. Input the relationship path samples and the average vector samples into the initial relationship prediction model, and use the initial relationship information of the preset relationship path, preset average vector and preset entity relationship information in the initial relationship prediction model to determine the predicted entity relationship information corresponding to the relationship path samples and the average vector samples, which is the predicted entity relationship information of the entity identification sample.

[0115] Here, the initial relationship prediction model can be set in advance, such as a DNN neural network, learning to sort, etc.

[0116] In some embodiments, the preset relationship path includes relationship path samples, the preset average vector includes average vector samples, and the preset entity relationship information includes predicted entity relationship information.

[0117] S260. Determine the loss value of the initial relationship prediction model according to the actual entity relationship information and the predicted entity relationship information and the preset loss relationship information. The preset loss relationship information includes the mutual information of the relationship path samples and the average vector samples.

[0118] Here, the preset loss relationship information is set in advance.

[0119] In some embodiments, the preset loss relationship information can be expressed using formula (1):

[0120] (1)

[0121] Among them, s(h', t') represents the loss value; J(θ) is the penalty term of the initial relationship prediction model, such as L1, L2 penalty function; y i is the actual entity relationship information of the entity identification sample [h', t']. vec , t' vec , ht' vec ],[v' p1 ,…,v' pi …, v' pn ]) represents the average vector [h'vec , t' vec , ht' vec ] and the relationship path [v' p1 ,…,v' pi …, v' pn ] is the mutual information term. L(y i ,f(h' vec , t' vec , ht' vec , v' p1 ,…,v' pi …, v' pn )) represents the initial objective function of the initial relationship prediction model, is the final objective function, which is also the preset loss relationship information.

[0122] It should be noted that the mutual information term is intended to minimize the correlation between entity attribute features and relationship paths.

[0123] S270. When the loss value does not meet the preset training stop condition, the initial relationship information is updated, and the predicted entity relationship information is updated using the updated initial relationship information. According to the actual entity relationship information and the updated predicted entity relationship information, the loss value of the initial relationship prediction model is updated according to the preset loss relationship information. When the updated loss value meets the preset stop condition, the target relationship information is determined to obtain the relationship prediction model.

[0124] In some embodiments, the preset training stopping condition is that the loss value of the initial relationship prediction model converges to a minimum.

[0125] In some embodiments, based on entity identification samples and actual entity relationship information of entity identification samples, a training data set and a test data set are constructed, and the initial relationship prediction model is trained until the loss value of the initial relationship prediction model converges to a minimum, thereby obtaining a trained relationship prediction model.

[0126] In this way, the relationship prediction model is trained through a large number of training samples. When the loss value of the initial relationship prediction model meets the preset stopping condition, the target relationship information is determined and the relationship prediction model is obtained, which further improves the accuracy of the entity relationship information.

[0127] With the development of large-scale model technology, more and more tasks, such as link prediction and knowledge completion, are gradually being integrated with large-scale model agent technology. Traditional knowledge completion methods rely on small models, such as GNNs and path sorting algorithms, to predict knowledge. These methods rely heavily on training data and have poor generalizability and scalability. On the other hand, while large-scale model agents offer significant advantages in natural language generation, retrieval-enhanced generation, and general knowledge, they lack rigorous knowledge understanding and reasoning capabilities and require the design of prompt text, resulting in poor scalability. For example, if a large model is asked, "What is the relationship between Person 2 and Person 1?", while the large model can generate relevant knowledge about "Person 2" and "Person 1" through retrieval-enhanced generation, it struggles to determine the true relationship between the two.

[0128] The embodiment provided in this application constructs a KG-agent intelligent system based on the embedded representation of the knowledge graph, and uses the entity attribute feature generation module to determine the average vector, the relationship path generation module to obtain the relationship path, and the relationship scoring module to predict the entity relationship information. By constructing an intelligent agent framework based on the knowledge graph, the large language model question and answer can be better combined with the associated knowledge in the knowledge graph. Based on the objective facts in the knowledge graph, the relationship path is mined, and at the same time, the entity attribute features generated by the large language model are combined to achieve and complete the knowledge completion in the large language model. Secondly, the knowledge graph is completed in an incremental update manner. By incrementally updating the entity relationship information, the incremental update of the knowledge graph is achieved, and the completion effect is improved.

[0129] Here, the KG-agent intelligent system can be integrated into the language model. For example, separate prompt words can be constructed and integrated into the Qwen2-72B-instruct. Alternatively, the KG-agent can be integrated into the language model using methods such as agent registration tools and tool call fine-tuning. Furthermore, in addition to using the Qwen2-72B-instruct model, other similar language models, such as multimodal visual language models, can also be used.

[0130] The embodiment provided by this application creatively uses the mutual information term. Different from the objective function of the traditional relationship prediction model, the relationship prediction model constructed by the embodiment provided by this application is not only the objective function L(y) of the DNN model constructed by using entity attribute features and relationship paths. i ,f(h vec , t vec , ht vec , v p1 ,…,v pi …, v pn )) and its penalties , and also use mutual information I([h vec , t vec , ht vec ],[v p1 ,…,v pi …, v pn ]) as part of the objective function to constrain entity attribute features and relationship paths, allowing features of different parts to independently learn DNN network weights. Compared to using only L(y i ,f(h vec , t vec , ht vec , v p1 ,…,v pi …, v pn )) and penalty terms, increasing mutual information can limit the correlation between entity attribute features and relationship paths. By learning the mutual information with the minimum feature correlation, the two parts of features can be independently represented and have stronger robustness and generalization.

[0131] The key points of the embodiments provided in this application mainly include: (1) Based on the existing knowledge graph triples and incremental knowledge graph triples, external knowledge of entities and entity attributes is provided to construct an embedded representation of the knowledge graph, thereby building a KG-agent intelligent system for the large language model, so that the large language model can correctly retrieve paths, predict relationships, and have better logical reasoning capabilities. It solves the hallucination problem of the large language model and completes and expands existing knowledge; (2) Based on the entity attribute features and relationship paths generated by the large language model and the knowledge graph, a relationship prediction model combined with mutual information is constructed to achieve knowledge completion. The relationship prediction model is also integrated into the KG-agent intelligent system, and the model call is realized using the intelligent system call capability of the large language model. The main advantages include: (1) The KG-agent intelligent system integrated by the large language model can complete knowledge completion. Compared with the entity attribute features and relationship features of the traditional knowledge graph, it can better generate the entity features and relationship features of the knowledge graph, thereby better completing the knowledge graph relationship prediction; (2) Based on the entity attribute features and relationship paths generated by the large language model and the knowledge graph, the entity relationship information is predicted using the relationship prediction model combined with mutual information, rather than using the entity attribute feature information in the attention-based neural network of the commonly used large models such as Llama and chatGPT to generate, predict or summarize the relationship between different entities.

[0132] The embodiments provided in this application can be applied to robots. Many robot question-answering systems based on large language models are prone to hallucinations, and knowledge completion is one of the important ways for robot large language models to obtain high-quality corpus and address the hallucination problem. As real-world text and data are trained and used by large language models, how to mine implicit relationships in the real world and construct new high-quality data has become a key component of existing robot large model technology.

[0133] Based on the relationship information determination method provided in the above embodiment, the present application also provides a specific implementation of the relationship information determination device. Please refer to the following embodiment.

[0134] See also Figure 6 The apparatus 300 for determining relationship information provided in the embodiment of the present application includes:

[0135] An acquisition module 310 is used to acquire an entity identifier in the question information;

[0136] A determination module 320 is configured to determine an entity vector corresponding to an entity identifier from a preset knowledge graph;

[0137] The acquisition module 310 is further configured to acquire the relationship path of the entity vector in the preset knowledge graph, as well as the description information of the entity identifier and the description text vector corresponding to the cross-description information;

[0138] The determination module 320 is further configured to determine an average vector of the entity vector and the description text vector;

[0139] The determination module 320 is also used to input the relationship path and the average vector into the relationship prediction model, and use the preset relationship path, the preset average vector and the target relationship information of the preset entity relationship information in the relationship prediction model to determine the target entity relationship information corresponding to the relationship path and the average vector, which is the entity relationship information of the entity identifier.

[0140] Based on this, in some embodiments, the acquisition module 310 may be specifically used to:

[0141] Get problem information;

[0142] Identify entity identifiers in question information.

[0143] Based on this, in some embodiments, the apparatus 300 may further include:

[0144] The generation module is used to generate response information corresponding to the entity relationship information according to a preset response generation rule after determining that the target entity relationship information corresponding to the relationship path and the average vector is the entity relationship information of the entity identifier.

[0145] Based on this, in some embodiments, the apparatus 300 may further include:

[0146] The writing module is used to write the entity relationship information into the preset knowledge graph after determining that the target entity relationship information corresponding to the relationship path and the average vector is the entity relationship information of the entity identifier.

[0147] Based on this, in some embodiments, the entity identifier includes a first sub-entity identifier and a second sub-entity identifier; the description text vector includes a first vector corresponding to the description information of the first sub-entity identifier, a second vector corresponding to the description information of the second sub-entity identifier, and a third vector corresponding to the cross-description information of the first sub-entity identifier and the second sub-entity identifier; the determination module 320 can specifically be used to:

[0148] Determine an entity vector corresponding to the first sub-entity identifier and a first sub-average vector of the first vector;

[0149] Determine an entity vector corresponding to the second sub-entity identifier and a second sub-average vector of the second vector;

[0150] The first sub-average vector, the second sub-average vector, and the third vector are concatenated to obtain an average vector.

[0151] Based on this, in some embodiments, the apparatus 300 may further include:

[0152] The acquisition module 310 is further configured to acquire entity identification samples and actual entity relationship information of the entity identification samples before inputting the relationship paths and average vectors into the relationship prediction model;

[0153] The determination module 320 is further configured to determine an entity vector sample corresponding to the entity identification sample from a preset knowledge graph;

[0154] The acquisition module 310 is further configured to acquire entity vector samples, relationship path samples in a preset knowledge graph, and description text vector samples corresponding to the description information and cross-description information of the entity identification samples;

[0155] The determination module 320 is further configured to determine an average vector sample of the entity vector sample and the description text vector sample;

[0156] The determination module 320 is further configured to input the relationship path samples and the average vector samples into the initial relationship prediction model, and use the preset relationship path, preset average vector, and initial relationship information of the preset entity relationship information in the initial relationship prediction model to determine the predicted entity relationship information corresponding to the relationship path samples and the average vector samples, which is the predicted entity relationship information of the entity identification sample;

[0157] The determination module 320 is further configured to determine the loss value of the initial relationship prediction model according to the actual entity relationship information and the predicted entity relationship information and the preset loss relationship information, wherein the preset loss relationship information includes the mutual information of the relationship path sample and the average vector sample;

[0158] The determination module 320 is also used to update the initial relationship information when the loss value does not meet the preset training stop condition, use the updated initial relationship information to update the predicted entity relationship information, update the loss value of the initial relationship prediction model according to the preset loss relationship information based on the actual entity relationship information and the updated predicted entity relationship information, and determine the target relationship information when the updated loss value meets the preset stop condition to obtain the relationship prediction model.

[0159] The various modules of the apparatus for determining relationship information provided in the embodiment of the present application can implement the functions of the various steps of the method for determining relationship information provided above and achieve the corresponding technical effects. For the sake of brevity, they will not be described in detail here.

[0160] Based on the same inventive concept, an embodiment of the present application also provides an electronic device.

[0161] Figure 7 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application is shown.

[0162] The electronic device may include a processor 401 and a memory 402 storing computer program instructions.

[0163] Specifically, the processor 401 may include a central processing unit (CPU) or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.

[0164] Memory 402 may include a large-capacity memory for data or instructions. By way of example and not limitation, memory 402 may include a hard disk drive (HDD), a floppy disk drive, flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive, or a combination of two or more of these. Where appropriate, memory 402 may include removable or non-removable (or fixed) media. Where appropriate, memory 402 may be internal or external to the integrated gateway disaster recovery device. In a specific embodiment, memory 402 is a non-volatile solid-state memory.

[0165] The memory may include read-only memory (ROM), random access memory (RAM), magnetic disk storage media devices, optical storage media devices, flash memory devices, electrical, optical, or other physical / tangible memory storage devices. Thus, generally, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to an aspect of the present disclosure.

[0166] The processor 401 reads and executes computer program instructions stored in the memory 402 to implement any one of the relationship information determination methods in the above embodiments.

[0167] In one example, the electronic device may further include a communication interface 403 and a bus 410. Figure 7 As shown, the processor 401 , the memory 402 , and the communication interface 403 are connected via a bus 410 and communicate with each other.

[0168] The communication interface 403 is mainly used to implement communication between various modules, devices, units and / or equipment in the embodiments of the present application.

[0169] Bus 410 includes hardware, software, or both that couples components of an electronic device to each other. By way of example, and not limitation, a bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Extended Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a HyperTransport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an InfiniBand interconnect, a Linear Predictive Coding (LPC) bus, a memory bus, a MicroChannel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (Peripheral Component Interconnect-X, PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local Bus (VESA Local Bus, VLB) bus, or other suitable buses, or a combination of two or more of these. Where appropriate, bus 410 may include one or more buses. Although the embodiments of the present application describe and illustrate a specific bus, the present application contemplates any suitable bus or interconnection. The electronic device can execute the relationship information determination method of the embodiments of the present invention, thereby implementing the above relationship information determination method.

[0170] In addition, in conjunction with the relationship information determination method in the above embodiments, embodiments of the present application may provide a computer storage medium for implementation. The computer storage medium stores computer program instructions; when the computer program instructions are executed by a processor, any of the relationship information determination methods in the above embodiments is implemented.

[0171] The present application also provides a computer program product. When the instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes each process of any one of the above-mentioned relationship information determination method embodiments.

[0172] It should be understood that the present application is not limited to the specific configurations and processes described above and illustrated in the figures. For the sake of brevity, a detailed description of known methods is omitted here. In the above embodiments, several specific steps are described and illustrated as examples. However, the method process of the present application is not limited to the specific steps described and illustrated. Those skilled in the art can make various changes, modifications, and additions, or change the order of the steps after understanding the spirit of the present application.

[0173] The functional blocks shown in the above structural block diagram can be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, they can be, for example, electronic circuits, application-specific integrated circuits (ASICs), appropriate firmware, plug-ins, function cards, etc. When implemented in software, the elements of this application are programs or code segments used to perform the required tasks. Programs or code segments can be stored in a machine-readable medium or transmitted via a data signal carried in a carrier wave over a transmission medium or communication link. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, read-only memory (ROM), flash memory, erasable read-only memory (EROM), floppy disks, compact disc read-only memory (CD-ROM), optical discs, hard disks, optical fiber media, radio frequency (RF) links, etc. Code segments can be downloaded via computer networks such as the Internet or an intranet.

[0174] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps. In other words, the steps can be performed in the order mentioned in the embodiments, or in a different order, or several steps can be performed simultaneously.

[0175] Aspects of the present disclosure have been described above with reference to flowcharts and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the present disclosure. It should be understood that each block in the flowcharts and / or block diagrams, as well as combinations of blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device to produce a machine such that execution of these instructions by the processor of the computer or other programmable data processing device enables the implementation of the functions / actions specified in one or more blocks in the flowcharts and / or block diagrams. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field programmable logic circuit. It should also be understood that each block in the block diagrams and / or flowcharts, as well as combinations of blocks in the block diagrams and / or flowcharts, can also be implemented by dedicated hardware that performs the specified functions or actions, or by a combination of dedicated hardware and computer instructions.

[0176] The above is only a specific implementation method of the present application. Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the scope of protection of the present application is not limited to this. Any technician familiar with this technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in this application, and these modifications or replacements should be included in the scope of protection of this application.

Claims

1. A method for determining relationship information, characterized in that: include: Get the entity identifier in the question information; Determine an entity vector corresponding to the entity identifier from a preset knowledge graph; Obtaining the relationship path of the entity vector in the preset knowledge graph, and obtaining the description information and cross-description information of the entity identifier from a preset text library; Vectorizing the description information and cross-description information of the entity identifier to obtain description text vectors corresponding to the description information and cross-description information of the entity identifier; Determine an average vector of the entity vector and the description text vector; The relationship path and the average vector are input into a relationship prediction model, and the target relationship information of the preset relationship path, preset average vector, and preset entity relationship information in the relationship prediction model is used to determine the target entity relationship information corresponding to the relationship path and the average vector, which is the entity relationship information of the entity identifier. The training process of the relationship prediction model includes: using preset loss relationship information to calculate the loss value of the initial relationship prediction model, and when the loss value meets the preset training stop condition, determining the target relationship information to obtain the relationship prediction model, the preset loss relationship information includes the mutual information of the relationship path sample and the average vector sample, and the preset loss relationship information is expressed using the following formula: ; Among them, s(h', t') represents the loss value; J(θ) is the penalty term of the initial relationship prediction model; y i is the actual entity relationship information of the entity identification sample [h', t']; I([h' vec , t' vec , ht' vec ],[v' p1 ,…,v' pi …, v' pn ]) represents the average vector [h' vec , t' vec , ht' vec ] and the relationship path [v' p1 ,…,v' pi …, v' pn ]; L(y i ,f(h' vec , t' vec , ht' vec , v' p1 ,…,v' pi …, v' pn )) represents the initial objective function of the initial relationship prediction model; Generate reply information corresponding to the entity relationship information according to preset reply generation rules; The entity identifier includes a first sub-entity identifier and a second sub-entity identifier; the description text vector includes a first vector corresponding to the description information of the first sub-entity identifier, a second vector corresponding to the description information of the second sub-entity identifier, and a third vector corresponding to the cross-description information of the first sub-entity identifier and the second sub-entity identifier; and determining an average vector of the entity vector and the description text vector includes: Determine an entity vector corresponding to the first sub-entity identifier and a first sub-average vector of the first vector; Determine an entity vector corresponding to the second sub-entity identifier and a second sub-average vector of the second vector; The first sub-average vector, the second sub-average vector, and the third vector are concatenated to obtain an average vector.

2. The method for determining relationship information according to claim 1, wherein: The obtaining of the entity identifier in the question information includes: Get problem information; Identify the entity identifier in the question information.

3. The method for determining relationship information according to claim 1, wherein: After determining that the target entity relationship information corresponding to the relationship path and the average vector is the entity relationship information of the entity identifier, the method further includes: Write the entity relationship information into the preset knowledge graph.

4. The method for determining relationship information according to claim 1, wherein: Before inputting the relationship path and the average vector into a relationship prediction model, the method further includes: Obtaining entity identification samples and actual entity relationship information of the entity identification samples; Determine an entity vector sample corresponding to the entity identification sample from the preset knowledge graph; Obtain the entity vector sample, the relationship path sample in the preset knowledge graph, and the description text vector sample corresponding to the description information and cross-description information of the entity identification sample; Determine an average vector sample of the entity vector sample and the description text vector sample; Inputting the relationship path sample and the average vector sample into an initial relationship prediction model, and using the preset relationship path, the preset average vector, and the initial relationship information of the preset entity relationship information in the initial relationship prediction model, determining predicted entity relationship information corresponding to the relationship path sample and the average vector sample, as the predicted entity relationship information of the entity identification sample; Determining a loss value of the initial relationship prediction model according to the actual entity relationship information and the predicted entity relationship information and preset loss relationship information, wherein the preset loss relationship information includes mutual information between the relationship path sample and the average vector sample; When the loss value does not meet the preset training stop condition, the initial relationship information is updated, and the predicted entity relationship information is updated using the updated initial relationship information. According to the actual entity relationship information and the updated predicted entity relationship information, the loss value of the initial relationship prediction model is updated according to the preset loss relationship information. When the updated loss value meets the preset training stop condition, the target relationship information is determined to obtain the relationship prediction model.

5. A device for determining relationship information, characterized in that: include: The acquisition module is used to obtain the entity identifier in the question information; A determination module, configured to determine an entity vector corresponding to the entity identifier from a preset knowledge graph; The acquisition module is further configured to acquire the relationship path of the entity vector in the preset knowledge graph, and to acquire the description information and cross-description information of the entity identifier from a preset text library; Vectorizing the description information and cross-description information of the entity identifier to obtain description text vectors corresponding to the description information and cross-description information of the entity identifier; The determining module is further configured to determine an average vector of the entity vector and the description text vector; The determination module is further configured to input the relationship path and the average vector into a relationship prediction model, and determine target entity relationship information corresponding to the relationship path and the average vector using a preset relationship path, a preset average vector, and target relationship information of preset entity relationship information in the relationship prediction model, which is entity relationship information of the entity identifier. The training process of the relationship prediction model includes: calculating a loss value of an initial relationship prediction model using preset loss relationship information, and determining the target relationship information when the loss value satisfies a preset training stop condition to obtain the relationship prediction model. The preset loss relationship information includes the mutual information of relationship path samples and average vector samples, and the preset loss relationship information is expressed using the following formula: ; Among them, s(h', t') represents the loss value; J(θ) is the penalty term of the initial relationship prediction model; y i is the actual entity relationship information of the entity identification sample [h', t']; I([h' vec , t' vec , ht' vec ],[v' p1 ,…,v' pi …, v' pn ]) represents the average vector [h' vec , t' vec , ht' vec ] and the relationship path [v' p1 ,…,v' pi …, v' pn ]; L(y i ,f(h' vec , t' vec , ht' vec , v' p1 ,…,v' pi …, v' pn )) represents the initial objective function of the initial relationship prediction model; Generate reply information corresponding to the entity relationship information according to preset reply generation rules; The entity identifier includes a first sub-entity identifier and a second sub-entity identifier; the description text vector includes a first vector corresponding to the description information of the first sub-entity identifier, a second vector corresponding to the description information of the second sub-entity identifier, and a third vector corresponding to the cross-description information of the first sub-entity identifier and the second sub-entity identifier; the determination module is further used to: Determine an entity vector corresponding to the first sub-entity identifier and a first sub-average vector of the first vector; Determine an entity vector corresponding to the second sub-entity identifier and a second sub-average vector of the second vector; The first sub-average vector, the second sub-average vector, and the third vector are concatenated to obtain an average vector.

6. An electronic device, characterized in that: The device includes: a processor and a memory storing computer program instructions; When the processor executes the computer program instructions, the method for determining relationship information according to any one of claims 1 to 4 is implemented.

7. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer program instructions, and when the computer program instructions are executed by a processor, the method for determining relationship information according to any one of claims 1 to 4 is implemented.

8. A computer program product, characterized in that When the instructions in the computer program product are executed by a processor of an electronic device, the electronic device is enabled to execute the method for determining relationship information according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Knowledge graph representation learning method and system in combination with entity description

    CN106886543A

  • Method for predicting entity relationship and training method and device of relationship prediction model

    CN113961720A

  • Question and answer method and system based on deep learning and knowledge graph

    CN115525754A

  • Entity relationship prediction method and device, electronic equipment and storage medium

    CN117743587A

  • Knowledge graph inductive relationship prediction method, system and device and medium

    CN117787395A