Method and apparatus for deep learning model
Patent Information
- Authority / Receiving Office
- EP · EP
- Patent Type
- Applications
- Current Assignee / Owner
- ROBERT BOSCH GMBH
- Filing Date
- 2023-06-28
- Publication Date
- 2026-05-06
Smart Images

Figure CN2023103135_02012025_PF_FP_ABST
Abstract
Description
METHOD AND APPARATUS FOR DEEP LEARNING MODELFIELD
[0001] Aspects of the present disclosure relate generally to artificial intelligence (AI) , and more particularly, to a method and a network for a deep learning model.BACKGROUND
[0002] Recently, deep learning models have achieved remarkable success in a variety of applications, including, not limited to, autonomous driving, chatbots, healthcare, and so on. However, these deep learning models are vulnerable to adversarial attacks, which pose a major challenge for their deployment in security-sensitive domains. To address this issue, robustness against adversarial attacks has become a crucial focus of AI safety research.
[0003] Therefore, it may be desirable to provide a method or a technique to improve the robustness of the deep learning models or algorithms against adversarial attacks.SUMMARY
[0004] The following presents a simplified summary of one or more aspects according to the present disclosure in order to provide a basic understanding of such aspects. This summary is not an extensive overview of all contemplated aspects, and is intended to neither identify key or critical elements of all aspects nor delineate the scope of any or all aspects. Its sole purpose is to present some concepts of one or more aspects in a simplified form as a prelude to the more detailed description that is presented later.
[0005] In an aspect of the disclosure, a computer-implemented method for a deep learning model is provided, comprising providing the deep learning model with a set of inputs each perturbed with a perturbation level; obtaining a plurality of groups of prompts for the set of inputs, wherein each of the set of inputs is associated with a corresponding group of the plurality of groups of prompts based on the perturbation level of that input; and optimizing the plurality of groups of prompts by minimizing a loss function of the deep learning model including the plurality of groups of prompts over the set of inputs.
[0006] In another aspect of the disclosure, a computer-implemented method for a deep learning model is provided, comprising providing the deep learning model with a set of images each perturbed with a perturbation level, wherein the deep learning model have been trained for image classification; obtaining a plurality of groups of prompts for the set of images, wherein each of the set of images is associated with a corresponding group of the plurality of groups of prompts based on the perturbation level of that image; and optimizing the plurality of groups of prompts by minimizing a loss function of the deep learning model including the plurality of groups of prompts over the set of images.
[0007] In another aspect of the disclosure, apparatus for diffusion model is provided, comprising a memory and at least one processor coupled to the memory. The at least one processor is configured to provide the deep learning model with a set of inputs each perturbed with a perturbation level; obtain a plurality of groups of prompts for the set of inputs, wherein each of the set of inputs is associated with a corresponding group of the plurality of groups of prompts based on the perturbation level of that input; and optimize the plurality of groups of prompts by minimizing a loss function of the deep learning model including the plurality of groups of prompts over the set of inputs.
[0008] In another aspect of the disclosure, a computer program product for a deep learning model is provided, comprising processor executable computer code for providing the deep learning model with a set of inputs each perturbed with a perturbation level; obtaining a plurality of groups of prompts for the set of inputs, wherein each of the set of inputs is associated with a corresponding group of the plurality of groups of prompts based on the perturbation level of that input; and optimizing the plurality of groups of prompts by minimizing a loss function of the deep learning model including the plurality of groups of prompts over the set of inputs.
[0009] In another aspect of the disclosure, a computer readable medium stores computer code for a deep learning model. The computer code when executed by a processor causes the processor to provide the deep learning model with a set of inputs each perturbed with a perturbation level; obtain a plurality of groups of prompts for the set of inputs, wherein each of the set of inputs is associated with a corresponding group of the plurality of groups of prompts based on the perturbation level of that input; and optimize the plurality of groups of prompts by minimizing a loss function of the deep learning model including the plurality of groups of prompts over the set of inputs.
[0010] The proposed methods for adversarial training according to one or more aspects of the present disclosure may be used for various applications and / or fields, such as autonomous cars, face recognition, malware detection, and the like. Although the following disclosure may be described with reference to classification for some part only for illustration, the present disclosure is applicable to many other application fields beyond the specific application filed of classification.
[0011] By using the prompts to direct models to concentrate on specific features of each perturbation level, the proposed methods can improve robustness of the models against a variety of range of adversarial attacks.
[0012] Other aspects or variations of the disclosure, as well as other advantages thereof will become apparent by consideration of the following detailed description and accompanying drawings.BRIEF DESCRIPTION OF THE DRAWINGS
[0013] The disclosed aspects will hereinafter be described in connection with the appended drawings that are provided to illustrate and not to limit the disclosed aspects.
[0014] FIG. 1 illustrates a schematic diagram for adversarial example.
[0015] FIG. 2 illustrates a schematic diagram for fine-tuning methods.
[0016] FIG. 3 illustrates a schematic diagram for prompting methods compared with the fine-tuning methods, to solve the problem of facing with different perturbation budgets or levels, according to one or more aspects of the present disclosure.
[0017] FIG. 4 illustrates a workflow of a method for prompt-based adversarial training of a deep learning model, according to one or more aspects of the present disclosure.
[0018] FIG. 5 illustrates a schematic framework for the prompt-based adversarial training of a deep learning model, according to one or more aspects of the present disclosure.
[0019] FIG. 6 illustrates a schematic framework for the prompt-based adversarial training of a deep learning model, according to one or more aspects of the present disclosure.
[0020] FIG. 7 illustrates an example of a hardware implementation for an apparatus according to one or more aspects of the present disclosure.DETAILED DESCRIPTION
[0021] The present disclosure will now be discussed with reference to several example implementations. It is to be understood that these implementations are discussed only for enabling those skilled in the art to better understand and thus implement the embodiments of the present disclosure, rather than suggesting any limitations on the scope of the present disclosure.
[0022] Deep learning models are highly expressive models that have recently achieved state of the art performance on speech and visual recognition tasks. However, recent studies have demonstrated that the deep learning models are vulnerable to adversarial examples-inputs that are almost indistinguishable from natural data and yet classified incorrectly by the models. For example, very small changes to the input images can fool state-of-the-art deep neural networks with high confidence. This may hold even when the benign example was classified correctly, and the change is imperceptible to a human. This may involve a crucial security issue in many application fields, such as autonomous cars, face recognition, and malware detection, and the like.
[0023] FIG. 1 illustrates a schematic diagram for adversarial example. Image 110 may be a benign example that can be correctly predicted by a network as a category of car. Image 130 may be an adversarial example generated from the image 110, by applying an imperceptible non-random perturbation to the image 110, for example. Image 120 may be a difference between the image 110 and image 130. In this example, image 130 may be incorrectly classified into a category of “ostrich, Struthio, camelus” by the network. It can be seen that even the difference between the image 110 and image 130 may be imperceptible to a human, the image 130 may be classified by the network into a significantly wrong category. This phenomenon may demonstrate that adversarial examples pose a threat to the deployment of the deep learning networks in safety and security sensitive domains. Thus, adversarial robustness is a critical element of model robustness when it involves defending against potential attacks from malicious adversaries.
[0024] To address this issue, adversarial training (AT) has been presented, which has been proven to be a highly effective defense method against adversarial examples, as it minimizes the worse-case training loss caused by the adversarial examples. For example, in AT, the adversarial examples are generated during the training and are used as the training samples. However, it has been observed that adversarial training may have limited generalization performance when facing with different perturbation budgets or perturbation levels from the adversarial examples.
[0025] This problem arises due to distribution shift between different perturbations. To alleviate this problem, a current method is to fine-tune pre-trained models to fit into a specific data distribution. However, it is commonly observed that the performance gains achieved in a current perturbation setting (e.g., a specific perturbation budget or level) come at the expense of the performance of other perturbation settings. This may indicate that the use of fine-tuning-based methods may result in catastrophic forgetting, where the model’s performance significantly degrades when it is applied to new tasks (e.g., with different data distributions) . It is nontrivial to solve this problem because of the strong trade-off between different perturbation levels.
[0026] FIG. 2 illustrates a schematic diagram for fine-tuning methods. In the fine-tuning method 200, the adversarial examples with different perturbation budgets or levels have different distribution shifts from the benign ones. For example, examples 201 may be the benign data with a perturbation budget of ε0, examples 202 may be the adversarial examples with a perturbation budget of ε1, examples 203 may be the adversarial examples with a perturbation budget of ε2, and so on. The optimal model for each perturbation budget may be obtained from the corresponding training process. For example, initial model 210 with parameters θ0 may be trained over the example 201 (e.g., by performing normal training 220) to obtain the optimal model 211 with parameters For another example, initial model 210 with parameters θ0 may be trained over examples 202 (e.g., by performing adversarial training 230) to obtain the optimal model 212 with parameters For yet another example, initial model 210 with parameters θ0 may be trained over examples 203 (e.g., by performing adversarial training 230) to obtain the optimal model 213 with parameters Fine-tuning 240 may be performed on the pre-trained models (e.g., optimal model 211, optimal model 212, and optimal model 213) , and can adapt the pre-trained models to a specific domain (e.g., data domain of examples 201, 202, or 203) but suffers from the catastrophic forgetting problem.
[0027] In the present disclosure, we study this problem of facing with different perturbation budgets or levels from a new perspective of continual learning. Robustness to various types of noise can be viewed as an incremental domain learning problem, which has been extensively investigated in the field of continual learning. In continual learning, catastrophic forgetting is typically tackled using replay-based or regularization-based methods. Replay-based methods require a buffer to store samples from previous tasks, which becomes computationally expensive as adversarial examples are generated in real-time. On the other hand, regularization-based methods add a regularizer to the loss function to constrain the modification of prior knowledge, but they require prior probability assumptions. To address these limitations, there is a need for a replay-free method with strong transferability. Prompting is a transfer learning method, where prompting directs the model to focus on specific input features with the pre-trained models unmodified.
[0028] FIG. 3 illustrates a schematic diagram for prompting methods compared with the fine-tuning methods, to solve the problem of facing with different perturbation budgets or levels, according to one or more aspects of the present disclosure. The prompting method 300 may offer a new perspective by incorporating additional prompts to reach a new optimal state. For example, instead of changing pre-trained model (e.g., optimal model 212 with parameters ) , a new optimal state 301 having pre-trained parameters incorporated with additional parameters may be obtained by prompt-tuning 310 to fit into examples 201. For another example, instead of changing pre-trained model (e.g., optimal model 212 with parameters ) , another new optimal state 303 having pre-trained parameters incorporated with additional parameters may be obtained by prompt-tuning 310 to fit into examples 203.
[0029] It will be appreciated to those skilled that the description with reference to FIG. 3 is an example just for illustration, and should not be used to limit the scope of the present disclosure. For example, pre-trained model may be the optimal model 211 with parameters and new optimal states and may be obtained to fit into examples 202 and 203, respectively.
[0030] FIG. 4 illustrates a workflow of a method for prompt-based adversarial training of a deep learning model, according to one or more aspects of the present disclosure. The method 400 may be performed on a deep learning model to defense the adversarial examples (e.g., as illustrated in FIG. 1) . At step 410, a deep learning model may be provided with a set of inputs, each of the set of inputs may have been perturbed with a perturbation level or budget (e.g., εi) . For example, the deep learning model may have been trained for a task of classification or recognition for example over benign examples before step 410. Alternatively, the deep learning model may have been trained over both benign and adversarial examples before step 410.
[0031] At step 420, a plurality of groups of prompts may be obtained for the set of inputs, wherein each of the set of inputs may be associated with a corresponding group of the plurality of groups of prompts based on the perturbation level of that input. For example, the perturbation level of each of the set of inputs may be obtained via a detection of each of the set of inputs or information indicating the perturbation level of each of the set of inputs.
[0032] At step 430, the plurality of groups of prompts may be optimized by minimizing a loss function of the deep learning model including the plurality of groups of prompts over the set of inputs. In an aspect of the present disclosure, the prompts may depend on the perturbation budget or perturbation level of the input examples. Incorporating the prompts can direct the deep learning model to focus on specific input features under specific data distribution, such that the generalization performance and / or robustness of the deep learning model to various types of perturbation may be improved.
[0033] FIG. 5 illustrates a schematic framework for the prompt-based adversarial training of a deep learning model, according to one or more aspects of the present disclosure. Framework 500 may be used in or combined with the method 400. Input image 501 may have been perturbed with a perturbation level, even though the changes may be imperceptible to a human. The input image 501 may be passed to a perturbation level detector 510, to obtain the perturbation level of the input image 501. The perturbation level of the input image 501 may then be passed to a prompt pool 520, to obtain a corresponding group of prompts for the input image 501 based on the perturbation level of the input image 501. The corresponding group of prompts may be fed into the pre-trained model 530 along with the input image 501 to perform an adversarial training, during which the parameters of the pre-trained model 530 may be frozen or the majority of parameters of the pre-trained model 530 may be frozen.
[0034] In an aspect of the present disclosure, the prompt pool 520 may be the only trainable module in the framework 500 during the adversarial training. The perturbation level detector 510 may be pre-trained or substituted by other modules to obtain information indicating the perturbation level of the input image. The perturbation level of the input image is introduced to query the proper prompts from the prompts pool 520, to make the prompt selection adaptive to the different data distributions due to different perturbation levels or budgets.
[0035] In other aspects of the present disclosure, the proposed prompt-based methods may not be restricted to handling adversarial examples with different perturbation levels, but also has the capability to handle datasets containing natural noises. In this situation, the perturbation level detector 510 may be used to detect a noise level of the input data.
[0036] For further illustration, given an image x and its corresponding label y, which satisfies the adversarial example xadv is commonly restricted within a norm bound around the benign image as ‖xadv-x‖p≤ε, in which ε is the perturbation level or budget. An adversarial example with perturbation budget ε can be generated by solving
[0037] Where is the loss function of a well-trained classifier with parameter θ.
[0038] To address the optimization problem in Eq. (1) , researchers have proposed various adversarial attack methods, which can be categorized into white-box and black-box attacks based on the knowledge of the target models. Whitebox attacks can leverage the gradient of the loss function and are typically more powerful. Popular white-box attacks include FGSM ( “Explaining and harnessing adversarial examples” by Ian J Goodfellow et al. ) , projected gradient descent (PGD) ( “Towards deep learning models resistant to adversarial attacks” by Aleksander Madry et al. ) , C&W ( “Towards evaluating the robustness of neural networks” by Nicholas Carlini et al. ) , and AutoAttack ( “Reliable evaluation of adversarial robustness with an ensemble of diverse parameter-free attacks” by Francesco Croce et al. ) .
[0039] Typically, one effective defense method is the adversarial training, which involves incorporating adversarial examples as input images during the training process. It can be formulated as a min-max optimization problem as
[0040] In spite of the effectiveness of adversarial training, there exists a trade-off between different perturbation budgets. The models adversarially trained with adversarial examples of a given perturbation budget ε may be more effective to a specific perturbation range than other ranges. That is because the distributions of adversarial examples are different when the perturbation budget changes. Thus, there may need an improvement on the robustness of adversarial training when the perturbation budget changes.
[0041] In one or more aspects of the present disclosure, different from traditional definition of adversarial robustness with a single perturbation budget, the proposed methods formulate it as a continual learning problem with incremental domains. In this way, the adversarial perturbation can be defined as a task index, and all the adversarial and clean examples satisfy a large distribution in which and is generated from the benign image x with perturbation budget ε. Continual learning methods typically maintain a single model and attempts to achieve a balanced optimal solution for all tasks. However, these methods may be less effective when dealing with significant distribution shifts, as the overlap region between several tasks may be small.
[0042] The proposed prompting methods offer a different approach to tackle this problem. For all the tasks (e.g., with different adversarial budgets εi) , prompting will construct a number of task-specific prompts where l is the prompt length and d is the dimension of the prompt, to guide the models to fucus on task-specific features. Given a transformer with parameter θ, the loss function incorporated with prompt Pε as extra parameters can be denoted as Accordingly, the adversarial robustness can be formulated as an optimization problem
[0043] Where parameter θ may be frozen during the process of the optimization, which may be referred to as a prompt-tuning 310, as illustrated via FIG. 3.
[0044] Generally, it may be difficult to find all the prompts, because the perturbation budget ε is continuous. For example, a possible solution is discretizing εand optimizing the corresponding prompts Pε. The original prompts P can be discretized as Together with a prompt selecting function, denoted as q: the optimization problem in Eq. (3) can be simplified as
[0045] Where each element can be optimized in continual learning framework.
[0046] FIG. 6 illustrates a schematic framework for the prompt-based adversarial training of a deep learning model, according to one or more aspects of the present disclosure. The framework 600 may comprise a transformer, which includes a backbone 630 (e.g., comprising a number of layers 631-1, 631-2, …, 631-N) and a head 635. For example, the transformer may have been trained for a task, such as image classification, recognition, or the like. Input image 601 may be sent to a perturbation level detector 610 to predict the perturbation level of the input image 601. The perturbation level detector 610 may have been trained to accurately classify adversarial examples with different perturbation budgets εi. It may use the pre-trained model (e.g., the transformer with parameter θ) as a proxy model to generate adversarial examples. The optimization for the perturbation level detector 610, fn (x) , may be formulated as
[0047] Where θn is the parameter and is the loss function of the perturbation level detector 610, is the adversarial example generated using the pre-trained model and perturbation budget εi.
[0048] The features extracted from the perturbation level detector 610 may be sent to a prompt pool 620. The prompt pool 620 may be organized as a key-value pairing function, where each group of prompts in the prompt pool may be associated with a learnable key as During the continual learning process, the keys are trained to match the features extracted from the perturbation level detector 610, fn (x) , which may be formulated as
[0049] Where D (·, ·) is a function to measure the distance between two vectors, represents the key set of the prompt pool.
[0050] Based on the matching of a key and the features extracted from the perturbation level detector 610, a corresponding group of prompts pairing with the key may be selected to feed into the transformer. On the other hand, the input image 601 may be partitioned into 640 patches to input into the transformer. The selected group of prompts 620-i may be concatenated with the inputs (e.g., including embeddings and features) of each layer. For example, the distances between all keys in the prompt pool and the features extracted from the perturbation level detector 610 may be calculated. The group of prompts with smallest distance may be selected to be prepended before the embedding vectors. With the selected group of prompts, adversarial training may be performed with the pre-trained parameters of the transformer frozen. This process may be similar to normal adversarial training, except that the learnable parameters may be restricted to the prompt pool. During the adversarial training, the prompts can be optimized to guide the transformer towards better robustness.
[0051] It will be appreciated that adding or other operations may be performed on the selected group of prompts and the embedding vectors of the input, without causing a departure of the present disclosure.
[0052] In other aspect of the present disclosure, the selected group of prompts may be sent to only partial layers of the transformer, i.e., a shallow prompt-tuning.
[0053] In yet another aspect of the present disclosure, the parameters of the backbone 630 may be frozen during the adversarial training for optimization of the prompt pool, while the head 635 may be adjusted to achieve a better performance. The adjustment of the head 635 can slightly improve the overall performance because the output of the CLS token may be influenced by prompts, thus requiring a new head layer.
[0054] In an embodiment, a prompt pool may comprise a set of keys and corresponding groups of prompts, which may be organized into key-value pairs. The key may be determined or selected based on a task index indicating the perturbation level, such that repeated selection of a single key may be avoided, and an adaptive selection of a proper key may be achieved. For example, a prompt may be a vector, which may be easily integrated into a deep learning network, such as a transformer and the like. For example, the number of prompts in each group of prompts may be the same, and may equal to 5, 10, 20, 30, 40, or other values.
[0055] In an embodiment, the deep learning model may comprise a vision transformer (e.g., Vision Transformer Small (ViTS) , Vision Transformer Base (ViTB) , or the like) , a deep neural network (DNN) , convolutional neural network (CNN) , or the like.
[0056] In an embodiment, an exemplary algorithm for the proposed method is presented as Algorithm 1.
[0057] For example, the perturbation level detector fn with θn may be trained first to accurately classify adversarial examples with different perturbation levels εi. The pre-trained model prepared for the prompt-tuning process may be used as the proxy model to generate adversarial examples. Once the perturbation level detector fn is trained, the process may move on to the adversarial training, during which the parameters of the pre-trained model may be frozen.
[0058] In an embodiment, the proposed method for prompting may not be restricted to handling adversarial examples with different perturbation levels, but also applicable to handle datasets containing natural noises or out-of-distribution (OOD) robustness. In this scenario, the adversarial level detector may be trained to accurately detect the noise level of input data.
[0059] To further demonstrate the advantages of the present disclosure, experimental results of robust accuracy (%) under white-box attacks are provided in Table 1.
[0060] Table 1
[0061] The experiments are performed on the Swin Transformer Small (SwinS) , Swin Transformer Base (SwinB) , ViTS, ViTB, and XciT models from “Alight recipe to train robust vision transformers” by Edoardo Debenedetti et al, under white-box attacks including PGD and AutoAttack. The perturbation budgets are selected from eps0, eps2, eps4, eps6 and eps8, where epsi indicates ε=i / 255. It reveals that proper prompts guide models to concentrate on task-specific features and improve the overall performance.
[0062] FIG. 7 illustrates an example of a hardware implementation for an apparatus 700 according to one or more aspects of the present disclosure. The apparatus 700 for adversarial training a deep learning model may comprise a memory 710 and at least one processor 720. The processor 720 may be coupled to the memory 710 and configured to implement the methods and / or frameworks 300, 400, 500 and 600 and Algorithm 1 described above with reference to FIGs. 3, 4, 5 and 6. The processor 720 may be a general-purpose processor, or may also be implemented as a combination of computing devices, e.g., a combination of a DSP and a microprocessor, multiple microprocessors, one or more microprocessors in conjunction with a DSP core, or any other such configuration. The memory 710 may store the input data, output data, data generated by processor 720, and / or instructions executed by processor 720.
[0063] The various operations, models, and networks described in connection with the disclosure herein may be implemented in hardware, software executed by a processor, firmware, or any combination thereof. According an embodiment of the disclosure, a computer program product for adversarial training a deep learning model may comprise processor executable computer code for implementation of the methods and / or the frameworks 300, 400, 500 and 600 and Algorithm 1 described above with reference to FIGs. 3, 4, 5 and 6. According to another embodiment of the disclosure, a computer readable medium may store computer code for adversarial training a deep learning model, the computer code when executed by a processor may cause the processor to implement the methods and / or the frameworks 300, 400, 500 and 600 and Algorithm 1 described above with reference to FIGs. 3, 4, 5 and 6. Computer-readable media includes both non-transitory computer storage media and communication media including any medium that facilitates transfer of a computer program from one place to another. Any connection may be properly termed as a computer-readable medium. Other embodiments and implementations are within the scope of the disclosure.
[0064] The preceding description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the various embodiments. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the scope of the various embodiments. Thus, the claims are not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the following claims and the principles and novel features disclosed herein.
Claims
1.A computer-implemented method for a deep learning model, comprising:providing the deep learning model with a set of inputs each perturbed with a perturbation level;obtaining a plurality of groups of prompts for the set of inputs, wherein each of the set of inputs is associated with a corresponding group of the plurality of groups of prompts based on the perturbation level of that input; andoptimizing the plurality of groups of prompts by minimizing a loss function of the deep learning model including the plurality of groups of prompts over the set of inputs.2.The computer-implemented method of claim 1, wherein the obtaining the plurality of groups of prompts for the set of inputs comprises:selecting, from a prompt pool, a group of prompts for one of the set of inputs based on a match of a key for the group of prompts and the perturbation level of the one of the set of inputs.3.The computer-implemented method of claim 2, wherein the prompt pool comprises a set of keys with each key in association with a group of prompts, and wherein the set of keys are trained to match different perturbation levels of the set of inputs.4.The computer-implemented method of claim 2, wherein the deep learning model comprises a transformer having a backbone and a head.5.The computer-implemented method of claim 4, wherein in the optimizing the plurality of groups of prompts by minimizing the loss function of the deep learning model including the plurality of groups of prompts, parameters of the backbone are frozen.6.The computer-implemented method of claim 4, further comprising:adjusting the head in response to the optimizing the plurality of groups of prompts by minimizing a loss function of the deep learning model including the plurality of groups of prompts.7.The computer-implemented method of claim 4, wherein the selected group of prompts are input to all layers or partial layers of the backbone when the one of the set of inputs is provided to the transformer.8.The computer-implemented method of claim 7, wherein the selected group of prompts are concatenated into original input embedding vectors for each layer of the all layers or the partial layers of the backbone.9.A computer-implemented method for a deep learning model, comprising:providing the deep learning model with a set of images each perturbed with a perturbation level, wherein the deep learning model have been trained for image classification;obtaining a plurality of groups of prompts for the set of images, wherein each of the set of images is associated with a corresponding group of the plurality of groups of prompts based on the perturbation level of that image; andoptimizing the plurality of groups of prompts by minimizing a loss function of the deep learning model including the plurality of groups of prompts over the set of images.10.An apparatus for a deep learning model, comprising:a memory; andat least one processor coupled to the memory and configured to perform the method of one of claims 1-8.11.A computer program product for a deep learning model, comprising: processor executable computer code for performing the method of one of claims 1-8.12.A computer readable medium, storing computer code for a deep learning model, the computer code when executed by a processor, causing the processor to perform the method of one of claims 1-8.