A gradient aggregation-based transferable adversarial sample generation method, system and device
By constructing a neighborhood loss total variation constraint and gradient aggregation, the adversarial example generation process is optimized, which solves the problem of insufficient transferability of existing methods under heterogeneous networks and defense mechanisms, and realizes the efficient transfer and robustness of adversarial examples on different models.
Patent Information
- Application Number
- CN202611578534.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-10-13
- Publication Date
- 2026-11-27
AI Technical Summary
Existing methods for generating transferable adversarial examples tend to overfit specific loss landscapes of proxy models during the generation process, resulting in insufficient transferability across heterogeneous networks, Transformer structures, or models with defensive mechanisms. Furthermore, they are computationally expensive, impacting the efficiency of practical robustness assessment.
By constructing a neighborhood loss total variation constraint and combining the worst-case perception loss and the minimum-case perception point for gradient aggregation, the adversarial example generation process is optimized, allowing it to enter a flat local loss region and improving transferability.
While reducing computational complexity, it improves the transferability and robustness of adversarial examples on unknown target models, making it suitable for security testing and defense method verification in deep learning systems such as image classification.
Smart Images

Figure CN123180231A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of artificial intelligence security, specifically relating to a method, system, and apparatus for generating transferable adversarial examples based on gradient aggregation. Background Technology
[0002] Deep neural networks have been widely used in tasks such as image recognition, object detection, autonomous driving, and medical image analysis. However, numerous studies have shown that deep neural networks are susceptible to adversarial examples consisting of subtle perturbations. Adversarial examples are usually visually very similar to the original samples, yet they can induce the model to output incorrect predictions, thus having a significant impact on the security of model deployment.
[0003] In practical applications, attackers or evaluators often lack access to the structure, parameters, and gradient information of the target model. Transfer-based black-box adversarial example generation methods have gained attention because they do not require querying the target model. These methods typically generate adversarial examples on known surrogate models and leverage the similarity of decision boundaries between different models to transfer the adversarial examples to unknown target models. However, adversarial examples generated by existing methods are prone to overfitting the specific loss landscape of the surrogate model, resulting in insufficient transferability across heterogeneous networks, Transformer structures, or models with defensive mechanisms.
[0004] Existing methods for generating transferable adversarial examples mainly suffer from the following drawbacks:
[0005] (1) Most methods rely on momentum accumulation, input transformation or simple gradient smoothing strategies, lack explicit modeling of the flatness of the local loss landscape of the proxy model, and the generated adversarial examples tend to concentrate in the sharp high attack benefit region unique to the proxy model.
[0006] (2) Although some methods use worst-case perturbation or gradient regularization to improve transferability, they usually only focus on a single mechanism and fail to simultaneously constrain the adversarial sample loss, the neighborhood worst loss, and local flatness.
[0007] (3) Directly searching for the worst perceived loss in the neighborhood requires high computational overhead, which will increase memory usage and running time during multiple iterations and multiple sample sampling, affecting the efficiency of actual robustness evaluation.
[0008] (4) Existing methods still have insufficient generalization ability across architecture models, adversarial training models and advanced defense models, making it difficult to provide stable evaluation samples with high transferability. Summary of the Invention
[0009] To address the aforementioned problems, this invention aims to propose a method, system, and apparatus for generating transferable adversarial examples based on gradient aggregation. By simultaneously optimizing empirical loss, worst-case perception loss, and alternative gap loss, the adversarial examples are guided into flat local loss regions, thereby improving the transferability of adversarial examples on unknown target models.
[0010] To solve the above-mentioned technical problems, the present invention adopts the following technical solution:
[0011] A method for generating transferable adversarial examples based on gradient aggregation, the method comprising:
[0012] Step 1: Obtain input samples and initialize attack parameters: Obtain the original samples to be evaluated and their label information, load the proxy model used to generate adversarial examples, and set the attack hyperparameters related to perturbation constraints, neighborhood sampling, and iterative updates;
[0013] Step 2: Perform neighborhood sampling and calculate the empirical loss gradient: Initialize adversarial samples, and in each iteration, add random sampling perturbations centered on the current adversarial sample to generate multiple neighborhood samples, and calculate the empirical loss gradient corresponding to each neighborhood sample.
[0014] Step 3: Construct the worst-case perception point and the minimum loss perception point: Based on the empirical loss gradient, approximate the maximum loss direction and the minimum loss direction in the neighborhood, determine the worst-case perception perturbation and the minimum loss perturbation respectively, construct the worst-case perception point and the minimum loss perception point, and calculate their gradients.
[0015] Step 4: Construct neighborhood loss total variation constraints and aggregate gradients: Construct a bidirectional substitution gap loss based on the worst-perceived loss and the minimum loss, and use it as a penalty term for the neighborhood loss total variation; use the empirical loss and the worst-perceived loss as attack benefit terms to jointly construct a joint optimization objective; perform weighted aggregation of the empirical loss gradient, the worst-perceived gradient, and the minimum loss gradient to obtain the gradient aggregation direction.
[0016] Step 5: Update adversarial examples and output results: Use the momentum term to cumulatively update the gradient aggregation direction, generate the next round of adversarial examples, and perform perturbation projection and pixel range clipping on them until the number of iterations is reached or the attack termination condition is met, and output the transferable adversarial examples that satisfy the perturbation budget constraint.
[0017] In the above technical solution, the specific steps for parameter acquisition and attack loss function construction in step 1 are as follows:
[0018] Obtain the original sample to be evaluated and its real label In the context of a targeted attack scenario, further specify the target label. Load one or more proxy models with known structures and parameters. And set a disturbance budget Number of iterations Step length Neighborhood sampling radius Worst perception radius Number of samples Balance coefficient and momentum coefficient Among them, the disturbance budget Neighborhood sampling radius is used to limit the difference between adversarial examples and the original samples. Used to control the sampling range around the current adversarial example, worst-case perception radius Used to construct the worst-case perception point and the minimum-loss perception point.
[0019] In the above technical solution, the specific steps of adversarial example initialization, neighborhood sampling, and empirical loss gradient calculation in step 2 are as follows:
[0020] Original sample Initialized as round 0 adversarial sample ,Right now ; in the In each iteration, using the current adversarial example Centered on, with a radius of Random sampling within the neighborhood A disturbance Obtain neighborhood samples ,in Each neighborhood sample Input proxy model Calculate its empirical loss And calculate the empirical loss gradient through backpropagation:
[0021]
[0022] The empirical loss gradient It is used to characterize the direction of decline or rise of the current neighborhood sample in the surrogate model loss landscape, providing a basis for subsequent worst-case perception perturbation estimation and gradient aggregation.
[0023] In the above technical solution, the specific steps for calculating the worst-case perception point, the minimum loss perception point, and their gradients in step 3 are as follows:
[0024] For each neighborhood sample Define the worst-case perception loss and the neighborhood minimum loss:
[0025]
[0026]
[0027] Among them, the worst-case perception loss is used to describe the upper bound of the loss within the neighborhood, and the neighborhood minimum loss is used to describe the lower bound of the loss within the neighborhood.
[0028] To avoid the high computational cost of directly searching for neighborhood extrema, a first-order Taylor expansion is used to approximate the maximum and minimum loss directions. For Neighborhood constraints, worst-case perception perturbation is acceptable Minimum loss disturbance can be taken Then construct the worst-case perception point. and minimum loss perception point and calculate respectively and
[0029] In the above technical solution, the specific steps of neighborhood loss total variation constraint and gradient aggregation in step 4 are as follows:
[0030] Constructing bidirectional substitution gap loss This is used to measure the total variation of the loss function within the neighborhood. The bidirectional substitution gap loss simultaneously characterizes the span between the upper and lower bounds of the loss within the neighborhood, and can more completely reflect the degree of loss fluctuation within the neighborhood of the current adversarial example.
[0031] Based on this, the experience loss, worst-case perception loss, and bidirectional substitution gap loss are all incorporated into the optimization objective:
[0032]
[0033] because The above joint optimization objective can be written as:
[0034]
[0035] in, This is used to ensure the effectiveness of the current adversarial sample's attack. Used to enhance constraints on high-loss regions within the neighborhood. Used to penalize the fluctuation range between the maximum and minimum losses within the neighborhood.
[0036] Based on the joint optimization objective, the bidirectional gap aggregation gradient is calculated for each neighborhood sample. And then The average of the nth sampling points is calculated to obtain the nth... Gradient aggregation direction of the wheel:
[0037]
[0038] Among them, the balance coefficient This is used to adjust the weight of the bidirectional substitution gap loss in the overall optimization objective, so that the generated adversarial examples are not only effective in attacking the proxy model, but also located in a flatter local loss region, thereby improving cross-model transferability.
[0039] In the above technical solution, the specific steps of momentum accumulation, adversarial example update, perturbation projection, and output in step 5 are as follows:
[0040] The gradient aggregation direction obtained in step 4 After normalization and accumulation with historical momentum terms, the updated momentum term is obtained:
[0041]
[0042] Both targeted and untargeted attacks have passed the empirical attack loss function. Under the premise of maximizing attack gains, the current adversarial sample is updated using the direction of the sign gradient:
[0043]
[0044] After the update is complete, Projecting back to the original sample Centered on, with radius perturbation constraint set Within this range, the sample pixel values are cropped to ensure that the generated samples meet the valid input range.
[0045]
[0046] Repeat the above steps until the preset number of iterations is reached. Alternatively, the attack termination condition may be met, ultimately outputting a transferable adversarial example that satisfies the perturbation budget constraint. .
[0047] A transferable adversarial example generation system based on gradient aggregation, characterized in that it includes:
[0048] Input configuration module: used to obtain the original sample to be evaluated. Authentic labels of samples or target tag Proxy model and disruptive budget Number of iterations Step length Neighborhood sampling radius Worst perception radius Number of samples Balance coefficient and momentum coefficient Attack parameters, etc.
[0049] Neighborhood sampling module: used to sample current adversarial examples Perform neighborhood sampling around the center to generate multiple neighborhood samples. The neighborhood samples are then input into the proxy model. Calculate the empirical loss and its gradient in the middle. ;
[0050] The bidirectional sensing approximation module is used to approximate the maximum and minimum loss directions in the neighborhood based on the empirical loss gradient, and to construct the worst-case sensing point. and minimum loss perception point And calculate the corresponding gradient;
[0051] Total variation constraints and gradient aggregation module: used to construct from empirical loss Worst-case perceived loss Total variation penalty for neighboring loss The joint optimization objective is composed of these components, and the empirical loss gradient, worst-case perceptual gradient, and minimum loss gradient are weighted and aggregated to obtain the gradient aggregation direction used to update adversarial examples. ;
[0052] Momentum projection update module: used for gradient aggregation direction By performing normalization and momentum accumulation, the momentum update direction is obtained. Based on whether the attack is targeted or non-targeted, the system performs symbolic gradient updates, perturbation projections, and pixel range cropping on the current adversarial sample to generate the next round of adversarial samples. ;
[0053] Result output module: Used to output results after reaching the required number of iterations. Alternatively, if the attack termination condition is met, output a transferable adversarial example that satisfies the perturbation budget constraint. It also records attack parameters, perturbation magnitude, proxy model attack results, and migration attack evaluation results.
[0054] A gradient aggregation-based transferable adversarial example generation apparatus includes a memory, a processor, and a computer program stored in the memory and executable on the processor. The processor executes the computer program to implement the steps of any of the above-described technical solutions for gradient aggregation-based transferable adversarial example generation methods or systems.
[0055] The beneficial effects of this invention are:
[0056] 1. By constructing a neighborhood loss total variation constraint and utilizing the information of the upper and lower bounds of the loss within the neighborhood, this invention can more comprehensively characterize the fluctuation range of the loss landscape surrounding the adversarial sample.
[0057] 2. This invention combines the worst-case perception point and the minimum loss perception point for gradient aggregation, so that the adversarial example generation process can simultaneously take into account the attack effectiveness and the flatness of local loss.
[0058] 3. This invention uses a first-order Taylor expansion to approximate the maximum and minimum loss directions of the neighborhood, eliminating the need to explicitly construct a Hessian matrix or perform a high-cost neighborhood search, thereby reducing computational complexity while enhancing the ability to model local flatness.
[0059] 4. This invention is compatible with momentum iteration, input transformation, model ensemble, and data augmentation-type transfer attack techniques, and is suitable for security testing, adversarial training data construction, and defense method verification of deep learning systems such as image classification. Attached Figure Description
[0060] Figure 1 This is a flowchart of a gradient aggregation-based transferable adversarial example generation algorithm.
[0061] Figure 2 This is a framework diagram of a transferable adversarial example generation system based on gradient aggregation;
[0062] Figure 3 This is a diagram illustrating the core mechanisms of neighborhood sampling, bidirectional sensing approximation, and gradient aggregation. Detailed Implementation
[0063] To make the objectives, technical solutions, and advantages of this invention clearer, examples are provided below. The described embodiments are only some preliminary embodiments of this invention, and not all embodiments.
[0064] This embodiment provides a method for generating transferable adversarial examples based on gradient aggregation, including the following steps:
[0065] Step 1: Obtain input samples and initialize attack parameters: Obtain the original samples to be evaluated and their label information, load the proxy model used to generate adversarial examples, and set the attack hyperparameters related to perturbation constraints, neighborhood sampling, and iterative updates;
[0066] Step 2: Perform neighborhood sampling and calculate the empirical loss gradient: Initialize adversarial samples, and in each iteration, add random sampling perturbations centered on the current adversarial sample to generate multiple neighborhood samples, and calculate the empirical loss gradient corresponding to each neighborhood sample.
[0067] Step 3: Construct the worst-case perception point and the minimum loss perception point: Based on the empirical loss gradient, approximate the maximum loss direction and the minimum loss direction in the neighborhood, determine the worst-case perception perturbation and the minimum loss perturbation respectively, construct the worst-case perception point and the minimum loss perception point, and calculate their gradients.
[0068] Step 4: Construct neighborhood loss total variation constraints and aggregate gradients: Construct a bidirectional substitution gap loss based on the worst-perceived loss and the minimum loss, and use it as a penalty term for the neighborhood loss total variation; use the empirical loss and the worst-perceived loss as attack benefit terms to jointly construct a joint optimization objective; perform weighted aggregation of the empirical loss gradient, the worst-perceived gradient, and the minimum loss gradient to obtain the gradient aggregation direction.
[0069] Step 5: Update adversarial examples and output results: Use the momentum term to cumulatively update the gradient aggregation direction, generate the next round of adversarial examples, and perform perturbation projection and pixel range clipping on them until the number of iterations is reached or the attack termination condition is met, and output the transferable adversarial examples that satisfy the perturbation budget constraint.
[0070] In this embodiment, the specific steps for configuring attack parameters and constructing the loss function in step 1 are as follows:
[0071] Select original image samples from the ImageNet image dataset and its real label Further target labeling is set in the target attack mission. In this embodiment, a pre-trained Inception network is selected as the surrogate model. ResNet, DenseNet, Vision Transformer, or combinations thereof are used as target models in transfer tests. A perturbation budget is set. Number of iterations Step length Number of samples Neighborhood sampling radius Worst perception radius Balance coefficient momentum coefficient .
[0072] In this embodiment, the specific steps of neighborhood sampling and empirical loss gradient calculation in step 2 are as follows:
[0073] Original sample As the initial adversarial example, i.e. In the first In each iteration, using the current adversarial example Centered on, with a radius of Random sampling within the neighborhood A disturbance Construct neighborhood samples:
[0074]
[0075] Each neighborhood sample Input proxy model In the middle, calculate its empirical loss. The empirical loss gradient is obtained through backpropagation. .
[0076] In this embodiment, the specific steps for constructing the worst-case perception point and the minimum-loss perception point in step 3 are as follows:
[0077] For each neighborhood sample Define the worst-case perception loss and the neighborhood minimum loss:
[0078]
[0079]
[0080] Based on empirical loss gradient Estimate the directions of maximum and minimum loss within the neighborhood respectively, and obtain and .in The worst-case scenario, The minimum loss sensing point is obtained through backpropagation. and .
[0081] In this embodiment, the specific steps of neighborhood loss total variation constraint and gradient aggregation in step 4 are as follows:
[0082] Calculate the bidirectional substitution gap loss , used to measure the total variation of the loss function within the neighborhood. The empirical loss, worst-case perception loss, and bidirectional substitution gap loss are all incorporated into the optimization objective, forming:
[0083]
[0084] because The objective function can be equivalently expressed as: ,in Used to maintain the attack effectiveness of the current adversarial sample itself. Used to reinforce high-loss constraints in the neighborhood. Used to suppress the amplitude of loss fluctuations within the neighborhood.
[0085] Based on the aforementioned joint optimization objective, an aggregated gradient is generated for each sampling point. Finally, the average of all sampling points is taken to obtain the first... Gradient aggregation direction of the wheel:
[0086]
[0087] In this embodiment, the specific steps of momentum update, perturbation projection, and adversarial example output in step 5 are as follows:
[0088] gradient aggregation direction After normalization and accumulation with the historical momentum term, we obtain:
[0089]
[0090] Subsequently, a symbolic gradient update is performed based on the attack pattern to obtain a temporary adversarial sample, which is then projected back onto the original sample. Centered on, with radius perturbation constraint set Within this range, the pixel area is simultaneously cropped to obtain:
[0091]
[0092] Repeat the above process until the required number of iterations is reached. Alternatively, if the attack termination condition is met, the final output will be a transferable adversarial example. .
[0093] This embodiment provides a transferable adversarial example generation system based on gradient aggregation, including the following modules:
[0094] Input configuration module: used to obtain the original sample to be evaluated, the sample's true label or target label, the proxy model, and the attack parameters;
[0095] Neighborhood sampling module: used to generate multiple neighborhood samples centered on the current adversarial sample in each iteration, and input the neighborhood samples into the proxy model for loss calculation and backpropagation to obtain the empirical loss gradient;
[0096] Bidirectional sensing approximation module: used to approximate the maximum and minimum loss directions in the neighborhood based on the empirical loss gradient, construct the worst-case sensing point and the minimum-loss sensing point, and calculate the corresponding worst-case sensing gradient and minimum-loss gradient;
[0097] Total variation constraints and gradient aggregation module: used to... The bidirectional substitution gap loss is calculated, and the empirical loss, worst-case perception loss, and neighborhood loss total variation penalty are jointly incorporated into the optimization objective. The gradients of the empirical loss, worst-case perception loss, and minimum loss are weighted and aggregated to obtain the gradient aggregation direction.
[0098] Momentum projection update module: used for gradient aggregation direction By performing normalization and momentum accumulation, the momentum update direction is obtained. Based on whether the attack is targeted or non-targeted, the system performs symbolic gradient updates, perturbation projections, and pixel range cropping on the current adversarial sample to generate the next round of adversarial samples. ;
[0099] Result output module: Used to output results after reaching the required number of iterations. Alternatively, if the attack termination condition is met, output a transferable adversarial example that satisfies the perturbation budget constraint. It also records attack parameters, perturbation magnitude, proxy model attack results, and migration attack evaluation results.
[0100] In this embodiment, the input configuration module is specifically implemented as follows:
[0101] The input configuration module reads raw image samples from the ImageNet image dataset. and their corresponding real labels And determine whether to set target tags based on the type of attack task. The original image samples undergo uniform preprocessing before being input into the proxy model, including image resizing, center cropping or proportional scaling, pixel value normalization, and channel normalization, to meet the input format requirements of the Inception network. The proxy model uses a pre-trained Inception model. The model parameters remain fixed during adversarial example generation and are used only to provide forward predictions and backpropagation gradients. The input configuration module further sets the attack parameters, including the perturbation budget. Number of iterations Step length Neighborhood sampling radius Worst perception radius Number of samples Balance coefficient and momentum coefficient For non-targeted attacks, the input configuration module is built. For targeted attacks, the input configuration module is built. This unifies the two types of attacks into an optimized form that maximizes attack benefits.
[0102] In this embodiment, the neighborhood sampling module is specifically implemented as follows:
[0103] The neighborhood sampling module in the first In the round of iteration, the current adversarial example Centered on, with a radius of Randomly generated within the neighborhood of Each sampling perturbation And construct neighborhood samples ,in To ensure that neighboring samples remain within the legal perturbation range, this module performs a projection operation on each neighboring sample to satisfy... Then, the pixel values are cropped to fall within the legal image value range. Subsequently, each neighborhood sample... Input Inception proxy model Perform forward propagation to calculate attack loss. or Then, the empirical loss gradient is obtained through backpropagation. To reduce gradient variance caused by random sampling, this module caches the gradient results of multiple neighborhood samples and provides multi-point empirical gradient information for subsequent gradient aggregation.
[0104] In this embodiment, the bidirectional sensing approximation module is specifically implemented as follows:
[0105] The bidirectional sensing approximation module uses the empirical loss gradient obtained from the neighborhood sampling module. A first-order Taylor expansion is used to approximate the maximum and minimum loss directions within the neighborhood. For each neighborhood sample... This module constructs the worst-case perception point along the direction of the empirical gradient sign:
[0106]
[0107] And construct the minimum loss sensing point in the opposite direction:
[0108]
[0109] in, For the worst perception radius, Used for sensing points with high loss in the approximate neighborhood. This module is used for sensing points with low loss within the approximate neighborhood. After construction, this module will respectively... and Input the Inception surrogate model, calculate the corresponding loss, and perform backpropagation to obtain the worst-case perceptual gradient and the minimum loss gradient. This process does not explicitly construct the Hessian matrix, nor does it require multiple rounds of searching within the neighborhood, thus controlling computational complexity while introducing bidirectional neighborhood information.
[0110] In this embodiment, the total variation constraint and gradient aggregation module is specifically implemented as follows:
[0111] The total variation constraint and gradient aggregation module first uses the worst-case perception loss. and neighborhood minimum loss Constructing bidirectional substitution gap loss:
[0112]
[0113] The bidirectional substitution gap loss is used to measure the difference between the upper and lower bounds of the loss in the neighborhood, i.e., the total variation of the loss function in the neighborhood of the current adversarial example. Subsequently, this module incorporates the empirical loss, the worst-case perceptual loss, and the neighborhood loss total variation penalty into a joint optimization objective, forming:
[0114]
[0115] because The above objective function can be equivalently expressed as:
[0116]
[0117] Based on the joint optimization objective, this module performs a weighted aggregation of the empirical loss gradient, the worst-case perceptual gradient, and the minimum loss gradient to obtain the aggregated gradient for each sampling point:
[0118]
[0119] Finally, for The average of the aggregated gradients corresponding to the nth neighboring samples is used to obtain the nth... Gradient aggregation direction of the wheel:
[0120]
[0121] In this way, the module maintains the effectiveness of adversarial example attacks while using the neighborhood loss total variation constraint to suppress drastic fluctuations in the local loss landscape, thereby improving the transferability of adversarial examples between different model structures.
[0122] In this embodiment, the momentum projection update module is specifically implemented as follows:
[0123] The momentum projection update module for the first Gradient aggregation direction obtained in turn Normalization was performed and compared with historical momentum terms. By accumulating the data, we obtain the updated momentum term:
[0124]
[0125] in, To prevent stable terms with a denominator of zero, the update direction is then determined based on the attack pattern, and based on... The module iteratively updates the current adversarial sample. For non-targeted attacks, the update direction increases the loss corresponding to the ground truth label; for targeted attacks, the update direction decreases the loss corresponding to the target label. After updating, the module projects the sample back to the original image. Centered on, disturbance budget constraint set Within this range, pixel values are cropped to ensure the generated image remains within the legal input range, thus obtaining the next round of adversarial examples. .
[0126] In this embodiment, the result output module is specifically implemented as follows:
[0127] The results output module reaches the preset number of iterations. Alternatively, after the attack termination condition is met, the final adversarial sample will be output. Simultaneously, this module saves key configuration and evaluation information during the adversarial example generation process, including attack mode, proxy model name Inception, and attack parameters. Furthermore, the result output module can input the generated adversarial examples into target models with different architectures for transfer testing, such as ResNet, DenseNet, Vision Transformer, or combinations thereof, to obtain transfer attack success rates and model robustness evaluation results.
Claims
1. A method for generating transferable adversarial examples based on gradient aggregation, characterized in that, Includes the following steps: Step 1: Obtain input samples and initialize attack parameters: Obtain the original samples to be evaluated and their label information, load the proxy model used to generate adversarial examples, and set the attack hyperparameters related to perturbation constraints, neighborhood sampling, and iterative updates; Step 2: Perform neighborhood sampling and calculate the empirical loss gradient: Initialize adversarial samples, and in each iteration, add random sampling perturbations centered on the current adversarial sample to generate multiple neighborhood samples, and calculate the empirical loss gradient corresponding to each neighborhood sample. Step 3: Construct the worst-case perception point and the minimum loss perception point: Based on the empirical loss gradient, approximate the maximum loss direction and the minimum loss direction in the neighborhood, determine the worst-case perception perturbation and the minimum loss perturbation respectively, construct the worst-case perception point and the minimum loss perception point, and calculate their gradients. Step 4: Construct neighborhood loss total variation constraints and aggregate gradients: Construct a bidirectional substitution gap loss based on the worst-perceived loss and the minimum loss, and use it as a penalty term for the neighborhood loss total variation; use the empirical loss and the worst-perceived loss as attack benefit terms to jointly construct a joint optimization objective; perform weighted aggregation of the empirical loss gradient, the worst-perceived gradient, and the minimum loss gradient to obtain the gradient aggregation direction. Step 5: Update adversarial examples and output results: Use the momentum term to cumulatively update the gradient aggregation direction, generate the next round of adversarial examples, and perform perturbation projection and pixel range clipping on them until the number of iterations is reached or the attack termination condition is met, and output the transferable adversarial examples that satisfy the perturbation budget constraint.
2. The method for generating transferable adversarial examples based on gradient aggregation according to claim 1, characterized in that, In step 1, the proxy model For one or more deep neural networks with known structures and parameters; when using an ensemble surrogate model, the output losses of multiple surrogate models are weighted and summed to form an empirical loss function. When a targeted attack mode is employed, the empirical loss function is used to reduce the target label. The corresponding classification loss, i.e. When using a non-targeted attack mode, the empirical loss function is used to improve the accuracy of the true labels. The corresponding classification loss or reduction in confidence level corresponding to the true label, i.e. .
3. The method for generating transferable adversarial examples based on gradient aggregation according to claim 1, characterized in that, In step 2, neighborhood samples Based on current adversarial examples Superimposed random sampling perturbation We obtained, among which Located at 0 as the center and with a radius of Within the neighborhood constraints; For each neighborhood sample Calculate experience loss or The empirical loss gradient is obtained through backpropagation. .
4. The method for generating transferable adversarial examples based on gradient aggregation according to claim 1, characterized in that, In step 3, the worst-case perception loss is defined as... The neighborhood minimum loss is defined as By using a first-order Taylor expansion to approximate the maximum and minimum loss directions within the neighborhood, the worst-case perceptual perturbation is obtained. and minimum loss disturbance ;Will As the worst-case scenario, As the minimum loss sensing point, the worst-case sensing gradient is calculated respectively. and minimum loss gradient .
5. The method for generating transferable adversarial examples based on gradient aggregation according to claim 1, characterized in that, In step 4, the bidirectional substitution gap loss is defined as the total variation of the neighborhood loss. The joint optimization objective is Equivalent representation is The bidirectional gap aggregation gradient for each neighboring sample is: , No. The gradient aggregation direction of the wheel is ,in Used to adjust the penalty strength of the total variation of neighborhood loss on local flatness.
6. The method for generating transferable adversarial examples based on gradient aggregation according to claim 1, characterized in that, In step 5 momentum term and in accordance with Update adversarial examples, where This indicates that the projection back to the original sample is used. The central set of disturbance budgets, Indicates pixel range cropping. To prevent stable terms with a denominator of zero.
7. A transferable adversarial example generation system based on gradient aggregation, characterized in that, include: Input configuration module: used to receive raw samples, label information, surrogate model, perturbation budget, and iterative hyperparameters; Neighborhood sampling module: used to generate neighborhood samples around the current adversarial example and calculate the empirical loss gradient; The bidirectional sensing approximation module is used to approximate the worst-case sensing perturbation and the minimum-case loss perturbation based on the empirical loss gradient and to calculate the gradient corresponding to the perturbation point. The total variation constraint and gradient aggregation module is used to calculate the bidirectional substitution gap loss and aggregate gradient directions based on the joint optimization objective. Momentum projection update module: used to perform momentum update, sign gradient update, perturbation projection and clipping operations; Results output module: Used to output transferable adversarial examples and their attack configurations, perturbation sizes, and robustness evaluation results.
8. A gradient-aggregation-based transferable adversarial example generation device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes, it implements the steps of the gradient aggregation-based transferable adversarial example generation method as described in any one of claims 1 to 6.
