Model vulnerability detection method, detection device, electronic device and storage medium

By obtaining the client model parameters at two points in time, calculating the loss function value and updating the data, the problem of cumbersome detection of model vulnerabilities in the existing technology is solved, and the efficiency of quickly detecting data leakage vulnerabilities is achieved.

CN114896602BActive Publication Date: 2024-09-17TSINGHUA SHENZHEN INTERNATIONAL GRADUATE SCHOOL
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210580388.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-26
Publication Date
2024-09-17
Estimated Expiration
2042-05-26

AI Technical Summary

Technical Problem

Existing model vulnerability detection methods require a lot of client data in distributed machine learning. The detection process is cumbersome and has poor practicality. It is especially ineffective when discovering data leakage vulnerabilities.

Method used

By obtaining the client model parameters at two points in time, calculating the loss function value, updating the image and label data until the minimum loss function value is obtained, it is possible to detect whether there are vulnerabilities in the client model.

Benefits of technology

It realizes the rapid detection of data leakage vulnerabilities in the model algorithm, which is more practical. It can obtain the target data through the client model parameters at two points in time, which improves the detection efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114896602B
    Figure CN114896602B
Patent Text Reader

Abstract

The present application discloses a model vulnerability detection method, detection device, electronic device and storage medium. The model vulnerability detection method includes: obtaining randomly generated image data and label data and calculating the model gradient of the cloud model accordingly; obtaining the first model parameter and the second model parameter of the client model, and calculating the loss function value in combination with the model gradient; updating the image data and label data until the minimum loss function value is obtained, and obtaining the corresponding target image data and target label data; detecting model vulnerabilities according to the target image data, target label data and original training data, wherein the first model parameter is the model parameter of the client model at the first time point, and the second model parameter is the model parameter of the client model at the second time point. The target data is obtained through the client model parameters at two time points, so that the data leakage vulnerabilities in the model algorithm can be quickly detected, which is more practical.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of machine learning technology, and in particular to a model vulnerability detection method, detection device, electronic device and storage medium. Background Art

[0002] Distributed machine learning, also known as distributed learning, refers to algorithms and systems that use multiple computing nodes for machine learning or deep learning, aiming to improve performance, protect privacy, and scale to larger training data and larger models.

[0003] In distributed machine learning, existing model vulnerability detection methods usually require more client data (such as model gradients, model parameters, loss functions, optimizers, and hyperparameters such as learning rates). The detection process is cumbersome and has poor practicality in scenarios where data leakage vulnerabilities in models are discovered. Summary of the invention

[0004] The present application aims to solve at least one of the technical problems existing in the prior art. To this end, the present application proposes a model vulnerability detection method, which can obtain target data through client model parameters at two time points, so as to quickly detect data leakage vulnerabilities existing in the model algorithm, which is more practical.

[0005] The present application also proposes a model vulnerability detection device, an electronic device and a storage medium applied to the above-mentioned model vulnerability detection method.

[0006] According to the model vulnerability detection method of the first aspect embodiment of the present application, it includes: obtaining randomly generated image data and label data; calculating the model gradient of the cloud model according to the image data and the label data; obtaining the first model parameter and the second model parameter of the client model; wherein the first model parameter is the model parameter of the client model at the first time point, and the second model parameter is the model parameter of the client model at the second time point; calculating the loss function value according to the model gradient, the first model parameter and the second model parameter; updating the image data and the label data until the minimum loss function value is obtained; obtaining the target image data and the target label data corresponding to the minimum loss function value; and detecting whether the client model has a model vulnerability according to the target image data, the target label data, the original image data and the original label data.

[0007] The model vulnerability detection method according to the embodiment of the present application has at least the following beneficial effects: the target data can be obtained through the client model parameters at two time points, so that the data leakage vulnerabilities existing in the model algorithm can be quickly detected, which is more practical.

[0008] According to some embodiments of the present application, the step of calculating the loss function value based on the model gradient, the first model parameter and the second model parameter includes: obtaining a first ratio based on the model gradient; obtaining a second ratio based on the first model parameter and the second model parameter; and obtaining the loss function value based on the first ratio and the second ratio.

[0009] According to some embodiments of the present application, the step of obtaining a first ratio based on the model gradient includes: calculating the norm of the model gradient to obtain a first norm value; calculating the ratio of the model gradient to the first norm value to obtain the first ratio.

[0010] According to some embodiments of the present application, the step of obtaining a second ratio based on the first model parameter and the second model parameter includes: calculating the difference between the first model parameter and the second model parameter to obtain a first difference; calculating the norm of the first difference to obtain a second norm value; calculating the ratio of the first difference to the second norm value to obtain the second ratio.

[0011] According to some embodiments of the present application, the step of obtaining the loss function value based on the first ratio and the second ratio includes: calculating the difference between the first ratio and the second ratio to obtain the second difference; calculating the norm of the second difference to obtain a third norm value; calculating the square of the third norm value to obtain the loss function value.

[0012] According to some embodiments of the present application, the step of updating the image data and the label data until the minimum loss function value is obtained includes: updating the image data and the label data according to the gradient descent method, and calculating the new model gradient of the cloud model; calculating the new loss function value according to the new model gradient, the first model parameters and the second model parameters; repeating the above steps until the minimum loss function value is obtained.

[0013] According to some embodiments of the present application, the step of detecting whether the client model has a model vulnerability based on the target image data, the target label data, the original image data and the original label data includes: calculating a first difference between the target image data and the original image data; calculating a second difference between the target label data and the original label data; and judging whether the client model has a model vulnerability based on the first difference, the second difference and a corresponding preset threshold.

[0014] According to the second aspect of the present application, a model vulnerability detection device includes: a first data acquisition module, the first data acquisition module is used to acquire randomly generated image data and label data; a data processing module, the data processing module is used to calculate the model gradient of the cloud model according to the image data and the label data; a model parameter acquisition module, the model parameter acquisition module is used to acquire the first model parameter and the second model parameter of the client model; wherein the first model parameter is the model parameter of the client model at the first time point, and the second model parameter is the model parameter of the client model at the second time point; a calculation module, the calculation module is used to calculate the loss function value according to the model gradient, the first model parameter and the second model parameter; a data update module, the data update module is used to update the image data and the label data until the minimum loss function value is obtained; a second data acquisition module, the second data acquisition module is used to acquire the target image data and the target label data corresponding to the minimum loss function value; a detection module, the detection module is used to detect whether the client model has a model vulnerability according to the target image data, the target label data, the original image data and the original label data.

[0015] According to an electronic device of an embodiment of the third aspect of the present application, the electronic device includes: at least one memory; at least one processor; at least one program; the program is stored in the memory, and the processor executes the at least one program to implement: the model vulnerability detection method of the embodiment of the first aspect mentioned above.

[0016] According to the storage medium of the fourth aspect embodiment of the present application, the storage medium is a computer-readable storage medium, and the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute: as the model vulnerability detection method of the first aspect embodiment mentioned above.

[0017] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] The present application is further described below with reference to the accompanying drawings and embodiments, wherein:

[0019] Figure 1 A flowchart of an embodiment of the model vulnerability detection method of the present application;

[0020] Figure 2 for Figure 1 The flowchart of step S400 is shown as an embodiment;

[0021] Figure 3 for Figure 2The flowchart of one embodiment of step S410 is shown;

[0022] Figure 4 for Figure 2 The flowchart of step S420 is shown as an embodiment;

[0023] Figure 5 for Figure 2 The flowchart of step S430 is shown as an embodiment;

[0024] Figure 6 for Figure 1 The flowchart of step S500 is shown as an embodiment;

[0025] Figure 7 for Figure 1 The flowchart of step S700 is shown as an embodiment;

[0026] Figure 8 A module diagram of an embodiment of a model vulnerability detection device of the present application;

[0027] Fig. 9 This is a schematic diagram of the hardware structure of an embodiment of the electronic device of the present application.

[0028] Reference numerals:

[0029] A first data acquisition module 100, a data processing module 200, a model parameter acquisition module 300, a calculation module 400; a data update module 500, a second data acquisition module 600, and a detection module 700. DETAILED DESCRIPTION

[0030] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present application, and cannot be understood as limiting the present application.

[0031] In the description of this application, "several" means more than one, "more" means more than two, "greater than", "less than", "exceed", etc. are understood to exclude the number itself, and "above", "below", "within", etc. are understood to include the number itself. If there is a description of "first" or "second", it is only used for the purpose of distinguishing technical features, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features or implicitly indicating the order of the indicated technical features.

[0032] In the description of this application, unless otherwise clearly defined, terms such as setting, installing, connecting, etc. should be understood in a broad sense, and technicians in the relevant technical field can reasonably determine the specific meanings of the above terms in this application based on the specific content of the technical solution.

[0033] The model vulnerability detection method of the embodiment of the present application can be applied to distributed machine learning. Distributed machine learning, also known as distributed learning, refers to the algorithm and system for machine learning or deep learning using multiple computing nodes, which aims to improve performance, protect privacy, and can be extended to larger-scale training data and larger models. Distributed machine learning can simplify the machine learning process of large models and high data volumes. In distributed machine learning, multiple local clients (i.e., computing nodes) can perform local model training in parallel based on independent training data, and then upload the gradient data obtained by training to the parameter server (i.e., the cloud). After receiving the gradient data calculated by each local client, the parameter server aggregates the total gradient, updates the model with it, and then sends the updated model to each local client. Thus, in the case where each client does not explicitly share the original data, a model with the same performance as the model trained using the original data of all clients is obtained, and time is saved. However, there are certain security risks in distributed machine learning. If there are loopholes in the model algorithm, and a third-party attacker obtains the model parameters, model gradients and other data of the local client, the original training data of the local client can be restored, thereby stealing the privacy of the local client.

[0034] In the related technology, vulnerability checking is performed by simulating the process of attackers recovering data to steal privacy. Existing model vulnerability detection methods usually require more client data (such as model gradients, model parameters, loss functions, optimizers, learning rates and other hyperparameters), and the detection process is relatively cumbersome. And with the upgrading of related technologies, the process of attackers stealing private data does not require as many types of data as before, and there may be situations where model vulnerabilities exist but are not detected. Therefore, the existing vulnerability detection methods are less practical in the context of discovering data leakage vulnerabilities in models.

[0035] Based on this, the present application proposes a model vulnerability detection method, detection device, electronic device and storage medium, which can obtain target data through client model parameters at two time points, so as to quickly detect data leakage vulnerabilities in the model algorithm, which is more practical.

[0036] Some embodiments, see Figure 1 ,Model vulnerability detection methods include:

[0037] S100, obtaining randomly generated image data and label data;

[0038] S200, calculating a model gradient of a cloud model according to the image data and the label data;

[0039] S300, obtaining a first model parameter and a second model parameter of a client model; wherein the first model parameter is a model parameter of the client model at a first time point, and the second model parameter is a model parameter of the client model at a second time point;

[0040] S400, calculating a loss function value according to a model gradient, a first model parameter, and a second model parameter;

[0041] S500, updating the image data and label data until a minimum loss function value is obtained;

[0042] S600, obtaining target image data and target label data corresponding to the minimum loss function value;

[0043] S700, detecting whether a client model has a model vulnerability according to the target image data, the target label data, the original image data and the original label data.

[0044] For step S100, in machine learning, image processing models are widely used, and image processing tasks are also the main application direction of machine learning technology. In image processing tasks, the model needs to be trained by images and corresponding labels. The randomly generated image data and label data in the embodiment of the present application correspond to them, but compared with the original training data, the randomly generated image data is irregular and the label data is also wrong.

[0045] For step S200, the cloud model is the model updated by the parameter server according to the gradient data uploaded by each local client, and the model gradient of the cloud model is the total gradient aggregated from the model gradients of each local client. Different image data and label data correspond to different model gradient values.

[0046] For step S300, the first model parameter and the second model parameter are model parameters obtained after the local client performs model training. It should be noted that the first model parameter and the second model parameter of this embodiment are from the same client model.

[0047] For step S400, the loss function is a calculation function used to measure the degree of difference between the predicted value of the model and the true value. In an embodiment of the present application, the loss function is constructed by the model gradient, the first model parameter and the second model parameter of the cloud model, and the loss function value is calculated. The size of the loss function value can represent the degree of difference between the randomly generated image data, the label data and the original training data of the client.

[0048] For step S500, it can be understood that there must be differences between the randomly generated image data, label data and the original training data of the client. Therefore, the image data and label data are updated in a certain way in the direction of reducing the difference, so that the loss function value becomes smaller until the minimum loss function value is obtained.

[0049] For step S600, as the image data and label data are repeatedly updated to reduce the loss function value, the originally irregular image data and erroneous label data will gradually approach the real original training data. When the loss function value is the smallest, the image data and label data at this time can be approximately regarded as the same as the original training data, that is, the target image data and target label data are obtained. And the accuracy of the obtained target image data and target label data is higher than that of the existing similar methods that require more client data.

[0050] For step S700, the original image data and the original label data are the original training data of the local client. It should be noted that this step can be performed in the cloud if the client is willing to provide the original image data and the original label data. The target image data and the target label data can also be sent from the cloud to the local client and performed by the client. If a vulnerability is detected, some methods can be used to enhance the security of data transmission, such as differential privacy encryption or sparsification when the local client uploads data.

[0051] It should be noted that, in the case of multiple clients, the model parameters of each client at two different time points can be obtained, and a set of target image data and target label data corresponding to each other can be obtained through the above steps, that is, a set of target image data and target label data is generated for each client. This allows for more comprehensive model vulnerability detection.

[0052] The model vulnerability detection method of the embodiment of the present application has at least the following beneficial effects: it can obtain target data through the client model parameters at two time points, so that data leakage vulnerabilities existing in the model algorithm can be quickly detected, and it is more practical.

[0053] Some embodiments, see Figure 2 , step S400 includes:

[0054] S410, obtaining a first ratio according to a model gradient;

[0055] S420, obtaining a second ratio according to the first model parameter and the second model parameter;

[0056] S430: Obtain a loss function value according to the first ratio and the second ratio.

[0057] For step S410, step S420 and step S430, the difference between the first model parameter and the second model parameter is the product of the model gradient of the client model and the learning rate. The method of converting to a ratio is to eliminate the learning rate, thereby approximating the model gradient of the client model. Therefore, the model vulnerability detection method of the embodiment of the present application does not need to obtain the learning rate data of the client.

[0058] Some embodiments, see Figure 3 , step S410 includes:

[0059] S411, calculating the norm of the model gradient to obtain a first norm value;

[0060] S412, calculating the ratio of the model gradient to the first norm value to obtain a first ratio.

[0061] For step S411 and step S412, the gradient of the model is a vector, and its norm is its Euclidean norm. In order to correspond to the model gradient of the client model, the model gradient of the cloud model is converted to obtain a first ratio.

[0062] The calculation formula for the first ratio is:

[0063]

[0064] For formula (1), Y1 represents the first ratio, represents randomly generated image data, represents randomly generated label data, l(·) represents the cloud model, Represents the model gradient of the cloud model corresponding to time point t of client k (kth client).

[0065] Some embodiments, see Figure 4 , step S420 includes:

[0066] S421, calculating the difference between the first model parameter and the second model parameter to obtain a first difference value;

[0067] S422, calculating the norm of the first difference value to obtain a second norm value;

[0068] S423, calculating the ratio of the first difference value to the second norm value to obtain a second ratio.

[0069] For step S421, step S422 and step S423, the difference between the first model parameter and the second model parameter is the product of the model gradient of the client model and the learning rate. The method of converting to a ratio is to eliminate the learning rate, thereby approximating the model gradient of the client model. Therefore, the model vulnerability detection method of the embodiment of the present application does not need to obtain the learning rate data of the client.

[0070] The calculation formula for the second ratio is:

[0071]

[0072] For formula (2), Y2 represents the second ratio, represents the model parameters of client k (kth client) at time point t, i.e., the first model parameters, It represents the model parameters of client k (kth client) at time point t+1, that is, the second model parameters.

[0073] Some embodiments, see Figure 5 , step S430 includes:

[0074] S431, calculating the difference between the first ratio and the second ratio to obtain a second difference;

[0075] S432, calculating the norm of the second difference value to obtain a third norm value;

[0076] S433, calculate the square of the third norm value to obtain the loss function value.

[0077] For step S431, step S432 and step S433, the loss function value is the variance of the first ratio and the second ratio, and the calculation formula of the loss function value is:

[0078]

[0079] For formula (3), L(·) represents the loss function, represents randomly generated image data, represents randomly generated label data, Y1 represents the first ratio, and Y2 represents the second ratio.

[0080] Substituting formula (1) and formula (2) into formula (3), we get:

[0081]

[0082] For formula (4), L(·) represents the loss function, represents randomly generated image data, represents randomly generated label data, l(·) represents the cloud model, represents the model gradient of the cloud model corresponding to time point t of client k (kth client), represents the model parameters of client k (kth client) at time point t, i.e., the first model parameters, It represents the model parameters of client k (kth client) at time point t+1, that is, the second model parameters.

[0083] Some embodiments, see Figure 6 , step S500 includes:

[0084] S510, updating the image data and label data according to the gradient descent method, and calculating the new model gradient of the cloud model;

[0085] S520, calculating a new loss function value according to the new model gradient, the first model parameter and the second model parameter;

[0086] S530, repeat the above steps until the minimum loss function value is obtained.

[0087] For step S510, step S520 and step S530, the gradient descent method is a first-order optimization algorithm. To use the gradient descent method to find the local minimum of a function, it is necessary to iteratively search for points at a specified step distance in the opposite direction of the gradient (or approximate gradient) corresponding to the current point on the function. It is understandable that there must be differences between the randomly generated image data and label data and the original training data of the client. Therefore, the image data and label data are updated in the direction of reducing the difference through the gradient descent method, and the model gradient and the new loss function value in the cloud are recalculated to reduce the loss function value until the minimum loss function value is obtained.

[0088] Some embodiments, see Figure 7 , step S700 includes:

[0089] S710, calculating a first difference between target image data and original image data;

[0090] S720, calculating a second difference between the target label data and the original label data;

[0091] S730: Determine whether the client model has a model vulnerability according to the first difference, the second difference and the corresponding preset threshold.

[0092] For step S710, step S720 and step S730, the calculation method of the first difference and the second difference can be selected according to the application scenario of the model. For example, the variance of a single image data or label data can be calculated and compared one by one. If a vulnerability is detected, some methods can be used to enhance the security of data transmission, such as differential privacy encryption or sparsification when the local client uploads data.

[0093] Some embodiments, see Figure 8The model vulnerability detection device includes: a first data acquisition module 100, a data processing module 200, a model parameter acquisition module 300, a calculation module 400, a data update module 500, a second data acquisition module 600 and a detection module 700, wherein the first data acquisition module 100 is used to acquire randomly generated image data and label data; the data processing module 200 is used to calculate the model gradient of the cloud model according to the image data and the label data; the model parameter acquisition module 300 is used to acquire the first model parameter and the second model parameter of the client model; wherein the first model parameter is the model parameter of the client model at the first time point, and the second model parameter is the model parameter of the client model at the second time point; the calculation module 400 is used to calculate the loss function value according to the model gradient, the first model parameter and the second model parameter; the data update module 500 is used to update the image data and the label data until the minimum loss function value is obtained; the second data acquisition module 600 is used to acquire the target image data and the target label data corresponding to the minimum loss function value; the detection module 700 is used to detect whether the client model has a model vulnerability according to the target image data, the target label data, the original image data and the original label data.

[0094] The model vulnerability detection device of the embodiment of the present application has at least the following beneficial effects: it can obtain target data through the client model parameters at two time points, so that data leakage vulnerabilities existing in the model algorithm can be quickly detected, and it is more practical.

[0095] In some embodiments, the electronic device comprises:

[0096] at least one memory;

[0097] at least one processor;

[0098] at least one program;

[0099] The program is stored in the memory, and the processor executes at least one program to implement: a model vulnerability detection method as described in any of the above embodiments. The electronic device can be any intelligent terminal including a mobile phone, a tablet computer, a personal digital assistant (PDA), a car computer, etc.

[0100] An embodiment, referring to Fig. 9 , Fig. 9 The hardware structure of an electronic device of another embodiment is illustrated, and the electronic device includes:

[0101] The processor may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application;

[0102] The memory can be implemented in the form of ROM (Read Only Memory), static storage device, dynamic storage device or RAM (Random Access Memory). The memory can store operating systems and other applications. When the technical solutions provided in the embodiments of this specification are implemented by software or firmware, the relevant program codes are stored in the memory, and the processor calls and executes the model vulnerability detection method of any of the above embodiments of this application;

[0103] Input / output interface, used to realize information input and output;

[0104] Input / communication interface, used to realize communication interaction between this device and other devices, which can be realized through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.);

[0105] The bus, which transfers information between the various components of the device (such as the processor, memory, input / output interfaces, and input / communication interfaces);

[0106] The processor, memory, input / output interface and input / communication interface are connected to each other through a bus inside the device.

[0107] In some embodiments, the storage medium is a computer-readable storage medium, and the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute: a model vulnerability detection method such as any of the above embodiments.

[0108] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0109] The embodiments described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.

[0110] Those skilled in the art will appreciate that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.

[0111] The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0112] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.

[0113] It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "comprise" and "have" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0114] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.

[0115] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0116] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0117] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0118] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including multiple instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM), disk or optical disk and other media that can store programs.

[0119] In the description of the present application, the description with reference to the term "some embodiments" or "an embodiment" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.

[0120] The embodiments of the present application are described in detail above in conjunction with the accompanying drawings, but the present application is not limited to the above embodiments. Various changes can be made within the knowledge of ordinary technicians in the relevant technical field without departing from the purpose of the present application. In addition, the embodiments of the present application and the features in the embodiments can be combined with each other without conflict.

Claims

1. A model vulnerability detection method, characterized in that: include: Get randomly generated image data and label data; Calculate a model gradient of a cloud model according to the image data and the label data; Acquire a first model parameter and a second model parameter of a client model; wherein the first model parameter is a model parameter of the client model at a first time point, and the second model parameter is a model parameter of the client model at a second time point; Calculate a loss function value according to the model gradient, the first model parameter and the second model parameter; Updating the image data and the label data until a minimum loss function value is obtained; Acquire target image data and target label data corresponding to the minimum loss function value; Detecting whether the client model has a model vulnerability according to the target image data, the target label data, the original image data, and the original label data; Wherein, the step of calculating the loss function value according to the model gradient, the first model parameter and the second model parameter comprises: Obtaining a first ratio according to the model gradient; wherein the step of obtaining the first ratio according to the model gradient comprises: calculating the norm of the model gradient to obtain a first norm value; calculating the ratio of the model gradient to the first norm value to obtain the first ratio; A second ratio is obtained according to the first model parameter and the second model parameter; wherein the step of obtaining the second ratio according to the first model parameter and the second model parameter comprises: calculating the difference between the first model parameter and the second model parameter to obtain a first difference; calculating the norm of the first difference to obtain a second norm value; calculating the ratio of the first difference to the second norm value to obtain the second ratio; The loss function value is obtained according to the first ratio and the second ratio; wherein the step of obtaining the loss function value according to the first ratio and the second ratio comprises: calculating the difference between the first ratio and the second ratio to obtain the second difference; calculating the norm of the second difference to obtain the third norm value; calculating the square of the third norm value to obtain the loss function value.

2. The model vulnerability detection method according to claim 1, characterized in that: The step of updating the image data and the label data until a minimum loss function value is obtained comprises: Updating the image data and the label data according to the gradient descent method, and calculating a new model gradient of the cloud model; Calculate a new loss function value according to the new model gradient, the first model parameter and the second model parameter; Repeat the above steps until the minimum loss function value is obtained.

3. The model vulnerability detection method according to claim 1, characterized in that: The step of detecting whether the client model has a model vulnerability according to the target image data, the target label data, the original image data and the original label data comprises: Calculating a first difference between the target image data and the original image data; Calculating a second difference between the target label data and the original label data; Whether the client model has a model vulnerability is determined according to the first difference, the second difference and a corresponding preset threshold.

4. A model vulnerability detection device, characterized in that: include: A first data acquisition module, the first data acquisition module is used to acquire randomly generated image data and label data; A data processing module, the data processing module is used to calculate a model gradient of a cloud model according to the image data and the label data; A model parameter acquisition module, the model parameter acquisition module is used to acquire a first model parameter and a second model parameter of a client model; wherein the first model parameter is a model parameter of the client model at a first time point, and the second model parameter is a model parameter of the client model at a second time point; A calculation module, wherein the calculation module is used to calculate a loss function value according to the model gradient, the first model parameter and the second model parameter; A data updating module, wherein the data updating module is used to update the image data and the label data until a minimum loss function value is obtained; A second data acquisition module, the second data acquisition module is used to acquire target image data and target label data corresponding to the minimum loss function value; A detection module, the detection module is used to detect whether the client model has a model vulnerability according to the target image data, the target label data, the original image data and the original label data; The step of calculating the loss function value according to the model gradient, the first model parameter and the second model parameter includes: Obtaining a first ratio according to the model gradient; wherein obtaining the first ratio according to the model gradient comprises: calculating the norm of the model gradient to obtain a first norm value; calculating the ratio of the model gradient to the first norm value to obtain the first ratio; Obtaining a second ratio according to the first model parameter and the second model parameter; wherein obtaining the second ratio according to the first model parameter and the second model parameter comprises: calculating a difference between the first model parameter and the second model parameter to obtain a first difference; calculating a norm of the first difference to obtain a second norm value; calculating a ratio of the first difference to the second norm value to obtain the second ratio; The loss function value is obtained according to the first ratio and the second ratio; wherein, the loss function value is obtained according to the first ratio and the second ratio, including: calculating the difference between the first ratio and the second ratio to obtain the second difference; calculating the norm of the second difference to obtain the third norm value; calculating the square of the third norm value to obtain the loss function value.

5. An electronic device, characterized in that include: at least one memory; at least one processor; at least one program; The program is stored in the memory, and the processor executes the at least one program to implement: A model vulnerability detection method as claimed in any one of claims 1 to 3.

6. Storage medium, the storage medium is a computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to cause a computer to execute: A model vulnerability detection method as claimed in any one of claims 1 to 3.