Neural network distributed encryption and its anti-collusion attack method
Through neural network black box watermarking technology and equivalent transformation, the problems of property rights tracking and collusion attacks in neural network model distribution are solved, and an efficient and secure property rights protection and model distribution framework is realized, which is suitable for black box scenarios.
Patent Information
- Application Number
- CN202210536262.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-17
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2042-05-17
AI Technical Summary
Existing neural network watermarking technology is difficult to effectively track and verify property rights issues in model distribution in black-box scenarios, especially during collusion attacks, and existing solutions require access to internal details of the model, which is not very practical.
Using dual verification technology of user fingerprint and model fingerprint based on neural network black box watermark, combined with adversarial sample generation algorithm and hash algorithm, user fingerprint and model fingerprint are generated, and equivalent transformation is performed through convolution layer confusion transformation and BN layer scaling transformation technology to implement a neural network model distribution framework that is resistant to collusion attacks.
It achieves efficient property rights tracking and verification in black box scenarios, resists collusion attacks, and does not require access to internal details of the model, improving the security and practicality of model distribution.
Smart Images

Figure CN114880642B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical fields of deep neural networks, machine learning, information security, etc., and in particular relates to a neural network distribution encryption and its anti-conspiracy attack method. Background Art
[0002] In recent years, deep neural network (DNN) technology has achieved remarkable results in computer vision, speech recognition, and natural language processing. With the commercialization of artificial intelligence, more and more neural network products have been put into use. However, a well-trained neural network requires a large data set, expensive computing resources, expertise, and research costs. Therefore, private or small companies that lack a large number of high-quality training sets or are limited by computing resources and expert resources may purchase related services from outside. On the other hand, some technology companies have begun to sell machine learning models directly, or share / distribute their pre-trained neural network models to promote academic exploration in the field of artificial intelligence, but they are worried that the model will be resold or leaked without authorization.
[0003] Digital watermarking technology is a recognizable digital signal embedded in host data. The application of watermarking technology mainly includes copyright protection, data monitoring and data tracking. In recent years, some scholars have proposed embedding digital watermarks in neural networks to protect the intellectual property rights of neural networks. From the current perspective, neural network model watermarking technology is still in the early stages of development and is not perfect in theory and practical application. The existing proposed methods have many limitations, and attackers still have a variety of ways to attack existing protection methods. Therefore, neural network watermarking urgently needs to be developed to protect the intellectual property issues caused by the explosive growth and use of artificial intelligence in the future.
[0004] The watermarking technologies proposed so far can be divided into two categories: white-box watermarking and black-box watermarking. The mainstream white-box watermarking scheme embeds the watermark information into the weight probability distribution of the neural network, and usually requires access to the structure and weight parameters of the adversary model during the watermark extraction stage. The working principle of the black-box neural network watermark is to create a trigger set, carrier or key data set, which will cause the target model to produce abnormal prediction behavior. This unusual output can be used to identify illegal copy models. In contrast, black-box watermarking only requires access to the input and output of the model, so it is more practical.
[0005] Uchida et al. [1] The first proposed DNNs watermarking scheme uses T-bit binary numbers {0,1} T As a watermark, and use a combined loss function including embedding regularization loss in the embedding process to represent the watermark by imposing statistical bias on certain parameters of the model through regularization loss.[2] For the first time, an end-to-end collusion-secure watermarking framework is proposed, which assigns a unique binary anti-collusion coded fingerprint to each user and embeds this fingerprint coding information into the probability distribution of DNN weights. It can effectively track the usage of each user model in the white-box scenario and detect specific illegal users involved in collusion attacks.
[0006] In the black box scenario, backdoor techniques and adversarial samples are also used as watermarking methods to protect ownership. Adi et al. [3] , add abstract samples with different distribution from the training set as backdoor samples to the model training set, embed such abstract samples as backdoor trigger sets in the model training or fine-tuning stage, and use them as a set of watermarks to verify the ownership of DNNs. Zhang et al. [4] , proposed a backdoor sample processing method based on text trigger sets, noise and irrelevant samples, and then used such a specific trigger set to verify ownership. Once the hit rate of the neural network on the trigger set is greater than a set threshold, the ownership of the model can be basically determined. However, most trigger samples and trigger labels based on black box scenarios are often unrelated, which means that the adversary can also fine-tune the neural network to embed another set of trigger sets for forgery attacks, thereby confusing ownership verification. Therefore, Zhu et al. [5] ,An anti-forgery attack trigger set generation algorithm is proposed, which associates samples with labels through a hash algorithm and associates samples with each other, making it difficult for the adversary to forge another set of trigger sets.
[0007] The existing work mainly solves the problem of proof of ownership of a single model, but ignores the intellectual property tracking, source tracing and possible collusion security issues brought about by multiple sub-models generated in the model distribution scenario. [2] As the first end-to-end collusion-safe neural network distribution framework, anti-collusion encoded information is used as a fingerprint information and embedded into the distribution model by introducing an additional regularized loss function. When illegal users try to aggregate the models they distribute to generate collusion models, that is, attackers try to erase the embedded watermark / fingerprint information to evade ownership detection while retaining the original performance of the model, the model owner can find out which specific users are involved in the collusion attack by extracting the weight parameters of the collusion model. However, the fingerprint verification process of existing schemes requires that the model owner can access the internal details of the suspicious model, such as network structure, parameters, etc., which is often unrealistic. Therefore, DeepMarks is a neural network distribution system in a white-box scenario. Whether it is to track the use of the distribution model or to detect ownership detection of participants involved in the collusion attack, it is necessary to extract the parameters of the target model, so it is not very practical in real life.
[0008] References:
[0009] [1] Uchida Y, Nagai Y, Sakazawa S, et al. Embedding watermarks into deep neural networks[C] / / Proceedings of the 2017 ACM on International Conference on Multimedia Retrieval. 2017:269 - 277.
[0010] [2] Chen H, Rouhani B D, Fu C, et al. Deepmarks: A secure fingerprinting framework for digital rights management of deep learning models[C] / / Proceedings of the 2019 on International Conference on Multimedia Retrieval. 2019:105 - 113.
[0011] [3] Adi Y, Baum C, Cisse M, et al. Turning your weakness into a strength: Watermarking deep neural networks by backdooring[C] / / 27th USENIX Security Symposium(USENIX Security 18). 2018:1615 - 1631.
[0012] [4] Zhang J, Gu Z, Jang J, et al. Protecting intellectual property of deep neural networks with watermarking[C] / / Proceedings of the 2018 on Asia Conference on Computer and Communications Security. 2018:159 - 172.
[0013] [5] Zhu R, Zhang X, Shi M, et al. Secure neural network watermarking protocol against forging attack[J]. EURASIP Journal on Image and Video Processing, 2020, 2020(1): 1-12.
[0014] [6] Goodfellow IJ, Shlens J, Szegedy C. Explaining and harnessing adversarial examples[J]. arXiv preprint arXiv:1412.6572, 2014.
[0015] [7] Carlini N, Wagner D. Towards evaluating the robustness of neural networks[C] / / 2017 ieee symposium on security and privacy(sp). IEEE, 2017: 39-57.
[0016] [8] Zeiler MD, Fergus R. Visualizing and understanding convolutional networks[C] / / European conference on computer vision. Springer, Cham, 2014: 818-833.
[0017] Ioffe S, Szegedy C. Batch normalization: Accelerating deep network training by reducing internal covariate shift[C] / / International conference on machine learning. PMLR, 2015: 448-456. Summary of the Invention
[0018] In order to make up for the gaps and deficiencies in the prior art, the present invention proposes a neural network distribution encryption and anti-conspiracy attack method, which provides a neural network model distribution and property rights protection framework that is anti-conspiracy attack based on neural network watermarking and model equivalent transformation. It is used to solve the property rights disputes and possible collusion attack threats caused by the distribution or sale of neural network models.
[0019] Aiming at the problem of neural network model distribution, an efficient neural network model distribution framework is proposed that resists collusion attacks and supports property rights tracking and verification. In this scheme, it is assumed that the owner of the neural network model has one or more well-trained models and wants to distribute or sell them to multiple users at the same time. The purpose is that when the distributed model is resold or leaked without authorization, the owner can track the property rights and find the infringing user. In addition, the models distributed to different users can resist malicious collusion attacks.
[0020] Based on the neural network black box watermarking technology, the user fingerprint is constructed, and based on the adversarial sample technology, the model fingerprint of the source model is extracted, thereby providing a dual fingerprint verification technology for the neural network model. The dual fingerprint verification technology provides the property rights traceability and tracking function from coarse-grained to fine-grained. In addition, two anti-collusion equivalent transformation technologies based on the neural network structure are proposed to achieve active defense against collusion attacks.
[0021] The framework designs a user fingerprint (watermark) generation and a model fingerprint extraction technology to provide dual fingerprint verification functions, thereby providing more reliable property rights protection. In addition, in response to the threat of collusion attacks, this framework provides two anti-collusion attack neural network equivalent transformation technologies to achieve active defense against malicious attacks. Therefore, this solution technology can quickly generate a series of collusion-safe and property rights-safe sub-models for distribution or sale with a small amount of computing resources for one source model or multiple source models.
[0022] This neural network model distribution and property protection framework, which is based on neural network watermarking and model equivalent transformation and is resistant to collusion attacks, allows model owners to generate multiple variants of neural network sub-models for distribution or sale through one or more source models and a small amount of computing resources. At the same time, for these distributed models, the framework also provides a property protection technology based on double fingerprints in a black box scenario, providing support for the property tracing, tracking and verification of the distributed models. In addition, two new types of equivalent transformations based on the structure of the neural network model are proposed, which can be applied to the generated series of sub-models to effectively solve the collusion attacks and reverse attacks between multiple models.
[0023] The present invention specifically adopts the following technical solutions:
[0024] A neural network distribution encryption method, characterized by comprising: a neural network model owner, a plurality of users to be distributed;
[0025] The model owner uses an adversarial sample generation algorithm to extract n adversarial sample and label pairs on the neural network source model as a set of model fingerprint information;
[0026] The model owner generates a key for each user to be distributed, and then generates a series of sample label pairs different from the original data set through the key as a set of unique fingerprints that are different from other users to be distributed; multiple users have their own user fingerprints, but share the same set of model fingerprints; the generation information of user fingerprints and model fingerprints belongs only to the model owner;
[0027] The model owner copies a source model based on the generated user fingerprint, and embeds the corresponding user fingerprint into the neural network after fine-tuning the copied model.
[0028] Furthermore, the following algorithm is used to extract adversarial samples:
[0029] minimize||x-x'|| 2 +c·f(x'), (1)where,
[0030] f(x')=max(max{Z(x') i :i≠t}-Z(x') t ,-k) (2)
[0031] In formula (1), x'=x+σ is the target adversarial sample, and Z(x') represents the output of the adversarial sample x' before it enters the softmax layer of the source neural network. i Represents the output of the i-th neuron before the softmax layer; Z(x') t Represents the output of the tth neuron corresponding to the target adversarial sample label subscript; k is a hyperparameter for adjusting the transferability of adversarial samples. By adjusting the appropriate k, a group of adversarial samples can be extracted as the source model fingerprint.
[0032] Furthermore, assuming that from the source model M source The extracted set of model fingerprints is FP model ={(img 1 ,target 1 ),(img 2 ,target 2 ),...,(img n ,target n )}; and there is a sub-model distributed to users Using Model Fingerprint FP model Validating sub-models The algorithm is as follows (3):
[0033]
[0034] When x=y, g(x,y)=1, otherwise g(x,y)=0; if is greater than a preset threshold, indicating that the submodel Generated from the source model of the model owner.
[0035] Furthermore, the specific method for generating the user fingerprint is:
[0036] Assume that the model owner assigns a unique original image to each user and two keys Key 1 、Key 2 , and use two different hash algorithms Hash 1 、Hash 2 , where Hash 1 The output is an image, Hash 2 The output is a positive integer;
[0037] As shown in the following formula (4), the hash algorithm Hash 1 The initial input parameter is the key image and the hash key Key 1 Generate the first hash image ρ 1 , and then the hash algorithm Hash 1 Output ρ 1 and Key 2 As a hash algorithm 2 The input gets the corresponding label ω 1 , as shown in formulas (6) and (7); and so on, the first hash image ρ generated 1 and Key 1 Through the hash algorithm Hash 1 Get the mth hash image, and similarly get the corresponding mth label, where N is the number of label categories of the data set used by the target neural network model:
[0038]
[0039] ω 1 =Hash 2 (ρ 1 ,Key 2 )%N,m=1 (5)
[0040] ρ m=Hash 1 (ρ m-1 ,Key 1 ),m=2,3,… (6)
[0041] ω m =Hash 2 (ω m-1 ,Key 2 )%N,m=2,3,… (7)
[0042] For multiple different users, the model owner generates m sample label pairs for each user, and uses them as the fingerprints of the corresponding users for tracking the property rights of the sub-models and detecting infringements.
[0043] Furthermore, the method of embedding the user fingerprint into the neural network is:
[0044] Assume that the user fingerprint set generated by the model owner for user 1 is: FP user1 ={(img 1 ,target 1 ),(img 2 ,target 2 ),...,(img n ,target n )}; The model owner copies a copy of the source model as At this time, the sub-model Fingerprints are not embedded yet; next, the child model is fine-tuned using the full dataset of the source model trained by the model owner Specifically, the sub-model is fine-tuned for E rounds, where the loss function used for the first F rounds of fine-tuning for E rounds is:
[0045] L emd =L basic +γ·L cossim (8)
[0046]
[0047] Among them, L basic is the loss function of the original task; L cossim is an additional cosine similarity loss, which is used to prevent the first anti-collusion equivalent transformation, i.e., the convolutional layer confusion transformation, from being reversed attacked by malicious users;
[0048] The model owner first selects a neural network structure that can perform convolutional layer confusion transformation. Assume that the target neural network has a structure with n convolutional layer confusion transformations, and its parameter set is T s ={T 1 ,T 2 ,T 3 ,…,Tn}; Randomly generate a corresponding vector set For the set T s and The elements with corresponding subscripts in have the same tensor shape;
[0049] Suppose there is a parameter of a certain structure and the corresponding random vector in is the filter of the layer i A random tensor with the same shape, m is the number of filters in this layer, that is, the number of channels;
[0050] For each user, a corresponding key is generated to convert the random vector Randomly shuffle and finally generate a scrambled random vector for user 1 And use random vectors while embedding user fingerprints Apply cosine similarity loss to the parameters T of the corresponding layer of the source neural network model; where γ is a function used to adjust the original loss function L basic And the cosine similarity loss term L cossim The hyperparameter of the loss ratio;
[0051] In order to ensure that the user fingerprint embedding does not affect the original accuracy of the neural network model, in each training batch of each fine-tuning round, FP user1 A pair of image labels in the batch are added to participate in the training. If the batch is larger than FP user1 The number of image label pairs in , then continue to take FP from the beginning user1 ; The process of embedding user fingerprints is divided into two stages. The first stage uses L emd The loss function fine-tunes the sub-model in round E. In the second stage, only L is used in the subsequent round EF fine-tuning. basic Make fine adjustments.
[0052] A neural network distribution anti-conspiracy attack method is based on the neural network distribution encryption method as described above, and another set of keys is generated for each user. This set of keys is used to perform anti-conspiracy equivalent transformation, and then the final model is distributed to the user.
[0053] Furthermore, the convolutional layer equivalent obfuscation transformation is used to perform anti-collusion equivalent transformation, that is, a unique obfuscation key is generated for each user, and the key contains secret position exchange information on multiple two-layer convolution structures.
[0054] Furthermore, the BN layer equivalent scaling transformation is used to perform anti-collusion equivalent transformation:
[0055] Assume that the parameters of the BN layer in one channel of a certain layer of the owner source model are fixed to γ, β, μ, σ; when the feature output of the input of the channel is x, and the output after the BN layer regularization calculation is y, there is the following equivalent change calculation:
[0056]
[0057] And it is derived into the following equivalent formula:
[0058]
[0059]
[0060]
[0061] in
[0062] x'=ax (20)
[0063]
[0064]
[0065] σ' 2 =b 2 σ 2 +(b 2 -1)∈ (23)
[0066] β'=cβ (24)
[0067] For each BN channel, a pair of random factors (a, b, c) are introduced to scale the parameters of the channel; the random factor a also acts on the convolution layer before the BN layer;
[0068] In the BN layer equivalent scaling transformation stage, a set of random factors (a, b, c) is generated for each user to be distributed according to each convolution channel in each selected transformation layer as the transformation key of the equivalent scaling transformation stage.
[0069] An electronic device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the neural network distribution encryption and anti-conspiracy attack method thereof are implemented as described above.
[0070] A computer-readable storage medium having a computer program stored thereon, characterized in that when the program is executed by a processor, the neural network distribution encryption and anti-conspiracy attack method thereof as described above are implemented.
[0071] In order to solve the problems existing in the prior art, the present invention and its preferred solution aim to propose a collusion-safe neural network distribution and property rights protection framework. Different from the existing passive defense scheme (i.e., the scheme of detecting colluding users participating in the attack), the present scheme adopts an active defense method to prevent malicious collusion attacks, and severely damages the performance of the collusion model generated by the collusion attack of illegal users, making the collusion model unusable, thereby fundamentally preventing collusion attacks. At the same time, the present scheme also proposes two fingerprint technologies in black box scenarios, and uses dual fingerprint technology to perform reliable ownership tracking and verification. The following are the five main contributions of the present invention, namely:
[0072] (1) Watermark / fingerprint generation algorithm for neural network models. This method can generate a series of unique sample label pairs for each user. This fine-grained user-level fingerprint provides property rights tracking and infringement verification functions for neural network distribution.
[0073] (2) Based on adversarial examples [6][7] The fingerprint model extraction technology provides the property rights traceability function, and cooperates with the user fingerprint technology to provide more reliable dual fingerprint (ownership) verification. Different from the existing solutions, dual fingerprints work in a black box, which is more practical for property rights tracking and traceability.
[0074] (3) Equivalent model transformation algorithm to resist collusion attacks. Different from existing schemes, this framework is the first to use the model structure [8][9] Two equivalent transformations against collusion attacks are proposed, which seriously damage the performance of the collusion model and fundamentally eliminate the occurrence of collusion attacks.
[0075] (4) Designing a loss function based on cosine similarity. In addition, this embodiment also proposes a loss function based on cosine similarity to enhance the security of the proposed equivalent transformation against collusion attacks and avoid reverse attacks by malicious users.
[0076] (5) Feasibility and efficiency. The present invention has proved through a large number of experiments that based on this scheme, the model owner only needs a small amount of calculation to quickly generate a series of collusion-safe and property-safe sub-models for distribution / sale.
[0077] Compared with the prior art, the present invention and its preferred embodiment propose a technology for neural network model distribution and property rights security that is effective in resisting collusion attacks. It is the first to propose collusion-secure model distribution based on structural transformation in a black box scenario and property rights tracing, tracking and verification that supports dual fingerprints. In addition, this technology particularly innovates two equivalent transformations based on the neural network structure, namely the convolutional confusion equivalent transformation and the BN layer equivalent scaling transformation. Based on this framework, the owner can generate a large number of sub-models and distribute them to multiple users with a small amount of computing resources. Finally, the equivalent transformation against model collusion attacks and the additional cosine similarity regularization term introduced in this embodiment can effectively avoid collusion attacks by malicious users and reverse attacks on the transformation. BRIEF DESCRIPTION OF THE DRAWINGS
[0078] Figure 1 It is a schematic diagram of the overall framework of the collusion-safe neural network distribution and property rights protection according to an embodiment of the present invention;
[0079] Figure 2 Schematic diagram of the process of generating user fingerprints according to an embodiment of the present invention;
[0080] Figure 3 It is a schematic diagram of the equivalent confusion transformation process of the convolutional layer in an embodiment of the present invention. DETAILED DESCRIPTION
[0081] In order to make the features and advantages of this patent more obvious and easy to understand, the following embodiments are specifically described in detail as follows:
[0082] It should be noted that the following detailed descriptions are illustrative and are intended to provide further explanation of the present application. Unless otherwise specified, all technical and scientific terms used in this specification have the same meanings as those commonly understood by those skilled in the art to which the present application belongs.
[0083] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit the exemplary embodiments according to the present application. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. In addition, it should be understood that when the terms "comprise" and / or "include" are used in this specification, it indicates the presence of features, steps, operations, devices, components and / or combinations thereof.
[0084] Embodiment 1:
[0085] See also Figure 1 , the infrastructure design of the collusion-safe neural network distribution and property rights protection framework, based on its execution elements, this embodiment proposes a collusion-safe and property rights-safe neural network distribution scheme in a black box scenario, which mainly includes two parties: a neural network model owner and multiple users to be distributed.
[0086] The specific implementation steps are as follows:
[0087] (1) The owner of the neural network model first uses the adversarial sample generation algorithm based on the needs of the system to extract n adversarial samples and label pairs on the source model as a set of model fingerprint information.
[0088] (2) The model owner generates a key for each user to be distributed, and then uses the key to generate a series of sample label pairs that are different from the original dataset as a set of unique fingerprints for the user that are different from other users. Different from model fingerprints, user fingerprints are embedded into the neural network through fine-tuning. Multiple users have their own user fingerprints, but share the same set of model fingerprints. Both user fingerprints and model fingerprints belong only to the model owner.
[0089] (3) The model owner copies a copy of the source model based on the user fingerprint generated in step (2), and fine-tunes the copied model to embed the corresponding user fingerprint.
[0090] (4) Based on step (3), another set of keys is generated for each user, and anti-collusion equivalent transformation is performed through this set of keys, and then the final model is distributed to the users.
[0091] As Figure 1 As shown, when malicious user 1 and user 2 collude to attack, they will obtain an unusable model with severely damaged performance. Since the collusion model will lose its value, there is no need to consider tracking or verifying the ownership of the collusion model. For the scenario of unauthorized resale or redistribution by user 3 or normal use by user 4, the model owner can use the model fingerprint and user fingerprint to track and verify the ownership of the model through dual fingerprint authentication.
[0092] Embodiment 2:
[0093] Assuming that the neural network model to be distributed or sold has extremely high commercial value, the neural network distribution and intellectual property protection framework designed in this embodiment can provide intellectual property tracking and verification through a double fingerprint verification mechanism, and resist malicious model theft attacks such as collusion attacks, reverse attacks, fingerprint removal, etc.
[0094] In Example 1, the infrastructure required for the neural network distribution and property rights protection scheme against collusion attacks is briefly described. Next, this embodiment will further describe the specific implementation details based on Example 1. The special features are as follows:
[0095] (1) Model fingerprint extraction of source model
[0096] Adversarial samples are transferable, that is, adversarial samples of one model are usually applicable to another model. Therefore, adversarial samples on the source model are often applicable to the sub-model derived from it. If the transferability (generalization) of the adversarial sample is too strong, it will migrate to other models generated based on non-source models. Therefore, in order to obtain adversarial samples that are strongly transferable to sub-models and weakly transferable to other non-related models, this embodiment adopts the following algorithm to extract adversarial samples:
[0097] minimize||x-x'|| 2 +c·f(x'), (1)
[0098] in
[0099] f(x')=max(max{Z(x') i :i≠t}-Z(x') t ,-k) (2)
[0100] In formula (1), x'=x+σ is the target adversarial sample, and Z(x') represents the output of the adversarial sample x' before it enters the softmax layer of the source neural network. i Represents the output of the i-th neuron before the softmax layer. Similarly, Z(x') t Represents the output of the tth neuron corresponding to the target adversarial sample label subscript. k is a hyperparameter for adjusting the transferability of adversarial samples. By adjusting the appropriate k, a set of efficient and usable adversarial samples can be extracted as the source model fingerprint.
[0101] Assume that the source model M source The extracted set of model fingerprints is FP model ={(img 1 ,target 1 ),(img 2 ,target 2 ),...,(img n ,target n )}. And there is a sub-model distributed to users Using Model Fingerprint FP model Validating sub-models The algorithm is as follows (3):
[0102]
[0103] When x=y, g(x,y)=1, otherwise g(x,y)=0. is greater than a preset threshold, such as 90%, indicating that the submodel Generated from the source model of the owner. Multiple different users share the model fingerprint of the same set of source models. The model fingerprint is transferable to different sub-models, so a set of model fingerprints can track the ownership of multiple distributed sub-models at the same time.
[0104] (2) User fingerprint generation
[0105] according to Figure 2 The model owner assigns a unique original image to each user. and two keys Key 1 、Key 2 , and use two different hash algorithms Hash 1 、Hash 2 , where Hash 1 The output is an image, and Hash 2 The output is a positive integer.
[0106] As shown in the following formula (4), the hash algorithm Hash 1 The initial input parameter is the key image and the hash key Key 1 Generate the first hash image ρ 1 , and then the hash algorithm Hash 1 Output ρ 1 and Key 2 As a hash algorithm 2 The input gets the corresponding label ω 1 . As in formulas (6) and (7), the first hash image ρ is generated 1 and Key 1 Through the hash algorithm Hash 1 The mth hash image is obtained, and the corresponding mth label is obtained similarly, where N is the number of label categories of the data set used by the target neural network model.
[0107]
[0108] ω 1 =Hash 2 (ρ 1 ,Key 2 )%N,m=1 (5)
[0109] ρ m =Hash 1 (ρ m-1 ,Key 1 ),m=2,3,… (6)
[0110] ω m =Hash 2 (ωm-1 ,Key 2 )%N,m=2,3,… (7)
[0111] like Figure 1 As shown in the figure, for multiple different users, the model owner generates m sample label pairs for each user, and uses them as the fingerprint of the corresponding user for tracking the property rights of the sub-model and detecting infringement. 1 、Hash 2 and key Key 1 、Key 2 Under the premise, it is extremely difficult to find a set of sample label pairs with the above hash relationship in the sub-model. Therefore, the design of user fingerprints used in the framework of this embodiment can resist fingerprint forgery attacks by malicious users.
[0112] Different from the model fingerprint proposed in step (1) of this embodiment, the user fingerprint provides fine-grained property rights tracking verification specific to the user level.
[0113] (3) User fingerprint embedding
[0114] Assume that the user fingerprint set generated by the model owner for user 1 is: FP user1 ={(img 1 ,target 1 ),(img 2 ,target 2 ),...,(img n ,target n )}. The model owner copies a copy of the source model as At this time, the sub-model The fingerprint has not been embedded yet. Next, the solution of this embodiment will use the complete data set of the source model trained by the model owner to fine-tune the sub-model Specifically, a small amount of computing resources is used to fine-tune the sub-model for E rounds, where the loss function used in the first F rounds of E round fine-tuning is:
[0115] L emd =L basic +γ·L cossim (8)
[0116]
[0117] Where L basic is the loss function of the original task, which is generally the common cross entropy loss function. cossimAn additional cosine similarity loss is innovatively introduced in this embodiment. The introduction of this loss is mainly to prevent the first anti-collusion equivalent transformation proposed in this solution, namely, the convolutional layer confusion transformation, from being reversely attacked by malicious users.
[0118] The model owner first selects a neural network structure that can perform convolutional layer confusion transformation. Assume that the target neural network has a structure with n convolutional layer confusion transformations, and its parameter set is T s ={T 1 ,T 2 ,T 3 ,…,T n}. The solution of this embodiment will randomly generate a corresponding vector set For the set T s and The elements with corresponding subscripts in have the same tensor shape. Here we only discuss the parameters of a certain structure. and the corresponding random vector in is the filter of the layer i A random tensor with the same shape, m is the number of filters in this layer, that is, the number of channels. For each user, this embodiment will generate a corresponding key for converting the random vector Randomly shuffle and finally generate a scrambled random vector for user 1 The solution of this embodiment will use a random vector while embedding the user's fingerprint. The cosine similarity loss is applied to the parameters T of the corresponding layer of the source neural network model. And γ is a function used to adjust the original loss function L basic And the cosine similarity loss term L cossim The hyperparameter of the loss ratio.
[0119] In order to ensure that the embedding of user fingerprints does not affect the original accuracy of the neural network model, this embodiment of the solution sequentially takes FP user1 A pair of image labels in the batch are added to participate in the training. If the batch is larger than FP user1 The number of image label pairs in , then continue to take FP from the beginning user1 The process of embedding user fingerprints is divided into two stages. The first stage uses L emd The loss function fine-tunes the sub-model in round E. In the second stage, only L is used in the subsequent round EF fine-tuning. basic Make fine adjustments.
[0120] (4) Anti-collusion equivalent transformation
[0121] (4-1) Convolutional Shuffle (convolutional layer equivalent confusion transformation):
[0122] By analyzing the forward calculation process of the convolutional neural network, this scheme invented an equivalent confusion transformation algorithm based on the convolution layer on the basis of the convolution forward propagation. The equivalent neural network is defined as: for two different models M 1 , M 2 For any input x, we have (10), that is, for any input x, we have exactly the same output.
[0123] y=M 1 (x) = M 2 (x) (10)
[0124] like Figure 3 As shown, we can assume that one of the sub-models generated after the user fingerprint fine-tuning embedding process is for The two consecutive convolutional layers in the structure are Conv 1 , Conv 2 . Conv 1 Include These three convolution filters, similarly Conv 2 Include These three convolution filters. The equivalent confusion transformation of the convolution layer will be Generate an obfuscation key, such as According to this key, the equivalent obfuscation transformation of the convolutional layer will exchange Conv 1 The positions of the first and second convolutional filters of the layer.
[0125] according to Figure 3 , it can be seen that after the above transformation, The intermediate feature outputs generated by the forward calculation of will also be swapped at the corresponding positions. In order to ensure that the confusion transformation processing does not change The final output of Conv 2 Layer contains Each of All need to follow Swap the positions of the first kernel and the second kernel. According to the above transformation process, for any input x, the transformed Conv' 1 and Conv' 2 , this obfuscation transformation scheme always satisfies:
[0126] Conv' 2 (Conv' 1 (x))=Conv 2 (Conv 1 (x)) (11)
[0127] In the field of image recognition, deep convolutional neural networks are widely used. Deep convolutional neural networks usually include multiple layers of continuous convolutional layer structures, and each convolutional layer includes a large number of filters, and each filter is composed of a large number of convolutional kernels. For such a neural network model, this embodiment can generate a unique obfuscation key for each user, and the key contains multiple secret position exchange information on two layers of convolutional structures. For example, for a deep convolutional neural network with multiple layers of continuous convolutional layers Conv 1 , Conv 2 , Conv 3 , Conv 4 , then according to the solution of this embodiment, Conv 1 , Conv 2 Do a confusion transformation to Conv 2 , Conv 3 Do a confusion transformation, similarly Conv 3 , Conv 4 You can also do a confusion transformation. Continuous multiple layers of confusion will amplify the previous confusion effect, that is, Conv 2 , Conv 3 Confusion is based on Conv 1 , Conv 2 Confusion upon confusion.
[0128] For the two sub-models after confusion transformation and Because of their and Different, so the parameters at the corresponding position have greater differences than before confusion. This difference makes the sub-model and The weight parameters after an illegal collusion attack will tend to a random distribution, thus damaging the performance of the collusion model.
[0129] (4-2) BN Scale (BN layer equivalent scaling transformation):
[0130] Although the embedding of user fingerprints makes the weight parameters of each pre-distributed sub-model slightly different. Based on the above (4-1) convolutional layer confusion equivalent transformation, if there is an additional neural network layer between two consecutive convolutional layers, the secret transformation made by the confusion process may be leaked. In order to further increase the complexity of the anti-collusion equivalent transformation while hiding the secret transformation made by the leakage confusion process, and enhance the damage of the equivalent changes against collusion security to the collusion model, this embodiment scheme is based on the convolutional layer equivalent confusion transformation, and further proposes a BN layer equivalent scaling transformation.
[0131] The BN layer equivalent scaling transformation is based on the batch normalization layer (BN layer) commonly used in convolutional neural networks. In a general convolutional neural network (CNN) structure, one convolution output channel corresponds to one batch normalization layer. Each BN layer mainly has two learnable parameters γ, β and two statistical parameters μ, σ. For a batch sample set φ = {x 1 ,x 2 ,…,x m-1 ,x m}, the calculation process of the BN layer is as follows:
[0132]
[0133]
[0134]
[0135]
[0136] Assume that the BN layer parameters in one channel of a certain layer of the owner source model are fixed to γ, β, μ, σ. When the feature output of the input of the channel is x, the output after the BN layer regularization calculation is y, this embodiment proposes the following equivalent change calculation:
[0137]
[0138] The following equivalent formula can be derived
[0139]
[0140]
[0141]
[0142] in
[0143] x'=ax (20)
[0144]
[0145]
[0146] σ' 2 =b 2 σ 2 +(b 2 -1)∈ (23)
[0147] β'=cβ (24)
[0148] In the equivalent scaling transformation of the BN layer, as shown in the equivalent transformation equations (16)-(24) above, for each BN channel, a pair of random factors (a, b, c) are introduced in the scheme to scale the parameters of the channel. The random factor a also acts on the convolution layer before the BN layer. When the convolution layer parameters are magnified a times, the forward propagation calculation result, that is, the feature map output of this layer is also magnified a times. The changed γ', β', μ', σ' restores the forward calculation result of the feature output scaled a times during the forward propagation process.
[0149] Therefore, in the BN layer equivalent scaling transformation stage, this framework can generate a set of random factors (a, b, c) for each user to be distributed as the transformation key in the scaling transformation stage according to each convolution channel in each selected transformation layer. Since the exchange keys between different users are different, for malicious users, the BN layer equivalent scaling transformation further destroys the performance of the collusion model on the basis of the convolution layer confusion transformation, enhancing the security of the proposed convolution layer confusion transformation and the ability to resist collusion attacks.
[0150] The above-mentioned program design scheme involving the algorithm provided in this embodiment can be stored in a computer-readable storage medium in a coded form, and implemented in the form of a computer program, and the basic parameter information required for the calculation is input through computer hardware, and the calculation result is output.
[0151] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0152] The present invention is described with reference to flowcharts of methods, devices (apparatus), and computer program products according to embodiments of the present invention. It should be understood that each process in the flowchart, as well as the combination of processes in the flowchart, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the process in the flowchart. Figure 1 A device that specifies functions in a process or multiple processes.
[0153] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple functions specified in a flowchart.
[0154] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 The steps of a specified function in a process or multiple processes.
[0155] The above is only a preferred embodiment of the present invention, and does not limit the present invention in other forms. Any technician familiar with the profession may use the above disclosed technical content to change or modify it into an equivalent embodiment with equivalent changes. However, any simple modification, equivalent change and modification made to the above embodiment according to the technical essence of the present invention without departing from the technical solution of the present invention still belongs to the protection scope of the technical solution of the present invention.
[0156] This patent is not limited to the above-mentioned optimal implementation method. Anyone can derive other forms of neural network distribution encryption and its anti-conspiracy attack method under the inspiration of this patent. All equal changes and modifications made according to the scope of the patent application of this invention should be covered by this patent.
Claims
1. A neural network distribution encryption method, Features: Contains: a neural network model owner and multiple users to be distributed; The model owner uses an adversarial sample generation algorithm to extract n adversarial sample and label pairs on the neural network source model as a set of model fingerprint information; The model owner generates a key for each user to be distributed, and then generates a series of sample label pairs different from the original data set through the key as a set of unique fingerprints that are different from other users to be distributed; Multiple users have their own user fingerprints, but share the same set of model fingerprints; the generation information of user fingerprints and model fingerprints belongs only to the model owner; The model owner copies a source model based on the generated user fingerprint, and embeds the corresponding user fingerprint into the neural network after fine-tuning the copied model; The following algorithm is used to extract adversarial samples: minimize||x-x'|| 2 +c·f(x'), (1)where, f(x')=max(max{Z(x') i :i≠t}-Z(x') t ,-k) (2) In formula (1), x'=x+σ is the target adversarial sample, Z(x') represents the output of the adversarial sample x' before it enters the softmax layer of the source neural network; and Z(x') i Represents the output of the i-th neuron before the softmax layer; Z(x') t Represents the output of the tth neuron corresponding to the subscript of the target adversarial sample label; k is a hyperparameter for adjusting the transferability of adversarial samples. By adjusting the appropriate k, a set of adversarial samples can be extracted as the source model fingerprint; Assume that the source model M source The extracted set of model fingerprints is FP model ={(img 1 ,target 1 ),(img 2 ,target 2 ),...,(img n ,target n )}; and there is a sub-model distributed to users Using Model Fingerprint FP model Validating sub-models The algorithm is as follows (3): When x=y, g(x,y)=1, otherwise g(x,y)=0; if is greater than a preset threshold, indicating that the submodel Generated from the source model of the model owner; The specific method for generating the user fingerprint is: Assume that the model owner assigns a unique original image to each user and two keys Key 1 、Key 2 , and use two different hash algorithms Hash 1 、Hash 2 , where Hash 1 The output is an image, Hash 2 The output is a positive integer; As shown in the following formula (4), the hash algorithm Hash 1 The initial input parameter is the key image and the hash key Key 1 Generate the first hash image ρ 1 , and then the hash algorithm Hash 1 Output ρ 1 and Key 2 As a hash algorithm 2 The input gets the corresponding label ω 1 , as shown in formulas (6) and (7); and so on, the first hash image ρ generated 1 and Key 1 Through the hash algorithm Hash 1 Get the mth hash image, and similarly get the corresponding mth label, where N is the number of label categories of the data set used by the target neural network model: oh 1 =Hash 2 (r 1 ,Key 2 )%N,m=1(5) r m =Hash 1 (r m-1 ,Key 1 ),m=2,3,…(6) oh m =Hash 2 (oh m-1 ,Key 2 )%N,m=2,3,…(7) For multiple different users, the model owner generates m sample label pairs for each user, and uses them as the fingerprints of the corresponding users for tracking the property rights of the sub-models and detecting infringements.
2. The neural network distribution encryption method according to claim 1, Features: The method of embedding the user fingerprint into the neural network is: Assume that the user fingerprint set generated by the model owner for user 1 is: FP user1 ={(img 1 ,target 1 ),(img 2 ,target 2 ),...,(img n ,target n )}; The model owner copies a copy of the source model as At this time, the sub-model Fingerprints are not embedded yet; next, the child model is fine-tuned using the full dataset of the source model trained by the model owner Specifically, the sub-model is fine-tuned for E rounds, where the loss function used for the first F rounds of fine-tuning for E rounds is: L emd =L basic +γ·L cossim (8) Among them, L basic is the loss function of the original task; L cossim is an additional cosine similarity loss, which is used to prevent the first anti-collusion equivalent transformation, i.e., the convolutional layer confusion transformation, from being reversed attacked by malicious users; The model owner first selects a neural network structure that can perform convolutional layer confusion transformation. Assume that the target neural network has a structure with n convolutional layer confusion transformations, and its parameter set is T s ={T 1 ,T 2 ,T 3 ,…,T n }; Randomly generate a corresponding vector set For the set T s and The elements with corresponding subscripts in have the same tensor shape; Suppose there is a parameter of a certain structure and the corresponding random vector in is the filter of the layer i A random tensor with the same shape, m is the number of filters in this layer, that is, the number of channels; For each user, a corresponding key is generated to convert the random vector Randomly shuffle and finally generate a scrambled random vector for user 1 And use random vectors while embedding user fingerprints Apply cosine similarity loss to the parameters T of the corresponding layer of the source neural network model; where γ is a function used to adjust the original loss function L basic And the cosine similarity loss term L cossim The hyperparameter of the loss ratio; In order to ensure that the user fingerprint embedding does not affect the original accuracy of the neural network model, in each training batch of each fine-tuning round, FP user1 A pair of image labels in the batch are added to participate in the training. If the batch is larger than FP user1 The number of image label pairs in , then continue to take FP from the beginning user1 ; The process of embedding user fingerprints is divided into two stages. The first stage uses L emd The loss function fine-tunes the sub-model in round E. In the second stage, only L is used in the subsequent round EF fine-tuning. basic Make fine adjustments.
3. A neural network distribution anti-collusion attack method, It is characterized in that Based on the neural network distribution encryption method as described in claim 1 or 2, another set of keys is generated for each user, and anti-collusion equivalent transformation is performed through this set of keys, and then the final model is distributed to the user.
4. The neural network distribution anti-collusion attack method according to claim 3, Features: The convolutional layer equivalent obfuscation transformation is used for anti-collusion equivalent transformation, that is, a unique obfuscation key is generated for each user, and the key contains multiple secret position exchange information on the two-layer convolution structure.
5. The neural network distribution anti-collusion attack method according to claim 3, Features: Use BN layer equivalent scaling transformation to perform anti-collusion equivalent transformation: Assume that the parameters of the BN layer in one channel of a certain layer of the owner source model are fixed to γ, β, μ, σ; when the feature output of the input of the channel is x, and the output after the BN layer regularization calculation is y, there is the following equivalent change calculation: And it is derived into the following equivalent formula: in x'=ax(20) in 2 =b 2 s 2 +(b 2 -1)∈(23) β'=cβ(24) For each BN channel, a pair of random factors (a, b, c) are introduced to scale the parameters of the channel; the random factor a also acts on the convolution layer before the BN layer; In the BN layer equivalent scaling transformation stage, a set of random factors (a, b, c) is generated for each user to be distributed according to each convolution channel in each selected transformation layer as the transformation key of the equivalent scaling transformation stage.
6. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the program, the neural network distribution encryption method as described in claim 1 or 2 is implemented.
7. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the program is executed by a processor, the neural network distribution encryption method as described in claim 1 or 2 is implemented.
