A knowledge graph link reasoning method
Patent Information
- Application Number
- CN202510887076.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-30
- Publication Date
- 2025-09-23
- Estimated Expiration
- 2045-06-30
Smart Images

Figure CN120409652B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of artificial intelligence and knowledge graphs, and in particular relates to a knowledge graph link reasoning method. Background Art
[0002] As core infrastructure in the field of artificial intelligence, knowledge graphs efficiently represent domain knowledge through structured networks of entities and relationships. They are widely used in scenarios such as social networking, intelligent question-answering, recommendation systems, and semantic search. One of their core tasks is link prediction, which involves inferring missing triplets (head entity, relationship, tail entity) to complete the knowledge graph. Traditional approaches, primarily based on graph neural networks (GNNs), learn entity representations by aggregating neighborhood information, but face significant challenges in practical applications.
[0003] Although GNN methods have made some progress in local structure modeling, their limitations are gradually becoming apparent. First, the low connectivity of knowledge graphs makes it difficult to capture semantic associations between distant entities. For example, in the "writer-work-publisher" triple, if there is a lack of intermediate relationship connections between entities, the model cannot effectively infer high-order semantic associations, resulting in low prediction accuracy for long-tail entities. Second, existing methods lack the ability to express local information. Most models use linear aggregation strategies to fuse neighbor features, making it difficult to distinguish the semantic differences between complex relationships (such as "father and son" and "teacher and student"). In addition, the dynamic semantic changes of entities under different relationships are not fully considered, further limiting the generalization ability of the model.
[0004] In recent years, hypergraph modeling technology has been introduced to enhance the representation learning of knowledge graphs. By modeling triples and their associated entity sets as hyperedges, hypergraph methods can break through the binary connection limitations of traditional graph structures and capture complex interactions between multiple nodes. For example, some studies use hypergraph neural networks (HGNNs) to aggregate the features of nodes within hyperedges to improve the local information fusion effect. However, existing hypergraph methods still have shortcomings: first, they do not explicitly distinguish between heterogeneous interactions and homogeneous interactions between entities and relationships within triples, resulting in insufficient modeling of interaction patterns; second, there is a lack of dynamic attention mechanisms for entity clustering under relationship constraints, and global semantic associations are not effectively utilized; third, no self-supervision strategy is introduced during training, making it difficult to distinguish between noise interference and true semantic associations, limiting the discriminability of representations.
[0005] On social platforms, user interactions (such as following, commenting, liking, and forwarding) form a dynamically evolving social graph. This graph can be viewed as a heterogeneous knowledge graph, where nodes represent users, content, or groups, and edges represent multiple types of behavioral relationships. However, real-world social data suffers from high sparsity, high noise perturbations, and rapid dynamic changes. Traditional graph representations and recommendation algorithms struggle to accurately capture multidimensional semantics, specifically the following technical challenges:
[0006] Insufficient dynamic interaction modeling: Existing models lack the ability to model the evolution of user interests over time, making it difficult to effectively capture timing-sensitive interaction behaviors.
[0007] The cold start problem of long-tail users is serious: newly registered or low-frequency active users lack sufficient behavior records, making it difficult for the recommendation system to accurately predict their interest preferences.
[0008] Noise interference affects recommendation effectiveness: There are a large number of non-real interactions (such as false clicks and abnormal operations) on social platforms, which leads to model learning deviations.
[0009] Low differentiation of multi-dimensional relationships: There are multiple types of complex interactions between users and content, and traditional single-channel graph structures are difficult to express their semantic differences. Summary of the Invention
[0010] In response to the above-mentioned deficiencies in the prior art, the present invention provides a knowledge graph link reasoning method that solves the problems of insufficient local feature modeling, global semantic fragmentation, and high data dependence in existing social network knowledge graph link reasoning methods.
[0011] In order to achieve the above objectives, the technical solution adopted by the present invention is: a knowledge graph link reasoning method, comprising the following steps:
[0012] S1. Preserving local structure through social triple integrity hypergraph and capturing global semantic associations with social relationship semantic hypergraph to construct a complementary dual hypergraph representation of social networks.
[0013] S2. Based on the dual hypergraph representation of social networks, a composite semantic representation fusion of heterogeneous interactions, homogeneous interactions, and overall interactions is combined with a hypergraph attention network to achieve dynamic semantic propagation guided by social relationships. This generates a structure-aware and context-dependent representation for each social node. The social triple integrity hypergraph is used to capture local interaction features, including heterogeneous interactions, homogeneous interactions, and overall interactions, while the social relationship semantic hypergraph is used to perceive global semantic differences.
[0014] S3. Design multi-channel contrastive learning based on social data based on structure-aware and context-dependent representations;
[0015] S4. Use the designed multi-channel contrastive learning to construct multi-channel auxiliary tasks, and optimize the social triple score ranking results based on the marginal ranking loss function. Through the joint learning framework, the knowledge graph link prediction task and the self-supervised comparison task are integrated to complete the reasoning of knowledge graph links. Among them, the self-supervised comparison task is a multi-channel auxiliary task.
[0016] The present invention achieves the following beneficial effects: by collaboratively optimizing social triple integrity modeling and global semantic associations, it addresses the shortcomings of traditional link inference methods in terms of local feature expression and global information fusion, significantly improving the accuracy and generalization of link prediction in knowledge graphs for social networks. Its modular design supports flexible expansion and adapts to the complex reasoning requirements of industrial-grade knowledge graphs, providing efficient technical support for scenarios such as intelligent question-answering and recommendation systems.
[0017] Furthermore, the S1 includes the following steps:
[0018] S101. Constructing triplet hyperedge sets based on social triples in knowledge graphs ,connecting the social head entity, the social relationship and the social tail entity to the same hyperedge to preserve the social triple integrity so as to preserve the local relationship through the social triple integrity hypergraph;
[0019] S102. Constructing a hyperedge set based on social relationship semantics ,The social head entities and social tail entities of the same social relationship are clustered separately, forming global semantic associations, and constructing a complementary dual hypergraph representation of social networks.
[0020] The beneficial effect of the above further scheme is that the dual hypergraphs of social networks form orthogonal complementation - the social triple integrity hypergraph prevents the loss of internal information of social triples, and the social semantic hypergraph breaks through the limitation of single social triples. The two work together to enable the model to have both fine-grained structure preservation and global semantic perception capabilities.
[0021] Furthermore, the S2 includes the following steps:
[0022] S201. By explicitly modeling multi-type interaction features among social head entities, social relationships, and social tail entities, a composite semantic representation including heterogeneous interactions, homogeneous interactions, and overall interactions is constructed. Local interaction features include heterogeneous interactions, homogeneous interactions, and overall interactions. A social triple integrity hypergraph is used to capture local interaction features.
[0023] S202, fusing the composite semantic representations through a weight matrix to generate a hyperedge semantic vector, wherein, during the social node representation update phase, a gated aggregation mechanism is used to achieve directional propagation of the hyperedge information to the target social node;
[0024] S203. Use the social relationship semantic hypergraph to perceive global semantic differences, and based on directed propagation, introduce a dynamic attention mechanism, combined with the hypergraph attention network, to achieve relationship-guided dynamic semantic propagation and generate structure-aware and context-dependent representations for each social node.
[0025] The beneficial effects of the above further scheme are: achieving triple breakthroughs through multi-level interaction modeling, explicitly quantifying the influence strength between different elements through differentiable attention weights; the relationship guidance mechanism enables the same social entity to obtain differentiated representations in different contexts; and the adaptive aggregation characteristics of the graph attention network significantly enhance the modeling ability of long-tail relationships.
[0026] Furthermore, the expression of the heterogeneous interaction is as follows:
[0027] ;
[0028] in, represents heterogeneous semantic vectors, Represents the feature vector of the user node, Embedded representation of the interaction between users and content, Represents the feature vector of the content node, + represents feature vector addition, represents element-wise multiplication, Represents a splicing operation;
[0029] The expression of the homogeneous interaction is as follows:
[0030] ;
[0031] in, Indicates the feature similarity between similar entities, represents the embedding representation of user A, represents the embedding representation of user B;
[0032] The overall interaction expression is as follows:
[0033] ;
[0034] in, represents the embedding representation that integrates user, content, and timestamp, Embedding that represents temporal information.
[0035] Furthermore, the S203 includes the following steps:
[0036] Based on directed propagation, a dynamic weight distribution mechanism is used to distinguish the contributions of different social entities to the hyperedge semantic representation. The expression of the attention coefficient is as follows:
[0037] ;
[0038] in, Represents a hyperedge Social Node The attention coefficient, p represents the attention vector, represents the learnable attention projection vector, represents the activation function, Represents a hyperedge The cluster center feature representation of Represents the feature representation of social nodes, Represents a hyperedge All social nodes in , Represents a hyperedge Feature representation of a social node in ;
[0039] Based on the differentiated contribution, in the social node representation update stage, a hierarchical attention mechanism is introduced to fuse multi-hyperedge information to generate a structure-aware and context-dependent representation for each social node. The updated representation is as follows:
[0040] ;
[0041] ;
[0042] in, Represents a social node The updated representation is, Represents a hyperedge Social Nodes The size of the contribution, Represents all social nodes The set of connected hyperedges, Represents a hyperedge Aggregation function to social nodes, Represents a hyperedge The expression, Represents a social node The final update shows that Represents a hyperedge The semantic representation vector of express q The transpose of q represents a trainable attention vector.
[0043] The beneficial effects of this further approach are: By introducing a dynamic weight allocation mechanism based on directed propagation, it effectively distinguishes the contributions of different target entities in an image to the semantics of visual relationships, thereby enhancing the discriminative and semantic expression capabilities of hyperedge representations. This mechanism not only suppresses the interference of redundant or irrelevant objects on semantic aggregation, improving the model's ability to model complex multi-target relationships, but also enhances semantic consistency and contextual adaptability during node representation updates. Furthermore, this method does not rely on artificial prior structures and has good versatility and robustness, making it suitable for object detection tasks in various image scenarios, including those with multi-scale and irregular structures.
[0044] Furthermore, the S3 includes the following steps:
[0045] Utilize the multi-channel dynamic weight mechanism to organically fuse heterogeneous features and generate multi-channel features;
[0046] Based on multi-channel features, for each channel, we use structure-aware and context-dependent representations as well as social network dual hypergraph representations to construct positive and negative sample pairs.
[0047] Based on the constructed positive and negative sample pairs, an improved loss function is designed to optimize the representation space, completing the design of multi-channel contrastive learning based on social data.
[0048] The beneficial effects of this further approach include: By constraining the semantic consistency of hyperedge and social node representations through a multi-channel contrastive learning framework, the model's adaptability to noise and sparse data is significantly enhanced by maximizing the mutual information of positive samples and suppressing the similarity of negative samples. Self-supervisory signals provide supplementary training targets for low-resource scenarios, alleviating model degradation caused by insufficient labeled data. A dynamic channel weighting mechanism automatically identifies key feature channels in different semantic scenarios. For example, it strengthens the contribution of global semantic channels for high-frequency relationships and enhances the weight of local structural channels for low-frequency relationships, enabling adaptive fusion of heterogeneous features.
[0049] Furthermore, the expression of the multi-channel feature is as follows:
[0050] ;
[0051] ;
[0052] in, represents multi-channel features, Indicates channel c For social entities v The final contribution weight is expressed as, Representing social entities v In the channel c The expression, t represents a social triplet channel, r Represents a social relationship channel, n Indicates the neighbor channel, Indicates that except the current channel c The outside channel, represents the learnable attention vector, represents the learnable weight matrix, Indicates that social entities are in the channel Representation.
[0053] Furthermore, the expression of the improved loss function is as follows:
[0054] ;
[0055] in, represents the improved loss function, v Represents a social entity, V Represents all social entities v A collection of e represents a hyperedge, Representation and Social Entities v The set of connected hyperedges, represents the activation function, represents the consistency discriminator, Indicates channel c Lower super edge e The expression, Representing social entities v In the channel c The expression, represents the negative sample hyperedge representation.
[0056] Furthermore, the S4 includes the following steps:
[0057] Utilize the designed multi-channel contrastive learning to construct multi-channel auxiliary tasks;
[0058] The structure-aware and context-dependent representations are used as embedding inputs, and the social triplet scores are calculated and ranked using a scoring function.
[0059] Taking the ranking results of social triplet scores as input, the margin-based ranking loss function is used for optimization;
[0060] Based on the optimization results, the knowledge graph link prediction task and the self-supervision task are integrated through a joint learning framework to complete the reasoning of knowledge graph links. Among them, the link prediction task is the main task and the self-supervision comparison task is the multi-channel auxiliary task.
[0061] The aforementioned advanced approach offers the following benefits: a margin-based ranking loss function directly optimizes the ranking performance of social triples, forcing the difference between positive and negative sample scores to meet semantic plausibility constraints, significantly improving the ranking accuracy of predictions. A joint learning framework integrates link prediction and self-supervised comparison tasks, balancing the training intensity of the primary and secondary tasks through hyperparameters to accelerate model convergence while mitigating overfitting risks. A lightweight scoring function supports efficient distributed computing, meeting the real-time inference requirements of industrial-grade knowledge graphs and significantly improving the deployment efficiency and response speed of large-scale graph completion tasks.
[0062] Furthermore, the loss function of the joint learning framework is expressed as follows:
[0063] ;
[0064] ;
[0065] in, represents the loss function of the joint learning framework, represents the hyperparameter used to control the impact of multi-channel auxiliary tasks, represents the self-supervised auxiliary task loss, represents the margin-based ranking loss function, Represents the user entity, Represents the positive sample content, T represents the set of training social triples, represents the marginal hyperparameter, represents the social triplet scoring function, Represents negative samples. BRIEF DESCRIPTION OF THE DRAWINGS
[0066] Figure 1 Flow chart of the method of the present invention. DETAILED DESCRIPTION
[0067] The specific embodiments of the present invention are described below to facilitate understanding of the present invention by those skilled in the art. However, it should be clear that the present invention is not limited to the scope of the specific embodiments. For those skilled in the art, as long as various changes are within the spirit and scope of the present invention as defined and determined by the appended claims, these changes are obvious, and all inventions and creations utilizing the concepts of the present invention are protected.
[0068] Example 1
[0069] like Figure 1 As shown, the present invention provides a knowledge graph link reasoning method, and its implementation method is as follows:
[0070] S1. Preserving local structure through the social triple integrity hypergraph and capturing global semantic associations using the social relationship semantic hypergraph, we construct a complementary dual hypergraph representation of social networks. The implementation method is as follows:
[0071] S101. Constructing triplet hyperedge sets based on social triples in knowledge graphs ,connecting the social head entity, the social relationship and the social tail entity to the same hyperedge to preserve the social triple integrity so as to preserve the local relationship through the social triple integrity hypergraph;
[0072] S102. Constructing a hyperedge set based on social relationship semantics ,The social head entities and social tail entities of the same social relationship are clustered separately, forming global semantic associations, and constructing a complementary dual hypergraph representation of social networks.
[0073] In this embodiment, a dual hypergraph representation of a social network serves as the structural input for the social graph and is subsequently used in both dynamic semantic propagation (S2) and multi-channel contrastive learning (S3). In S2, the triple integrity hypergraph is used to capture local interaction features (heterogeneous interactions, homogeneous interactions, and overall interactions), while the social relationship semantic hypergraph is used to perceive global semantic differences. In S3, representations generated from different hypergraphs serve as multi-channel inputs to construct positive and negative samples for contrastive learning, enhancing the discriminability of node representations.
[0074] In this embodiment, a social triplet integrity hypergraph is constructed: a hyperedge structure is constructed based on user behavior triples (e.g., <user A, like, post B>, <user C, join, group G>). Each hyperedge connects the social triplet elements of a behavior action: the social head entity (user), the social relationship (behavior type), and the social tail entity (content or group), preserving the integrity of the local interaction structure. Deduplication is performed on historical social behavior data to construct a sparse but effective set of hyperedges.
[0075] Social Relationship Semantic Hypergraph Construction: Based on semantic clustering, users or objects with the same social relationships are aggregated. For example, for the "forward" behavior, users who frequently forward messages are aggregated to discover potential social circles. For the "join a group" behavior, users can be clustered based on group topics, establishing cross-community semantic associations and strengthening the ability to express global structures.
[0076] In this embodiment, a social triplet hyperedge is constructed based on the social triplet of the knowledge graph, and the social head entity, social relationship, and social tail entity are connected to the same hyperedge to preserve the integrity of the social triplet and ensure that local information is not lost. The details are as follows:
[0077] First, traverse the social triples in the knowledge graph one by one ( h , r , t ), the social head entity in the social triple h , social relationships r and social tail entities t As a structural unit, a hyperedge is formed. Then, the hyperedges constructed by all social triples are aggregated to form a triplet hyperedge set. During the generation process, a repetitive detection mechanism needs to be introduced to filter out possible repeated triplets in the training set, thereby ensuring the sparsity and structural validity of the hyperedge set.
[0078] In this embodiment, we construct relationship hyperedges based on social relationship semantics, cluster the social head entities and social tail entities of the same social relationship, and form global semantic associations, so that the model can capture long-distance semantic information and improve reasoning ability. r The triples of social head entities and social tail entities are respectively established as cluster sets. When creating a social relationship, two subsets are formed for each type of social relationship: one connecting all social head entities centered on that social relationship, and the other connecting all social tail entities. This approach effectively reveals the potential semantic commonalities between social entities. Furthermore, by integrating the social entity hyperedges of all social relationships, a social relationship semantic hypergraph is constructed, effectively organizing and modeling global semantic information.
[0079] S2. Based on the dual hypergraph representation of social networks, we fuse composite semantic representations of heterogeneous interactions, homogeneous interactions, and overall interactions, and combine them with a hypergraph attention network to implement dynamic semantic propagation guided by social relationships. This generates a structure-aware and context-dependent representation for each social node. The social triple integrity hypergraph is used to capture local interaction features, including heterogeneous interactions, homogeneous interactions, and overall interactions, while the social relationship semantic hypergraph is used to perceive global semantic differences. The implementation method is as follows:
[0080] S201. By explicitly modeling multi-type interaction features among social head entities, social relationships, and social tail entities, a composite semantic representation including heterogeneous interactions, homogeneous interactions, and overall interactions is constructed. Local interaction features include heterogeneous interactions, homogeneous interactions, and overall interactions. A social triple integrity hypergraph is used to capture local interaction features.
[0081] S202, fusing the composite semantic representations through a weight matrix to generate a hyperedge semantic vector, wherein, during the social node representation update phase, a gated aggregation mechanism is used to achieve directional propagation of the hyperedge information to the target social node;
[0082] S203. Utilize the social relationship semantic hypergraph to perceive global semantic differences. Based on directed propagation, introduce a dynamic attention mechanism, combined with a hypergraph attention network, to achieve relationship-guided dynamic semantic propagation and generate a structure-aware and context-dependent representation for each social node. (Based on directed propagation, the dynamic attention mechanism is introduced, combined with a hypergraph attention network. Its role is to utilize structural clustering in the social relationship semantic hypergraph to guide information propagation and achieve global semantic perception.) Specifically:
[0083] Based on directed propagation, a dynamic weight distribution mechanism is used to distinguish the contributions of different social entities to the hyperedge semantic representation. Based on the differentiated contributions, a hierarchical attention mechanism is introduced in the social node representation update stage to fuse multi-hyperedge information and generate structure-aware and context-dependent representations for each social node.
[0084] In this embodiment, the ultimate goal of the dynamic semantic propagation in S203 is to generate a structure-aware and context-dependent representation for each social node, and fusing multi-hyperedge information is the final stage to achieve this goal.
[0085] In this embodiment, the dynamic semantic propagation of S2 generates a structure-aware and context-dependent representation for each social entity. This representation then enters S3's multi-channel contrastive learning as an input feature to construct positive and negative samples and optimize the representation space. When the S4 scoring function ranks the scores of social triples, it uses this semantically enhanced representation as the embedding input.
[0086] In this example, by explicitly modeling the multi-type interaction features between social head entities, social relationships, and social tail entities, a composite semantic representation encompassing heterogeneous interactions, homogeneous interactions, and overall interactions is constructed. Heterogeneous interaction features are generated through linear combinations and nonlinear mappings of entities and relationships.
[0087] Heterogeneous interaction modeling: Jointly modeling user attribute features and behavioral relationship features to generate heterogeneous semantic vectors:
[0088] ;
[0089] in, represents heterogeneous semantic vectors, Represents the feature vector of the user node, Embedded representation of the interaction between users and content, Represents the feature vector of the content node, + represents feature vector addition, represents element-wise multiplication, Represents a splicing operation.
[0090] Homogeneous interaction modeling: Calculating feature similarity between similar entities, such as potential friend identification:
[0091] ;
[0092] in, Indicates the feature similarity between similar entities, represents the embedding representation of user A, represents the embedding representation of user B.
[0093] Holistic interaction modeling: Integrating user, content, and timestamp embedding to achieve time-sensitive modeling:
[0094] ;
[0095] in, represents the embedding representation that integrates user, content, and timestamp, Embedding that represents temporal information.
[0096] The above features are fused through the weight matrix to form a hyperedge semantic vector:
[0097] ;
[0098] in, Represents a hyperedge e The embedding representation vector of Represents the first heterogeneous interaction feature, modeling the element-level interaction between "social head entity + social relationship" and "social tail entity - social relationship", Represents the second heterogeneous interaction feature, modeling the element-level joint feature intersection of "social entities and social relationships", Represents homogeneous interaction features, considering the similarity or correspondence between the head and tail target objects of the social interaction, ignoring the relationship component, Represents the first overall interaction feature, where the parts of the social triplet are directly added together to form an overall combined semantic vector. Represents the second overall interaction feature, retaining the complete information of each element in the social triplet and jointly modeling, W Represents a trainable parameter matrix. In the social node representation update phase, the gated aggregation mechanism is used to achieve the directional propagation of hyperedge information to the target node:
[0099] ;
[0100] in, Represents a social node v The final embedding representation of represents the activation function, represents a learnable linear transformation matrix that converts the aggregated hyperedge information into a semantic representation in the social node space. Represents a hyperedge Aggregation function to social nodes, represents the embedding representation of the hyperedge, represents a hyperedge, Represents the set of all hyperedges connected to a social node. By restricting the scope of interaction to the social nodes within a shared hyperedge, this design significantly reduces computational complexity while maintaining the strength of semantic associations. This makes it particularly suitable for distributed processing scenarios of very large social network knowledge graphs.
[0101] In this example, a hypergraph attention network (HGAN) is used to implement semantically aware feature propagation. This method uses a dynamic weighting mechanism to distinguish the contributions of different social entities to the semantic representation of hyperedges. First, the semantic cluster center features of the hyperedge-connected social entities are calculated based on their embedding vectors:
[0102] ;
[0103] in, Represents a hyperedge The cluster center feature representation of Indicates taking the average of multiple embedding vectors dimension by dimension to produce a central embedding. Represents the feature representation of social nodes, which represents the embedding of the current social node (such as users, posts, etc.), Represents a social node, Belong to the super edge .
[0104] Since social entities near the cluster center often contain more representative semantic information, they are given higher weights when calculating the attention score, ensuring that core social entities receive greater attention during feature aggregation. This effectively distinguishes the differences between different social entities in the hyperedge representation. The expression of the attention coefficient is as follows:
[0105] ;
[0106] in, Represents a hyperedge Social Node The attention coefficient, p represents the attention vector, Represents a learnable attention projection vector, which is used to learn the node's attention preference for the semantic cluster center. Represents the activation function, which is used to enhance the nonlinear expression ability before calculating attention, and is often used to alleviate the problem of small gradient return. Represents a hyperedge The cluster center feature representation of Represents the feature representation of social nodes, Represents a hyperedge All social nodes in, such as a user, , Represents a hyperedge Feature representation of a social node in .
[0107] In this embodiment, dynamic weights are used to explicitly model the contribution of different social nodes to the hyperedge semantics when generating the hyperedge semantic representation, and serve as a transmission basis in the subsequent social node representation update stage to transfer the hyperedge semantic information from the hyperedge to the social node, thereby realizing semantic-driven embedding updates.
[0108] In the social node representation update stage, a hierarchical attention mechanism is introduced to fuse multi-hyperedge information:
[0109] ;
[0110] ;
[0111] in, Represents a social node The updated representation is, Represents a hyperedge Social Nodes The size of the contribution, Represents all social nodes The set of connected hyperedges, Represents a hyperedge Aggregation function to social nodes, Represents a hyperedge The expression, Represents a social node The final update shows that Represents a hyperedge The semantic representation vector of express q The transpose of q represents a trainable attention vector.
[0112] In this embodiment, S2 implements relationship-guided dynamic semantic propagation, which includes two sub-processes: first, within each hyperedge, the semantic weighting between social nodes and cluster centers is completed through the hypergraph attention mechanism (HGAN); then, at the social node level, the semantic information from different hyperedges is integrated by introducing a hierarchical attention mechanism, and finally a social node representation with global semantic enhancement is obtained.
[0113] S3. Based on structure-aware and context-dependent representations, we design multi-channel contrastive learning based on social data. The implementation method is as follows:
[0114] Utilize the multi-channel dynamic weight mechanism to organically fuse heterogeneous features and generate multi-channel features;
[0115] Based on multi-channel features, for each channel, we use structure-aware and context-dependent representations as well as social network dual hypergraph representations to construct positive and negative sample pairs.
[0116] Based on the constructed positive and negative sample pairs, an improved loss function is designed to optimize the representation space, completing the design of multi-channel contrastive learning based on social data.
[0117] In this example, multi-channel contrastive learning designed in S3 serves as an auxiliary task, forming a joint optimization objective with the main task (ranking social triples) in S4. The InfoNCE loss function enforces semantic consistency among social triples, thereby enabling the scoring function to learn more discriminative embeddings and suppressing the influence of noise samples on the scoring results.
[0118] In this embodiment, in order to enhance the generalization ability and robustness of the model, a multi-channel contrastive learning mechanism is introduced.
[0119] In this embodiment, the organic integration of heterogeneous features is achieved through a multi-channel dynamic weight allocation mechanism, targeting social entities. v , construct a set of channel weight coefficients , and its calculation process is defined as:
[0120] ;
[0121] The final comprehensive representation of social entities is generated by weighted fusion of multi-channel features:
[0122] ;
[0123] in, represents multi-channel features, Indicates channel c For social entities v The final contribution weight is expressed as, Representing social entities v In the channel c The expression, t represents a social triplet channel, r Represents a social relationship channel, n Indicates the neighbor channel, Indicates that except the current channel c The other channel identifiers used for normalization in the denominator are also taken from the set { t , r , n}, represents the learnable attention vector, represents a learnable weight matrix used to project entity representations of different channels into a unified attention space, Indicates that social entities are in the channel The attention mechanism is used to selectively aggregate social entity representations from different channels.
[0124] In this embodiment, a multi-channel contrastive learning framework is proposed to enhance the semantic consistency between hyperedges and social nodes. , construct positive and negative sample pairs, positive sample pairs By social nodes v and its connected hyperedges , positive samples are real user behavior interactions; negative samples are randomly sampled from interactions that have never occurred.
[0125] Optimize the representation space based on the improved InfoNCE loss function:
[0126] ;
[0127] in, represents the improved loss function, v Represents a social entity, V Represents all social entities v A collection of e represents a hyperedge, Representation and Social Entities v The set of connected hyperedges, represents the activation function, represents the consistency discriminator, Indicates channel c Lower super edge e The expression, Representing social entities v In the channel c The expression, Represents the negative sample hyperedge representation, from the social entity v Random sampling from the set of irrelevant hyperedges indicates an incorrect or irrelevant semantic combination, such as a behavior circle that has no direct relationship with the user / goal.
[0128] In this embodiment, a discriminator D is designed to measure the consistency score between the hyperedge and the social node representation, which is specifically implemented as a dot product operation of two vectors. This loss function maximizes the mutual information of positive sample pairs and suppresses the similarity of negative sample pairs, forcing the hyperedge representation to accurately capture the common semantics of its connected nodes while rejecting the interference features of irrelevant nodes.
[0129] S4. Utilize the designed multi-channel contrastive learning to construct a multi-channel auxiliary task, and optimize the social triplet score ranking results based on the marginal ranking loss function. Through a joint learning framework, the knowledge graph link prediction task and the self-supervised contrast task are integrated to complete the reasoning of knowledge graph links. The self-supervised contrast task is a multi-channel auxiliary task, and its implementation method is as follows:
[0130] Utilize the designed multi-channel contrastive learning to construct multi-channel auxiliary tasks;
[0131] The structure-aware and context-dependent representations are used as embedding inputs, and the social triplet scores are calculated and ranked using a scoring function.
[0132] Taking the ranking results of social triplet scores as input, the margin-based ranking loss function is used for optimization;
[0133] Based on the optimization results, the knowledge graph link prediction task and the self-supervision task are integrated through a joint learning framework to complete the reasoning of knowledge graph links. Among them, the link prediction task is the main task and the self-supervision comparison task is the multi-channel auxiliary task.
[0134] In this embodiment, the scoring function in S4 is responsible for calculating the matching degree of each social triplet, and the ranking loss function is optimized with the social triplet score result as input, thereby reversely adjusting the learning direction of the embedding representation.
[0135] In this embodiment, the dual hypergraph modeling of social networks in S1 provides hypergraph structure and connection mode for S2 and S3; feature modeling and dynamic semantic propagation in S2 generate structure-aware and context-dependent representations for S3 and S4, and S3 builds a multi-channel auxiliary supervision path for S4; S4 link prediction optimization integrates main and auxiliary tasks and outputs the final reasoning result.
[0136] In this embodiment, given the embeddings of social entities and social relationships, the social triplet scores are calculated using a scoring function to calculate the loss, based on the margin-based ranking loss function:
[0137] ;
[0138] The "+" sign at the end of the marginal ranking loss function formula is the "positive truncation" operator in the hinge loss function. If the prediction is correct (that is, the positive sample score is much higher than the negative sample), then this item is 0 and no loss is generated. If the prediction is wrong or the confidence is insufficient (that is, the difference between the positive and negative sample scores is less than λ), a positive loss is generated, and λ represents a marginal threshold in the ranking loss lambda.
[0139] In this embodiment, the joint training framework integrates the knowledge graph link prediction task and the self-supervision task, where the link prediction task is the main task and the self-supervision task is the auxiliary task. The final joint learning goal is defined as follows:
[0140] ;
[0141] in, represents the loss function of the joint learning framework, represents the hyperparameter used to control the impact of multi-channel auxiliary tasks, represents the self-supervised auxiliary task loss, represents the margin-based ranking loss function, Represents the user entity, Represents the positive sample content, T represents the set of training social triples, represents the marginal hyperparameter, represents the social triplet scoring function, Indicates negative samples, wrong relations or wrong entities.
[0142] In summary, the present invention, when applied to social graph link prediction, has achieved significant improvements in user relationship prediction accuracy, significantly increased click-through rates for cold-start user recommendations, robustness under noise interference, and excellent practical application results in ad recommendation and friend discovery tasks. By constructing a multi-perspective hypergraph structure, designing a feature-enhanced network, and introducing a mutual information optimization strategy, the present invention significantly improves the prediction accuracy of missing entities and relationships in knowledge graphs. It can also be widely applied to fields such as intelligent search, semantic reasoning, and big data analysis.
[0143] Example 2
[0144] To further verify the applicability of the present invention in cross-domain applications, the following provides a specific application scenario for the field of image processing, especially target detection tasks, to illustrate the effectiveness and actual technical effects of the present invention in structural modeling and semantic reasoning.
[0145] In image object detection, semantic relationships often exist between multiple object entities in an image (e.g., "person carrying a backpack," "car parked on the roadside"). However, existing detection methods primarily focus on bounding box prediction and object classification, lacking in-depth modeling of the semantic structure between objects. This presents the following technical challenges:
[0146] Weak multi-target relationship modeling capabilities: Traditional detection models ignore the contextual interactions between targets and only make independent judgments based on single targets, making it difficult to characterize semantic collaboration and behavioral dependencies.
[0147] The representation of similar targets is ambiguous: For example, there is a lack of structured representation between multiple pedestrians in an image, making it impossible to model group behavior patterns or positional coordination relationships;
[0148] Lack of structure-aware training mechanism: Existing object detection loss functions mainly focus on classification and localization accuracy, lacking auxiliary supervision to guide the model to perceive the relationship structure between objects;
[0149] The problem of sparse annotation of semantic relationships in images is serious: the interactive relationships between objects often lack clear annotations, and the self-supervision signal is missing, which affects the ability of semantic understanding.
[0150] To this end, this embodiment proposes an image object detection assisted reasoning method that combines multi-channel hypergraph modeling and self-supervised optimization. The method aims to introduce a structured modeling mechanism to enhance the semantic expression ability between objects and improve the understanding depth and robustness of the detection model. The method includes the following steps:
[0151] S1: Construct a dual hypergraph structure for target detection. The implementation method is as follows:
[0152] S11: Triplet integrity hypergraph construction: Construct triplet hyperedges based on visual triples (e.g., (<pedestrian, handheld, backpack>), (<vehicle, parked, roadside>)). Each hyperedge connects a subject target, a semantic relationship, and an object target to model local structure and preserve the integrity of object interactions in the image.
[0153] S12: Relational semantic hypergraph construction: Based on semantic relationship categories (such as "carry", "ride", "place", etc.), target entities with the same relationship are clustered and relational hyperedges are constructed to achieve global semantic perception and semantic consistency modeling.
[0154] S2: Dynamic interactive feature fusion and semantic propagation, which is implemented as follows:
[0155] S21: Heterogeneous interaction modeling: Fusion of semantic information between subject goals and semantic relationships, and object goals and semantic relationships to generate heterogeneous interaction representations :
[0156] ;
[0157] in, represents element-wise multiplication, Represents a splicing operation, The feature vector representing the subject target, The feature vector representing the semantic relationship, The feature vector representing the object target.
[0158] S22: Homogeneous interaction modeling: Calculate the semantic interaction features between similar targets to enhance the consistency of visual semantics :
[0159] ;
[0160] in, and Represent the embedding representations of target A and target B respectively.
[0161] S23: Holistic Interaction Modeling: Fusion of target category features, spatial position encoding, and semantic attributes to form a holistic representation :
[0162] ;
[0163] in, represents the embedding representation of the target category, Embedded representations representing semantic attributes, Embedding representation representing spatial position encoding.
[0164] S24: Hypergraph Attention Network (HGAN) propagation: Introducing semantic clustering centers to highlight the contribution of key objects in the image to relationship modeling , and calculate the attention weight:
[0165] ;
[0166] in, Represents a hyperedge Target node The attention coefficient, Represents a learnable attention projection vector, which is used to learn the node's attention preference for the semantic cluster center. The index variable representing the target node, indicating a node on the hyperedge Internal target node, Represents a hyperedge In the channel c The semantic cluster center representation under , such as the shared semantic vector corresponding to the relationship class "holding" or "placing", Indicates the target node The embedded feature vector of Represents the activation function.
[0167] Then, a hierarchical attention mechanism is introduced to update the target node representation:
[0168] ;
[0169] in, Indicates the updated target node i Represents a vector, which is the target node i (such as a detection box) the final visual representation after fusing multiple relational hyperedge semantics, Indicates the target node i The set of all connected hyperedges, Indicates the target node i Superedge The fusion weight controls the influence of different semantic channels on the target representation update. represents a learnable linear transformation matrix, Represents a hyperedge The semantic representation vector of .
[0170] S3: Multi-channel contrastive learning based on target detection data, which is implemented as follows:
[0171] S31: Construction of positive and negative samples: The positive sample pairs are composed of targets with real interaction relationships in the image and their corresponding hyperedges; the negative sample pairs are randomly sampled from target areas where no semantic interaction occurs.
[0172] S32: Improved InfoNCE loss function: uses node-hyperedge comparative learning to maximize the mutual information of positive samples and suppress the interference of negative samples:
[0173] ;
[0174] in, represents the loss function, c Indicates the channel type, Represents the target node index, which refers to a detection target in the image. e represents a hyperedge, Indicates the target node All participating hyperedges represent the position of the target in all relationship structures. represents the activation function, represents the consistency discriminator, Indicates channel c Lower super edge e The expression, Represents the detection entity In the channel c The expression, represents the negative hyperedge representation, which indicates the semantic structure that the target does not attend but is structurally similar (for distraction).
[0175] S4: Jointly optimize the object detection task and the structural relationship reasoning task. The implementation method is as follows:
[0176] S41: Marginal ranking loss optimizes structural relationship modeling performance: Using marginal ranking loss to improve the judgment accuracy of visual semantic triples:
[0177] ;
[0178] in, represents the semantic matching score function between the target and its context, represents negative samples, represents the ranking loss, guiding the model to identify whether there is a true semantic relationship between targets, Represents the head entity or subject entity, the detection target in the image, such as "person", Represents the tail entity (positive sample), an object target that has a real semantic relationship with the main target, Represents the training sample set, that is, the set of all entity combinations that constitute the "positive sample relationship pair", represents a marginal hyperparameter that ensures the model is more confident in judging positive samples as larger than negative samples.
[0179] S42: Joint training framework design: Optimize the main target detection tasks (such as classification and localization) together with the structural reasoning and self-supervision tasks to form a unified loss function :
[0180] ;
[0181] in, and Both represent weight control factors, represents the classification loss, represents the bounding box regression loss.
[0182] The method of this embodiment is applied to the task of image object detection and has the following technical effects:
[0183] Significantly enhance the semantic structure modeling capabilities between targets, improve detection context consistency and structural integrity; introduce structure-aware auxiliary supervision signals to improve the detection accuracy of small targets and occluded targets; use self-supervision mechanisms to enhance the model expression capabilities in unlabeled scenarios and improve generalization effects; possess good cross-image semantic transfer capabilities, and are suitable for high-level visual tasks such as behavior recognition, scene understanding, and autonomous driving in complex scenarios.
Claims
1. A knowledge graph link reasoning method, characterized in that: The following steps are involved: S1. Preserving local structure through social triple integrity hypergraph and capturing global semantic associations with social relationship semantic hypergraph to construct a complementary dual hypergraph representation of social networks. S2. Based on the dual hypergraph representation of social networks, a composite semantic representation fusion of heterogeneous interactions, homogeneous interactions, and overall interactions is combined with a hypergraph attention network to achieve dynamic semantic propagation guided by social relationships. This generates a structure-aware and context-dependent representation for each social node. The social triple integrity hypergraph is used to capture local interaction features, including heterogeneous interactions, homogeneous interactions, and overall interactions, while the social relationship semantic hypergraph is used to perceive global semantic differences. S3. Design multi-channel contrastive learning based on social data based on structure-aware and context-dependent representations; S4. Use the designed multi-channel contrastive learning to construct multi-channel auxiliary tasks, and optimize the social triple score ranking results based on the marginal ranking loss function. Through the joint learning framework, the knowledge graph link prediction task and the self-supervised comparison task are integrated to complete the reasoning of knowledge graph links. Among them, the self-supervised comparison task is a multi-channel auxiliary task.
2. The knowledge graph link reasoning method according to claim 1, characterized in that: Said S1 comprises the following steps: S101. Constructing triplet hyperedge sets based on social triples in knowledge graphs ,connecting the social head entity, the social relationship and the social tail entity to the same hyperedge to preserve the social triple integrity so as to preserve the local relationship through the social triple integrity hypergraph; S102. Constructing a hyperedge set based on social relationship semantics ,The social head entities and social tail entities of the same social relationship are clustered separately, forming global semantic associations, and constructing a complementary dual hypergraph representation of social networks.
3. The knowledge graph link reasoning method according to claim 1, characterized in that: The S2 comprises the following steps: S201. By explicitly modeling multi-type interaction features among social head entities, social relationships, and social tail entities, a composite semantic representation including heterogeneous interactions, homogeneous interactions, and overall interactions is constructed. Local interaction features include heterogeneous interactions, homogeneous interactions, and overall interactions. A social triple integrity hypergraph is used to capture local interaction features. S202, fusing the composite semantic representations through a weight matrix to generate a hyperedge semantic vector, wherein, during the social node representation update phase, a gated aggregation mechanism is used to achieve directional propagation of the hyperedge information to the target social node; S203. Use the social relationship semantic hypergraph to perceive global semantic differences, and based on directed propagation, introduce a dynamic attention mechanism, combined with the hypergraph attention network, to achieve relationship-guided dynamic semantic propagation and generate structure-aware and context-dependent representations for each social node.
4. The knowledge graph link reasoning method according to claim 3 is characterized in that: The expression of the heterogeneous interaction is as follows: ; in, represents heterogeneous semantic vectors, Represents the feature vector of the user node, Embedded representation of the interaction between users and content, Represents the feature vector of the content node, + represents feature vector addition, represents element-wise multiplication, Represents a splicing operation; The expression of the homogeneous interaction is as follows: ; in, Indicates the feature similarity between similar entities, represents the embedding representation of user A, represents the embedding representation of user B; The overall interaction expression is as follows: ; in, represents the embedding representation that integrates user, content, and timestamp, Embedding that represents temporal information.
5. The knowledge graph link reasoning method according to claim 4 is characterized in that: The S203 includes the following steps: Based on directed propagation, a dynamic weight distribution mechanism is used to distinguish the contributions of different social entities to the hyperedge semantic representation. The expression of the attention coefficient is as follows: ; in, Represents a hyperedge Social Node The attention coefficient, p represents the attention vector, represents the learnable attention projection vector, represents the activation function, Represents a hyperedge The cluster center feature representation of Represents the feature representation of social nodes, Represents a hyperedge All social nodes in , Represents a hyperedge Feature representation of a social node in ; Based on the differentiated contribution, in the social node representation update stage, a hierarchical attention mechanism is introduced to fuse multi-hyperedge information to generate a structure-aware and context-dependent representation for each social node. The updated representation is as follows: ; ; in, Represents a social node The updated representation is, Represents a hyperedge Social Nodes The size of the contribution, Represents all social nodes The set of connected hyperedges, Represents a hyperedge Aggregation function to social nodes, Represents a hyperedge The expression, Represents a social node The final update shows that Represents a hyperedge The semantic representation vector of express q The transpose of q represents a trainable attention vector.
6. The knowledge graph link reasoning method according to claim 1, characterized in that: The S3 includes the following steps: Utilize the multi-channel dynamic weight mechanism to organically fuse heterogeneous features and generate multi-channel features; Based on multi-channel features, for each channel, we use structure-aware and context-dependent representations as well as social network dual hypergraph representations to construct positive and negative sample pairs. Based on the constructed positive and negative sample pairs, an improved loss function is designed to optimize the representation space, completing the design of multi-channel contrastive learning based on social data.
7. The knowledge graph link reasoning method according to claim 6, characterized in that: The expression of the multi-channel feature is as follows: ; ; in, represents multi-channel features, Indicates channel c For social entities v The final contribution weight is expressed as, Representing social entities v In the channel c The expression, t represents a social triplet channel, r Represents a social relationship channel, n Indicates the neighbor channel, Indicates that except the current channel c The outside channel, represents the learnable attention vector, represents the learnable weight matrix, Indicates that social entities are in the channel Representation.
8. The knowledge graph link reasoning method according to claim 7, characterized in that: The expression of the improved loss function is as follows: ; in, represents the improved loss function, v Represents a social entity, V Represents all social entities v A collection of e represents a hyperedge, Representation and Social Entities v The set of connected hyperedges, represents the activation function, represents the consistency discriminator, Indicates channel c Lower super edge e The expression, Representing social entities v In the channel c The expression, represents the negative sample hyperedge representation.
9. The knowledge graph link reasoning method according to claim 1, characterized in that: The S4 comprises the following steps: Utilize the designed multi-channel contrastive learning to construct multi-channel auxiliary tasks; The structure-aware and context-dependent representations are used as embedding inputs, and the social triplet scores are calculated and ranked using a scoring function. Taking the ranking results of social triplet scores as input, the margin-based ranking loss function is used for optimization; Based on the optimization results, the knowledge graph link prediction task and the self-supervision task are integrated through a joint learning framework to complete the reasoning of knowledge graph links. Among them, the link prediction task is the main task and the self-supervision comparison task is the multi-channel auxiliary task.
10. The knowledge graph link reasoning method according to claim 9, characterized in that: The loss function of the joint learning framework is expressed as follows: ; ; in, represents the loss function of the joint learning framework, represents the hyperparameter used to control the impact of multi-channel auxiliary tasks, represents the self-supervised auxiliary task loss, represents the margin-based ranking loss function, Represents the user entity, Represents the positive sample content, T represents the set of training social triples, represents the marginal hyperparameter, represents the social triplet scoring function, Represents negative samples.
Citation Information
Patent Citations
Knowledge graph completion method based on global and local comparative learning
CN117668256A
Knowledge graph completion method based on graph context and relation perception attention
CN119067211A