Semantic camouflage node injection based robustness detection method for graph neural networks

By generating adversarial examples in a low-dimensional semantic manifold space using a variational graph autoencoder, and iteratively optimizing the convex orientation loss and distance loss functions under black-box conditions, the problems of semantic deviation and insufficient detection in existing robust detection methods are solved, and stable, fast and accurate robustness evaluation of graph neural networks is achieved.

CN123158643APending Publication Date: 2026-11-24HARBIN INSTITUTE OF TECHNOLOGY (SHENZHEN) (INSTITUTE OF SCIENCE AND TECHNOLOGY INNOVATION HARBIN INSTITUTE OF TECHNOLOGY SHENZHEN)
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611369969.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-04
Publication Date
2026-11-24

AI Technical Summary

Technical Problem

Existing robustness detection methods are prone to semantic deviation from normal data distribution when constructing adversarial examples, making it difficult to effectively detect the vulnerability of graph neural networks in black-box scenarios. Furthermore, the generated adversarial examples are easily intercepted by deep anomaly detectors, resulting in inflated and distorted robustness evaluation results.

Method used

The variational graph autoencoder maps graph data to a low-dimensional semantic manifold space to generate adversarial examples. Iterative optimization is then performed under black-box conditions using a dual loss function consisting of convex direction loss and distance loss to generate the optimal attack direction, ensuring a balance between semantic concealment and aggressiveness in the adversarial examples.

Benefits of technology

It achieves stable, fast, and accurate robustness evaluation of graph neural networks under black-box conditions. The generated adversarial examples can efficiently penetrate deep anomaly detection, ensuring the authenticity and effectiveness of robust detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123158643A_ABST
    Figure CN123158643A_ABST
Patent Text Reader

Abstract

This invention relates to the field of cyberspace security technology and discloses a robustness detection method for graph neural networks based on semantic masquerading node injection. It constructs a continuous semantic manifold space through a variational graph autoencoder and generates injected nodes mapped onto the manifold surface using a coarse-to-fine projection mechanism. Subsequently, it utilizes a strictly convex dual loss function composed of convex direction loss and distance loss to guide iterative optimization under black-box conditions. This effectively suppresses optimization oscillations and ensures convergence to the global optimum while achieving deep penetration and precise quantification of the vulnerability of the target graph neural network model. Thus, it enables a true, reliable, and efficient quantitative evaluation of the robustness of the target graph neural network model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of cyberspace security technology, specifically to a robust detection method for graph neural networks based on semantic masquerading node injection. Background Technology

[0002] Graph neural networks (Graph Neural Networks) are widely used in social networks, financial transaction graphs, and biomolecular networks due to their powerful topological representation and feature fusion capabilities when processing non-Euclidean topological data. However, the message passing mechanism of Graph Neural Networks makes them vulnerable to adversarial attacks, necessitating robustness testing. Existing robustness detection methods typically involve random initialization or simple perturbation in the original feature space or latent space when constructing adversarial examples. This can easily lead to semantic deviations from normal data distribution in the adversarial examples, making it difficult to fully expose the model's vulnerabilities. Furthermore, obtaining the target model's internal parameters and gradient information is also necessary. In black-box scenarios where model parameters are inaccessible, the coverage and effectiveness of robustness detection are significantly insufficient. Summary of the Invention

[0003] This invention provides a robustness detection method for graph neural networks based on semantic masquerading node injection to address the problem of insufficient robustness of node injection.

[0004] In a first aspect, the present invention provides a robustness detection method for graph neural networks based on semantically masquerading node injection, the method comprising: Based on the variational graph autoencoder, the target graph data is reparameterized and encoded, which maps the attribute features and topological structure of each node in the target graph data to a low-dimensional continuous semantic manifold space, and outputs the latent representation of each node in the semantic manifold space. Based on the latent representation, a set of semantic anchor points is selected. The set of semantic anchor points is weighted and summed through convex combination to generate a coarse representation vector. The coarse representation vector is then projected and corrected according to the geometric error bound of the manifold to obtain the latent representation of the injected node mapped to the surface of the semantic manifold space. Under the black-box condition where the internal parameters of the target graph neural network cannot be obtained, an iterative optimization is performed along the attack direction based on the latent representation of the injected node using a dual loss function consisting of convex direction loss and distance loss, to obtain the optimal attack direction and the final latent representation of the injected node. The fusion evaluation score of candidate nodes is calculated based on the optimal attack direction. A preset number of candidate nodes with the highest fusion evaluation scores are selected to establish topological connection edges with the injected nodes to complete the adversarial sample injection. The robustness of the target graph neural network is quantified based on the change in the target graph neural network prediction results before and after injection.

[0005] This invention uses Variational Graph Auto-Encoders (VGAEs) to reparameterize target graph data, outputting the latent representation of each node in the target graph within a low-dimensional semantic manifold space. A weighted summation of the anchor point set selected based on the latent representation is then performed through convex combination, followed by projection correction, to obtain the latent representation of the injected nodes mapped onto the surface of the semantic manifold space. A dual loss function consisting of convex direction loss and distance loss is used to iteratively optimize along the attack direction based on the latent representation of the injected nodes, obtaining the optimal attack direction and the final latent representation of the injected nodes. Finally, the fusion evaluation score of candidate nodes is calculated based on the optimal attack direction. A predetermined number of candidate nodes with the highest fusion evaluation scores are selected to establish topological connections with the injected nodes to complete the adversarial example injection, and the robustness of the target graph neural network is quantified. By generating adversarial examples in a low-dimensional continuous semantic manifold space and using convex combination and projection correction to ensure the semantic concealment of injected nodes, and then combining a dual loss function strictly located in the convex direction for efficient optimization under black-box conditions, it can be guaranteed that the generated adversarial examples have high concealment to penetrate depth anomaly detection, while being able to converge stably and quickly to the globally optimal attack direction. This enables a real, reliable and efficient quantitative evaluation of the robustness of the target graph neural network model.

[0006] In one optional implementation, a variational graph autoencoder is used to perform reparameterization encoding on the target graph data, mapping the attribute features and topological structure of each node in the target graph data to a low-dimensional continuous semantic manifold space, and outputting the latent representation of each node in the semantic manifold space, including: By performing aggregation encoding on the node attributes and adjacency matrix of each node in the target graph data using a graph encoder, the mean and log-variance of the potential distribution of each node are inferred. Random noise following a standard Gaussian distribution is introduced, and reparameterized sampling is performed based on the mean and log-variance to obtain the latent vector of each node; The reconstruction loss, consisting of adjacency reconstruction error and attribute reconstruction error, is combined with the divergence between the latent distribution and the prior distribution to form the training objective, and iterative training is performed on the variational graph autoencoder. After the reconstruction loss converges, the encoder and decoder parameters are frozen, and the latent representation of each node in the semantic manifold space is output.

[0007] This invention utilizes the reparameterization mechanism of a variational graph autoencoder to map discrete graph structure data into a continuous latent probability distribution, thereby constructing a smooth and compact semantic manifold space. Within this space, any sampled point, after decoding, naturally conforms to the underlying semantic distribution of the original graph data, which is beneficial for subsequently generating adversarial examples with endogenous semantic concealment.

[0008] In one alternative implementation, selecting the set of semantic anchors based on latent representations includes: Clustering is performed on the latent representations of all nodes in the semantic manifold space. Each cluster center is extracted as a central anchor point, and the node with the largest geodesic distance from the set of selected anchor points is selected as the boundary anchor point from the latent representations of all nodes. Extract the latent vector of the target node to be evaluated and the mean of the latent vectors of its first-order neighbor nodes, and use them as local anchor points; The central anchor point, boundary anchor points, and local anchor points are merged to form a semantic anchor point set.

[0009] This invention provides a set of semantic anchor points based on global distribution, boundary topology, and local semantics. This ensures that the generated injected nodes not only conform to the distribution pattern of normal node data globally, but also improve the semantic consistency with the neighborhood of the target node locally, thereby enhancing the concealment of adversarial examples.

[0010] In one optional implementation, a weighted summation is performed on each semantic anchor in the semantic anchor set through convex combination to generate a coarse representation vector. The coarse representation vector is then projected and corrected according to the manifold geometric error bound to obtain the latent representation of the injected nodes mapped onto the surface of the semantic manifold space, including: The attention score between the target node to be evaluated and each semantic anchor in the set of semantic anchors is calculated by using an attention mechanism, and the combination coefficient of each semantic anchor is obtained. The combination coefficient satisfies the non-negativity and normalization constraints. By using the combination coefficients to perform a weighted summation on each semantic anchor point, a coarse representation vector located inside the convex hull formed by the semantic anchor points is obtained. Based on manifold geometry theory, the maximum theoretical error bound of the vector distance to the semantic manifold space surface is quantified, where the maximum theoretical error bound is proportional to the curvature of the semantic manifold space section and the square of the maximum geodesic distance between each semantic anchor point. The coarse representation vector and the latent vector of the target node are spatially concatenated and input into a pre-defined multilayer perceptron. The corrected vector is output through nonlinear mapping. Based on the maximum theoretical error bound, the correction vector is superimposed on the coarse representation vector to calculate the latent representation of the injected node mapped onto the surface of the semantic manifold space.

[0011] This invention first utilizes convex combination to ensure that the coarse representation vector is located inside the convex hull of normal data, avoiding its deviation from the normal distribution. Then, based on manifold geometry theory, the error bound is quantized and projection correction is performed to map the coarse representation vector that is suspended in the gaps outside the manifold to the real manifold surface, thereby avoiding it from falling into the gaps of the real semantic manifold, improving the endogenous semantic concealment of adversarial examples, reducing the probability of adversarial examples being detected, and ensuring the high robustness of adversarial examples.

[0012] In one alternative implementation, the maximum theoretical error bound of the quantized semantic manifold space surface includes: A k-nearest neighbor manifold graph is constructed using the latent representations of each node in the target graph data in the semantic manifold space, serving as the target anchor point region. The local geodesic distance is approximated by the edge weights based on the Euclidean distance between the latent representations. The geodesic distance between two semantic anchors in any target anchor region is obtained by finding the shortest path, and the maximum geodesic distance in the target anchor region is taken. For two semantic anchor points within the target anchor point region, calculate the geodesic midpoint and Euclidean linear midpoint of the local manifold formed by the two semantic anchor points, and estimate the curvature of the local semantic manifold section based on the distance between the geodesic midpoint and the Euclidean linear midpoint. The geometric error bound of the manifold is calculated based on the curvature of the local semantic manifold section and the maximum geodesic distance, and the maximum theoretical error bound is obtained.

[0013] This invention, based on Riemannian geometry, provides a rigorous mathematical upper bound for roughly representing the distance from a vector to the real manifold surface by calculating local geodesic distances and manifold cross-sectional curvature. This provides a theoretical basis and quantitative constraints for subsequent refinement steps, enhancing the theoretical rigor of the method.

[0014] In one optional implementation, the coarse representation vector and the latent vector of the target node are spatially concatenated and input into a preset multilayer perceptron. A corrected vector is output through nonlinear mapping, including: The coarse representation vector and the latent vector of the target node are spatially concatenated and input into a pre-defined multilayer perceptron. An initial correction vector is output through nonlinear mapping. Perform local principal component decomposition on the semantic anchor neighborhood to obtain the tangent space basis vectors of the semantic manifold, where the semantic anchor neighborhood is the local graph neighborhood formed by the original graph nodes corresponding to each anchor in the semantic anchor set and their first-order adjacent nodes. Project the direction of the initial correction vector onto the basis vectors of the tangent space; Perform proportional modulus truncation on the tangent vector after projection correction and output the correction vector.

[0015] This invention projects the initial correction vector onto the tangent space of the semantic manifold, removing invalid components pointing to gaps in the manifold normal, ensuring that the correction direction always follows the manifold surface. Subsequent proportional modulus truncation guarantees that the corrected vector strictly falls within the local manifold error tube. This ensures that the final generated latent representation of the injected node can be accurately and stably mapped to the manifold surface, avoiding reduced concealment due to over-correction and manifold crossing.

[0016] In one optional implementation, a dual loss function consisting of convex direction loss and distance loss is used to iteratively optimize along the attack direction based on the latent representation of the injected node, thereby obtaining the optimal attack direction and the final latent representation of the injected node, including: Calculate the convex direction loss and distance loss corresponding to the latent representation of the candidate injection node in the initial attack direction. Calculate the weighted sum of the dual loss functions of convex direction loss and distance loss as the value of the dual loss function, and perform gradient update on the latent representation of the injection node based on the value of the dual loss function. After each iteration, the latent representation of the injected node is projected onto the intersection of the basis vectors in the tangent space and the maximum theoretical error bound. When the relative change in the latent representation of the injected node is less than the preset convergence threshold in the preset round of iterations, or when the number of iterations reaches the preset maximum number of iterations, the iteration search stops, and the optimal attack direction and the final latent representation of the injected node are output.

[0017] This invention constructs a strictly convex dual loss function consisting of convex direction loss and distance loss, unifying the attack target and camouflage constraints within the same potential geometric space for collaborative solution, thus reducing optimization oscillations caused by gradient direction conflicts. Furthermore, after each iteration, projection constraints are applied to the intersection of the tangent space basis vectors and the maximum theoretical error bound, ensuring that the iteration path is always confined within the effective feasible region of the manifold. This enables stable and rapid convergence to the unique global optimum under black-box conditions, improving the offensiveness of adversarial examples.

[0018] In one optional implementation, the fusion evaluation score of candidate nodes is calculated based on the optimal attack direction. A predetermined number of candidate nodes with the highest fusion evaluation scores are selected to establish topological connection edges with the injected node to complete the adversarial example injection. The robustness of the target graph neural network is quantified based on the change in the prediction results of the target graph neural network before and after injection, including: Calculate the projected vulnerability score of the candidate node along the optimal attack direction, and the homogeneity score between the candidate node and the potential representation of the injected node; The product of the vulnerability score and the homogeneity score is used as the fusion evaluation score of the candidate node. To complete the adversarial example injection, a topological connection edge is established between the candidate nodes with the highest fusion evaluation scores and the injected nodes. The comprehensive robustness score is calculated based on the shift in local node decision confidence and the decrease in global model accuracy before and after the injection of adversarial examples. The robustness of the target graph neural network is determined based on the comprehensive robustness score.

[0019] This invention calculates the vulnerability of candidate nodes along the attack direction and their semantic homogeneity with the injected node, then selects the most vulnerable neighboring nodes that are semantically most consistent with the injected node and establishes topological connections. This enhances the effectiveness of injected node attacks and improves the concealment of injected nodes in the local topological structure. Furthermore, by comprehensively quantifying the local node decision confidence shift and the global model accuracy decline, the robustness of the target graph neural network can be comprehensively, objectively, and accurately evaluated from multiple dimensions.

[0020] Secondly, the present invention provides a robustness detection device for graph neural networks based on semantic masquerading node injection, the device comprising: The mapping module is used to perform reparameterization encoding on the target graph data based on the variational graph autoencoder, mapping the attribute features and topological structure of each node in the target graph data to a low-dimensional continuous semantic manifold space, and outputting the latent representation of each node in the semantic manifold space; The determination module is used to select a set of semantic anchor points based on the latent representation, perform a weighted summation on each semantic anchor point in the set of semantic anchor points through convex combination to generate a coarse representation vector, and perform projection correction on the coarse representation vector according to the manifold geometric error bound to obtain the latent representation of the injected node mapped to the surface of the semantic manifold space. The optimization module is used to perform iterative optimization along the attack direction based on the latent representation of the injected node under the black-box condition that the internal parameters of the target graph neural network cannot be obtained. It uses a dual loss function consisting of convex direction loss and distance loss to obtain the optimal attack direction and the final latent representation of the injected node. The evaluation module is used to calculate the fusion evaluation score of candidate nodes based on the optimal attack direction, select a preset number of candidate nodes with the highest fusion evaluation scores to establish topological connection edges with the injected nodes to complete the adversarial sample injection, and quantify the robustness of the target graph neural network based on the change in the target graph neural network prediction results before and after injection.

[0021] Thirdly, the present invention provides an electronic device, comprising: a memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the computer instructions to perform the robustness detection method of graph neural network based on semantic masquerading node injection as described in the first aspect or any corresponding embodiment.

[0022] Fourthly, the present invention provides a computer-readable storage medium storing computer instructions for causing a computer to execute the robustness detection method for graph neural networks based on semantic masquerading node injection as described in the first aspect or any corresponding embodiment thereof.

[0023] Fifthly, the present invention provides a computer program product, including computer instructions for causing a computer to execute the robustness detection method for graph neural networks based on semantic masquerading node injection as described in the first aspect or any corresponding embodiment thereof. Attached Figure Description

[0024] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0025] Figure 1 This is a schematic diagram of an application scenario according to an embodiment of the present invention; Figure 2 This is a schematic diagram of the first process of a graph neural network robustness detection method based on semantic masquerading node injection according to an embodiment of the present invention; Figure 3 This is a schematic diagram of the second process of a graph neural network robustness detection method based on semantic masquerading node injection according to an embodiment of the present invention; Figure 4 This is a schematic diagram of the iterative optimization process of a graph neural network robustness detection method based on semantic masquerading node injection according to an embodiment of the present invention; Figure 5 This is a structural block diagram of a graph neural network robustness detection device based on semantic masquerading node injection according to an embodiment of the present invention; Figure 6 This is a schematic diagram of the hardware structure of an electronic device according to an embodiment of the present invention. Detailed Implementation

[0026] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0027] It is understood that before using the technical solutions disclosed in the various embodiments of the present invention, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in the present invention and their authorization should be obtained in accordance with relevant laws and regulations through appropriate means.

[0028] The terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this invention, "a plurality of" means two or more, unless otherwise explicitly specified.

[0029] As an optional application scenario of this invention, such as Figure 1 As shown, the robustness detection system for graph neural networks based on semantic masquerading node injection may include at least one terminal device and at least one server. Figure 1 The system is illustrated in the example, which includes a computer 101, a mobile terminal 102, and a server 103, and the terminal devices such as the computer 101 and the mobile terminal 102 are connected to the server 103 through a network 110.

[0030] Specifically, the terminal device can be a smartphone, tablet, laptop, PDA, desktop computer, game console, smart TV, smart wearable device, in-vehicle terminal, VR (Virtual Reality) device, AR (Augmented Reality) device, etc. Server 103 can be a standalone physical server, a server cluster, a distributed system, or a cloud server providing cloud services. Network 110 can be a wired or wireless network, examples of which include, but are not limited to, the Internet, corporate intranet, local area network, wide area network, mobile communication network, and combinations thereof.

[0031] Server 103 is equipped with a graph neural network robustness detection service. This service can receive target graph data and target graph neural network models to be evaluated submitted from terminal devices or third-party systems, and perform a robustness detection process based on semantic masquerading node injection. After the detection is completed, the detection results are fed back to the terminal device.

[0032] Before deploying or launching related systems or models, security stress testing and vulnerability discovery are often required. Quantitative evaluation of the anti-interference capability and robustness of deep learning models when encountering malicious node injection guides the security hardening of graph neural network models. With its powerful topological representation and feature fusion capabilities in processing non-Euclidean topological data, graph neural networks have been widely applied in social network analysis, financial risk control, and recommender systems. Robustness testing methods for related technologies mainly assess the model's anti-interference capability by injecting adversarial nodes into the target graph or modifying the connections of existing nodes. However, the injected nodes generated when constructing adversarial examples tend to deviate from the manifold distribution of normal data in the semantic space, thus being effectively intercepted by deep anomaly detectors based on manifold reconstruction errors, leading to inflated and distorted robustness evaluation results. Furthermore, during optimization, the inconsistent gradient directions of the attack target and the masquerading constraints can easily cause gradient conflicts and optimization oscillations, increasing computational costs and limiting applicability in real-world deployment scenarios where model parameters are unavailable.

[0033] In view of this, embodiments of the present invention provide a robustness detection method for graph neural networks based on semantically disguised node injection. By generating adversarial examples from coarse to fine within a continuous semantic manifold space constructed by a variational graph autoencoder, and guiding iterative optimization under black-box conditions with a strictly convex double loss function, a stable and efficient global optimal attack is achieved while ensuring the high concealment of the injected nodes. Ultimately, a true, reliable and efficient quantitative evaluation of the robustness of the target graph neural network is achieved.

[0034] According to an embodiment of the present invention, a robustness detection method for graph neural networks based on semantic masquerading node injection is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0035] This embodiment provides a robustness detection method for graph neural networks based on semantic masquerading node injection, which can be applied to data processing servers. Figure 2 This is a flowchart of a graph neural network robustness detection method based on semantic masquerading node injection according to an embodiment of the present invention, as follows: Figure 2 As shown, the process includes the following steps: Step S201: Perform reparameterization encoding on the target graph data based on variational graph autoencoder, map the attribute features and topological structure of each node in the target graph data to a low-dimensional continuous semantic manifold space, and output the latent representation of each node in the semantic manifold space.

[0036] Specifically, the server acquires the target image data to be detected. ,in, For the original set of nodes, Let A be an adjacency matrix, either known or constructed from business relationship records, and let adjacency matrix A represent the edge set E. This is a node attribute matrix, where n represents the number of nodes in the graph, i represents the i-th node, j represents the j-th node, and d... x For the feature dimensions of node attributes, Represents a node With nodes There are edges connecting them. This indicates that no edge connections exist. For nodes without explicit attributes, the structural feature input consists of node degree, local clustering coefficient, positional encoding, and learnable node embeddings.

[0037] By acquiring the target image data to be detected It is mapped to a latent spatial distribution by a graph convolutional encoder. Based on the mean vector output by the encoder Sum of logarithmic and standard deviation vectors For each node in the target graph Perform reparameterized sampling. Specifically, first sample a random noise vector from a standard normal distribution. ,in The nodes are then computed using a random vector with the same dimension as the latent space; the nodes are then calculated via a reparameterization formula. Potential representation :

[0038] After performing the above reparameterization sampling on all n nodes, the latent representation matrix Z of each node in the target graph data in the low-dimensional continuous semantic manifold space is obtained:

[0039] Where T represents transpose.

[0040] Step S202: Select a set of semantic anchor points based on the latent representation, perform a weighted summation on each semantic anchor point in the set through convex combination to generate a coarse representation vector, and perform projection correction on the coarse representation vector according to the manifold geometric error bound to obtain the latent representation of the injected node mapped to the surface of the semantic manifold space.

[0041] Specifically, from the obtained latent representations of each node, a subset of nodes are selected as semantic anchors to construct a semantic anchor set. For example, a central anchor and boundary anchors referencing the central anchor set are selected. The target node to be evaluated... Corresponding latent vector and the mean vector of all its first-order neighbors. The selected set of anchor points should have good spatial coverage and semantic representativeness in the semantic manifold space. Next, based on the combination coefficients corresponding to each anchor point... A coarse representation vector of the injected node is generated by performing a convex combination weighted summation on each semantic anchor in the semantic anchor set. The combination coefficients of the convex combination satisfy the non-negativity constraint and the sum of the weights of each node is 1, so as to ensure that the coarse representation vector is located inside the convex hull spanned by the set of semantic anchor points, that is, in the dense region of normal data distribution in the semantic manifold space.

[0042] Since the obtained coarse representation vectors may still lie in the gaps between semantic manifold spaces, it is necessary to obtain local manifold geometric information based on the set of semantic anchor points, i.e., the curvature of the manifold cross section. And the maximum geodesic distance L between anchor points is used to calculate the manifold geometric error bound. and will and target vector Perform spatial stitching and calculate the correction vector accordingly. By mapping the coarse representation vector from the interior of the convex hull to the vicinity of the surface of the semantic manifold space, the latent representation of the injected node is obtained. The magnitude of the projection correction is subject to the manifold geometric error bound. The constraints can prevent over-correction from causing the potential representation of the injected node to deviate from the semantic distribution area of ​​the normal data.

[0043] Step S203: Under the black-box condition that the internal parameters of the target graph neural network cannot be obtained, an iterative optimization is performed along the attack direction based on the latent representation of the injected node using a dual loss function consisting of convex direction loss and distance loss, to obtain the optimal attack direction and the final latent representation of the injected node.

[0044] Specifically, under the black-box condition of not being able to obtain the internal model parameters of the target graph neural network, convex direction loss and distance loss functions are constructed. The convex direction loss measures the degree of perturbation of the latent representation of the injected node along the attack direction, guiding the latent representation of the injected node to move in the direction that maximizes the prediction bias of the target graph neural network, thus ensuring the effectiveness of the injected node's attack on the target graph neural network. The distance loss measures the degree of deviation between the latent representation of the injected node and the normal node distribution in the semantic manifold space, constraining the latent representation of the injected node not to deviate from the semantic distribution region of the normal data during iterative optimization along the attack direction, thus maintaining the semantic concealment of the injected node. The convex direction loss and distance loss are weighted and combined, and the output of the target graph neural network is used as a feedback signal to determine the attack direction of the latent representation of the injected node. The latent representation of the injected node and the target graph data are input into the target graph neural network to obtain the prediction output of the target graph neural network for each node. Based on the deviation between the prediction output and the expected attack effect, the perturbation gradient direction of the latent representation is calculated, and this perturbation gradient direction is used as the attack direction. .

[0045] The latent representation of the injected node is then iteratively optimized along the attack direction based on a dual loss function. In each iteration, the gradient of the dual loss function with respect to the latent representation of the injected node is calculated, and the latent representation of the injected node is updated along the gradient direction. During the iteration, the convex direction loss moves the latent representation in the direction that enhances the attack effect, while the distance loss constrains the deviation of the latent representation from the normal semantic distribution. The combined effect of these two factors allows the latent representation of the injected node to gradually approach the optimal attack position while maintaining semantic concealment. The iterative optimization process terminates when a preset convergence condition is met, such as the value of the dual loss function converging below a preset threshold, the change in the latent representation between two adjacent iterations being less than a preset threshold, or reaching a preset maximum number of iterations. After the iterative optimization terminates, the finally determined attack direction is taken as the optimal attack direction, and the latent representation of the injected node after iterative convergence is taken as the final latent representation of the injected node. .

[0046] Step S204: Calculate the fusion evaluation score of candidate nodes based on the optimal attack direction, select a preset number of candidate nodes with the highest fusion evaluation scores to establish topological connection edges with the injected nodes to complete the adversarial sample injection, and quantify the robustness of the target graph neural network based on the change in the target graph neural network prediction results before and after injection.

[0047] Specifically, based on the optimal attack direction, a fusion evaluation score is calculated for each candidate node in the target graph data. The fusion evaluation score comprehensively reflects the homogeneity of the candidate node and the injected node in the semantic space, as well as the degree to which the candidate node perturbs the prediction results of the target graph neural network along the optimal attack direction, i.e., the vulnerability of the target graph neural network. Semantic homogeneity is measured by the similarity between the latent representation of the candidate node and the final latent representation of the injected node. Higher homogeneity indicates that the candidate node and the injected node are closer in the semantic space, and the easier it is for the injected node to integrate into the normal data distribution after establishing topological connections. The magnitude of change in the predicted output of the target graph neural network after establishing connections between the candidate node and the injected node is the vulnerability score. Higher vulnerability indicates that the candidate node can amplify the adversarial effect of the injected node on the target graph neural network. The vulnerability score and the homogeneity score are weighted and multiplied to obtain the fusion evaluation score for each candidate node; a higher score indicates a better performance of the injected node.

[0048] From all candidate nodes in the target graph data, select a preset number of candidate nodes with the highest fusion evaluation scores, and establish topological connection edges between the injected node and the selected candidate nodes to complete the graph structure injection of the adversarial example.

[0049] After adversarial sample injection, the target graph data is input into the target graph neural network, and the prediction output of the target graph neural network for each node is obtained. The changes in the prediction results of the target graph neural network before and after the adversarial sample injection are calculated. For example, the proportion of nodes with flipped predicted labels to the total number of nodes, the shift in the predicted probability distribution, and the degree of decrease in the prediction confidence of the target nodes. Based on these changes, the robustness of the target graph neural network is quantitatively evaluated. A larger change indicates poorer prediction stability and lower robustness when facing semantically hidden adversarial sample injection; a smaller change indicates stronger resistance to adversarial sample injection and higher robustness.

[0050] The robustness detection method for graph neural networks based on semantically camouflaged node injection provided in this embodiment maps the target graph data to a low-dimensional continuous semantic manifold space through a variational graph autoencoder, obtaining the latent representation of each node, so that subsequent adversarial examples can fall on the semantic manifold space. Then, a set of semantic anchor points is selected based on the latent representation, and a coarse representation vector is generated through convex combination. Projection correction is performed according to the manifold geometric error bound, ensuring that the latent representation of the injected node is located within a dense region of normal data distribution, while also improving the intrinsic semantic concealment of the injected node, effectively reducing the risk of being identified by anomaly detection mechanisms. Furthermore, under black-box conditions, iterative optimization is performed using a dual loss function consisting of convex direction loss and distance loss, maximizing the attack perturbation effect while maintaining the semantic camouflage concealment of the injected node. Finally, candidate nodes are selected based on the optimal attack direction to establish topological connection edges to complete the adversarial example injection. The robustness of the target graph neural network is quantified based on the change in prediction results before and after injection, accurately evaluating the prediction stability and anti-interference ability of the graph neural network in the face of semantically concealed adversarial attacks.

[0051] In an optional implementation, step S201 above includes: Step 1: Perform aggregation encoding on the node attributes and adjacency matrix of each node in the target graph data using a graph encoder to infer the mean and log-variance of the potential distribution of each node.

[0052] Step 2: Introduce random noise that follows a standard Gaussian distribution, and perform reparameterized sampling based on the mean and log-variance to obtain the latent vector of each node.

[0053] Step 3: Using the reconstruction loss composed of adjacency reconstruction error and attribute reconstruction error, and the divergence between the latent distribution and the prior distribution, we form the training objective and perform iterative training on the variational graph autoencoder. Step 4: After the reconstruction loss converges, freeze the encoder and decoder parameters and output the latent representation of each node in the semantic manifold space.

[0054] Specifically, in step one, the adjacency matrix of the target graph data is symmetrically normalized to obtain a normalized adjacency matrix. The normalized adjacency matrix and the node attribute feature matrix are input into the graph encoder. Through multi-layer graph convolution operations, the structural and attribute information of each node and its neighborhood is aggregated layer by layer, encoding the high-dimensional attribute features and local topological structure of each node into a low-dimensional hidden layer representation. In the output layer of the graph encoder, two independent linear transformations map the hidden layer to the mean vector of the latent distribution of each node. With log-variance vector The mean vector represents the central position of each node in the semantic manifold space, and the logarithmic variance vector represents the degree of uncertainty in the potential distribution of each node.

[0055] In step two, random noise vectors are sampled from a standard Gaussian distribution, based on the mean vector. With log-variance vector By combining random noise with distribution parameters through a reparameterization formula, the latent vector of each node is calculated. :

[0056] in, For each node's potential vector, Let be the mean vector of each node. Let be the standard deviation vector of each node. It is standard Gaussian noise.

[0057] In step three, the latent vectors of each node are input into the decoder, and the reconstruction error L of the adjacency matrix is ​​calculated respectively. A Reconstruction error L of node attribute features X The weighted sum of these two values ​​yields a reconstruction loss that restores the topological structure and attribute information of the original graph data. Simultaneously, the divergence between the latent distribution of each node and the standard Gaussian prior distribution is calculated, for example, the KL divergence. Where φ represents the fixed encoder parameters obtained after training. This is the approximate posterior distribution of the i-th node inferred by the encoder; that is, given the node attribute feature matrix X and the adjacency matrix A, the encoder's estimate of the distribution of the i-th node in the latent space. The prior distribution of the latent variables is usually set as a standard Gaussian distribution N(0,I). The reconstruction loss is weighted and combined with the KL divergence to form the training objective. Iterative training is performed on the encoder and decoder parameters of the variational graph autoencoder.

[0058]

[0059] in, , The weights are the reconstruction error and divergence corresponding to the node attribute features. This represents the reconstruction error of the adjacency matrix. Reconstruction error of node attribute features Let be the divergence between the potential distribution of each node and the standard Gaussian prior distribution.

[0060] In step four, when the reconstruction loss converges to below a preset threshold or reaches the preset maximum number of training epochs, iterative training is terminated, and the encoder parameters φ and decoder parameters ψ are frozen. The target graph data is then input into the graph encoder with frozen parameters, and forward inference is performed to output the latent representation of each node in the semantic manifold space.

[0061] In this way, graph convolutional aggregation coding maps node attributes and topological structure to a low-dimensional semantic manifold space, and improves the restoration of the latent space through joint optimization of reconstruction loss and divergence, thus better establishing the semantic manifold and improving the stability of subsequent robust detection.

[0062] In one alternative implementation, selecting the set of semantic anchors based on latent representations includes: Step 1: Perform clustering on the latent representations of all nodes in the semantic manifold space, extract the cluster centers as central anchors, and select the node with the largest geodesic distance from the set of selected anchors from the latent representations of all nodes as the boundary anchor. Step 2: Extract the latent vector of the target node to be evaluated and the mean of the latent vectors of its first-order neighbor nodes, and use them as local anchor points. Step 3: Merge the central anchor point, boundary anchor point, and local anchor point to form a semantic anchor point set.

[0063] Specifically, in step one, a clustering operation is performed on the latent representations of all nodes in the semantic manifold space. For example, K-Means clustering is used to group nodes whose latent representations are similarly distributed in the semantic space into the same cluster, and the centers of K clusters are extracted as central anchor points. The central anchor point represents the core location of each major data distribution area in the semantic manifold space. Simultaneously, from the latent representations of all nodes, the farthest point is sampled from the set of anchor points initially referenced by the central anchor point set. Each time, the node vector with the largest minimum geodesic distance to the selected set of anchor points is chosen as the boundary anchor point, for a total of K boundary anchor points. And exclude vectors that have been used as center anchors. Boundary anchors can characterize the outer boundary position of data distribution in semantic manifold space, and are used to cover sparse and transitional regions in the latent space.

[0064] In step two, the target node to be evaluated is... Extract the latent vector of the target node itself, taking itself and its first-order neighbors as the range. The mean of the latent vectors of all first-order neighbor nodes Let this mean vector be used as a local anchor point.

[0065] Where u is the latent vector of the u-th node. For the target node, The set of neighboring nodes of the target node.

[0066] In step three, the extracted K center anchor points, K boundary anchor points, and extracted local anchor points are combined. and The anchors are merged to form a set of 2K+2 semantic anchors.

[0067] In this way, by obtaining the central anchor point, boundary anchor point, and local anchor point, the geometric structure of the semantic manifold space is characterized in a multi-layered manner from global to local, which improves the coverage and accuracy of the latent representation of the injected node generated based on convex combination in the semantic space.

[0068] In one alternative implementation, such as Figure 3 The diagram shown is a second flowchart illustrating a graph neural network robustness detection method based on semantic masquerading node injection according to an embodiment of the present invention. Step S202 may include: Step S31: Calculate the attention score between the target node to be evaluated and each semantic anchor in the semantic anchor set through the attention mechanism, and obtain the combination coefficient of each semantic anchor.

[0069] The combination coefficients satisfy non-negativity and normalization constraints.

[0070] Specifically, the latent vector of the target node to be evaluated is used as the query vector, and the latent vectors of each semantic anchor in the semantic anchor set are used as the key vector and value vector, respectively. The attention score between the target node and each semantic anchor is calculated. For example, this can be obtained during the self-supervised pre-training phase on the target graph.

[0071] Query Matrix Bond matrix Each target node to be evaluated is used as a pseudo-target node in turn, and the attention score is calculated:

[0072] in, For attention score, For querying the matrix, The key matrix, The potential vector of the target node. For each semantic anchor in the set of semantic anchors, there is a latent vector. is the dimension of the potential vector of the target node to be evaluated.

[0073] Next, the attention scores are normalized, for example, by using the Softmax function to obtain the combination coefficients of each semantic anchor. :

[0074] Where i and j represent the attention score of the i-th target node and the attention score of the j-th semantic anchor, respectively. The ratio of the attention score of the target semantic anchor to the attention scores of all anchors is used as the combination coefficient of the target semantic anchor. It satisfies the nonnegativity constraint and the sum of all combination coefficients equals one.

[0075] In an alternative implementation, the anchor reconstruction loss can also be minimized based on the combination coefficients, the latent vectors of each semantic anchor in the semantic anchor set, and the local anchor vectors.

[0076] in, For anchor point reconstruction loss, These are the weighting coefficients. The potential vector of the target node. For each semantic anchor in the set of semantic anchors, there is a latent vector. The latent vector of the target node itself The mean of the latent vectors of all first-order neighbor nodes, The combination coefficients for the target semantic anchors.

[0077] Based on the obtained minimized anchor point reconstruction loss, the query matrix is ​​updated in reverse. Bond matrix And fix it after training is completed.

[0078] In this way, the combination coefficient is calculated with minimal loss at each anchor point, thus improving the reliability of the detection.

[0079] Step S32: Use the combination coefficients to perform a weighted summation on each semantic anchor point to obtain a coarse representation vector located inside the convex hull formed by the semantic anchor points.

[0080] Specifically, based on the combination coefficients of each semantic anchor, a weighted summation operation is performed on the latent vectors of each semantic anchor to obtain a coarse representation vector:

[0081] in, For a rough representation of the vector, it is based on the set of semantic anchors. Calculation of all anchor points in the data (2K+2 in this embodiment), and .

[0082] Step S33: Based on manifold geometry theory, quantify the maximum theoretical error bound of the surface of the semantic manifold space that roughly represents the vector distance.

[0083] The maximum theoretical error bound is proportional to the curvature of the semantic manifold spatial section and the square of the maximum geodesic distance between each semantic anchor point.

[0084] Specifically, based on manifold geometry theory, the cross-sectional curvature of the semantic manifold in the current region is calculated, and the maximum geodesic distance between each semantic anchor point is calculated. The cross-sectional curvature is multiplied by the square of the maximum geodesic distance to obtain the maximum theoretical error bound that roughly represents the vector distance to the semantic manifold spatial surface.

[0085] Step S34: Spatial concatenation of the coarse representation vector and the latent vector of the target node is performed and input into a preset multilayer perceptron. The corrected vector is output through nonlinear mapping.

[0086] Specifically, the coarse representation vector and the latent vector of the target node to be evaluated are spatially concatenated along the feature dimension to form a concatenated feature vector. The concatenated feature vector is then input into a pre-defined multilayer perceptron, and after multilayer nonlinear transformation and activation function mapping, a corrected vector is output.

[0087] Step S35: Based on the maximum theoretical error bound, the correction vector is superimposed on the coarse representation vector to calculate the latent representation of the injected node mapped onto the surface of the semantic manifold space.

[0088] Specifically, based on the calculated maximum theoretical error bound, the correction vector is scaled, and the scaled correction vector is superimposed on the output coarse representation vector to obtain the latent representation of the injected node mapped onto the surface of the semantic manifold space.

[0089] In this way, the combination coefficient is calculated based on the semantic relevance between the target node and each semantic anchor point, so that the coarse representation vector generated by the weighted summation is located inside the convex hull of the anchor point. The position of the coarse representation vector is mapped to the surface of the semantic manifold space through the correction vector. The resulting latent representation of the injected node is naturally integrated into the normal data distribution in the semantic space, has endogenous concealment, and is beneficial to subsequent robust detection.

[0090] In an optional implementation, step S33 above, quantizing the maximum theoretical error bound of the semantic manifold space surface, includes: Step S331: Construct a k-nearest neighbor manifold graph using the latent representations of each node in the target graph data in the semantic manifold space, as the target anchor point region, and approximate the local geodesic distance using the edge weights based on the Euclidean distance between the latent representations.

[0091] Specifically, using the latent representations of each node in the semantic manifold space of the target graph data as the vertex set, the Euclidean distance between the latent representation of each node and the latent representations of the other nodes is calculated. The k nodes with the smallest Euclidean distance are selected as the nearest neighbors of that node. Connection edges are established between a node and its nearest neighbors to construct a k-nearest neighbor manifold. The edge weights of each connection edge are set to the Euclidean distance between the latent representations of the corresponding two nodes. The Euclidean distance is used to approximate the local geodesic distance between adjacent nodes. For example, let the latent vectors of adjacent target nodes be... Boundary rights Approximate target node latent vector The local geodesic distance between them.

[0092] in, Let Riemann metric tensor be calculated at the midpoint of two potential vectors. It is the transpose of the difference vector between two potential vectors.

[0093] Step S332: Obtain the geodesic distance between two semantic anchors in any target anchor region through the shortest path, and take the maximum geodesic distance in the target anchor region.

[0094] Specifically, based on the local approximate geodesic distance between two adjacent anchor points, the shortest path algorithm is used to calculate the geodesic distance between any two semantic anchor points within the target anchor point region. All semantic anchor point pairs within the target anchor point region are traversed, and the maximum geodesic distance among them is taken as the maximum geodesic distance within the target anchor point region, i.e.:

[0095] in, This represents the maximum geodesic distance within the current target anchor point area. The geodesic distance between any two semantic anchor points within the target anchor point area.

[0096] Step S333: For two semantic anchor points within the target anchor point region, calculate the geodesic midpoint and Euclidean linear midpoint of the local manifold formed by the two semantic anchor points, and estimate the curvature of the local semantic manifold section based on the distance between the geodesic midpoint and the Euclidean linear midpoint.

[0097] Specifically, for any two semantic anchor points within the target anchor point region, an anchor point pair is formed. Calculate the geodesic midpoints of the two points on the surface of the semantic manifold space, respectively. With the midpoint of a linear line in Euclidean space The geodesic midpoint is the midpoint of the shortest path along the manifold surface between two semantic anchors, and the Euclidean linear midpoint is the arithmetic mean of the latent vectors of the two semantic anchors in Euclidean space. Calculate the Euclidean distance between the geodesic midpoint and the Euclidean linear midpoint, and let:

[0098] in, This is an estimate of the curvature of the cross section of the local semantic manifold (i.e., the target anchor point region). For two semantic anchors and Between the semantic manifold space surface The geodesic distance is the shortest path length along the surface of the manifold. This indicates that all anchor point pairs in the target anchor point region are traversed, and the maximum geodesic distance is taken. To maintain a fixed safety factor, Used to ensure that the denominator is not zero.

[0099] The larger the distance, the greater the curvature of the manifold in that local region, i.e., the greater the cross-sectional curvature; the smaller the distance, the closer the manifold is to being flat in that local region, i.e., the smaller the cross-sectional curvature.

[0100] Step S334: Calculate the geometric error bound of the manifold based on the curvature of the local semantic manifold section and the maximum geodesic distance, and obtain the maximum theoretical error bound.

[0101] Specifically, based on manifold geometry theory, the maximum theoretical error bound of the coarsely quantified representation of the distance between the vector and the true manifold surface is determined. The error bound is related to the curvature of the manifold section. And it is proportional to the square of the maximum geodesic distance L between anchor points, satisfying the mathematical relationship:

[0102] Therefore, the maximum error bound of the coarse representation vector in the target anchor region is:

[0103] Where t represents an anchor point in the target anchor point region, The curvature of the manifold section in this region, This represents the maximum geodesic distance between each anchor point.

[0104] In this way, by calculating the maximum error bound of the coarse representation vector in the target anchor point region through the maximum geodesic distance and the curvature of the manifold section in the local region, the possibility of the injected node being filtered out due to the coarse representation vector falling into the semantic manifold gap is reduced, and the concealment of the injected node is improved.

[0105] In an optional implementation, step S34 above may include: Step a1 involves spatially concatenating the coarse representation vector with the latent vector of the target node, inputting it into a pre-defined multilayer perceptron, and outputting an initial correction vector through nonlinear mapping.

[0106] Step a2: Perform local principal component decomposition on the neighborhood of the semantic anchor point to obtain the tangent space basis vectors of the semantic manifold.

[0107] The semantic anchor neighborhood is the local graph neighborhood formed by the original graph nodes corresponding to each anchor in the semantic anchor set and their first-order adjacent nodes.

[0108] Step a3: Project the direction of the initial correction vector onto the basis vectors of the tangent space.

[0109] Step a4: Perform proportional modulus truncation on the tangent vector after projection correction and output the correction vector.

[0110] Specifically, in step a1, the coarse representation vector is... The latent vector of the target node to be evaluated itself Spatial concatenation is performed along the feature dimension to form a concatenated feature vector. Two The first and last connections of the 2-dimensional vector are 2 The feature vector is concatenated from the dimensional vector. The input is fed into a pre-defined multilayer perceptron, where it undergoes layer-by-layer mapping through multiple fully connected layers and non-linear activation functions, outputting an initial corrected vector.

[0111] in, This is the initial correction vector. This is the weight matrix of the first fully connected layer. This is the weight matrix for the second fully connected layer. This is the first layer bias vector. This is the second layer bias vector. It is a non-linear activation function (e.g., ReLU).

[0112] In step a2, the local graph neighborhood formed by the original graph nodes and their first-order adjacent nodes corresponding to each semantic anchor in the semantic anchor set is used as the scope. Based on the latent representations of each node in this neighborhood in the semantic manifold space, a local latent representation set is obtained. Local principal component decomposition is performed on the local latent representation set, and the top few principal component directions with the largest variance contribution rate are extracted and used as the tangent space basis vectors of the semantic manifold at the current anchor neighborhood. That is, the main direction of change of the semantic manifold within a local region.

[0113] In step a3, the initial correction vector is subjected to orthogonal projection operations onto each tangent space basis vector:

[0114] in, For the correction vector, Let T be the basis vectors of the tangent space, and let T denote the transpose. This is the initial correction vector.

[0115] The tangent vector lies in the tangent space of the semantic manifold, and its direction is tangent to the manifold surface, thus eliminating the normal component in the initial correction vector that deviates from the manifold surface.

[0116] In step a4, the magnitude of the tangent vector after projection correction is calculated, and the magnitude of the tangent vector is compared with the preset maximum correction magnitude threshold, which can be expressed by the following formula:

[0117] in, To perform the correction vector after proportional modulus truncation, To roughly characterize the maximum theoretical error bound of the vector distance to the real manifold surface, For the correction vector, To protect the parameters and prevent the denominator from being zero.

[0118] That is, when the magnitude of the tangent vector does not exceed the maximum correction magnitude threshold, the tangent vector is kept unchanged and output as the correction vector; when the magnitude of the tangent vector exceeds the maximum correction magnitude threshold, the tangent vector is scaled proportionally according to the maximum correction magnitude threshold so that the magnitude of the scaled tangent vector is equal to the maximum correction magnitude threshold, and the scaled tangent vector is output as the correction vector.

[0119] In this way, after the multilayer perceptron generates the initial correction direction based on the splicing features, it performs orthogonal projection on the tangent space basis vectors extracted by local principal component decomposition to eliminate the normal deviation component. Then, it corrects the upper bound of the correction amplitude by equal-proportional modulus truncation constraint. The final output correction vector fits the manifold surface in direction and is constrained in amplitude, ensuring the geometric rationality and numerical stability of the projection correction.

[0120] In one alternative implementation, step S203 may include: Step 1: Calculate the convex direction loss and distance loss corresponding to the latent representation of the candidate injection node in the initial attack direction. Calculate the weighted sum of the dual loss functions of convex direction loss and distance loss as the dual loss function value, and perform gradient update on the latent representation of the injection node based on the dual loss function value.

[0121] Step 2: After each iteration, project constraints are applied to the updated latent representation of the injected node onto the intersection of the basis vectors in the tangent space and the maximum theoretical error bound.

[0122] Step 3: When the relative change of the latent representation of the injected node is less than the preset convergence threshold in the preset round of iterations, or when the number of iterations reaches the preset maximum number of iterations, stop the iterative optimization, and output the optimal attack direction and the final latent representation of the injected node.

[0123] Specifically, in step one, the current latent representation of the candidate injection node is used as the optimization variable, and its convex direction loss and distance loss along the initial attack direction are calculated respectively. The convex direction loss constrains the latent representation of the injection node to shift along the initial attack direction, causing the injection node to deviate from the normal data distribution in the semantic space, thus affecting the target node. Query its category probability and select the true category center. and the most probable competitive category center Define the normalized attack direction vector. The geometric center midpoint of the positive and negative sample classes Therefore, the loss in the convex direction can be expressed by the following expression:

[0124] in, The loss is convex, where N represents the number of valid competitive categories selected by the current target node. For the first Normalized attack direction vectors in each competing category direction The latent representation vector of the injected node. Let be the geometric midpoint between the true category center and the i-th competing category center. As the scaling factor, when When the direction of attack is the same, the larger the inner product, the better. The smaller the function output, the smaller the loss in the convex direction.

[0125] The distance loss constraint sets the semantic distance between the latent representation of the injected node and the latent representation of the target node, ensuring that the injected node's neighborhood distribution in the semantic space is close to that of the target node. This can be expressed as:

[0126] in, For distance loss, The target attack location is within the manifold. The potential vector of the target node. For the selected attack direction, The latent representation vector of the injected node. To determine the maximum allowed semantic displacement, the 95th percentile of the geodesic distance between the target node and its normal neighbors of the same type is taken, along with the preset attack budget radius. The smaller value in, that is:

[0127] in, For the maximum allowed semantic displacement, This is the 95th percentile value of the geodesic distance between the target node and its normal neighbors of the same type. Set the preset attack budget radius.

[0128] Next, the convex direction loss and distance loss are weighted and summed according to preset weights to obtain the double loss function value. The overall objective of the double loss function value is:

[0129] in The overall objective of the dual loss function value is... For convex direction loss, For distance loss, , The preset weight coefficients are fixed after obtaining the optimal attack direction and the final potential representation of the injected node.

[0130] Finally, by performing gradient updates on the latent representation of the injected node based on the dual loss function value, a unique global optimal solution can be obtained, which balances the latent representation vector of the injected node between the attack direction and the consistency of the target neighborhood.

[0131] In step two, after each gradient update, projection constraints are applied to the updated latent representation of the injected nodes. The feasible region of the projection constraints is defined by the following two conditions:

[0132] and

[0133] in, The latent representation vector of the injected node. To roughly represent the vector, For the maximum theoretical error bound, Let be the affine subspace spanned by the basis vectors of the tangent space.

[0134] That is, the latent representation vector of the injected node must simultaneously satisfy that the Euclidean distance with the coarse representation vector does not exceed the maximum theoretical error bound, and that it lies in the affine subspace spanned by the basis vectors of the tangent space of the coarse representation vector.

[0135] In step three, after each iteration, the relative change of the injected node's latent representation relative to the previous iteration is calculated. When the relative change is less than a preset convergence threshold, the optimization process is considered converged, and the iterative optimization stops. Iterative optimization also stops when the number of iterations reaches a preset maximum. The injected node's latent representation with the smallest double loss function value during the iterative optimization process is output as the final latent representation, and the corresponding attack direction is taken as the optimal attack direction.

[0136] like Figure 4 The diagram illustrates the iterative optimization process of a graph neural network robustness detection method based on semantic masquerading node injection according to an embodiment of the present invention. R is an unconstrained high-dimensional Euclidean space. For semantic manifold space, This is the potential representation of the initial injected nodes before the iteration begins. , This represents the latent representation of injected nodes that do not converge during the iteration process. This represents the final potential representation after iterative optimization. It can be seen that, in Figure 4 In an unconstrained high-dimensional Euclidean space *a*, there exists a latent representation of injection nodes located in the voids of the manifold space. Figure 4 In an unconstrained high-dimensional Euclidean space b, the latent representations of the injected nodes in all iterative optimization processes lie on the semantic manifold space.

[0137] In this way, through the weighted calculation and constraints of the dual loss function, it is ensured that the latent representation of the injected node deviates from the normal data distribution in the semantic space while conforming to the manifold structure of the target neighborhood. This allows the injected node to simultaneously take into account both attack and concealment, thereby improving the robustness of the model under adversarial perturbations.

[0138] In one alternative implementation, step S204 may include: Step b1: Calculate the projected vulnerability score of the candidate node along the optimal attack direction, and the homogeneity score between the candidate node and the potential representation of the injected node.

[0139] Step b2: The product of the vulnerability score and the homogeneity score is used as the fusion evaluation score of the candidate node.

[0140] Step b3: Establish topological connection edges between the candidate nodes with the highest fusion evaluation scores and the injected nodes to complete the adversarial example injection.

[0141] Step b4: Calculate the comprehensive robustness score based on the shift in local node decision confidence and the decrease in global model accuracy before and after the injection of adversarial examples.

[0142] Step b5: Determine the robustness of the target graph neural network based on the comprehensive robustness score.

[0143] Specifically, in step b1, two evaluation metrics are calculated for each candidate node in the candidate node set. The candidate node set is defined as follows:

[0144] in, For the set of candidate nodes, For the target node, ( ) is the target node The h-order neighborhood, The target node is the set of normal nodes in the original graph that are not marked by the anomaly detector and are allowed to have test edges. Injecting directly by covering one side, if it's a stress test of the global region, h can be gradually increased until... Covers all nodes.

[0145] The vulnerability score is obtained by projecting the latent representation of the candidate node obtained by the variational graph autoencoder along the optimal attack direction using the inner product. It characterizes the semantic sensitivity of the candidate node in the attack direction and can be expressed by the following expression:

[0146] in, It is the latent representation of candidate node u in the original image obtained by the same VGAE encoder. This is the optimal attack direction.

[0147] Homogeneity score is obtained by calculating the cosine similarity between the latent representation of the candidate node and the final latent representation of the injected node, and can be expressed by the following expression:

[0148] in, It is the latent representation of candidate node u in the original image obtained by the same VGAE encoder. It is the final potential representation of the node to be injected, and the two are in the same semantic manifold coordinate system.

[0149] In step b2, the projected vulnerability score of each candidate node is multiplied by its homogeneity score to obtain the fusion evaluation score of the candidate node:

[0150] in, Candidate nodes Along the direction of attack Vulnerability score of projection, The cosine similarity between the latent representation of the candidate node and the final latent representation of the injected node is the homogeneity score.

[0151] In step b3, all candidate nodes are sorted from highest to lowest according to their fusion evaluation scores. The Top-N candidate nodes with the highest fusion evaluation scores are selected, and topological connections are established between the injected node and the selected candidate nodes to complete the injection of adversarial examples into the target graph. N in Top-N is determined by the topological injection budget, and its upper limit satisfies the minimum of the following three factors: the number of new edges allowed for a single injected node, the difference between the maximum normal degree of the business graph and the number of currently established edges, and the size of the candidate node set. Furthermore, the selected N edges are unique. That is:

[0152] Where N is the number of edges. The number of new edges allowed for a single injected node. The maximum normal degree set for new nodes in the business graph. This represents the current number of edges that have been established. This is the set of candidate nodes.

[0153] Injecting explicit attributes of nodes The latent representation is obtained by reconstructing the final latent representation using a variational graph autoencoder decoder. It can be used for edge selection and geometric constraints, explicit attributes. Used to construct the actual input graph, both pointing to the same injection test node.

[0154] In step b4, before and after injecting adversarial examples, the local node decision confidence shift and the decrease in global model accuracy are calculated respectively. The local node decision confidence shift is obtained by calculating the difference between the confidence probability of the target model predicting the target node as the true class before the injection of perturbations and after the injection of hidden test nodes. It characterizes the degree of interference in the decision of a single target node when facing the injection of hidden nodes, and can be expressed by the following expression:

[0155] in, For local node decision confidence, Represents the target node The true class label (pre-labeled, fixed baseline true label in the dataset, unaffected by model prediction or node injection perturbations). This indicates the target model's effect on nodes without injected perturbations. The confidence probability of predicting the true category. This represents the confidence probability that the target model predicts the node as the true category after the hidden test node is injected. The larger the value, the worse the decision stability of the target model under local topological perturbations.

[0156] The global model accuracy degradation is obtained by calculating the difference in model accuracy on the original graph and the perturbed graph after anomaly filtering on the same fixed set of test nodes. It characterizes the macroscopic performance change of the entire graph deep learning system when encountering unknown and hidden threats, and can be expressed by the following expression:

[0157] in, The degree of decrease in global model accuracy. and All are in the same fixed set of test nodes Above calculation, It does not include training nodes, validation nodes, and newly injected nodes. Using the original image G, Perturbation graph after injecting hidden test nodes , where f is the target graph neural network model to be evaluated.

[0158] The comprehensive robustness security score is obtained by weighting and summing the local decision confidence shift and the global accuracy decline according to preset weights, as shown in the following expression:

[0159] in, Represents the set of target nodes to be tested one by one, | |This represents the total number of its nodes. Local weights With global weight satisfy It can be configured according to different needs; for example, it can enhance the protection of critical nodes for businesses that emphasize this feature. Improvement for businesses that emphasize overall system accuracy , For local node decision confidence, This represents the degree of decrease in global model accuracy.

[0160] The larger the value, the more the classification confidence of the node decreases after the injection of adversarial examples, and the more unstable the local decision of the model is. The average value obtained after taking the mean is the average severity of the local perturbation. The larger the value, the more severe the damage to the overall model's predictive performance caused by adversarial injection; finally, This indicates the degree of loss after the model is attacked. This is the robustness and safety score of the model.

[0161] Or, when the disturbance is very severe. in the formula The larger the value, the better. Therefore, to ensure numerical stability and facilitate the determination of injection effectiveness, the overall robustness safety score can be truncated to the interval between zero and one, i.e.:

[0162] in, This represents the normalized overall robustness safety score. This represents the local average confidence shift. Indicates the degree of decrease in global accuracy. Truncate the values ​​within the parentheses to the [0,1] interval, local weighting. With global weight satisfy It can be set according to different needs. When the condition is met, it indicates that the model is completely robust and adversarial injection has no effect; in This indicates that the model is completely vulnerable, and adversarial injection has caused significant damage.

[0163] In step b5, the robustness level of the target graph neural network is determined based on the comprehensive robustness safety score. The higher the comprehensive robustness safety score, the more stable the model's classification decisions are under adversarial perturbations, indicating higher robustness.

[0164] Furthermore, a security rating can be set, which is generated based on a comprehensive robustness security score, local confidence shift distribution, global accuracy degradation, misclassification rate (MCR), and camouflage success rate (CSR), rather than using a single indicator to replace all detection results. For example, [the following can be added:] Classified as Grade A, [0.70, 0.85) as Grade B, [0.50, 0.70) as Grade C, [0, 0.50) as Grade D, when the MCR after anomaly filtering increases by at least 5 percentage points relative to the baseline, or When the 95th percentile is not less than 0.30, a high-risk decision vulnerability is additionally marked.

[0165] Correspondingly, the server can automatically generate detection reports and vulnerability distribution maps. Nodes can be sorted according to decision confidence offset and post-attack misclassification status. Node risks are represented by color and size encoding on the original graph topology, and center anchor points, boundary anchor points, and coarse representation vectors are marked on the potential manifold projection graph. With the final potential representation The trajectory is compiled, and various assessment indicators and security levels are summarized to finally generate a node-level vulnerability list, weak areas at manifold boundaries, model-level security ratings, and corresponding hardening priorities.

[0166] Thus, the fusion of the projected vulnerability score and the homogeneity score can improve the offensiveness and semantic consistency of candidate nodes, enabling adversarial examples to achieve maximum semantic impact with minimal topological perturbation after injection through the optimal candidate nodes, thereby improving concealment while causing maximum perturbation. Furthermore, the comprehensive robustness security score quantifies the model's resistance to adversarial perturbations from two dimensions: local decision bias and global performance degradation, improving the efficiency of robustness evaluation for graph neural networks.

[0167] The following describes a robustness detection method for graph neural networks based on semantic masquerading node injection according to the present invention, using a specific embodiment.

[0168] When conducting experiments using the Cora citation network dataset, which contains 2,708 nodes and 5,429 edges with a node feature dimension of 1,433, the dataset was divided into training, validation, and test sets at 10%, 10%, and 80% ratios, respectively. GCN (Graph Convolutional Network), GAT (Graph Attention Network), and GraphSAGE were used as the target graph neural network models to be evaluated. Regarding the attack and detection boundary settings, this embodiment performs escape-style black-box testing after the target model training is completed, setting a node budget for each target node to be evaluated. and side budget This means that only one malicious test node is generated and one associated edge is established each time. The defense side uses AnomalyDAE as the anomaly detector, which is trained using a clean training graph before injection, and anomaly thresholds are set on clean verification nodes. It represents the 99th percentile of outlier scores.

[0169] In the semantic manifold construction phase, this embodiment uses a 2-layer GCN as the encoder and a 2-layer MLP as the decoder, with a learning rate of 0.001 and a latent hidden dimension of 32. The VGAE is trained on the original graph, and the validation loss is set to less than 1 for 20 consecutive rounds. Training is stopped and VGAE parameters are frozen when the reconstruction metrics no longer improve. In the coarse search and fine refinement stages of manifold awareness, K-Means clustering is performed on the latent representations of nodes, combined with farthest point sampling, and the number of center anchor points is determined through grid search. For the target node, One central anchor point, A semantic anchor set is composed of boundary anchor points, the latent vector of the target node itself, and the mean vectors of its first-order neighbors. A coarse injection representation is obtained through a convex semantic attention mechanism. Subsequently, the coarse representation and the target representation are concatenated and input into a multilayer perceptron to generate a correction vector, with curvature... Using 1.5 as the initial calibration value and re-estimating based on the local geodetic midpoint deviation, according to the maximum theoretical error boundary... Perform tangent space projection and truncation correction. During the dual-loss optimization and edge selection phase, set the convex direction loss weights. Distance loss weight After optimization, the explicit node features are restored using the VGAE decoder, and the candidate node with the highest score is selected based on the product of vulnerability score and homogeneity score to establish a connection. Experimental results show that on the Cora dataset, the baseline graph has an MCR of 17.5% ± 0.7%. After injecting adversarial examples using the method of this invention, the average MCR increases to 31.3% ± 0.5%. The CSR reached 13.8 percentage points, and the CSR reached 99.9%, indicating that the adversarial nodes generated by this invention not only successfully bypassed anomaly detection, but also significantly induced decision-making vulnerabilities in the target model, demonstrating high robustness.

[0170] In another specific embodiment, the PubMed dataset can also be used for detection, which contains 19,717 nodes, 44,338 edges, 3 node categories, and 500-dimensional node features. The intermediate processes are not detailed here. After five repetitions of the experiment, the average MCR of the method of this invention is 22.4 ± 0.4%, while the corresponding baseline MCR is 14.6 ± 1.0%, and the CSR is 99.9%.

[0171] In another specific embodiment, detection can also be performed based on the Flickr dataset, which contains 89,250 nodes, 899,756 edges, 7 node categories, and 500-dimensional node features. The intermediate processes are not detailed here. After repeating the experiment 5 times, the average MCR of this embodiment is 59.1 ± 0.7%, while the corresponding baseline MCR is 51.4 ± 1.6%, representing an MCR improvement of 7.7 percentage points. The CSR is 99.5%, only 0.4 percentage points lower than Cora and PubMed, and remains above the 95% effective spoofing threshold.

[0172] Table 1 below shows the number of nodes, edges, categories, feature dimensions, and baseline graph MCR for the three specific embodiments mentioned above, as well as the MCR and CSR for the embodiments of the present invention. MCR is the misclassification rate of nodes after anomaly filtering, and CSR is the success rate of injected nodes passing the anomaly filtering spoofing.

[0173] Table 1. Implementation parameters and test results on the three datasets.

[0174] Thus, it can be shown that on graphs with a significant increase in the number of nodes and edges, the method of the present invention can still steadily improve the detection rate of decision vulnerabilities, and the semantic spoofing ability only shows a slight decrease, demonstrating wide applicability.

[0175] This embodiment also provides a robustness detection device for graph neural networks based on semantic masquerading node injection. This device is used to implement the above embodiments and preferred embodiments, and details already described will not be repeated. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.

[0176] This embodiment provides a robustness detection device for graph neural networks based on semantically masquerading node injection, such as... Figure 5 As shown, it includes: The mapping module 510 is used to perform reparameterization encoding on the target graph data based on the variational graph autoencoder, mapping the attribute features and topological structure of each node in the target graph data to a low-dimensional continuous semantic manifold space, and outputting the latent representation of each node in the semantic manifold space.

[0177] The determination module 520 is used to select a set of semantic anchor points based on the latent representation, perform a weighted summation on each semantic anchor point in the set of semantic anchor points through convex combination to generate a coarse representation vector, and perform projection correction on the coarse representation vector according to the manifold geometric error bound to obtain the latent representation of the injected node mapped to the surface of the semantic manifold space.

[0178] The optimization module 530 is used to perform iterative optimization along the attack direction based on the latent representation of the injected node under the black-box condition that the internal parameters of the target graph neural network cannot be obtained, using a dual loss function consisting of convex direction loss and distance loss, to obtain the optimal attack direction and the final latent representation of the injected node.

[0179] Evaluation module 540 is used to calculate the fusion evaluation score of candidate nodes based on the optimal attack direction, select a preset number of candidate nodes with the highest fusion evaluation scores to establish topological connection edges with the injected nodes to complete the adversarial sample injection, and quantify the robustness of the target graph neural network based on the change in the target graph neural network prediction results before and after injection.

[0180] In some alternative implementations, the mapping module 510 is further configured to: By performing aggregation encoding on the node attributes and adjacency matrix of each node in the target graph data using a graph encoder, the mean and log-variance of the potential distribution of each node are inferred. Random noise following a standard Gaussian distribution is introduced, and reparameterized sampling is performed based on the mean and log-variance to obtain the latent vector of each node; The reconstruction loss, consisting of adjacency reconstruction error and attribute reconstruction error, is combined with the divergence between the latent distribution and the prior distribution to form the training objective, and iterative training is performed on the variational graph autoencoder. After the reconstruction loss converges, the encoder and decoder parameters are frozen, and the latent representation of each node in the semantic manifold space is output.

[0181] In some alternative implementations, the determining module 520 is further configured to: Clustering is performed on the latent representations of all nodes in the semantic manifold space. Each cluster center is extracted as a central anchor point, and the node with the largest geodesic distance from the set of selected anchor points is selected as the boundary anchor point from the latent representations of all nodes. Extract the latent vector of the target node to be evaluated and the mean of the latent vectors of its first-order neighbor nodes, and use them as local anchor points; The central anchor point, boundary anchor points, and local anchor points are merged to form a semantic anchor point set.

[0182] In some alternative implementations, the determining module 520 is further configured to: The attention score between the target node to be evaluated and each semantic anchor in the set of semantic anchors is calculated by using an attention mechanism, and the combination coefficient of each semantic anchor is obtained. The combination coefficient satisfies the non-negativity and normalization constraints. By using the combination coefficients to perform a weighted summation on each semantic anchor point, a coarse representation vector located inside the convex hull formed by the semantic anchor points is obtained. Based on manifold geometry theory, the maximum theoretical error bound of the vector distance to the semantic manifold spatial surface is quantified, where the maximum theoretical error bound is proportional to the curvature of the semantic manifold section and the square of the maximum geodesic distance between each semantic anchor point. The coarse representation vector and the latent vector of the target node are spatially concatenated and input into a pre-defined multilayer perceptron. The corrected vector is output through nonlinear mapping. Based on the maximum theoretical error bound, the correction vector is superimposed on the coarse representation vector to calculate the latent representation of the injected node mapped onto the surface of the semantic manifold space.

[0183] In some optional implementations, when determining the maximum theoretical error boundary of the semantic manifold space surface, module 520 is further configured to: A k-nearest neighbor manifold graph is constructed using the latent representations of each node in the target graph data in the semantic manifold space, serving as the target anchor point region. The local geodesic distance is approximated by the edge weights based on the Euclidean distance between the latent representations. The geodesic distance between two semantic anchors in any target anchor region is obtained by finding the shortest path, and the maximum geodesic distance in the target anchor region is taken. For two semantic anchor points within the target anchor point region, calculate the geodesic midpoint and Euclidean linear midpoint of the local manifold formed by the two semantic anchor points, and estimate the curvature of the local semantic manifold section based on the distance between the geodesic midpoint and the Euclidean linear midpoint. The geometric error bound of the manifold is calculated based on the curvature of the local semantic manifold section and the maximum geodesic distance, and the maximum theoretical error bound is obtained.

[0184] In some optional implementations, when outputting the correction vector, the determining module 520 is further configured to: The coarse representation vector and the latent vector of the target node are spatially concatenated and input into a pre-defined multilayer perceptron. An initial correction vector is output through nonlinear mapping. Perform local principal component decomposition on the semantic anchor neighborhood to obtain the tangent space basis vectors of the semantic manifold, where the semantic anchor neighborhood is the local graph neighborhood formed by the original graph nodes corresponding to each anchor in the semantic anchor set and their first-order adjacent nodes. Project the direction of the initial correction vector onto the basis vectors of the tangent space; Perform proportional modulus truncation on the tangent vector after projection correction and output the correction vector.

[0185] In some alternative implementations, the optimization module 530 is further configured to: Calculate the convex direction loss and distance loss corresponding to the latent representation of the candidate injection node in the initial attack direction. Calculate the weighted sum of the dual loss functions of convex direction loss and distance loss as the value of the dual loss function, and perform gradient update on the latent representation of the injection node based on the value of the dual loss function. After each iteration, the latent representation of the injected node is projected onto the intersection of the basis vectors in the tangent space and the maximum theoretical error bound. When the relative change in the latent representation of the injected node is less than the preset convergence threshold in the preset round of iterations, or when the number of iterations reaches the preset maximum number of iterations, the iteration search stops, and the optimal attack direction and the final latent representation of the injected node are output.

[0186] In some alternative implementations, the evaluation module 540 is further configured to: Calculate the projected vulnerability score of the candidate node along the optimal attack direction, and the homogeneity score between the candidate node and the potential representation of the injected node; The product of the vulnerability score and the homogeneity score is used as the fusion evaluation score of the candidate node. To complete the adversarial example injection, a topological connection edge is established between the candidate nodes with the highest fusion evaluation scores and the injected nodes. The comprehensive robustness score is calculated based on the shift in local node decision confidence and the decrease in global model accuracy before and after the injection of adversarial examples. The robustness of the target graph neural network is determined based on the comprehensive robustness score.

[0187] The graph neural network robustness detection device based on semantically masquerading node injection provided in this embodiment of the invention can execute the graph neural network robustness detection method based on semantically masquerading node injection provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the method. Further functional descriptions of the above modules and units are the same as in the corresponding embodiments described above, and will not be repeated here.

[0188] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention.

[0189] The following is a detailed reference. Figure 6 This diagram illustrates a suitable structure for implementing an electronic device according to embodiments of the present invention. The electronic device may include a processor (e.g., a central processing unit, graphics processor, etc.) 601, which can perform various appropriate actions and processes according to a program stored in ROM 602 or a program loaded from memory 608 into RAM 603. RAM 603 also stores various programs and data required for the operation of the electronic device. The processor 601, ROM 602, and RAM 603 are interconnected via a bus 604. An input / output (I / O) interface 605 is also connected to bus 604; wherein ROM is a read-only memory and RAM is a random access memory.

[0190] Typically, the following devices can be connected to I / O interface 605: input devices 606 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 607 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; memory devices 608 including, for example, magnetic tapes, hard disks, etc.; and communication devices 609. Communication device 609 allows electronic devices to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 6 Electronic devices with various devices are shown, but it should be understood that it is not required to implement or have all of the devices shown, and more or fewer devices may be implemented or have instead.

[0191] In particular, according to embodiments of the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of the present invention include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 609, or installed from a memory 608, or installed from a ROM 602. When the computer program is executed by the processor 601, it performs the functions defined in the robustness detection method for graph neural networks based on semantic masquerading node injection according to embodiments of the present invention.

[0192] Figure 6 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of use of the embodiments of the present invention.

[0193] This invention also provides a computer-readable storage medium. The methods described above according to embodiments of the invention can be implemented in hardware or firmware, or implemented as computer code that can be recorded on a storage medium, or implemented as computer code downloaded via a network and originally stored on a remote storage medium or a non-transitory machine-readable storage medium and then stored on a local storage medium. Thus, the methods described herein can be processed by software stored on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. The storage medium can be a magnetic disk, optical disk, read-only memory, random access memory, flash memory, hard disk, or solid-state drive, etc.; further, the storage medium can also include combinations of the above types of memory. It is understood that computers, processors, microprocessor controllers, or programmable hardware include storage components capable of storing or receiving software or computer code. When the software or computer code is accessed and executed by the computer, processor, or hardware, the robustness detection method of graph neural networks based on semantic masquerading node injection shown in the above embodiments is implemented.

[0194] A portion of this invention can be applied as a computer program product, such as computer program instructions, which, when executed by a computer, can invoke or provide the methods and / or technical solutions according to the invention through the operation of the computer. Those skilled in the art will understand that the forms in which computer program instructions exist in a computer-readable medium include, but are not limited to, source files, executable files, installation package files, etc. Correspondingly, the ways in which computer program instructions are executed by a computer include, but are not limited to: the computer directly executing the instructions, or the computer compiling the instructions and then executing the corresponding compiled program, or the computer reading and executing the instructions, or the computer reading and installing the instructions and then executing the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to a computer.

[0195] Although embodiments of the invention have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the invention, and such modifications and variations all fall within the scope defined by the appended claims.

Claims

1. A method for detecting robustness of a graph neural network based on semantic camouflage node injection, characterized in that, The method includes: Based on the variational graph autoencoder, the target graph data is reparameterized and encoded, and the attribute features and topological structure of each node in the target graph data are mapped to a low-dimensional continuous semantic manifold space, and the latent representation of each node in the semantic manifold space is output. Based on the latent representation, a set of semantic anchor points is selected. A weighted summation is performed on each semantic anchor point in the set of semantic anchor points through convex combination to generate a coarse representation vector. The coarse representation vector is then projected and corrected according to the manifold geometric error bound to obtain the latent representation of the injected node mapped to the surface of the semantic manifold space. Under the black-box condition where the internal parameters of the target graph neural network cannot be obtained, an iterative optimization is performed along the attack direction based on the latent representation of the injected node using a dual loss function consisting of convex direction loss and distance loss, to obtain the optimal attack direction and the final latent representation of the injected node. Based on the optimal attack direction, the fusion evaluation score of the candidate nodes is calculated. A preset number of candidate nodes with the highest fusion evaluation scores are selected to establish topological connection edges with the injected node to complete the adversarial sample injection. The robustness of the target graph neural network is quantified based on the change in the prediction results of the target graph neural network before and after injection.

2. The method of claim 1, wherein, The variational graph autoencoder performs reparameterization encoding on the target graph data, mapping the attribute features and topological structure of each node in the target graph data to a low-dimensional continuous semantic manifold space, and outputs the latent representation of each node in the semantic manifold space, including: By performing aggregation encoding on the node attributes and adjacency matrix of each node in the target graph data using a graph encoder, the mean and log-variance of the potential distribution of each node are inferred. Random noise following a standard Gaussian distribution is introduced, and reparameterized sampling is performed based on the mean and the log-variance to obtain the latent vector of each node; The reconstruction loss, consisting of adjacency reconstruction error and attribute reconstruction error, is combined with the divergence between the latent distribution and the prior distribution to form the training objective, and iterative training is performed on the variational graph autoencoder. After the reconstruction loss converges, the encoder and decoder parameters are frozen, and the latent representation of each node in the semantic manifold space is output.

3. The method according to claim 1 or 2, characterized in that, The selection of the semantic anchor point set based on the latent representation includes: Clustering is performed on the latent representations of all nodes in the semantic manifold space, each cluster center is extracted as a central anchor point, and the node with the largest geodesic distance from the set of selected anchor points is selected from the latent representations of all nodes as a boundary anchor point. Extract the latent vector of the target node to be evaluated and the mean of the latent vectors of its first-order neighbor nodes, and use them as local anchor points; The central anchor point, the boundary anchor point, and the local anchor point are merged to form the semantic anchor point set.

4. The method according to claim 1 or 2, characterized in that, The step of performing a weighted summation on each semantic anchor in the semantic anchor set through convex combination to generate a coarse representation vector, and performing projection correction on the coarse representation vector according to the manifold geometric error bound to obtain the latent representation of the injected node mapped to the surface of the semantic manifold space, includes: The attention score between the target node to be evaluated and each semantic anchor in the set of semantic anchors is calculated by using an attention mechanism to obtain the combination coefficient of each semantic anchor, wherein the combination coefficient satisfies the non-negativity and normalization constraints. By using the combined coefficients to perform a weighted summation on each semantic anchor point, a coarse representation vector located inside the convex hull formed by the semantic anchor points is obtained. According to manifold geometry theory, the maximum theoretical error bound of the distance between the coarse representation vector and the surface of the semantic manifold space is quantified, wherein the maximum theoretical error bound is proportional to the curvature of the cross section of the semantic manifold space and the square of the maximum geodesic distance between each of the semantic anchor points; The coarse representation vector and the latent vector of the target node are spatially concatenated and input into a preset multilayer perceptron. A corrected vector is output through nonlinear mapping. Based on the maximum theoretical error bound, the correction vector is superimposed on the coarse representation vector to calculate the latent representation of the injected node mapped onto the surface of the semantic manifold space.

5. The method of claim 4, wherein, The maximum theoretical error bound for quantifying the surface of the semantic manifold space includes: A k-nearest neighbor manifold graph is constructed using the latent representations of each node in the target graph data in the semantic manifold space, serving as the target anchor region, and the local geodesic distance is approximated by the edge weights based on the Euclidean distance between the latent representations. The geodesic distance between two semantic anchors in any target anchor region is obtained by finding the shortest path, and the maximum geodesic distance in the target anchor region is taken. For two semantic anchor points within the target anchor point region, calculate the local manifold geodesic midpoint and Euclidean linear midpoint formed by the two semantic anchor points, and estimate the local semantic manifold cross-sectional curvature based on the distance between the geodesic midpoint and the Euclidean linear midpoint. The geometrical error bound of the manifold is calculated based on the curvature of the local semantic manifold section and the maximum geodesic distance, thus obtaining the maximum theoretical error bound.

6. The method of claim 5, wherein, The step of spatially concatenating the coarse representation vector with the latent vector of the target node, inputting it into a preset multilayer perceptron, and outputting a corrected vector through nonlinear mapping includes: The coarse representation vector and the latent vector of the target node are spatially concatenated and input into a preset multilayer perceptron. An initial correction vector is output through nonlinear mapping. Perform local principal component decomposition on the semantic anchor neighborhood to obtain the tangent space basis vectors of the semantic manifold, wherein the semantic anchor neighborhood is the local graph neighborhood formed by the original graph nodes corresponding to each anchor in the semantic anchor set and their first-order adjacent nodes; Project the direction of the initial correction vector onto the tangent space basis vectors; Perform proportional modulus truncation on the tangent vector after projection correction and output the correction vector.

7. The method of claim 6, wherein, The dual loss function, consisting of convex direction loss and distance loss, iteratively optimizes the latent representation of the injected node along the attack direction to obtain the optimal attack direction and the final latent representation of the injected node, including: Calculate the convex direction loss and distance loss corresponding to the latent representation of the candidate injection node in the initial attack direction, calculate the weighted sum of the dual loss function of the convex direction loss and the distance loss as the dual loss function value, and perform gradient update on the latent representation of the injection node based on the dual loss function value; After each iteration update, the updated latent representation of the injected node is subjected to projection constraints on the intersection of the tangent space basis vectors and the maximum theoretical error bound; When the relative change in the latent representation of the injected node is less than the preset convergence threshold in the preset round of iterations, or when the number of iterations reaches the preset maximum number of iterations, the iteration search stops, and the optimal attack direction and the final latent representation of the injected node are output.

8. The method of claim 1, wherein, The process involves calculating the fusion evaluation score of candidate nodes based on the optimal attack direction, selecting a predetermined number of candidate nodes with the highest fusion evaluation scores to establish topological connections with the injected node to complete the adversarial example injection, and quantifying the robustness of the target graph neural network based on the change in the prediction results before and after injection. This includes: Calculate the projected vulnerability score of the candidate node along the optimal attack direction, and the homogeneity score between the candidate node and the potential representation of the injected node; The product of the vulnerability score and the homogeneity score is used as the fusion evaluation score of the candidate node; The adversarial sample injection is completed by establishing topological connection edges between the candidate nodes with the highest fusion evaluation scores and the injection nodes. The comprehensive robustness score is calculated based on the shift in local node decision confidence and the decrease in global model accuracy before and after the injection of the adversarial sample. The robustness of the target graph neural network is determined based on the comprehensive robustness score.

9. An apparatus for detecting robustness of a graph neural network based on semantic camouflage node injection, characterized in that, The device includes: The mapping module is used to perform reparameterization encoding on the target graph data based on the variational graph autoencoder, mapping the attribute features and topological structure of each node in the target graph data to a low-dimensional continuous semantic manifold space, and outputting the latent representation of each node in the semantic manifold space; The determination module is used to select a set of semantic anchor points based on the latent representation, perform a weighted summation on each semantic anchor point in the set of semantic anchor points through convex combination to generate a coarse representation vector, and perform projection correction on the coarse representation vector according to the manifold geometric error bound to obtain the latent representation of the injection node mapped to the surface of the semantic manifold space. The optimization module is used to perform iterative optimization along the attack direction based on the latent representation of the injected node under the black-box condition that the internal parameters of the target graph neural network cannot be obtained, using a dual loss function consisting of convex direction loss and distance loss, to obtain the optimal attack direction and the final latent representation of the injected node. The evaluation module is used to calculate the fusion evaluation score of the candidate nodes based on the optimal attack direction, select a preset number of candidate nodes with the highest fusion evaluation scores to establish topological connection edges with the injected nodes to complete the adversarial sample injection, and quantify the robustness of the target graph neural network based on the change in the prediction results of the target graph neural network before and after injection.

10. An electronic device, comprising: include: A memory and a processor are interconnected, the memory storing computer instructions, and the processor executing the computer instructions to perform the robust graph neural network detection method based on semantic masquerading node injection as described in any one of claims 1 to 8.