Information processing method and device of knowledge graph, equipment and storage medium
By expanding and compressing the dimensions of historical entities and relationships in the knowledge graph, the problem of learning accuracy when faced with new entities and relationships is solved, improving learning effectiveness and saving storage resources.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- TSINGHUA UNIVERSITY
- Filing Date
- 2020-08-27
- Publication Date
- 2026-05-19
AI Technical Summary
When faced with an increasing number of new entities and relationships, existing knowledge graphs suffer from limited feature space in their learning models, resulting in lower learning accuracy.
By extending the dimensions of the vector representations of historical entities and relationships, adjusting the initial vector representations of the target entities and relationships, and further adjusting them within the extended vector space, a more accurate vector representation is obtained through dimensional compression.
It improves the learning accuracy of knowledge graphs, saves storage space, and avoids catastrophic forgetting during the learning process.
Smart Images

Figure CN111782826B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the fields of knowledge graph and machine learning technology, and in particular to a method, apparatus, device and storage medium for information processing of knowledge graphs. Background Technology
[0002] As human knowledge continues to increase, it is necessary to frequently add new knowledge to the existing knowledge graph, thereby constantly updating the knowledge graph.
[0003] In related technologies, knowledge graphs include entities and relations. Based on the old parameters of the learning model of the knowledge graph, the knowledge graph can continuously learn and reduce the influence of old data samples on the changes of old parameters, thereby reducing the probability that the knowledge graph will catastrophically forget old data during learning.
[0004] In the aforementioned techniques, when the number of new entities and relationships in the knowledge graph increases significantly, the size of the feature space of the learning model is limited, resulting in lower learning accuracy of the knowledge graph. Summary of the Invention
[0005] This application provides a method, apparatus, device, and storage medium for processing knowledge graphs, which can improve the accuracy of knowledge graph learning. The technical solution is as follows:
[0006] According to one aspect of the embodiments of this application, a method for processing information in a knowledge graph is provided, the method comprising:
[0007] Obtain the knowledge graphs corresponding to multiple graph learning tasks; wherein, the k-th graph learning task is used to learn the k-th knowledge graph, the k-th knowledge graph includes multiple entities and at least one set of relations between the multiple entities, and k is a positive integer;
[0008] Before performing the k-th graph learning task, the vector representations of historical entities and historical relations that appeared in the first k-1 graph learning tasks are subjected to dimensionality expansion processing to obtain the initial vector representations of the historical entities and the historical relations in the k-th graph learning task.
[0009] Determine the initial vector representation of the newly added entity and the initial vector representation of the newly added relation in the k-th knowledge graph;
[0010] During the execution of the k-th learning task, the initial vector representations of the target entity and the target relation are adjusted to obtain the learned vector representations of the target entity and the target relation; wherein, the target entity includes the historical entity and the newly added entity, and the target relation includes the historical relation and the newly added relation;
[0011] The learned vector representations of the target entity and the target relation are subjected to dimensionality compression to obtain the vector representations of the target entity and the target relation.
[0012] According to one aspect of the embodiments of this application, a knowledge graph information processing apparatus is provided, the apparatus comprising:
[0013] The graph acquisition module is used to acquire knowledge graphs corresponding to multiple graph learning tasks; wherein, the kth graph learning task is used to learn the kth knowledge graph, and the kth knowledge graph includes multiple entities and at least one set of relations between the multiple entities, where k is a positive integer;
[0014] The dimension expansion module is used to perform dimension expansion processing on the vector representations of historical entities and the vector representations of historical relations that appear in the first k-1 graph learning tasks before executing the k-th graph learning task, so as to obtain the initial vector representations of the historical entities and the historical relations in the k-th graph learning task.
[0015] The vector determination module is used to determine the initial vector representation of newly added entities and the initial vector representation of newly added relations in the k-th knowledge graph;
[0016] The vector adjustment module is used to adjust the initial vector representation of the target entity and the initial vector representation of the target relation during the execution of the k-th learning task, so as to obtain the learned vector representation of the target entity and the learned vector representation of the target relation; wherein, the target entity includes the historical entity and the newly added entity, and the target relation includes the historical relation and the newly added relation;
[0017] The dimension compression module is used to perform dimension compression processing on the learned vector representation of the target entity and the learned vector representation of the target relation to obtain the vector representation of the target entity and the vector representation of the target relation.
[0018] According to one aspect of the embodiments of this application, a computer device is provided, the computer device including a processor and a memory, the memory storing at least one instruction, at least one program, code set or instruction set, the at least one instruction, the at least one program, the code set or instruction set being loaded and executed by the processor to implement the information processing method of the knowledge graph as described above.
[0019] According to one aspect of the embodiments of this application, a computer-readable storage medium is provided, wherein at least one instruction, at least one program, code set, or instruction set is stored in the computer-readable storage medium, wherein the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by a processor to implement the information processing method of the knowledge graph as described above.
[0020] According to one aspect of the embodiments of this application, a computer program product or computer program is provided, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the aforementioned knowledge graph information processing method.
[0021] The technical solutions provided in this application embodiment may have the following beneficial effects:
[0022] By expanding the dimensions of the vectors corresponding to entities and relations in the k-th knowledge graph, and adjusting the vectors corresponding to entities and relations in the expanded vector space, we can obtain more accurate learned vector representations of target entities and target relations, thereby improving the accuracy of knowledge graph learning.
[0023] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description
[0024] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0025] Figure 1 This is a flowchart of an information processing method for a knowledge graph provided in one embodiment of this application;
[0026] Figure 2 This is a flowchart of an information processing method for a knowledge graph provided in another embodiment of this application;
[0027] Figure 3 This is a schematic diagram illustrating the effect of knowledge graph learning corresponding to different spaces provided in one embodiment of this application;
[0028] Figure 4 This is a block diagram of a knowledge graph information processing apparatus provided in one embodiment of this application;
[0029] Figure 5 This is a block diagram of a knowledge graph information processing apparatus provided in another embodiment of this application;
[0030] Figure 6 This is a block diagram of a computer device provided in one embodiment of this application. Detailed Implementation
[0031] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of methods consistent with some aspects of this application as detailed in the appended claims.
[0032] Artificial intelligence (AI) is the theory, methods, technology, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In other words, AI is a comprehensive technology within computer science that attempts to understand the essence of intelligence and produce a new kind of intelligent machine that can react in a way similar to human intelligence. AI studies the design principles and implementation methods of various intelligent machines, enabling them to possess the functions of perception, reasoning, and decision-making.
[0033] Artificial intelligence (AI) is a comprehensive discipline encompassing a wide range of fields, including both hardware and software technologies. Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies primarily include computer vision, speech processing, natural language processing, and machine learning / deep learning.
[0034] Natural Language Processing (NLP) is an important field within computer science and artificial intelligence. It studies the theories and methods for enabling effective communication between humans and computers using natural language. NLP is a science that integrates linguistics, computer science, and mathematics. Therefore, research in this field involves natural language—the language people use in daily life—and thus it has a close relationship with linguistic research. NLP techniques typically include text processing, semantic understanding, machine translation, question answering, and knowledge graphs.
[0035] Machine learning (ML) is a multidisciplinary field involving probability theory, statistics, approximation theory, convex analysis, and algorithm complexity theory. It specifically studies how computers can simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental way to endow computers with intelligence; its applications span all areas of artificial intelligence. Machine learning and deep learning typically include techniques such as artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and learn-by-doing.
[0036] With the research and advancement of artificial intelligence (AI) technology, AI is being studied and applied in various fields, such as smart homes, smart wearable devices, virtual assistants, smart speakers, smart marketing, autonomous driving, drones, robots, smart healthcare, and smart customer service. It is believed that with the development of technology, AI will be applied in more fields and play an increasingly important role.
[0037] The solutions provided in this application involve artificial intelligence natural language processing and machine learning technologies, such as embedding new knowledge into existing knowledge graphs.
[0038] In some embodiments, the technical solutions provided in this application can be applied to numerous application scenarios such as semantic retrieval, knowledge question answering, text information enhancement, and personalized recommendation. Entities and relations are represented as vectors (similar to Word2Vec), and the characters or words in the entities and relations are represented as vector information. Then, prediction is performed based on the vector information of the entities and relations. For example, head entities and relations can be used to predict tail entities, or tail entities and relations can be used to predict head entities. In the embodiments of this application, after obtaining the vector representations of the target entity and the target relation, a graph information record text can be generated, which includes the vector representations of the target entity and the target relation. In some embodiments, target text content is obtained, and the target text content is vectorized to obtain a vector representation of the target text content. The vector representation of the target text content is then correlated with the vector representations of target entities and target relationships contained in the graph information record text to obtain the correlation between the vector representation of the target text content and the vector representations of each target entity and each target relationship contained in the graph information record text. Vector representations in the graph information record text whose correlation with the vector representation of the target text content is greater than or equal to a similarity threshold are identified as vector representations correlated with the vector representation of the target text content. The target entities / relationships corresponding to the vector representations correlated with the vector representation of the target text content are identified as entities / relationships correlated with the target text content. Optionally, the correlation calculation includes calculating the distance between vector representations, calculating the cosine similarity between vector representations, etc. Optionally, the specific value of the similarity threshold can be set by those skilled in the art based on actual conditions, and this embodiment does not limit this.
[0039] In one example, in a semantic retrieval scenario, the target search content (i.e., the target text content mentioned above) used for semantic retrieval is vectorized to obtain a vector representation of the target search content. Based on the above content, the text is recorded using graph information to identify entities / relationships that are related to the target search content. These entities / relationships are identified as extended related terms for this semantic retrieval. Based on the target search content and extended related terms, semantic retrieval results are obtained. Each semantic retrieval result includes at least one related content, and each related content contains either the target search content or extended related terms. Because the semantic retrieval results are related to the target search content used for retrieval, it is convenient for users to quickly find the information they want from the semantic retrieval results.
[0040] In one example, in a knowledge-based question-and-answer scenario, the user's target question (i.e., the target text content mentioned above) is vectorized to obtain a vector representation of the target question. Based on the above content, the text is recorded using graph information to identify entities / relationships related to the target question. These entities / relationships are then identified as the response keywords for this knowledge-based question-and-answer session. These response keywords are then combined to form grammatically corrected response content, thus obtaining the response content corresponding to the target question. Before vectorizing the user's question, the semantic information of the original question is analyzed to automatically correct any errors (e.g., correcting typos, adjusting word order, and standardizing colloquial expressions). The corrected question content is then vectorized. Optionally, knowledge-based question-and-answer can be applied to fields such as medical consultation and children's knowledge expansion.
[0041] In one example, in a personalized recommendation scenario, keywords from content viewed or followed by the user are identified as target keywords. These target keywords include tags, titles, and frequently occurring keywords in comments or bullet comments. The target keywords are then vectorized to obtain their vector representations. Based on the above, and using graph information to record text, entities / relationships related to the target keywords are identified. These entities / relationships are then identified as extended keywords for this recommendation operation. Content whose tags / titles / bullet comments / comments contain the target keywords or extended keywords is then recommended to the user, thereby increasing the probability that the recommended content is of interest to the user.
[0042] The information processing method for the knowledge graph provided by this application can also be applied to other fields, and the embodiments of this application do not specifically limit it.
[0043] The knowledge graph information processing method provided in this application can be executed by a computer device at each step; that is, this application provides a knowledge graph information processing method implemented by a computer device. The computer device refers to an electronic device with data computing, processing, and storage capabilities. This computer device can be a terminal such as a PC (Personal Computer), tablet computer, smartphone, wearable device, or intelligent robot; it can also be a server. The server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services. The technical solution of this application will be described below through several embodiments.
[0044] The technical solution of this application will be described and illustrated below through several embodiments.
[0045] Figure 1 A flowchart illustrating an information processing method for a knowledge graph according to an embodiment of this application is shown. In this embodiment, the method is illustrated by example when applied to the computer device described above. Figure 1 As shown, the method may include the following steps (101-105):
[0046] Step 101: Obtain the knowledge graphs corresponding to the multiple graph learning tasks.
[0047] In some embodiments, the k-th graph learning task is used to learn the k-th knowledge graph, which includes multiple entities and at least one set of relations between them, where k is a positive integer. A knowledge graph is a semantic network that reveals the relationships between entities and is widely used in intelligent search, intelligent question answering, personalized recommendation, and other fields. Knowledge graphs can be stored in units of facts, which can be represented as (head entity, relation, tail entity). The graph learning task refers to embedding new facts into an existing knowledge graph and vectorizing the knowledge graph. The k-th knowledge graph includes the new facts added in the k-th graph learning task.
[0048] In some embodiments, the k-th knowledge graph is represented as G. k ={E k ,R k ,F k}, G k Let E represent the k-th knowledge graph. k R k and F k Let F be the set of entities, relations, and facts of the k-th knowledge graph. k Each fact in (e s ,r,e o In ), e s Represents the head entity, e o r represents the tail entity, and e represents the head entity. s Combined with the entity e o The relationship between them, e s ∈E k e o ∈E k , r∈R k .
[0049] Step 102: Before performing the k-th graph learning task, perform dimensionality expansion processing on the vector representations of historical entities and historical relations that appeared in the first k-1 graph learning tasks to obtain the initial vector representations of historical entities and historical relations in the k-th graph learning task.
[0050] In some embodiments, the first k-1 graph learning tasks are graph learning tasks that have been completed prior to the k-th graph learning task. Entities appearing in the first k-1 graph learning tasks are called historical entities, and relations appearing in the first k-1 graph learning tasks are called historical relations. The initial vector representations of historical entities and historical relations in the k-th graph learning task are the vectors on which the k-th graph learning task first adjusts the parameters of the vectors corresponding to historical entities and historical relations.
[0051] In some embodiments, before performing the k-th graph learning task, the vector representations of historical entities and historical relations are expanded in dimension, and the resulting vectors are determined as the initial vector representations of the historical entities and historical relations in the k-th graph learning task. In one example, the vector representations of historical entities and historical relations appearing in the first k-1 graph learning tasks are 50-dimensional. After dimension expansion, 100-dimensional initial vector representations of the historical entities and historical relations are obtained in the k-th graph learning task. In some embodiments, the vector representations of historical entities and historical relations appearing in the first k-1 graph learning tasks have the same dimension. In other embodiments, the dimension of the initial vector representation of the historical entity in the k-th graph learning task is equal to the dimension of the initial vector representation of the historical relation in the k-th graph learning task.
[0052] Step 103: Determine the initial vector representation of the newly added entity and the initial vector representation of the newly added relation in the k-th knowledge graph.
[0053] In some embodiments, newly added entities and relations in the k-th knowledge graph are assigned random initial vectors to obtain initial vector representations of the newly added entities and relations. Optionally, the elements in the initial vectors of the newly added entities and relations are obtained using a random number model. In one example, the dimension of the initial vectors of the newly added entities and relations is determined to be 100, that is, each initial vector includes 100 elements. For each initial vector, the elements contained therein are generated sequentially using a random number model to obtain the initial vector. Optionally, the elements in multiple lower-dimensional vectors are determined using a random number model, and the lower-dimensional vectors are randomly concatenated to obtain the initial vector representations of the newly added entities and relations. In one example, the initial vector representations of the new entity and the new relation have a dimension of 100. Multiple random vectors of dimension x are obtained through a random number model, where x is a common divisor of 100 (e.g., 2, 4, 5, 10, 12, 25, 50). For each new entity and new relation, a random vector is randomly selected from the multiple random vectors of dimension x and concatenated to form a 100-dimensional vector, thus obtaining the initial vector representations of the new entity and the new relation.
[0054] In some embodiments, the dimensions of the initial vector representations of newly added entities, newly added relations, historical entities, and historical relations in the k-th knowledge graph learning task are equal. In some embodiments, the dimensions of the initial vector representations of historical entities and historical relations in the k-th knowledge graph learning task are both 100, then the dimensions of the initial vector representations of newly added entities and newly added relations in the k-th knowledge graph are also 100.
[0055] Step 104: During the execution of the k-th learning task, the initial vector representations of the target entity and the target relation are adjusted to obtain the learned vector representations of the target entity and the target relation.
[0056] The target entities include historical entities and newly added entities, and the target relationships include historical relationships and newly added relationships. In some embodiments, based on the initial vector representations of the target entities and the initial vector representations of the target relationships, the parameters (i.e., the elements contained in the vectors) of the vector representations of the target entities and the target relationships are continuously adjusted until the k-th learning task satisfies the conditions, indicating that the adjustment of the vector representations of the target entities and the target relationships is complete, thus obtaining the learned vector representations of the target entities and the target relationships.
[0057] Step 105: Perform dimensionality compression on the learned vector representations of the target entity and the target relation to obtain the vector representations of the target entity and the target relation.
[0058] In some embodiments, the learned vector representations of the target entity and the learned vectors of the target relation have high dimensionality, requiring significant storage space and processing resources for storage and processing. Dimensionality reduction and compression of the learned vector representations of the target entity and the target relation can save storage space and processing resources for the indicator graph. In some embodiments, the vector representations of the target entity and the target relation are obtained by performing linear transformations on their respective learned vector representations.
[0059] In summary, the technical solution provided in this application expands the dimensions of the vectors corresponding to entities and relations in the k-th knowledge graph, and adjusts the vectors corresponding to entities and relations in the expanded vector space, thereby obtaining a more accurate learned vector representation of the target entity and a more accurate learned vector representation of the target relation, thus improving the accuracy of knowledge graph learning.
[0060] In addition, the embodiments of this application compress the dimensions of the learned vector representations of the target entities and the target relations obtained in the extended space, thereby avoiding the excessively high dimensionality of the vector representations corresponding to the knowledge graph. This not only improves the accuracy of knowledge graph learning but also saves the storage space of the vector representations corresponding to the knowledge graph.
[0061] Figure 2 A flowchart of an information processing method for a knowledge graph according to an embodiment of this application is shown. In this embodiment, the method is illustrated by example when applied to the computer device described above. The method may include the following steps (201-210):
[0062] Step 201: Obtain the knowledge graphs corresponding to the multiple graph learning tasks.
[0063] For details regarding step 201, please refer to the above. Figure 1 Step 101 of the embodiment will not be repeated here.
[0064] Step 202: Before performing the k-th graph learning task, perform dimensional expansion processing on the vector representations of historical entities and historical relations that appeared in the first k-1 graph learning tasks to obtain the initial vector representations of historical entities and historical relations in the k-th graph learning task.
[0065] The content of step 202 can be referred to step 102 of the above embodiment 1, and will not be repeated here.
[0066] In some embodiments, step 202 further includes the following sub-steps:
[0067] 1. Concatenate the vector representation of the historical entity with the first set vector to obtain the initial vector representation of the historical entity in the k-th graph learning task;
[0068] 2. Concatenate the vector representation of the historical relationship with the second set vector to obtain the initial vector representation of the historical vector in the k-th graph learning task.
[0069] In the above implementation, the initial vector representation of the historical entity in the k-th graph learning task is obtained by concatenating the vector representation of the historical entity with the first predetermined vector, and the initial vector representation of the historical vector in the k-th graph learning task is obtained by concatenating the vector representation of the historical relation with the second predetermined vector, thus expanding the dimension of the vectors corresponding to the historical entity and historical relation in the k-th graph learning task. Optionally, both the first and second predetermined vectors are zero vectors. For example, if the vector representation of the historical entity / relation is 50-dimensional, and the first and second predetermined vectors are 50-dimensional zero vectors, concatenating the 50-dimensional zero vectors to the 50-dimensional vector representation of the historical entity / relation yields a 100-dimensional initial vector representation of the historical entity / relation in the k-th graph learning task. Optionally, the first and second predetermined vectors are random vectors, and the method for determining the random vectors can refer to the above. Figure 1 In step 103 of the embodiment, the contents of determining the initial vector representation of the newly added entity and the initial vector representation of the newly added relation are not described here.
[0070] Step 203: Determine the initial vector representation of the newly added entity and the initial vector representation of the newly added relation in the k-th knowledge graph.
[0071] For details regarding step 203, please refer to the above. Figure 1 Step 103 of the embodiment will not be repeated here.
[0072] Step 204: Obtain the fact set corresponding to the kth knowledge graph and the fact sets corresponding to the first k-1 knowledge graphs.
[0073] The fact set includes at least one positive fact and at least one negative fact. A positive fact is a triple consisting of two entities with a relationship, while a negative fact is a triple consisting of two entities without a relationship. In some embodiments, a negative fact is obtained by replacing the head / tail entity in a positive fact. In some embodiments, the fact set of the k-th knowledge graph includes all possible combinations of entities and relationships included in the k-th knowledge graph. The fact set corresponding to the k-th knowledge graph can be represented as: in, Let E represent the set of facts corresponding to the k-th knowledge graph. k Let R represent the set of entities corresponding to the k-th knowledge graph. k This represents the set of relations corresponding to the k-th knowledge graph.
[0074] In other embodiments, the fact set of the first k-1 knowledge graphs includes all possible combinations of entities and relations included in the first k-1 knowledge graphs. The fact set corresponding to the first k-1 knowledge graphs can be represented as: in, E represents the set of facts corresponding to the first k-1 knowledge graphs. 1,k-1 Let R represent the set of entities corresponding to the first k-1 knowledge graphs. 1,k-1 This represents the set of relations corresponding to the first k-1 knowledge graphs. In one example, if the first k-1 knowledge graphs include Entity 1, Entity 2, Entity 3, Entity 4, Relation 1, and Relation 2, then the set of facts corresponding to the first k-1 knowledge graphs includes the following 12 facts: Fact 1 = (Entity 1, Relation 1, Entity 2), Fact 2 = (Entity 1, Relation 1, Entity 3), Fact 3 = (Entity 1, Relation 1, Entity 4), Fact 4 = (Entity 2, Relation 1, Entity 3), Fact 5 = (Entity 2, Relation 1, Entity 4), Fact 6 = (Entity 3, Relation 1, Entity 4), Fact 7 = (Entity 1, Relation 2, Entity 2), Fact 8 = (Entity 1, Relation 2, Entity 3), Fact 9 = (Entity 1, Relation 2, Entity 4), Fact 10 = (Entity 2, Relation 2, Entity 3), Fact 11 = (Entity 2, Relation 2, Entity 4), Fact 12 = (Entity 3, Relation 2, Entity 4).
[0075] Step 205: Train the embedding model using the fact set corresponding to the kth knowledge graph and determine the first loss value corresponding to the embedding model.
[0076] The initial value of the first loss is determined based on the initial vector representations of the newly added entities and relations. In some embodiments, the embedding model needs to be trained multiple times. For each training iteration, a scoring function is used to score the vector representations of the newly added entities and relations obtained in that training iteration, resulting in the value of the scoring function for that iteration. The corresponding first loss value is then calculated based on this score function value. The value of the scoring function can be expressed as... in, These are the vectors corresponding to the head entity (after dimension expansion), the relation (after dimension expansion), and the tail entity (after dimension expansion), respectively. A higher score function value indicates a greater probability that the corresponding fact is a positive fact. In some embodiments, the score function value is mapped to a probability value p(e) in the interval [0, 1] using the sigmoid function (S-shaped function). s ,r,e o )=σ(s(e s ,r,e o Based on the probability value p(e) s ,r,e o Calculate the value of the corresponding first loss.
[0077] In some embodiments, the first loss value can be calculated using the following formula:
[0078] Formula 1:
[0079]
[0080] in, T represents the first loss value. new It is the set of facts corresponding to the k-th knowledge graph. This represents the probability that a fact in the fact set corresponding to the k-th knowledge graph is a positive fact.
[0081] Step 206: Train the embedding model using the fact sets corresponding to the first k-1 knowledge graphs to determine the second loss value corresponding to the embedding model.
[0082] The initial value of the second loss is determined based on the initial vector representations of historical entities and historical relationships. In some embodiments, the embedding model needs to be trained multiple times. For each training iteration, a scoring function is used to score the vector representations of historical entities and historical relationships obtained in that training iteration, resulting in the value of the scoring function corresponding to that training iteration. Then, the corresponding second loss value is calculated based on the value of the scoring function corresponding to that training iteration.
[0083] In some embodiments, step 206 further includes the following sub-steps:
[0084] 1. From the fact sets corresponding to the first k-1 knowledge graphs, sample at least one fact to obtain the historical fact set;
[0085] 2. Train the embedding model using a set of historical facts to determine the second loss value corresponding to the embedding model.
[0086] In this implementation, since the fact sets corresponding to the first k-1 knowledge graphs contain a large number of historical entities and relationships, a historical fact set is obtained by sampling a portion of the facts from the fact sets corresponding to the first k-1 knowledge graphs. This historical fact set is then used to train the embedded model, and the corresponding second loss value is calculated based on the vectors corresponding to the historical entities and relationships included in the historical fact set. In some embodiments, the calculation method for the second loss value can refer to the following formula:
[0087] Formula 2:
[0088]
[0089] in, T represents the second loss value. old This refers to the facts included in a set of historical facts. Let represent the probability that a fact in the fact set corresponding to the k-th knowledge graph is a positive fact. This represents the probability that a fact included in the set of historical facts is a positive fact. The loss function used to calculate the second loss value is the KL divergence function, which can promote optimization... While learning new knowledge, the probability distribution of old knowledge is largely maintained, thus achieving both learning new knowledge and retaining old knowledge.
[0090] Steps 205 and 206 can be executed simultaneously, or step 206 can be executed first and then step 205, or step 205 can be executed first and then step 206. This application embodiment does not specifically limit this.
[0091] Step 207: Determine the first comprehensive loss value based on the first loss value and the second loss value.
[0092] Based on the first loss value and the second loss value obtained from the above steps, the corresponding first comprehensive loss value can be obtained. In some embodiments, the calculation of the first comprehensive loss value can refer to the following formula three:
[0093] Formula 3:
[0094]
[0095] in, This represents the first overall loss value. This represents the first loss value. The value represents the second loss value, and α1 is an adjustment factor, which is a constant. The value of α1 can be 0.2, 0.5, 0.8, 1.0, 1.5, 2, etc. The specific value of α1 can be set by relevant technical personnel according to the actual situation, and this application embodiment does not make a specific limitation on it.
[0096] Step 208: Adjust the parameters of the embedding model based on the first comprehensive loss value to obtain the completed embedding model.
[0097] In some embodiments, for each training iteration of the embedding model, the parameters of the embedding model are adjusted based on the first comprehensive loss value obtained in that training iteration; based on the embedded model with adjusted parameters, the first comprehensive loss value obtained in the next training iteration is obtained, and the parameters of the embedding model are adjusted again based on the first comprehensive loss value obtained in the next training iteration. The embedding model is trained in this cyclical manner, so that the first comprehensive loss value shows a decreasing trend until the first comprehensive loss value meets the condition, and the trained embedding model is obtained.
[0098] In some embodiments, the conditions satisfied by the first comprehensive loss value include: the first comprehensive loss value is less than or equal to a first comprehensive loss threshold; or, the first comprehensive loss value is less than or equal to the first comprehensive loss threshold for a consecutive times, where a is a positive integer; or, the first comprehensive loss value no longer decreases for b consecutive times; or, in c consecutive training sessions, the absolute value of the difference between the first comprehensive loss value obtained in each training session and the first comprehensive loss value obtained in the previous training session is less than a decreasing threshold. Wherein, a, b, and c are positive integers, and the specific values of a, b, c, the first comprehensive loss threshold, and the decreasing threshold are set by those skilled in the art based on actual circumstances; this application embodiment does not specifically limit these values.
[0099] Step 209: Determine the learned vector representations of the target entity and the target relation by completing the training of the embedding model.
[0100] In some embodiments, after the embedding model has been trained, the learned vector representations of the target entity and the target relation are obtained from the parameters of the trained embedding model.
[0101] Step 210: Multiply the learned vector representation of the target entity by the first linear transformation matrix to obtain the vector representation of the target entity; multiply the learned vector representation of the target relation by the second linear transformation matrix to obtain the vector representation of the target relation.
[0102] In some embodiments, after obtaining the learned vectors of the target entity and the target relation, the learned vector representation of the target entity is multiplied by the first linear transformation matrix to obtain the vector of the target entity after dimensional compression. The learned vector representation of the target relation is then multiplied by the second linear transformation matrix to obtain the vector of the target entity after dimensional compression. Based on the vectors obtained from this dimensional compression of the target entity and the target relation, a corresponding first comprehensive loss value is calculated. The parameters of the first and second linear transformation matrices are adjusted based on this first comprehensive loss value, and this process is repeated until the first comprehensive loss value meets the condition. The calculation of the first comprehensive loss value can be referred to the above, and will not be repeated here.
[0103] In some embodiments, the vector representations of the target entity and the target relationship are calculated using a linear transformation in hyperbolic space, which is a space with a negative Gaussian curvature everywhere. The first linear transformation matrix Mx is replaced by M... B (x), defined as follows: Formula 4:
[0104] Formula 4:
[0105]
[0106] Wherein, exp0(·) and log0(·) are defined as follows: Formula 5 and Formula 6 respectively:
[0107] Formula 5:
[0108]
[0109] Formula Six:
[0110]
[0111] in Add the law to Mebius.
[0112] The second linear transformation matrix is similar and will not be elaborated here.
[0113] In summary, the technical solution provided in this application, by enabling historical entities and historical relationships to participate in the k-th knowledge graph learning task, can learn new knowledge while maintaining old knowledge, thereby expanding the knowledge graph while maintaining the overall accuracy of the knowledge graph, avoiding catastrophic forgetting during the knowledge graph learning process, and improving the learning accuracy of the knowledge graph.
[0114] In some embodiments, this application further includes the following steps:
[0115] 1. Determine the first distance value between the newly added entities based on the temporary vector representation of the newly added entities;
[0116] 2. Determine the second distance value between historical entities based on the temporary vector representation of historical entities;
[0117] 3. Calculate the first distance loss value based on the first distance value and the second distance value;
[0118] 4. Based on the first comprehensive loss value and the first distance loss value, the parameters of the embedding model are adjusted to obtain the completed embedding model.
[0119] In the above implementation, based on the temporary vector representation of the newly added entities and the fact vector representation of the historical entities, a first distance value between the newly added entities and a second distance value between the historical entities are calculated respectively. Based on the first and second distance values, a first distance loss value is calculated. This first distance loss value ensures that the relative distances between the newly added entities and the historical entities remain as constant as possible during vector parameter adjustment and dimensionality compression. Here, the first distance value refers to the relative distance between the newly added entities, and the second distance value refers to the relative distance between the historical entities.
[0120] In some embodiments, the calculation method for the first distance loss value after dimensional expansion can refer to the following formula seven:
[0121] Formula 7:
[0122]
[0123] in, This represents the first distance loss value after dimensional expansion. This represents the second distance value. This represents the first distance value.
[0124] In some embodiments, the calculation method for the first distance loss value after dimensionality compression can refer to the following formula eight:
[0125] Formula 8:
[0126]
[0127] in, This represents the first distance loss value after dimensionality compression. This represents the distance between entity vectors before compression. This represents the distance between entity vectors after compression.
[0128] Below, with For example, this explains how to calculate the distance between vectors corresponding to entities. The calculation formula can be found in Formula Nine below:
[0129] Formula Nine:
[0130]
[0131]
[0132] and The calculation formula is the same, and will not be repeated here.
[0133] In some embodiments, the first and second distance values are calculated in hyperbolic space. Replace the ||xy|| structure involved in the above formula with d. B (x, y), defined as follows: Formula 10:
[0134] Formula 10:
[0135]
[0136] In the above implementation, during the adjustment process using the vectors corresponding to entities, the relative distance between the vectors corresponding to entities is maintained as much as possible, thereby preserving the relationships between entities and improving the accuracy of knowledge graph learning.
[0137] Table 1 shows the statistical results of experimental data for various knowledge graph learning methods:
[0138] Table 1
[0139]
[0140]
[0141] As shown in Table 1, the knowledge graph learning method provided in this application has a higher hit rate compared to other models; based on the information processing method of the knowledge graph provided in this application, the hit rate of knowledge graph learning in hyperbolic space is higher than that in Euclidean space. Figure 3 As shown, the hit rate for learning knowledge graphs in hyperbolic space is significantly higher than that in Euclidean space. Therefore, learning knowledge graphs in hyperbolic space is clearly superior to learning them in Euclidean space.
[0142] The following are embodiments of the apparatus described in this application, which can be used to execute the embodiments of the method described in this application. For details not disclosed in the apparatus embodiments of this application, please refer to the embodiments of the method described in this application.
[0143] Please refer to Figure 4This diagram illustrates a block diagram of a knowledge graph information processing apparatus according to an embodiment of this application. The apparatus has the functionality to implement the aforementioned knowledge graph information processing method; this functionality can be implemented in hardware or by hardware executing corresponding software. The apparatus can be the computer device described above, or it can be mounted on a computer device. The apparatus 400 may include: a graph acquisition module 410, a dimension expansion module 420, a vector determination module 430, a vector adjustment module 440, and a dimension compression module 450.
[0144] The graph acquisition module 410 is used to acquire knowledge graphs corresponding to multiple graph learning tasks respectively; wherein, the kth graph learning task is used to learn the kth knowledge graph, the kth knowledge graph includes multiple entities and at least one set of relationships between the multiple entities, and k is a positive integer.
[0145] The dimension expansion module 420 is used to perform dimension expansion processing on the vector representations of historical entities and the vector representations of historical relationships that appear in the previous k-1 graph learning tasks before executing the k-th graph learning task, so as to obtain the initial vector representations of the historical entities and the historical relationships in the k-th graph learning task.
[0146] The vector determination module 430 is used to determine the initial vector representation of the newly added entity and the initial vector representation of the newly added relation in the k-th knowledge graph.
[0147] The vector adjustment module 440 is used to adjust the initial vector representation of the target entity and the initial vector representation of the target relation during the execution of the k-th learning task, so as to obtain the learned vector representation of the target entity and the learned vector representation of the target relation; wherein, the target entity includes the historical entity and the newly added entity, and the target relation includes the historical relation and the newly added relation.
[0148] The dimension compression module 450 is used to perform dimension compression processing on the learned vector representation of the target entity and the learned vector representation of the target relationship to obtain the vector representation of the target entity and the vector representation of the target relationship.
[0149] In summary, the technical solution provided in this application expands the dimensions of the vectors corresponding to entities and relations in the k-th knowledge graph, and adjusts the vectors corresponding to entities and relations in the expanded vector space, thereby obtaining a more accurate learned vector representation of the target entity and a more accurate learned vector representation of the target relation, thus improving the accuracy of knowledge graph learning.
[0150] In some embodiments, the dimension expansion module 420 is used for:
[0151] The vector representation of the historical entity is concatenated with the first set vector to obtain the initial vector representation of the historical entity in the k-th graph learning task;
[0152] The vector representation of the historical relationship is concatenated with the second set vector to obtain the initial vector representation of the historical vector in the k-th graph learning task.
[0153] In some embodiments, both the first set vector and the second set vector are zero vectors.
[0154] In some embodiments, the dimensional compression module 450 is used for:
[0155] The learned vector representation of the target entity is multiplied by the first linear transformation matrix to obtain the vector representation of the target entity;
[0156] The vector representation of the target relation after learning is multiplied by the second linear transformation matrix to obtain the vector representation of the target relation.
[0157] In some embodiments, the vector representations of the target entity and the target relationship are calculated using a linear transformation in hyperbolic space.
[0158] In some embodiments, the vector adjustment module 440 includes: a fact acquisition submodule 441, a loss determination submodule 442, a parameter adjustment submodule 443, and a vector determination submodule 444.
[0159] The fact acquisition submodule 441 is used to acquire the fact set corresponding to the kth knowledge graph and the fact set corresponding to the first k-1 knowledge graphs; wherein, the fact set includes at least one positive fact and at least one negative fact.
[0160] The loss determination submodule 442 is used to train the embedding model using the fact set corresponding to the kth knowledge graph to determine the first loss value corresponding to the embedding model; wherein, the initial value of the first loss value is determined based on the initial vector representation of the newly added entity and the newly added relationship.
[0161] The loss determination submodule 442 is further configured to train the embedding model using the fact set corresponding to the first k-1 knowledge graphs to determine the second loss value corresponding to the embedding model; wherein the initial value of the second loss value is determined based on the initial vector representation of the historical entity and the historical relationship.
[0162] The loss determination submodule 442 is further configured to determine a first comprehensive loss value based on the first loss value and the second loss value.
[0163] The parameter adjustment submodule 443 is used to adjust the parameters of the embedding model based on the first comprehensive loss value to obtain the completed embedding model.
[0164] The vector determination submodule 444 is used to determine the learned vector representation of the target entity and the learned vector representation of the target relationship through the completed training embedding model.
[0165] In some embodiments, such as Figure 5 As shown, the device 400 further includes a distance determination module 460 and a loss determination module 470.
[0166] The distance determination module 460 is used to determine a first distance value between the newly added entities based on the temporary vector representation of the newly added entities.
[0167] The distance determination module 460 is further configured to determine a second distance value between the historical entities based on the temporary vector representation of the historical entities.
[0168] The loss determination module 470 is used to calculate a first distance loss value based on the first distance value and the second distance value.
[0169] The parameter adjustment submodule 443 is used to: adjust the parameters of the embedding model based on the first comprehensive loss value and the first distance loss value to obtain the completed embedding model.
[0170] In some embodiments, the first distance value and the second distance value are calculated in hyperbolic space.
[0171] In some embodiments, the loss determination submodule 442 is configured to:
[0172] From the fact sets corresponding to the first k-1 knowledge graphs, at least one fact is sampled to obtain the historical fact set;
[0173] The embedding model is trained using the set of historical facts to determine the second loss value corresponding to the embedding model.
[0174] It should be noted that the apparatus provided in the above embodiments is only illustrated by the division of the above functional modules when implementing its functions. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the apparatus and method embodiments provided in the above embodiments belong to the same concept, and the specific implementation process can be found in the method embodiments, which will not be repeated here.
[0175] Please refer to Figure 6 This diagram illustrates the structural block diagram of a computer device according to an embodiment of this application. The computer device is used to implement the knowledge graph information processing method provided in the above embodiments. Specifically:
[0176] The computer device 600 includes a CPU (Central Processing Unit) 601, a system memory 604 including RAM (Random Access Memory) 602 and ROM (Read-Only Memory) 603, and a system bus 605 connecting the system memory 604 and the central processing unit 601. The computer device 600 also includes a basic I / O (Input / Output) system 606 that facilitates information transfer between various components within the computer, and a mass storage device 607 for storing the operating system 613, application programs 614, and other program modules 615.
[0177] The basic input / output system 606 includes a display 608 for displaying information and an input device 609 for user input, such as a mouse or keyboard. Both the display 608 and the input device 609 are connected to the central processing unit 601 via an input / output controller 610 connected to the system bus 605. The basic input / output system 606 may also include the input / output controller 610 for receiving and processing input from multiple other devices such as a keyboard, mouse, or electronic stylus. Similarly, the input / output controller 610 also provides output to a display screen, printer, or other types of output devices.
[0178] The mass storage device 607 is connected to the central processing unit 601 via a mass storage controller (not shown) connected to the system bus 605. The mass storage device 607 and its associated computer-readable media provide non-volatile storage for the computer device 600. That is, the mass storage device 607 may include computer-readable media (not shown) such as a hard disk or a CD-ROM (Compact Disc Read-Only Memory) drive.
[0179] Without loss of generality, the computer-readable medium may include computer storage media and communication media. Computer storage media include volatile and non-volatile, removable and non-removable media implemented using any method or technology for storing information such as computer-readable instructions, data structures, program modules, or other data. Computer storage media include RAM, ROM, EPROM (Erasable Programmable Read Only Memory), EEPROM (Electrically Erasable Programmable Read Only Memory), flash memory or other solid-state storage technologies, CD-ROM, DVD (Digital Video Disc) or other optical storage, magnetic tape cassettes, magnetic tape, disk storage, or other magnetic storage devices. Of course, those skilled in the art will recognize that the computer storage media are not limited to the above-mentioned types. The system memory 604 and the mass storage device 607 described above can be collectively referred to as memory.
[0180] According to various embodiments of this application, the computer device 600 can also be connected to a remote computer on a network, such as the Internet. That is, the computer device 600 can be connected to a network 612 via a network interface unit 611 connected to the system bus 605, or the network interface unit 611 can be used to connect to other types of networks or remote computer systems (not shown).
[0181] In some embodiments, a computer-readable storage medium is also provided, wherein at least one instruction, at least one program, code set, or instruction set is stored therein, wherein the at least one instruction, the at least one program, the code set, or the instruction set is executed by a processor to implement the above-described knowledge graph information processing method.
[0182] Optionally, the computer-readable storage medium may include: ROM (Read-Only Memory), RAM (Random-Access Memory), SSD (Solid State Drives), or optical disc, etc. The random access memory may include ReRAM (Resistance Random Access Memory) and DRAM (Dynamic Random Access Memory).
[0183] In some embodiments, a computer program product or computer program is also provided, the computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, causing the computer device to perform the above-described knowledge graph information processing method.
[0184] It should be understood that "multiple" as used herein refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. Furthermore, the step numbers described herein are merely illustrative of one possible execution order. In some other embodiments, the steps may not be executed in numerical order, such as two steps with different numbers being executed simultaneously, or two steps with different numbers being executed in the reverse order of the illustration. This application does not limit this.
[0185] The above description is merely an exemplary embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A method for processing information in a knowledge graph, characterized in that the method... include: Obtain the knowledge graphs corresponding to multiple graph learning tasks; the k-th graph learning task is used to learn the k-th knowledge graph, which includes multiple entities and at least one set of relations between the multiple entities, where k is a positive integer; Before performing the k-th graph learning task, the vector representations of historical entities and historical relations that appeared in the first k-1 graph learning tasks are expanded in dimension to obtain the initial vector representation V1 of historical entities in the k-th graph learning task and the initial vector representation V2 of historical relations in the k-th graph learning task. Determine the initial vector representation V3 for newly added entities and the initial vector representation V4 for newly added relations in the k-th knowledge graph. V1, V2, V3, and V4 have the same dimension. During the execution of the k-th learning task, in the expanded vector space, the initial vector representations of the target entity and the target relation are adjusted to obtain the learned vector representations of the target entity and the target relation, specifically including: During the execution of the kth learning task, the fact set corresponding to the kth knowledge graph and the fact sets corresponding to the first k-1 knowledge graphs are obtained. The fact set includes at least one positive fact and at least one negative fact. A positive fact is a triple formed by two entities that have a relationship, and a negative fact is a triple formed by two entities that do not have a relationship. The embedding model is trained using the fact set corresponding to the k-th knowledge graph, and the first loss value corresponding to the embedding model is determined. The initial value of the first loss value is determined based on the initial vector representation of the newly added entities and relations. For each training iteration, a scoring function is used to score the vector representations of newly added entities and relations obtained in that training iteration, thus obtaining the corresponding scoring function value for that training iteration. The higher the scoring function value, the greater the probability that the corresponding fact is a positive fact. Then, the corresponding first loss value is calculated based on the scoring function value for that training iteration. The embedding model is trained using the fact set corresponding to the first k-1 knowledge graphs to determine the second loss value of the embedding model; the initial value of the second loss value is determined based on the initial vector representation of historical entities and historical relationships. The first comprehensive loss value is determined based on the first loss value and the second loss value; Based on the temporary vector representation of the newly added entities, a first distance value between the newly added entities is determined; based on the temporary vector representation of the historical entities, a second distance value between the historical entities is determined; based on the first distance value and the second distance value, a first distance loss value is calculated; through the first distance loss value, the relative distance between the newly added entities and the historical entities is kept as constant as possible during the vector adjustment process; Based on the first comprehensive loss value and the first distance loss value, the parameters of the embedding model are adjusted to obtain the completed embedding model; The learned vector representations of the target entities and the target relations are determined by completing the training of the embedding model; the target entities include historical entities and newly added entities, and the target relations include historical relations and newly added relations. The learned vector representations of the target entity and the target relation are subjected to dimensionality compression to obtain the vector representations of the target entity and the target relation. Generate a graph information record text, which includes vector representations of target entities and vector representations of target relationships; In a knowledge-based question-and-answer scenario, the target text content of the user's question is obtained, the semantic information of the target text content is parsed and vectorized to obtain the vector representation of the target text content. The graph information is recorded in the text, and the vector representations with a cosine similarity greater than or equal to the similarity threshold with the vector representation of the target text content are identified as vector representations that are related to the vector representation of the target text content. The target entities or relationships corresponding to the vector representations that are related to the vector representations of the target text content are identified as entities or relationships that are related to the target text content, and are used as response keywords for the target text content.
2. The method according to claim 1, characterized in that, The vector representations of historical entities and historical relations appearing in the first k-1 graph learning tasks are expanded in dimension to obtain the initial vector representations of historical entities and historical relations in the k-th graph learning task, including: The vector representation of the historical entity is concatenated with the first set vector to obtain the initial vector representation of the historical entity in the k-th graph learning task; By concatenating the vector representation of historical relations with the second set vector, we obtain the initial vector representation of historical relations in the k-th graph learning task.
3. The method according to claim 2, characterized in that, Both the first and second set vectors are zero vectors.
4. The method according to claim 1, characterized in that, The learned vector representations of the target entity and the target relation are subjected to dimensionality compression to obtain vector representations of the target entity and the target relation, including: The learned vector representation of the target entity is multiplied by the first linear transformation matrix to obtain the vector representation of the target entity. The vector representation of the target relation is obtained by multiplying the learned vector representation of the target relation with the second linear transformation matrix.
5. The method according to claim 4, characterized in that, The vector representations of target entities and target relationships are computed using linear transformations in hyperbolic space.
6. The method according to any one of claims 1 to 5, characterized in that, The first and second distance values are calculated in hyperbolic space.
7. The method according to any one of claims 1 to 5, characterized in that, The embedding model is trained using the fact sets corresponding to the first k-1 knowledge graphs, and the second loss value corresponding to the embedding model is determined, including: From the fact sets corresponding to the first k-1 knowledge graphs, sample at least one fact to obtain the historical fact set; The embedding model is trained using a set of historical facts to determine the second loss value corresponding to the embedding model.
8. An information processing device for a knowledge graph, characterized in that, The device includes: The graph acquisition module is used to acquire the knowledge graphs corresponding to multiple graph learning tasks. The k-th graph learning task is used to learn the k-th knowledge graph. The k-th knowledge graph includes multiple entities and at least one set of relations between the multiple entities, where k is a positive integer. The dimension expansion module is used to expand the dimensions of the vector representations of historical entities and the vector representations of historical relations that appear in the first k-1 graph learning tasks before executing the k-th graph learning task, so as to obtain the initial vector representation V1 of the historical entities in the k-th graph learning task and the initial vector representation V2 of the historical relations in the k-th graph learning task. The vector determination module is used to determine the initial vector representation V3 of the newly added entity and the initial vector representation V4 of the newly added relation in the k-th knowledge graph. V1, V2, V3, and V4 have the same dimension. The vector adjustment module is used to adjust the initial vector representations of the target entity and the target relation in the expanded vector space during the execution of the k-th learning task, so as to obtain the learned vector representations of the target entity and the target relation. The vector adjustment module is specifically used to obtain the fact set corresponding to the k-th knowledge graph and the fact sets corresponding to the first k-1 knowledge graphs during the execution of the k-th learning task. The fact sets include at least one positive fact and at least one negative fact. A positive fact refers to a triple consisting of two entities with a relationship, and a negative fact refers to a triple consisting of two entities without a relationship. The embedding model is trained using the fact set corresponding to the k-th knowledge graph to determine the first loss value. The initial value of the first loss value is determined based on the initial vector representations of the newly added entities and relationships. For each training iteration, a scoring function is used to score the vector representations of the newly added entities and relationships obtained in that training iteration, resulting in a scoring function value for that training iteration. A higher scoring function value indicates a greater probability that the corresponding fact is a positive fact. The corresponding first loss value is then calculated based on the scoring function value for that training iteration. The fact set corresponding to the first k-1 knowledge graphs is used to train the embedding model. The embedding model is trained using a set of algorithms to determine a second loss value. The initial value of the second loss value is determined based on the initial vector representations of historical entities and relationships. A first comprehensive loss value is determined based on the first and second loss values. A first distance value between new entities is determined based on the temporary vector representations of newly added entities. A second distance value between historical entities is determined based on the temporary vector representations of historical entities. A first distance loss value is calculated based on the first and second distance values. The first distance loss value is used to ensure that the relative distances between new entities and historical entities remain as constant as possible during vector adjustment. The parameters of the embedding model are adjusted based on the first comprehensive loss value and the first distance loss value to obtain a fully trained embedding model. The learned vector representations of the target entities and target relationships are determined using the trained embedding model. Target entities include historical entities and new entities, and target relationships include historical relationships and new relationships. The dimension compression module is used to perform dimension compression processing on the learned vector representations of the target entity and the target relation, so as to obtain the vector representations of the target entity and the target relation. The device is also used to: generate graph information recording text, which includes vector representations of target entities and vector representations of target relations; acquire the target text content of user questions in a knowledge question-and-answer scenario, parse the semantic information of the target text content and vectorize it to obtain the vector representation of the target text content; identify vector representations in the graph information recording text whose cosine similarity with the vector representation of the target text content is greater than or equal to a similarity threshold as vector representations that are associated with the vector representation of the target text content; and identify the target entities or target relations corresponding to the vector representations that are associated with the vector representation of the target text content as entities or relations that are associated with the target text content, and use them as response keywords for the target text content.
9. A computer device, characterized in that, The computer device includes a processor and a memory, the memory storing at least one program, which is loaded and executed by the processor to implement the information processing method for knowledge graphs as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores at least one program, which is loaded and executed by a processor to implement the information processing method for knowledge graphs as described in any one of claims 1 to 7.
11. A computer program product, characterized in that, The computer program product includes computer instructions that are executed by a processor to implement the information processing method for the knowledge graph as described in any one of claims 1 to 7.