A knowledge graph representation learning method, device and equipment and readable storage medium

By employing latent variable decoupling modeling and relational attention aggregation mechanisms, the semantic aliasing problem of entities and relations in knowledge graph representation learning is solved, achieving high-precision and strong-generalization knowledge graph representation and improving the accuracy and robustness of downstream tasks.

CN122154872APending Publication Date: 2026-06-05SHENZHEN WHALE VISION TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHENZHEN WHALE VISION TECH CO LTD
Filing Date
2026-03-05
Publication Date
2026-06-05

AI Technical Summary

Technical Problem

In existing technologies, knowledge graph representation learning methods suffer from ambiguity and poor generalization due to the mixed encoding of multiple semantic features of entities and relationships in enterprise applications. They also struggle to decouple potential factors and lack independent modeling capabilities, resulting in ambiguity and insufficient generalization.

Method used

By introducing latent variable decoupling modeling and relational attention aggregation mechanism, the initial semantic representation of an entity is decomposed into multiple independent latent semantic factors using the encoding model, and combined with independence constraints and discriminator-assisted training, semantic decoupling representation is achieved.

Benefits of technology

It effectively reduces the risk of semantic aliasing and improves the representation accuracy and generalization ability of knowledge graphs in complex relationship modeling and downstream task transfer.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122154872A_ABST
    Figure CN122154872A_ABST
Patent Text Reader

Abstract

The application relates to the technical field of artificial intelligence, and discloses a knowledge graph representation learning method, device, equipment and readable storage medium, which comprises the following steps: acquiring triples in a local knowledge graph of different business lines, and performing encoding processing on entities in the triples by using an encoding model to generate corresponding initial semantic representations; performing decomposition processing on the initial semantic representations to obtain a latent feature set for representing different semantic factors; performing latent variable independence modeling on the latent feature set based on an independence constraint mechanism to obtain semantic decoupling representations; performing relationship attention aggregation processing on the semantic decoupling representations according to the relationship types in the triples to generate relationship-related entity representations; and training the entity representations and the triples based on a preset optimization target to update parameters of the encoding model. The method of the application can significantly improve the accuracy and robustness of link prediction and knowledge completion without relying on external knowledge.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] Knowledge graphs, as a structured knowledge representation centered on entities and relationships, are widely used in artificial intelligence tasks such as intelligent question answering, recommendation systems, information retrieval, and knowledge reasoning. In large enterprise groups, different business units—such as supply chain management, customer service, marketing operations, and equipment maintenance—typically maintain independent knowledge graph systems to support their specific business processes. While these local knowledge graphs are rich in content, they exhibit significant differences in data structure, naming conventions, and semantic expression, making effective integration of cross-system knowledge difficult. Knowledge graph representation learning, by mapping discrete entities and relationships to a low-dimensional continuous vector space, achieves a computable representation of semantic information, significantly reducing knowledge sparsity and computational complexity. After years of development, this technology has evolved from early linear embedding models (such as TransE and TransH) to a deep modeling paradigm that integrates graph neural networks (GNNs), attention mechanisms, and pre-training strategies, effectively capturing multi-hop structural dependencies and contextual semantic features. Meanwhile, by constructing relation-specific projection spaces (such as TransR and TransD) or fusing multi-source information, the expressive power and robustness of the representation are further improved, promoting the development of highly interpretable and cross-domain knowledge modeling.

[0003] Despite advancements in modeling capabilities, existing methods still commonly face the core problem of potential semantic aliasing in real-world enterprise applications—multiple semantic features of entities and relationships (such as category, function, and context) are mixed and encoded in the same vector space, leading to ambiguous representations and poor generalization. (For example, "server equipment" belongs to the IT asset category, participates in operation and maintenance processes, carries service functions, and is associated with security events.) While methods based on structural projection or GNNs can distinguish some semantics, they struggle to achieve true decoupling of underlying factors. Solutions relying on external knowledge or multimodal information are limited by data quality and consistency, resulting in insufficient generality. This makes large-scale deployment within enterprises difficult. Furthermore, attention mechanisms focus on weighted feature aggregation and lack the ability to independently model semantic components, failing to fundamentally address coupling and redundancy issues. Summary of the Invention

[0004] In view of this, embodiments of this application provide a knowledge graph representation learning method, apparatus, device, and readable storage medium, which can effectively solve the problems of strong coupling, poor interpretability, and insufficient generalization ability of entity representation caused by semantic aliasing in the prior art.

[0005] In a first aspect, embodiments of this application provide a knowledge graph representation learning method, including: The system obtains triples from local knowledge graphs from different business lines and uses an encoding model to encode the entities in the triples to generate corresponding initial semantic representations. The initial semantic representation is decomposed to obtain a set of potential features used to characterize different semantic factors; Based on the independence constraint mechanism, the latent variable independence is modeled on the latent feature set to obtain a semantically decoupled representation; Based on the relation type in the triple, relation attention aggregation processing is performed on the semantic decoupling representation to generate relation-related entity representations; Based on a preset optimization objective, the entity representation and the triples are trained to update the parameters of the encoding model.

[0006] In some embodiments, obtaining triples from a knowledge graph and encoding the entities in the triples using an encoding model to generate corresponding initial semantic representations includes: Map each entity in the triplet to its corresponding initial vector representation; The initial vector representation is input into the encoding model to obtain the mean vector and the variance vector; Based on the mean vector and the variance vector, multiple latent variable vectors are obtained by sampling. The multiple latent variable vectors are concatenated to generate the corresponding initial semantic representation.

[0007] In some embodiments, the decomposition of the initial semantic representation to obtain a set of potential features for characterizing different semantic factors includes: The initial semantic representation is divided into multiple sub-vectors according to a preset dimension; wherein each sub-vector is used to represent different types of semantic factors; Perform dimension mapping on each subvector to obtain the corresponding subspace representation; Each of the subspace representations is constructed as a set of latent features.

[0008] In some embodiments, the step of modeling the latent variable independence of the latent feature set based on the independence constraint mechanism to obtain a semantically decoupled representation includes: Using the set of latent features as true samples, corresponding true sample latent variables are generated; Randomly shuffle the subspace order in the latent feature set to generate corresponding pseudo-sample latent variables; The latent variables of the real samples and the latent variables of the fake samples are input into the discriminator to obtain the adversarial discrimination score; The latent feature set is trained based on the adversarial discrimination score to obtain a semantically decoupled representation that satisfies the independence constraint.

[0009] In some embodiments, performing relational attention aggregation processing on the semantically decoupled representation based on the relation type in the triples to generate relation-related entity representations includes: Obtain the vector representation of the relation type; Each latent variable in the vector representation and the semantically decoupled representation is weighted separately to obtain multiple attention weights; Weighted fusion is performed on each latent variable based on multiple attention weights to generate a relation-related entity representation.

[0010] In some embodiments, training the entity representation and the triples based on a preset optimization objective to update the parameters of the encoding model includes: Construct a set of triples containing pairs of positive and negative samples; Based on the entity representation, a scoring calculation is performed on the set of triples to obtain the corresponding score value; The joint loss is calculated based on the score value; The encoding model is trained by backpropagation using the joint loss, and the corresponding model parameters are updated.

[0011] In some embodiments, the step of backpropagating the encoding model using the joint loss to update the corresponding model parameters further includes: The gradient vectors of the parameters of each layer of the coding model are calculated based on the joint loss. The corresponding parameter update amount is generated based on the gradient vector and the preset learning rate; The parameter update amount is applied to the parameters of each layer of the coding model to obtain the updated model parameters.

[0012] Secondly, embodiments of this application provide a knowledge graph representation learning device, comprising: The encoding module is used to obtain triples from local knowledge graphs from different business lines, and to use the encoding model to encode the entities involved in the triples in order to generate the corresponding initial semantic representations. The decomposition module is used to decompose the initial semantic representation to obtain a set of potential features for characterizing different semantic factors; The modeling module is used to perform latent variable independence modeling on the latent feature set based on the independence constraint mechanism to obtain a semantically decoupled representation; The aggregation module is used to perform relational attention aggregation processing on the semantic decoupling representation according to the relation type in the triple, and generate relation-related entity representations; An update module is used to train the entity representation and the triples based on a preset optimization objective in order to update the parameters of the encoding model.

[0013] Thirdly, embodiments of this application provide a terminal device, the terminal device including a processor and a memory, the memory storing a computer program, and the processor executing the computer program to implement the knowledge graph representation learning method of the first aspect described above.

[0014] Fourthly, embodiments of this application provide a computer-readable storage medium, wherein when the computer program is executed on a processor, it implements the knowledge graph representation learning method of the first aspect described above.

[0015] The embodiments of this application have the following beneficial effects: by introducing latent variable decoupling modeling and relational attention aggregation mechanism, multi-dimensional feature decomposition of entities in the latent semantic space and independent modeling of semantic information are realized, effectively reducing the risk of semantic aliasing; at the same time, by combining discriminator-assisted independence constraints and joint loss function training mechanism, the controllability and discriminative ability of latent variable representation are improved, thereby enhancing the representation accuracy and generalization ability of knowledge graph in complex relation modeling and downstream task transfer. Attached Figure Description

[0016] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0017] Figure 1 A flowchart of a knowledge graph representation learning method according to an embodiment of this application is shown; Figure 2 Another flowchart of the knowledge graph representation learning method according to an embodiment of this application is shown; Figure 3 This paper illustrates yet another flowchart of a knowledge graph representation learning method according to an embodiment of this application; Figure 4 This illustration shows a structural diagram of a knowledge graph representation learning method according to an embodiment of this application. Detailed Implementation

[0018] The technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments.

[0019] The components of the embodiments of this application described and illustrated in the accompanying drawings can be arranged and designed in a variety of different configurations. Therefore, the following detailed description of the embodiments of this application provided in the drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.

[0020] In the following text, the terms "comprising," "having," and their cognates, which may be used in various embodiments of this application, are intended only to indicate a particular feature, number, step, operation, element, component, or combination thereof, and should not be construed as primarily excluding the presence of one or more other features, numbers, steps, operations, elements, components, or combinations thereof, or adding the possibility of one or more combinations thereof. Furthermore, the terms "first," "second," "third," etc., are used only for distinguishing descriptions and should not be construed as indicating or implying relative importance.

[0021] Unless otherwise specified, all terms used herein (including technical and scientific terms) shall have the same meaning as commonly understood by one of ordinary skill in the art to which the various embodiments of this application pertain. Terms (such as those defined in commonly used dictionaries) shall be interpreted as having the same meaning as in their contextual meaning in the relevant technical field and shall not be construed as having an idealized or overly formal meaning, unless clearly defined in the various embodiments of this application.

[0022] The following detailed description of some embodiments of this application is provided in conjunction with the accompanying drawings. Unless otherwise specified, the following embodiments and features can be combined with each other.

[0023] Considering the problems of strong coupling, poor interpretability, and insufficient generalization ability in entity representation caused by semantic aliasing in existing technologies, this application proposes a knowledge graph representation learning method. By introducing a latent variable decoupling mechanism, the initial semantic representation of an entity is decomposed into multiple independent latent semantic factors. Independence constraints are then used to achieve statistical decoupling of each dimension, allowing for separate modeling of different semantic factors. Furthermore, a relational attention mechanism is utilized to adaptively aggregate relevant semantic features based on specific relation types, improving the contextual adaptability and task specificity of the representation. This method achieves high-definition, highly generalized knowledge graph representations under pure structure-driven conditions without relying on external knowledge or multimodal information, significantly improving the accuracy and robustness of downstream tasks such as link prediction and knowledge completion.

[0024] The following examples illustrate this knowledge graph representation learning method.

[0025] Figure 1 A flowchart of a knowledge graph representation learning method according to an embodiment of this application is shown. Exemplarily, the knowledge graph representation learning method includes the following steps: Step S100: Obtain triples from local knowledge graphs of different business lines, and use an encoding model to encode the entities in the triples to generate the corresponding initial semantic representations.

[0026] A knowledge graph is a knowledge structure composed of sets of entities, relations, and facts, typically represented as G={V,R,T}, where V represents the entity set, R represents the relation set, and T represents the fact set consisting of triples. Triples originate from local knowledge graphs maintained by multiple business lines within the enterprise. These business lines may include supply chain management, customer service, marketing operations, and equipment maintenance. The encoding model maps the entities in the triples to the latent semantic space and generates corresponding initial semantic representations, achieving a unified expression of entity semantic information and graph structure features. This enables subsequent latent variable decoupling modeling to be performed in a continuous space.

[0027] In an optional embodiment, step S100 includes the following sub-steps: S101 maps each entity in the triple to its corresponding initial vector representation.

[0028] The initial vector is represented as a continuous vectorized representation of entity v, used to represent the semantic information of the entity.

[0029] As an example, for the head entity and tail entity in the triple (h,r,t), initial vector representations can be constructed separately. and This initial vector is used as input for subsequent latent variable distribution modeling.

[0030] In knowledge graph representation learning, entity and relation vectors are typically defined as follows: Within a continuous vector space, entity semantics and relational structures are preserved, providing foundational input data for subsequent latent variable sampling and feature decoupling. For example, the same entity can present different semantic identities in local knowledge graphs of different business lines.

[0031] S102, input the initial vector representation into the encoding model to obtain the mean vector and variance vector.

[0032] Wherein, the mean vector and variance vector are used to represent the parameter distributions of the corresponding latent variable space, and the coding model is denoted as . As an example, after receiving the initial entity vector v, the encoding model generates latent variable distribution parameters through a three-layer fully connected neural network. (mean) and (Variance) can be expressed as: ; in, , which is used as the distribution parameter for subsequent sampling.

[0033] For example, the estimated distribution of latent variables corresponding to the mean vector and variance vector mentioned above can represent the random generation mechanism of entities in the latent semantic space, providing a computable probabilistic basis for obtaining latent variables through sampling later.

[0034] S103, based on the mean vector and variance vector, samples to obtain multiple latent variable vectors.

[0035] Here, the latent variable vector represents a random instance of an entity in the latent semantic space. As an example, assuming the latent variables follow a Gaussian distribution, the latent variable vector can be generated using the following sampling method: ; Wherein, the latent variable z is the mean With variance The parameters are normally distributed samples.

[0036] For example, this sampling mechanism can generate latent semantic feature vectors for each entity, enabling latent variable learning to balance distributed representation and randomness.

[0037] S104 concatenates multiple latent variable vectors to generate the corresponding initial semantic representation.

[0038] Latent variable concatenation refers to combining multiple sampled latent variable vectors according to their dimensions to form a complete initial semantic representation. For example, sampling results corresponding to different latent variable dimensions can be concatenated to form a high-dimensional semantic representation for subsequent latent space decomposition.

[0039] In other implementations, basic normalization can be performed on the concatenated latent variable vector to further maintain the continuous structural expression of each latent variable dimension. The initial semantic representation can correspond to the entity representation of cross-business unified modeling within the enterprise group, and is used to decompose the different semantic factors of the entity into multiple subspaces in subsequent steps.

[0040] Step S200: Decompose the initial semantic representation to obtain a set of potential features used to characterize different semantic factors.

[0041] The latent feature set refers to the set of subspaces in the latent semantic space used to represent different semantic factors of an entity. It is used to decompose and organize the entity's semantics along the dimensions of latent variables, allowing different semantic factors to occupy independent dimensions. These different semantic factors include the entity's category attributes, structural features, or functional information, enabling the semantic differences of the same entity across business lines such as supply chain, operations, and marketing to be represented by different subspaces within the latent space. This decomposition process makes subsequent modeling of the independence of latent variables more interpretable, thereby reducing the impact of semantic aliasing.

[0042] In an optional embodiment, step S200 includes the following sub-steps: S201, the initial semantic representation is divided into multiple sub-vectors according to a preset dimension. Each sub-vector is used to represent different types of semantic factors.

[0043] Here, the predefined dimension refers to a partitioning rule predefined according to the dimensional structure of the latent variables, so that different parts of the latent variables correspond to different semantic factors. Exemplarily, the initial semantic representation can be... Divide into k non-overlapping sub-vectors, that is: ; Each subvector It represents different types of potential semantic factors, such as entity category attributes, structural features, or functional information.

[0044] For example, by dividing the dimensions of latent variables, different semantic factors can be explicitly distinguished in the latent space, enabling subsequent relationship modeling and independence constraints to be carried out at the dimensional level, thereby improving the semantic decoupling effect.

[0045] S202, Perform dimension mapping on each subvector to obtain the corresponding subspace representation.

[0046] Here, dimensional mapping refers to using mapping operations to transform each sub-vector into a latent space form with semantic representation capabilities. Exemplarily, a linear mapping can be performed using a parameter matrix, for example, for each... Using the mapping matrix P, the corresponding subspace vectors are obtained: ; For example, dimensional mapping can enhance the semantic distinguishability of latent variables, enabling each subspace to have independent expressive power, and providing a structured semantic space for subsequent relational attention mechanisms and latent variable independence modeling.

[0047] S203, constructs each subspace representation as a set of latent features.

[0048] The latent feature set is a set of structures formed by combining multiple subspace representations. Exemplarily, the latent feature set can be formed by combining multiple mapped subspace representations: ; In other implementations, basic normalization or sparsity constraints may be performed on the set of latent features to further optimize the combination of latent variables.

[0049] Step S300: Based on the independence constraint mechanism, perform latent variable independence modeling on the latent feature set to obtain a semantically decoupled representation.

[0050] The independence constraint mechanism is used to impose independent distribution constraints on latent variables of different dimensions in the latent space to mitigate semantic aliasing, enabling latent variables to have independent expressive power in the semantic dimension and obtaining semantically decoupled representations. Semantic decoupling representations are used to separate factors of the same entity mixed in different business lines into mutually independent subspaces. This independence constraint is achieved by constructing the difference between the joint distribution and marginal distribution of latent variables and performing approximate optimization, thereby ensuring that different latent semantic factors have independent meaning in the latent space.

[0051] In one alternative embodiment, such as Figure 2 As shown, step S300 includes the following sub-steps: S301, using the set of latent features as true samples, generates corresponding true sample latent variables.

[0052] Here, the true latent variables refer to latent variable samples directly generated from the latent feature set, representing the current joint distribution structure of the latent variables. Exemplarily, the constructed latent feature set can be used directly. As input, the corresponding latent variables of the true samples are obtained and used for subsequent adversarial training.

[0053] For example, by using latent variables from real samples, a joint distribution of latent variables can be constructed during the training process, providing a joint distribution basis for the independence constraints of latent variables.

[0054] S302, randomly shuffles the subspace order in the latent feature set to generate corresponding pseudo-sample latent variables.

[0055] The random shuffling process refers to randomly shuffling the order of dimensions in the subspace representation, thereby statistically disrupting the joint relationships between different subspaces in the resulting latent variable sample. For example, the subspace dimensions in the latent variable sample can be arranged in a random order to obtain the pseudo-sample latent variables. , used to construct the marginal distribution of latent variables.

[0056] For example, by randomly perturbing the order of the subspace, the latent variables of the pseudo-sample can be made to approximate the marginal distributions of each dimension of the latent variables, providing the necessary statistical samples for modeling the independent distribution of the latent variables.

[0057] S303: Input the latent variables of the real samples and the latent variables of the fake samples into the discriminator to obtain the adversarial discrimination score.

[0058] The discriminator distinguishes whether the true latent variable originates from a joint distribution or whether the false latent variable originates from independent sampling, thus obtaining an adversarial discriminant score representing the overall correlation. Exemplarily, the true latent variable can be denoted as z, and the false latent variable as... The discriminator loss can be approximated as: ; in, For discriminator loss; For expectation operators; For the discriminator function; For example, the discriminator training process described above can be used to assess the degree of deviation between the joint distribution of latent variables and the marginal distribution, providing an adversarial modeling mechanism for independence constraints.

[0059] S304, based on the adversarial discriminant score, trains the latent feature set to obtain a semantically decoupled representation that satisfies the independence constraint.

[0060] Semantic decoupling representation refers to a latent variable structure that satisfies the latent variable independence constraint and has the independent expressive power of different semantic factors. Exemplarily, an optimization objective for the independent distribution of latent variables can be constructed based on the total correlation (TC) of the latent variables: ; in, Total relevance; for Divergence is used to quantify the degree of difference between two probability distributions. It is a multi-source random variable; For each component The product of the marginal probability distributions; The independence constraint is approximated by a discriminator, so that the latent variables approximate the independent distribution during training.

[0061] In other implementations, weighting coefficients can be introduced during the optimization process to adjust the proportion of independence constraints in the overall training objective.

[0062] Step S400: Based on the relation type in the triple, perform relation attention aggregation processing on the semantic decoupling representation to generate relation-related entity representations.

[0063] The relationship types are derived from relationship patterns in supply chain, customer service, market operations, and equipment maintenance. Relationship attention aggregation processing refers to weighted aggregation of latent variable dimensions in semantically decoupled representations based on information relevance for different relationship types in the knowledge graph, thereby forming entity representations relevant to the current relationship semantics. Different business lines have different relationship patterns. The relationship attention mechanism can adaptively select the most relevant latent variable dimensions based on relationship semantics, improving the expressive power of entity representations in relationship prediction tasks.

[0064] In an optional embodiment, step S400 includes the following sub-steps: S401, obtain the vector representation of the relation type.

[0065] The vector representation of the relation type is used to characterize the continuous vector representation of the relational semantic information in the triplet, and is used to measure the correlation between the latent variable dimension and a specific relation in the latent semantic space. For example, for a triplet relation r, the corresponding relation vector can be obtained. , which is used as an input variable for subsequent weight calculation.

[0066] For example, by obtaining relation vectors, relation semantics can be mapped to a continuous space, thereby providing a basis for latent variable attention calculation and enabling attention weights to reflect the importance of relation semantics.

[0067] S402 performs weight calculations on each latent variable in the vector representation and semantically decoupled representation to obtain multiple attention weights.

[0068] Here, attention weights are weight values ​​used to measure the semantic relevance of different latent semantic factors to the current relation. Exemplarily, parameter matrices can be defined separately. and and for each latent variable Perform a linear transformation to obtain the mapping result: ; Subsequently, the mapped latent variables and the relation vector are weighted and their correlation is calculated to obtain the attention weights of the corresponding latent variables: ; in, Represents the normalized weight of the i-th element; Typically, it represents the probability / value of variable zj under distribution P; Typically, it represents the probability / value of variable r under distribution Q; It is the sum of the original contributions of all k elements; For example, by calculating the attention weights as described above, the degree of matching between each latent variable and the semantics of the relation can be dynamically reflected in the latent space, making the weighted convergence process adaptive.

[0069] S403 performs weighted fusion on each latent variable based on multiple attention weights to generate entity representations related to relationships.

[0070] Weighted fusion refers to performing a weighted summation operation on each latent variable according to attention weights to obtain an entity representation that reflects the semantics of the relationship. As an example, the weighted latent variables can be accumulated: ; in, This represents the final generated aggregate vector; The weight coefficients corresponding to the i-th basis vector zi typically satisfy the following conditions: ; The i-th fundamental vector participating in the aggregation; In other implementations, normalization may be performed on the weighted and fused entity representations to enhance the comparability of entity vector representations.

[0071] Step S500: Based on the preset optimization objective, train the entity representation and triples to update the parameters of the encoding model.

[0072] The preset optimization objective refers to the objective function used in the knowledge graph representation learning process to jointly optimize the entity latent variable distribution, semantic independence constraints, and relation attention mechanism, thereby improving the expressive power of entity representations in knowledge reasoning and relation prediction tasks. Exemplarily, the optimization objective can take the following joint loss form L: ; in, This represents the loss of the translation model based on the triplet structure. The KL divergence represents the distance between the latent variable distribution and the prior distribution. This indicates the overall correlation constraint among latent variables. , This indicates the preset weighting coefficients.

[0073] In one alternative embodiment, such as Figure 3 As shown, step S500 includes the following sub-steps: S501, construct a set of triples containing pairs of positive and negative samples.

[0074] In this context, positive sample triples represent existing combinations of entity relations in the knowledge graph, while negative sample triples represent combinations of non-existent entity relations constructed by replacing the head or tail entity. For example, a corresponding negative sample triple (h',r,t') can be obtained by randomly replacing the head or tail entity in the triple (h,r,t).

[0075] For example, positive sample triples come from fact sets in local knowledge graphs of business lines such as supply chain, customer service, operations, or maintenance, while negative sample triples are constructed on these sets. By constructing triple sets using both positive and negative samples, the entity relationship structure and latent semantic representation in the knowledge graph can be learned simultaneously during training, enabling the model to distinguish between real and random relationships.

[0076] S502, based on entity representation, performs score calculation on the set of triples to obtain the corresponding score value.

[0077] The score measures the similarity between positive and negative sample triples in the latent space, guiding negative samples away from the semantic representation of positive samples. Exemplarily, the translation model's scoring function can be expressed as: ; in, The scoring function for triples, Let r be the vector representation of the head entity and the tail entity, and r be the relation representation. Minimizing the score can improve the consistency of the triple structure. It is the L2 norm (Euclidean norm).

[0078] For example, the scoring mechanism described above can make the representations of positive sample triples more similar, while the representations of negative sample triples are more dissimilar, thereby improving the ability to predict relationships.

[0079] S503, the joint loss is calculated based on the score value.

[0080] The joint loss is used to jointly optimize triple structure constraints, latent variable distribution normalization, and semantic independence modeling. As an example, the translation model loss can be calculated using the marginal loss form: ; in, The loss function representing knowledge graph embedding; The threshold for edge loss is used to ensure sufficient separation between positive and negative samples; It is the score of the effective triplet; This is the score for the negative triplet. The joint loss described above can be combined with the distribution constraint term. and total correlation terms Together they form the overall optimization goal.

[0081] S504 uses joint loss to backpropagate and train the encoding model, updating the corresponding model parameters.

[0082] Backpropagation training is used to update the parameters of the encoding model using gradients based on the joint loss, thereby achieving joint iterative optimization of the entity latent variable representation, relation vector, and encoding model parameters. Demonstratively, multiple rounds of training can be performed on the encoding model based on the joint loss function until convergence.

[0083] In one optional implementation, step S504 includes the following sub-steps: The gradient vectors of the parameters of each layer of the encoding model are calculated based on the joint loss.

[0084] The gradient vector represents the partial derivative of the joint loss with respect to the parameters of the encoding model, serving as the basis for subsequent parameter updates. For example, backpropagation can be performed on the parameters of each layer of the encoding model based on the joint loss function to calculate the corresponding gradient values, thus obtaining a set of gradient vectors representing the direction of parameter updates.

[0085] The corresponding parameter update amount is generated based on the gradient vector and the preset learning rate.

[0086] The learning rate controls the magnitude of parameter updates, ensuring that parameter adjustments remain stable during training. For example, gradient descent can be used to multiply the gradient vector by the learning rate to obtain an update representing the magnitude of parameter changes, which is then used to numerically adjust the model parameters.

[0087] The parameter update amount is applied to the parameters of each layer of the encoded model to obtain the updated model parameters.

[0088] The parameter update process adjusts the parameter values ​​of the encoding model in the current iteration based on the parameter update amount, enabling the model to gradually approach the optimal solution of the joint loss during training. For example, the parameters of each layer can be added or subtracted sequentially to obtain the updated model parameters, which are then used to support the next training iteration.

[0089] For example, the method in this embodiment uses the YAGO dataset as an experimental platform to evaluate its performance in knowledge graph representation learning tasks. The experiments use standard link prediction metrics for validation, including MR (MeanRank), MRR (Mean Reciprocal Rank), and Hits@K. MR reflects the average rank of the model's predicted correct entities; MRR measures the overall ranking quality by calculating the average of the reciprocals of the predicted rankings; and Hits@K represents the proportion of correct answers appearing in the top K positions of the predicted results. The experiments compare the proposed method with existing convolutional neural network feature extraction methods (ConvE), deep dimension enhancement network methods (LiftNet), and graph neural network methods (GAT) using the same knowledge graph representation learning model DistMult. The proposed method in this embodiment demonstrates a significant improvement in accuracy on the connection prediction task, as shown in Table 1 below.

[0090] Table 1

[0091] Figure 4 A schematic diagram of a knowledge graph representation learning device according to an embodiment of this application is shown. Exemplarily, the device 100 includes: The encoding module 110 is used to obtain triples in the knowledge graph and use an encoding model to encode the entities involved in the triples to generate corresponding initial semantic representations. The decomposition module 120 is used to decompose the initial semantic representation to obtain a set of potential features for characterizing different semantic factors. Modeling module 130 is used to perform latent variable independence modeling on the latent feature set based on the independence constraint mechanism to obtain semantically decoupled representation; Aggregation module 140 is used to perform relational attention aggregation processing on the semantic decoupling representation according to the relation type in the triple, and generate relation-related entity representations; The update module 150 is used to train the entity representation and the triples based on a preset optimization objective in order to update the parameters of the encoding model.

[0092] It is understood that the apparatus of this embodiment corresponds to the method of the above embodiments, and the options in the above embodiments are also applicable to this embodiment, so they will not be described again here.

[0093] This application also provides a terminal device, exemplary of which includes a processor and a memory, wherein the memory stores a computer program, and the processor executes the computer program to enable the terminal device to perform the functions of the various modules in the above-described method or apparatus.

[0094] The processor can be an integrated circuit chip with signal processing capabilities. The processor can be a general-purpose processor, including at least one of a Central Processing Unit (CPU), Graphics Processing Unit (GPU), Network Processor (NP), Digital Signal Processor (DSP), Application-Specific Integrated Circuit (ASIC), Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The general-purpose processor can be a microprocessor or any conventional processor, capable of implementing or executing the methods, steps, and logic block diagrams disclosed in the embodiments of this application.

[0095] The memory can be, but is not limited to, Random Access Memory (RAM), Read Only Memory (ROM), Programmable Read-Only Memory (PROM), Erasable Programmable Read-Only Memory (EPROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), etc. The memory is used to store computer programs, and the processor can execute the computer programs accordingly after receiving execution instructions.

[0096] This application also provides a computer-readable storage medium for storing the computer program used in the aforementioned terminal device. For example, the computer-readable storage medium may include, but is not limited to, various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0097] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can also be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings show the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that, in alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and combinations of blocks in the block diagram and / or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.

[0098] In addition, the functional modules or units in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.

[0099] If the aforementioned functions are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a smartphone, personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application.

[0100] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application.

Claims

1. A knowledge graph representation learning method, characterized in that, The method includes: The system obtains triples from local knowledge graphs from different business lines and uses an encoding model to encode the entities in the triples to generate corresponding initial semantic representations. The initial semantic representation is decomposed to obtain a set of potential features used to characterize different semantic factors; Based on the independence constraint mechanism, the latent variable independence is modeled on the latent feature set to obtain a semantically decoupled representation; Based on the relation type in the triple, relation attention aggregation processing is performed on the semantic decoupling representation to generate relation-related entity representations; Based on a preset optimization objective, the entity representation and the triples are trained to update the parameters of the encoding model.

2. The knowledge graph representation learning method according to claim 1, characterized in that, The process of obtaining triples from local knowledge graphs from different business lines and encoding the entities in the triples using an encoding model to generate corresponding initial semantic representations includes: Map each entity in the local knowledge graph triple to a corresponding initial vector representation; The initial vector representation is input into the encoding model to obtain the mean vector and the variance vector; Based on the mean vector and the variance vector, multiple latent variable vectors are obtained by sampling. The multiple latent variable vectors are concatenated to generate the corresponding initial semantic representation.

3. The knowledge graph representation learning method according to claim 1, characterized in that, The decomposition of the initial semantic representation to obtain a set of potential features for characterizing different semantic factors includes: The initial semantic representation is divided into multiple sub-vectors according to a preset dimension; wherein each sub-vector is used to represent different types of semantic factors; Perform dimension mapping on each subvector to obtain the corresponding subspace representation; Each of the subspace representations is constructed as a set of latent features.

4. The knowledge graph representation learning method according to claim 1, characterized in that, The method based on the independence constraint mechanism, which models the latent variable independence of the latent feature set to obtain a semantically decoupled representation, includes: Using the set of latent features as true samples, corresponding true sample latent variables are generated; Randomly shuffle the subspace order in the latent feature set to generate corresponding pseudo-sample latent variables; The latent variables of the real samples and the latent variables of the fake samples are input into the discriminator to obtain the adversarial discrimination score; The latent feature set is trained based on the adversarial discrimination score to obtain a semantically decoupled representation that satisfies the independence constraint.

5. The knowledge graph representation learning method according to claim 1, characterized in that, The step of performing relational attention aggregation processing on the semantically decoupled representation based on the relation type in the triples to generate relation-related entity representations includes: Obtain the vector representation of the relation type; Each latent variable in the vector representation and the semantically decoupled representation is weighted separately to obtain multiple attention weights; Weighted fusion is performed on each latent variable based on multiple attention weights to generate a relation-related entity representation.

6. The knowledge graph representation learning method according to claim 1, characterized in that, The process of training the entity representation and the triples based on a preset optimization objective to update the parameters of the encoding model includes: Construct a set of triples containing pairs of positive and negative samples; Based on the entity representation, a scoring calculation is performed on the set of triples to obtain the corresponding score value; The joint loss is calculated based on the score value; The encoding model is trained by backpropagation using the joint loss, and the corresponding model parameters are updated.

7. The knowledge graph representation learning method according to claim 6, characterized in that, The step of using the joint loss to perform backpropagation training on the encoding model and updating the corresponding model parameters further includes: The gradient vectors of the parameters of each layer of the coding model are calculated based on the joint loss. The corresponding parameter update amount is generated based on the gradient vector and the preset learning rate; The parameter update amount is applied to the parameters of each layer of the coding model to obtain the updated model parameters.

8. A knowledge graph representation learning device, characterized in that, include: The encoding module is used to obtain triples from local knowledge graphs from different business lines, and to use the encoding model to encode the entities involved in the triples in order to generate the corresponding initial semantic representations. The decomposition module is used to decompose the initial semantic representation to obtain a set of potential features for characterizing different semantic factors; The modeling module is used to perform latent variable independence modeling on the latent feature set based on the independence constraint mechanism to obtain a semantically decoupled representation; The aggregation module is used to perform relational attention aggregation processing on the semantic decoupling representation according to the relation type in the triple, and generate relation-related entity representations; An update module is used to train the entity representation and the triples based on a preset optimization objective in order to update the parameters of the encoding model.

9. A terminal device, characterized in that, The terminal device includes a processor and a memory, the memory storing a computer program, and the processor executing the computer program to implement the knowledge graph representation learning method according to any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, It stores a computer program that, when executed on a processor, implements the knowledge graph representation learning method according to any one of claims 1-7.