Link reasoning method based on comparative learning

By adopting a link reasoning method based on contrast learning in federated graph learning, a link inference for twins or triplets networks is constructed, which solves the privacy risk problem of link theft attack in federated graph learning, and realizes accurate judgment and privacy protection of unknown node links.

CN119808830AInactive Publication Date: 2025-04-11CHINA ACADEMY OF ELECTRONICS AND INFORMATION TECHNOLOGY OF CHINA ELECTRONICS TECHNOLOGY GROUP CORPORATION +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510300810.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-14
Publication Date
2025-04-11
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

There is a privacy risk of link theft attack in federated graph learning. Attackers can infer whether there is a relationship between nodes by accessing the model API, resulting in data privacy leakage.

Method used

A link reasoning method based on contrast learning is adopted to construct a link inferencer containing twin networks or triplet networks. Edge node pairs and borderless node pairs are characterized by node posterior probability, and the link inferencer is trained to learn the difference between edge node features and borderless node features to accurately judge whether unknown nodes have links.

Benefits of technology

Effectively distinguish between node pairs of all categories and node pairs of the same category, protect privacy, ensure accurate judgment on whether unknown nodes have links, and reduce the risk of link theft attacks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119808830A_ABST
    Figure CN119808830A_ABST
Patent Text Reader

Abstract

The invention discloses a link reasoning method based on comparative learning, and belongs to the technical field of data processing. The link reasoning method based on comparative learning comprises the following steps: inputting known nodes into a trained graph neural network model to obtain posterior probabilities of the nodes; constructing an edged node pair and an edgeless node pair for all the nodes according to an edged mode and an edgeless mode; according to the posterior probability of the nodes, feature processing is carried out on the edged node pairs and the edgeless node pairs; and constructing a link inference device, and inputting the edge node pair features and / or the edge-free node pair features into the link inference device to train the link inference device. According to the link reasoning method based on comparative learning, whether the unknown node has the link or not is accurately judged through the link reasoning device, and technical support can be provided for relation speculation and the like.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data processing, and in particular to a link inference method based on contrastive learning. Background Art

[0002] More and more electronic devices, such as mobile phones and computers, are appearing in our lives. These electronic devices are connected to each other through communication. The concept of smart home has been proposed, which contains many electronic devices. In order to better analyze the role of these electronic devices, the home electronic device association diagram establishes connection relationships to achieve detailed and reasonable monitoring and management.

[0003] With the widespread concern about privacy issues, federated learning has become an effective solution in recent years and has been applied to many fields such as computer vision and natural language processing. In order to solve the privacy problem of graphs, federated graph learning (FGL) has been proposed in recent years. Using federated graph learning in many real-world application scenarios can alleviate data privacy issues, such as recommendation systems for consumer electronics and financial fraud detection. However, federated graph learning still has some privacy risks. In federated graph learning, customers jointly train graph neural network (GNN) models. On the graph model, there is a relational reasoning attack called link stealing attack. After the model training is completed, the embeddings of nodes of the same type will be more similar. Similar nodes are more likely to be connected. The adversary only needs to access the model API to obtain the posterior values ​​of two nodes in the same node pair, and then he can determine whether there is a connection between the node pairs. This type of attack will lead to the inference of whether there is a relationship between nodes. For example, manufacturers obtain the connection information of other manufacturers' devices in the user's home through link stealing attacks. They can use this data to recommend related electronic products to users and improve the efficiency and effectiveness of product recommendations. Summary of the invention

[0004] The purpose of the present invention is to provide a link reasoning method based on contrastive learning, construct a link reasoner including a twin network or a triplet network, perform feature processing on edge node pairs and unbounded node pairs respectively according to the node posterior probability, train the link reasoner through the edge node pair features and the unbounded node pair features, and learn the difference between the edge node features and the unbounded node features, so as to accurately judge whether the unknown node has a link, thereby effectively distinguishing all categories of node pairs and node pairs in the same category, and protecting privacy.

[0005] To achieve the above object, the present invention provides a link inference method based on contrastive learning, comprising the following steps: S1. Input known nodes into the trained graph neural network model to obtain the posterior probability of the nodes. S2. Construct edge node pairs and edgeless node pairs for all nodes according to edge and edgeless nodes; S3, performing feature processing on edge node pairs and unedge node pairs respectively according to the posterior probability of the nodes; S4. Build a link reasoner, and input edge node pair features and / or edgeless node pair features into the link reasoner to train the link reasoner.

[0006] Preferably, in S3, the feature processing of the node is specifically as follows: 8 distance calculations and 4 vector operations are performed on the posterior probability of the node to obtain a feature vector of 8 dimensions + a total number of 4 node classes, and the two states of having edges and having no edges correspond to labels 0 and 1 respectively.

[0007] Preferably, in S4, the link reasoner includes a twin network and a binary classifier, the twin network includes two embedded sub-networks, and weights are shared between the two embedded sub-networks; the edge node pair features and the unedge node pair features in the binary sample are respectively input into the two embedded sub-networks, and the twin network loss is calculated.

[0008] Preferably, the loss function of the twin network is: ;

[0009] in, K represents the number of samples, Y Indicates whether two samples are similar. is the default marginal parameter, is the distance between two tuples, defined as ;

[0010] in, S yes , The dimension of These are all samples in the binary group.

[0011] Preferably, in S4, the link reasoner includes a triplet network and a binary classifier, the triplet network includes three embedded sub-networks, and the three embedded sub-networks do not share weights; the edge node pair features, edge node pair features and unedge node pair features in the triplet sample are respectively input into the three embedded sub-networks, one edge node pair feature is used as an anchor point, another edge node pair feature is used as a positive example, and one unedge node pair feature is used as a negative example; the triplet network loss is calculated.

[0012] Preferably, the loss function of the triplet network is: ;

[0013] in, represents the distance operation, It is a pre-set parameter. is the anchor point sample, is a positive sample (same category as the anchor point), is a negative sample (different category from the anchor point).

[0014] Preferably, the binary classifier is a support vector machine with a basic linear kernel function.

[0015] The advantages and positive effects of the link inference method based on contrastive learning described in the present invention are: constructing a link inferencer including a twin network or a triplet network, performing feature processing on edge node pairs and unbounded node pairs respectively according to the node posterior probability, training the link inferencer through the edge node pair features and the unbounded node pair features, and the link inferencer learning the difference between the edge node features and the unbounded node features, thereby accurately judging whether an unknown node has a link.

[0016] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 is a flow chart of the link inference method based on contrastive learning of the present invention; Figure 2 It is a schematic diagram of the twin network structure of the link inference method based on contrastive learning of the present invention; Figure 3 Schematic diagram of the triplet network structure of the link inference method based on contrastive learning of the present invention. DETAILED DESCRIPTION

[0018] In this application, unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by technicians in the technical field of this application. In the event of any inconsistency, the meaning described in this specification or the meaning derived from the contents recorded in this specification shall prevail. In addition, the terms used herein are only for the purpose of describing the embodiments of the present application and are not intended to limit the present application. In order to accurately describe the technical content in this application and to accurately understand the present invention, the following explanations or definitions are given to the terms used in this specification before describing the specific embodiments: The embodiments of the present invention are described in detail below in conjunction with the accompanying drawings.

[0019] like Figure 1 A link inference method based on contrastive learning includes the following steps: S1. Input known nodes into the trained graph neural network model to obtain the posterior probability of the nodes.

[0020] Select a trained graph neural network model, and after confirmation, select a small number of known nodes and edges as background knowledge. Input the node into the API of the federated graph learning model, and the trained federated graph learning model will give output based on the input. The main work of the federated graph learning model is to classify nodes, so the output is the posterior probability value of the node belonging to a certain category, and the posterior probability of the node is obtained.

[0021] S2. For all nodes, construct edge node pairs and edgeless node pairs according to edge and no edge.

[0022] All nodes in the background knowledge are divided into two cases, with edges and without edges, to construct edge node pairs and edgeless node pairs respectively.

[0023] S3. Perform feature processing on edge node pairs and unedge node pairs respectively according to the posterior probability of the nodes.

[0024] The feature processor performs feature processing on node pairs as follows: perform 8 distance calculations and 4 vector operations on the posterior probability of the node to obtain a feature vector of 8 dimensions with a total number of 4 node classes, and the two states of edge and no edge correspond to labels 0 and 1 respectively; obtain the processed node pair features and node pair labels, and construct a data set. Take 80% of the data set as the training set and 20% of the data set as the validation set.

[0025] The eight distance calculations for node pairs are shown in Table 1.

[0026] Table 1 8 distance calculations for node pairs ;

[0027] The four vector operations of node pairs are shown in Table 2.

[0028] Table 2 Four vector operations on node pairs ;

[0029] in, For Node The posterior probability vector of values, For Node The posterior probability vector of values, is the maximum value after the difference operation, S4. Build a link reasoner, and input edge node pair features and / or edgeless node pair features into the link reasoner to train the link reasoner.

[0030] The link reasoner includes an embedding network (embeddingNet) and a binary classifier. In order to enhance the effect of link reasoning, contrastive learning is introduced. Behind contrastive learning, the clusters of node pairs with links in the embedding space are clustered, while the clusters of node pairs without links are separated by the binary classifier for better classification. Based on the contrastive learning method of metric learning, similar sample pairs can get better similarity by obtaining higher similarity. This is because the posterior results between node pairs with the same category links are similar and difficult to distinguish. In order to obtain better fine-grained classification, we must amplify the similar posterior within the class to better distinguish the relationship between node pairs with and without edges in all classes, and the relationship between node pairs with and without edges in the same class.

[0031] Two link reasoners are designed. The first link reasoner includes a twin network and a binary classifier, such as Figure 2 As shown in Figure 2. The binary classifier is a support vector machine (SVM) with a basic linear kernel function. The twin network consists of two embedded sub-networks, and the weights are shared between the two embedded sub-networks. The edge node pair features and the edgeless node pair features in the binary sample are input into the two embedded sub-networks respectively, and the differences between similar samples and dissimilar samples are learned, and the loss of the twin network is calculated.

[0032] The loss function of the twin network is: ;

[0033] in, K represents the number of samples, Y Indicates whether two samples are similar. is the default marginal parameter, is the distance between two tuples, defined as ;

[0034] in, S yes , The dimension of These are all samples in the binary group.

[0035] In the first link reasoner, the binary sample is input into the twin network, and the feature embedding with large difference and easy to classify is obtained through CNN learning. Finally, the classifier can obtain good classification effect in all class cases.

[0036] The structure of a binary sample is a positive and negative pair. All samples belonging to the same category constitute a binary. , samples that do not belong to the same category form a bigram .

[0037] The second type of link reasoners include triplet networks and binary classifiers, such as Figure 3 As shown. The triplet network consists of three embedded sub-networks, and the three embedded sub-networks do not share weights. The edge node pair features, edge node pair features, and edgeless node pair features in the triplet sample are input into the three embedded sub-networks respectively, one edge node pair feature is used as an anchor, another edge node pair feature is used as a positive example, and one edgeless node pair feature is used as a negative example. Calculate the triplet network loss.

[0038] The loss function of the triplet network is: ;

[0039] in, Represents distance operation, Similar samples representing anchor points, It is a pre-set parameter. is the anchor point sample, is a positive sample (same category as the anchor point), is a negative sample (different category from the anchor point).

[0040] The second link reasoner performs better in classifying link inferences belonging to the same class.

[0041] After the link reasoner is trained, you can input any two nodes, and the link reasoner will output whether there is a link between the two nodes.

[0042] Therefore, the link reasoning method based on contrastive learning described in the present invention is adopted to accurately judge whether an unknown node has a link through a link reasoner, thereby providing technical support for inferring relationships, etc.

[0043] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that they can still modify or replace the technical solution of the present invention with equivalents, and these modifications or equivalent replacements cannot cause the modified technical solution to deviate from the spirit and scope of the technical solution of the present invention.

Claims

1. A link inference method based on contrastive learning, characterized in that: The following steps are involved: S1. Input known nodes into the trained graph neural network model to obtain the posterior probability of the nodes. S2. Construct edge node pairs and edgeless node pairs for all nodes according to edge and edgeless nodes; S3, performing feature processing on edge node pairs and unedge node pairs respectively according to the posterior probability of the nodes; S4. Build a link reasoner, and input edge node pair features and / or edgeless node pair features into the link reasoner to train the link reasoner.

2. A link inference method based on contrastive learning according to claim 1, characterized in that: In S3, the feature processing of the node is specifically as follows: 8 distance calculations and 4 vector operations are performed on the posterior probability of the node to obtain a feature vector of 8 dimensions + the total number of 4 node classes, and the two states of edge and no edge correspond to labels 0 and 1 respectively.

3. A link inference method based on contrastive learning according to claim 2, characterized in that: In S4, the link reasoner includes a twin network and a binary classifier, the twin network includes two embedded sub-networks, and the weights are shared between the two embedded sub-networks; the edge node pair features and the unedge node pair features in the binary sample are respectively input into the two embedded sub-networks, and the twin network loss is calculated.

4. A link inference method based on contrastive learning according to claim 3, characterized in that: The loss function of the twin network is: ; in, K represents the number of samples, Y Indicates whether two samples are similar. is the default marginal parameter, is the distance between two tuples, defined as ; in, S yes , The dimension of These are all samples in the binary group.

5. A link inference method based on contrastive learning according to claim 2, characterized in that: In the S4, the link reasoner includes a triplet network and a binary classifier, the triplet network includes three embedded sub-networks, and the three embedded sub-networks do not share weights; the edge node pair features, edge node pair features and unedge node pair features in the triplet sample are respectively input into the three embedded sub-networks, one edge node pair feature is used as an anchor point, another edge node pair feature is used as a positive example, and one unedge node pair feature is used as a negative example; the triplet network loss is calculated.

6. A link inference method based on contrastive learning according to claim 5, characterized in that: The loss function of the triplet network is: ; in, represents the distance operation, It is a pre-set parameter. is the anchor point sample, is a positive sample, is a negative sample.

7. A link inference method based on contrastive learning according to claim 4 or 5, characterized in that: The binary classifier is a support vector machine with a basic linear kernel function.