Constant time discrete Gaussian sampling method and device based on DPWGAN
Through the DPWGAN model combining differential privacy and Wasserstein distance, discrete Gaussian distributed sampling is optimized, which solves the time consistency and resource utilization problems of sampling methods in blockchain signatures, and enhances security and applicability.
Patent Information
- Application Number
- CN202411184792.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-27
- Publication Date
- 2024-12-13
AI Technical Summary
The discrete Gaussian distribution sampling method in existing blockchain signatures lacks time consistency, consumes too much resources and is difficult to deal with situations where data distributions vary greatly, and is vulnerable to side channel attacks.
Using a constant-time discrete Gaussian sampling method based on DPWGAN, the generated data is optimized by generating networks and discriminant network iteratively, combining differential privacy and Wasserstein distance, reducing the difference between generated data and real data, and adding random noise to real data to improve privacy sex.
It improves the time consistency and resource utilization of sampling, reduces storage space requirements, enhances the ability to resist side channel attacks, and effectively deals with situations where data distributions vary greatly.
Smart Images

Figure CN119129663A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field, and in particular to a constant-time discrete Gaussian sampling method and device based on DPWGAN. Background Art
[0002] The goal of GAN is to generate Gaussian normal distribution data from uniformly distributed data, that is, to sample data samples that obey uniform distribution, and generate Gaussian normal distribution data after GAN processing. The GAN series model mainly consists of two parts: the generator and the discriminator. The generator is responsible for generating data, and the discriminator is responsible for distinguishing the gap between the generated data and the real data. The purpose is to make the gap between the generated data and the real data smaller and smaller, so that the generated data has data characteristics similar to the real data.
[0003] First of all, the GAN technical solution first inputs one-dimensional uniformly distributed samples into the generator, and inputs the data features of the real target data, that is, the data features of discrete Gaussian distribution data, into the discriminator. Then, the discriminator will use the data features of the target data as the basis for judgment to determine the authenticity of the data continuously generated by the generator. If the authenticity score is too low, the generator will be required to continue to iteratively generate data until the gap between the real data and the generated data is small enough, which we call the loss function. Therefore, the core purpose of the GAN technical solution is to make the loss function of the model smaller and smaller, that is, the difference between the target data and the generated data is getting smaller and smaller. In this technical solution, four references are selected for the data features of the target data, namely the mean, standard deviation, skewness, and kurtosis, which are combined as the standard for the discriminator to judge whether the data is real enough.
[0004] After obtaining sufficiently realistic generated data, the discriminator will print out the data, and the entire GAN model training and generation process is completed. The printed data will be sampled by the sampler, and any number will be randomly selected from it. This number is the random sampling number that obeys the discrete Gaussian distribution.
[0005] At present, in the process of generating blockchain signatures, there have always been the following three shortcomings for the discrete Gaussian distribution sampling link. First, in the existing schemes for generating blockchain signatures, the methods used for discrete Gaussian distribution sampling do not have strong time consistency, which makes it vulnerable to side channel attacks. Being able to resist side channel attacks is particularly important in the current cutting-edge blockchain signature technology, such as the field of quantum-resistant blockchain signatures. Second, the current mainstream discrete Gaussian distribution sampling adopts the form of discrete binary trees. Although discrete binary trees have the advantage of fast calculation time, they need to store a large number of probability statistical distribution tables in advance, and the storage space occupied is ten or even twenty times that of the code part, making its disk usage high, which is not conducive to deployment on nodes with limited resource environments, such as edge nodes. Third, although there are also generative models such as GAN to complete discrete Gaussian distribution sampling, the loss function used by the GAN model is not conducive to handling the situation when the data distribution of the input data and the target data is too different due to the function design. Summary of the invention
[0006] The technical problem to be solved by the present invention is how to improve time consistency, save resources and reduce distribution differences in view of the above shortcomings; in view of this, the present invention provides a constant-time discrete Gaussian sampling method and device based on DPWGAN.
[0007] The technical solution adopted by the present invention is a constant-time discrete Gaussian sampling method based on DPWGAN, comprising:
[0008] Step S1, obtaining uniformly distributed training data and real data;
[0009] Step S2, based on the configured generative network, using the training data, obtaining corresponding generated data and inputting it into a loss function, based on the configured discriminative network, determining the true value corresponding to the true data and inputting it into the loss function, for determining the difference between the true value and the generated data;
[0010] Step S3, the generating network iterates the current generated data based on the difference of the loss function so as to reduce the difference between the generated data and the true value;
[0011] Step S4, sampling processing is performed on the generated data that has been iterated and meets the predetermined requirements.
[0012] In one embodiment, the method further comprises:
[0013] After acquiring the real data, random noise is added to the real data.
[0014] In one embodiment, after obtaining the real data, random noise is added to the real data, which is achieved by the following formula:
[0015]
[0016] in, is the domain, is random noise and satisfies α∈(1,∞), the real data
[0017] In one embodiment, the loss function specifically includes:
[0018]
[0019] Among them, W(P r ,P g ) represents the minimum consumption under the optimal planning, Ⅱ(P r ,P g ) is to convert P r , P g The set of all possible joint distributions combined together, γ(x,y) represents the work required to transform x into y, so as to transform the distribution P r Convert to distribution P g .
[0020] Another aspect of the present invention further provides a constant-time discrete Gaussian sampling device based on DPWGAN, comprising:
[0021] An acquisition unit configured to acquire uniformly distributed training data and real data;
[0022] A comparison unit is configured to obtain corresponding generated data based on the configured generation network using the training data and input the generated data into a loss function, and to determine a true value corresponding to the true data based on the configured discrimination network and input the true value into the loss function to determine the difference between the true value and the generated data;
[0023] an iterative unit, configured to iterate the current generated data based on the difference of the loss function in the generation network so that the difference between the generated data and the true value is reduced;
[0024] The sampling unit is configured to perform sampling processing on the generated data after iteration and meeting the predetermined requirements.
[0025] Another aspect of the present invention provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the constant-time discrete Gaussian sampling method based on DPWGAN as described in any one of the above items.
[0026] Another aspect of the present invention further provides a computer storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the constant-time discrete Gaussian sampling method based on DPWGAN as described in any one of the above items are implemented.
[0027] Compared with the prior art, the present invention has at least the following advantages:
[0028] The method provided by the present invention completes discrete Gaussian distribution sampling in a generative model manner, thereby enhancing the temporal consistency of sampling and thus improving the ability to resist side channel attacks; compared with discrete binary trees, DPWGAN does not need to pre-store probability statistical distribution tables, saving storage space overhead; compared with the classic GAN model, DPWGAN uses Wasserstein distance instead of JS distance used by GAN, and can provide a better loss function minimum solution for the case where the data distribution of input data and target data differs too much. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 A schematic diagram of a flow chart of a constant-time discrete Gaussian sampling method based on DPWGAN according to an embodiment of the present invention;
[0030] Figure 2 is a flow chart of the overall sampling scheme of DPWGAN according to an embodiment of the present invention;
[0031] Figure 3 A schematic diagram of a training process of a DPWGAN according to an embodiment of the present invention;
[0032] Figure 4 A schematic diagram of a constant-time discrete Gaussian sampling device based on DPWGAN according to an embodiment of the present invention;
[0033] Figure 5 The figure is a schematic diagram of the composition of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0034] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined purpose, the present invention is described in detail below in conjunction with the accompanying drawings and preferred embodiments.
[0035] Unless otherwise defined, all terms (including technical terms and scientific terms) used in this article have the same meaning as commonly understood by ordinary technicians in the field to which this application belongs. It should also be understood that terms (such as terms defined in commonly used dictionaries) should be interpreted as having the same meaning as their meaning in the context of the relevant technology, and will not be interpreted in an idealized or overly formal sense unless explicitly defined in this article.
[0036] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0037] In an embodiment of the present invention, a constant-time discrete Gaussian sampling method based on DPWGAN is provided. Figure 1 As shown, including:
[0038] Step S1, obtaining uniformly distributed training data and real data;
[0039] Step S2, based on the configured generative network, using the training data, obtaining corresponding generated data and inputting it into a loss function, based on the configured discriminative network, determining the true value corresponding to the true data and inputting it into the loss function, for determining the difference between the true value and the generated data;
[0040] Step S3, the generating network iterates the current generated data based on the difference of the loss function so as to reduce the difference between the generated data and the true value;
[0041] Step S4, sampling processing is performed on the generated data that has been iterated and meets the predetermined requirements.
[0042] The method provided in this embodiment is described in detail below.
[0043] refer to Figure 2 The DPWGAN model provided in this embodiment mainly includes a generation network, a discrimination network and a differential privacy module.
[0044] refer to Figure 3 Specifically, the training process of the generator is as follows: when the uniformly distributed training data is passed into the DPWGAN module, the generator network obtains the generated data according to the data characteristics of the target data. According to the score given by the discriminant network, that is, the size of the loss function, the generator will iterate the generated data and regenerate data that is closer to the target data.
[0045] The training process of the discriminator is as follows: after the real data is passed into the discriminator, random noise will be added first. The purpose is to protect the privacy of the real data. Especially when applied in actual production, it is necessary to protect the data characteristics of the real data to prevent attackers from falsifying data after obtaining the real data characteristics. Figure 2 The darkest colored lines are only for parameter transfer, including gradient calculation, etc., and the information privacy is low. The medium-depth lines represent the reverse transfer without sensitive information, which is sent to the discriminant network after being processed by random noise. The discriminant network then passes the data to the loss function below to determine the difference with the generated data. The front-most colored lines represent the transfer containing sensitive information, which only exists when the loss function is passed to random noise.
[0046] The way to achieve differential privacy is to add random noise, and the formula principle is as follows.
[0047] Randomization mechanism with domain D and parameter space τ Satisfying (∈,δ)-DP, the model parameter of deep learning is θ, for any two adjacent training sets The parameter space is τ. Then for any It can be defined as:
[0048]
[0049] In addition, for any pair of adjacent data sets When randomization mechanism When α∈(1,∞), if (α,∈)-RDP is satisfied, then for any pair of adjacent training sets satisfy:
[0050]
[0051] For the present invention, the training set That is, the real data input, randomized parameters represents the introduced random noise.
[0052] The DPWGAN model used in this solution involves the following WGAN model principles, which mainly include the formula definition of its loss function:
[0053]
[0054] Among them, P r is the true sample distribution, P g is the sample distribution generated by the generator. Here II(P r ,P g ) is to convert P r and P g The set of all possible joint distributions that can be combined together. γ(x,y) represents the work required to transform x into y, so as to transform the distribution P r Convert to distribution P g . And W(P r ,P g ) is the minimum consumption under the “optimal planning”, which can be considered to have met the predetermined requirements and can be used for subsequent sampling processing.
[0055] Compared with the prior art, this embodiment has at least the following effects:
[0056] 1) Combine the differential privacy method with WGAN and perform discrete Gaussian distribution sampling. This solves the problem of excessive randomness of the results when using the original GAN model for discrete Gaussian distribution sampling. Combined with the advantages of differential privacy, it provides privacy protection for the real data of the input model, making the model solution more secure.
[0057] 2) Using a generative model, a new constant-time discrete Gaussian distribution sampling solution is proposed, which makes up for the disadvantage that the discrete binary tree method used in mainstream methods is vulnerable to side channel attacks;
[0058] 3) Compared with the discrete distribution binary tree, a discrete Gaussian distribution sampling solution is proposed, which can greatly save storage space and enhance the applicability of future application scenarios.
[0059] The second embodiment of the present invention corresponds to the first embodiment, and can be referred to Figure 4 , this embodiment introduces a constant time discrete Gaussian sampling device based on DPWGAN, including the following components:
[0060] An acquisition unit configured to acquire uniformly distributed training data and real data;
[0061] A comparison unit is configured to obtain corresponding generated data based on the configured generation network using the training data and input the generated data into a loss function, and to determine a true value corresponding to the true data based on the configured discrimination network and input the true value into the loss function to determine the difference between the true value and the generated data;
[0062] an iterative unit, configured to iterate the current generated data based on the difference of the loss function in the generation network so that the difference between the generated data and the true value is reduced;
[0063] The sampling unit is configured to perform sampling processing on the generated data after iteration and meeting the predetermined requirements.
[0064] In this embodiment, after the real data is acquired, random noise is added to the real data.
[0065] In this embodiment, after obtaining the real data, random noise is added to the real data, which is achieved by the following formula:
[0066]
[0067] in, is the domain, is random noise and satisfies α∈(1,∞), the real data
[0068] In this embodiment, the loss function specifically includes:
[0069]
[0070] Among them, W(P r ,P g ) represents the minimum consumption under the optimal planning, Ⅱ(P r ,P g ) is to convert P r , P g The set of all possible joint distributions combined together, γ(x,y) represents the work required to transform x into y, so as to transform the distribution P r Convert to distribution P g .
[0071] A third embodiment of the present invention is an electronic device, such as Figure 5 As shown, it can be understood as a physical device, including a processor and a memory storing instructions executable by the processor. When the instructions are executed by the processor, the following operations are performed:
[0072] Step S1, obtaining uniformly distributed training data and real data;
[0073] Step S2, based on the configured generative network, using the training data, obtaining corresponding generated data and inputting it into a loss function, based on the configured discriminative network, determining the true value corresponding to the true data and inputting it into the loss function, for determining the difference between the true value and the generated data;
[0074] Step S3, the generating network iterates the current generated data based on the difference of the loss function so as to reduce the difference between the generated data and the true value;
[0075] Step S4, sampling processing is performed on the generated data that has been iterated and meets the predetermined requirements.
[0076] The fourth embodiment of the present invention, the process of the constant time discrete Gaussian sampling method based on DPWGAN in this embodiment is the same as that of the first, second or third embodiment, except that, in engineering implementation, this embodiment can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the method of the present invention can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, disk, CD), including a number of instructions for a device to execute the method described in the embodiment of the present invention.
[0077] Through the description of the specific implementation methods, a deeper and more specific understanding of the technical means and effects adopted by the present invention to achieve the predetermined purpose should be obtained. However, the accompanying drawings are only for reference and illustration purposes and are not intended to limit the present invention.
Claims
1. A constant-time discrete Gaussian sampling method based on DPWGAN, characterized in that: include: Step S1, obtaining uniformly distributed training data and real data; Step S2, based on the configured generative network, using the training data, obtains corresponding generated data and inputs it into a loss function; based on the configured discriminative network, determines the true value corresponding to the true data and inputs it into the loss function to determine the difference between the true value and the generated data; Step S3, the generation network iterates the current generated data based on the difference of the loss function, so as to reduce the difference between the generated data and the true value; Step S4: Sampling the generated data that meets the predetermined requirements after iteration.
2. The constant-time discrete Gaussian sampling method based on DPWGAN according to claim 1, characterized in that: The method further comprises: After acquiring the real data, random noise is added to the real data.
3. The data maintenance and management method based on the three-dimensional digital twin model according to claim 2 is characterized in that: After obtaining the real data, random noise is added to the real data, which is achieved by the following formula: in, is the domain of definition, θ is the deep learning model parameter, and τ is the parameter space is random noise and satisfies α∈(1,∞), the real data 4. The constant-time discrete Gaussian sampling method based on DPWGAN according to claim 3, characterized in that: The loss function specifically includes: Among them, P r is the true sample distribution, P g is the sample distribution generated by the generator, W(P r ,P g ) represents the minimum consumption under the optimal planning, Ⅱ(P r ,P g ) is to convert P r 、P g The set of all possible joint distributions combined together, γ(x,y) represents the work required to transform x into y, so as to transform the distribution P r Convert to distribution P g .
5. A constant-time discrete Gaussian sampling device based on DPWGAN, characterized in that: include: an acquisition unit configured to acquire uniformly distributed training data and real data; a comparison unit configured to obtain corresponding generated data using the training data based on the configured generative network and input the generated data into a loss function, and to determine a true value corresponding to the true data based on the configured discriminative network and input the true value into the loss function to determine the difference between the true value and the generated data; an iterative unit, configured to iterate the current generated data based on the difference of the loss function in the generation network, so as to reduce the difference between the generated data and the true value; The sampling unit is configured to perform sampling processing on the generated data that meets the predetermined requirements after iteration.
6. An electronic device, characterized in that: The electronic device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, the steps of the constant-time discrete Gaussian sampling method based on DPWGAN are implemented.
7. A computer storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the steps of the constant-time discrete Gaussian sampling method based on DPWGAN are implemented as claimed in any one of claims 1 to 4.
Citation Information
Patent Citations
Discrete Gaussian noise parallel generation method and hardware structure
CN113986196A
Method, system, equipment and medium for generating discrete Gaussian distribution random numbers in LWE password
CN117950625A
Differential privacy based training of data generation system
WO2021223663A1
