Tight Differential Privacy for Discrete-Valued Mechanisms and for the Subsampled Gaussian Mechanism Using FFT
Antti Koskela, Joonas Jälkö, Lukas Prediger, Antti Honkela
Introduction
Differential privacy (DP) (Dwork et al.,, 2006) has been established as the standard approach for privacy-preserving machine learning. As DP algorithms have grown increasingly complex, accurately bounding the compound privacy loss has become more challenging as well. The moments accountant (Abadi et al.,, 2016) represented a major breakthrough in the accuracy of bounding the privacy loss in compositions of subsampled Gaussian mechanisms that are commonly used in DP stochastic gradient descent (DP-SGD). This has further been refined through the general development of Rényi differential privacy (RDP) (Mironov,, 2017) as well as tighter RDP bounds for subsampled mechanisms (Balle et al.,, 2018; Wang et al.,, 2019; Zhu and Wang,, 2019; Mironov et al.,, 2019). RDP enables tight analysis for compositions of Gaussian mechanisms, but this may be difficult for other mechanisms. Moreover, conversion of RDP guarantees back to more commonly used -guarantees is lossy.
In this work, we focus on an alternative approach based on the privacy loss distribution (PLD) formalism introduced by Sommer et al., (2019). This work directly extends the recent Fourier accountant by Koskela et al., (2020) to discrete mechanisms. We provide a rigorous error analysis which leads to strict -bounds. This analysis is further used to obtain strict bounds for the subsampled Gaussian mechanism.
The need to consider discrete mechanisms for rigorous DP on finite-precision computers was first pointed out by Mironov, (2012). Agarwal et al., (2018) implement a communication efficient binomial mechanism cpSGD for neural network training which however cannot handle compositions. Agarwal et al., (2018) and Kairouz et al., (2019) note the need for a privacy accountant for the binomial mechanism as an important open problem, which we solve in this paper for the case where gradients are replaced with a sign approximation.
The outline of the paper is as follows. In Sections 2 and 3 we give the basic definitions and describe the PLD formalism used for our accountant. In Section 4 we describe the algorithm based on the fast Fourier transform (FFT) and in Section 5 we provide an error analysis. Section 6 concludes with experiments illustrating the efficiency and accuracy of the method.
Implementation of the methods is available in Githubhttps://github.com/DPBayes/PLD-Accountant/.
We extend the work by Koskela et al., (2020) which considered an FFT based method for approximating the tight -DP guarantees of the subsampled Gaussian mechanism, however without strict lower and upper bounds. The main contributions of this work are:
A framework for computing tight -DP guarantees of discrete-valued mechanisms.
An error analysis of the proposed method using moment bounds of the mechanism at hand, which leads to strict lower and -upper bounds.
Accurate lower and upper bounds for -DP of the subsampled Gaussian mechanism.
Differential Privacy
We first recall some basic definitions of DP (Dwork et al.,, 2006). We use the following notation. An input data set containing data points is denoted as , where , .
We say two data sets and are neighbours in remove/add relation if we get one by removing/adding an element from/to the other and denote this with . We say and are neighbours in substitute relation if we get one by substituting one element in the other. We denote this with .
Let and . Let define a neighbouring relation. Mechanism is -DP if for every and every measurable set we have that
When the relation is clear from context or irrelevant, we will abbreviate it as -DP. We call tightly -DP, if there does not exist such that is -DP.
Privacy Loss Distribution
We first introduce the basic tool for obtaining tight privacy bounds: the privacy loss distribution (PLD). The results in Subsection 3.1 are reformulations of the results given by Meiser and Mohammadi, (2018) and Sommer et al., (2019). Proofs of the results of this section are given in the supplementary material.
We consider discrete-valued one-dimensional mechanisms which can be seen as mappings from to the set of discrete-valued random variables. The generalised probability density functions of and , denoted and , respectively, are given by
If is a function such that determines a random variable, then
More generally, we define integrals over generalised probability density functions as in (3.2). We prefer using the integral notation as it simplifies the analysis.
We define the privacy loss distribution as follows.
where .
Evaluating -bounds using the PLD formalism is essentially based on a result (Supplements) which states that the mechanism is tightly -DP with
This relation holds for both continuous and discrete output mechanisms, and a more general version of this result using so called -divergences is given by Barthe and Olmedo, (2013). In case and are generalised probability density functions of the form (3.1), i.e.,
For the discrete-valued mechanisms, the relation (3.4) was originally given by Sommer et al., (2019, Lemmas 5 and 10). Assuming the PLD distribution is of the form (3.3), the relation (3.4) directly gives the following representation for .
is tightly -DP for
and similarly for .
We remark that finding the outputs and that give the maximum is application specific and has to be carried out individually for each case, similarly as, e.g., in the case of RDP (Mironov,, 2017).
2 Example: The Randomised Response
To illustrate the formalism described above, consider the randomised response mechanism (Warner,, 1965) which is described as follows. Suppose is a function . Define the randomised mechanism for input by
where . The mechanism is -DP for (Dwork and Roth,, 2014). Let and let and . As these are the only possible outputs, and represent the worst case in Lemma 2 and give the tight . We see that the density functions of and are given by
where Assume . Then by Lemma 2 we see that
As , we see that as expected.
3 Tight (ε,δ)𝜀𝛿(\varepsilon,\delta)-Bounds for Compositions
Let and be random variables described by generalised probability density functions and of the form (3.1). We define the convolution as
Notice that describes the probability density of the random variable . The following theorem shows that the tight -bounds for compositions of non-adaptive mechanisms are obtained using convolutions of PLDs (see also Sommer et al.,, 2019, Thm. 1).
Consider a -fold non-adaptive composition of a mechanism . The composition is tightly -DP for given by
where is as defined in (3.5) and denotes the -fold convolution of the density function (an analogous expression holds for ).
We remark that our approach also allows computing tight privacy bounds for a composite mechanism , where the PLDs of the mechanisms vary (see the supplementary material).
4 Subsampling Amplification
The subsampling amplification can be analysed similarly as by Koskela et al., (2020) in the case of the Gaussian mechanism. For example, considering the -neighbouring relation and using the Poisson subsampling with subsampling ratio leads to considering the pair of density functions
where the density function corresponds to a subsample including the additional data element. Subsampling without and with replacement using -neighbouring relation can be analysed with mixture distributions analogously (Koskela et al.,, 2020).
Fourier Accountant for Discrete-Valued Mechanisms
We next describe the numerical method for computing tight DP guarantees for discrete one-dimensional distributions using the PLD formalism. We will apply the fast Fourier transform to numerically evaluate the PLD convolutions of Theorem 3.
The discrete Fourier transform and its inverse are defined as (Stoer and Bulirsch,, 2013)
For our purposes FFT will be useful as it enables evaluating the discrete convolutions efficiently. The so-called convolution theorem (Stockham Jr,, 1966) states that for periodic discrete convolutions it holds that
where denotes the elementwise product and the summation indices are modulo . Using (4.1), repeated convolutions are evaluated efficiently.
2 Grid Approximation
In order to harness the FFT, we place the PLD on a grid
Suppose the distribution of the PLD is of the form
where and , . We define the grid approximations
i.e., and refer to the closest left and right grid approximation points to . We note that as ’s correspond to the log ratios of probabilities of individual events, often a moderate is sufficient for the condition to hold for all . In the Supplements we provide analysis also for the case where this assumption does not hold. From (B.3) we have:
Lemma 1 directly generalises to convolutions. The following bounds for the moment generating functions will be used in the error analysis.
3 Truncation of Convolutions and Periodisation
The FFT assumes that inputs are periodic over a finite range. We describe truncation of convolutions and periodisation of distribution functions to meet this assumption. Suppose is defined such that
where and . The convolutions can then be written as
Let . We truncate these convolutions to the interval such that
We define to be a -periodic extension of , i.e., is of the form
In case the distribution is defined on an equidistant grid, FFT can be used to evaluate as follows:
Let be of the form (B.7), such that is even, , and , . Define
and ⊙k denotes the elementwise power of vectors.
4 Approximation of the δ(ε)𝛿𝜀\delta(\varepsilon)-Integral
Finally, using the truncated and periodised convolutions we approximate the integral formula in Lemma 2 for the tight -value as
To evaluate as a function of , Newton’s method can be used (Koskela et al.,, 2020). Suppose is continuous and given by the integral (4.5). Then, and Newton’s method applied to the function gives the iteration
Error Analysis
We next give a bound for the error induced by Algorithm 1 which is determined by the parameter . The total error consists of (see the supplementary material)
The tail integral .
The error arising from periodisation of and truncation of the convolutions.
We obtain bounds for these two error sources using the Chernoff bound (Wainwright,, 2019)
which holds for any random variable and all . Suppose is of the form
where and . Then, the moment generating function of is given by
Suppose , for some coefficients , and suppose is of the form (5.1). Then, we have that
where denotes the Rényi divergence of order (Mironov,, 2017). Further, defining
we see that is exactly the logarithm of the moment generating function of the privacy loss function as defined, e.g., by Abadi et al., (2016) and Mironov et al., (2019). Thus existing Rényi differential privacy estimates for could be used to bound the moment generating function of .
2 Tail Bound
Denote , where denotes the PLD random variable of the th mechanism. If ’s are independent, we have that
Then, if ’s are i.i.d. and distributed as , the Chernoff bound shows that for any
3 Total Error
We define and via the moment generating function of the PLD as
Using the analysis given in the supplementary material, we bound the errors arising from the periodisation of the distribution and truncation of the convolutions. As a result, combining with (5.3), we obtain the following bound for the total error incurred by Algorithm 1.
Let be defined on the grid as described above, let give the tight -bound for and let be the result of Algorithm 1. Then, for all
We emphasise that the error analysis is given in terms of the parameter . The parameter can be increased in case the resulting lower and upper bounds for are too far from each other.
Examples
Consider the neighbouring relation . Let be a counting query, i.e.,
and let . Denote by the number of elements in which equal . Let , , be such that elements equal . Then, the logarithmic ratio at is given by
2 The Binomial Mechanism
As described in the proof of Thm. 1 of Agarwal et al., (2018), for the privacy analysis of the binomial mechanism it is sufficient to consider the neighbouring binomial distributions centred at 0 and . If, for example, , it is sufficient to consider the neighbouring binomial distributions
Then, the privacy loss distribution is of the form
and determining the privacy loss distribution can be done analogously.
The -analysis of the multivariate binomial mechanism can be carried out via one-dimensional distributions using the following observation.
and thus we can use Algorithm 1 to obtain tight -bounds for a single call of .
Figure 4 shows results for an MNIST classification task, where we use a three-layer feedforward network with ReLUs and a hidden layer of width 60. DP-SGD approximation of the gradients is carried out such that for each per example gradient we use a sign approximation: the 200 largest elements (by magnitude) of the input layer are approximated by their sign and the rest are set to zero and similarly the 20 largest of the hidden layer and the largest one of the output layer. Elementwise zero centred binomial noise with parameters and is then added to the averaged gradients. By Thm. 1 and subsampling amplification (Sec. 3.4), the -bound can be obtained by running Algorithm 1 for the PLD determined by the distributions
where and are the density functions of the random variables
The results of Figure 4 are averages of 5 runs. We set the initial learning rate . We linearly decrease the learning rate after each epoch such that it is zero at the end of the training (when starting from epoch 13, and when starting from epoch 5). We compare this method to cpSGD (Agarwal et al.,, 2018) applied to Infinite MNIST data set which has the same test data set as MNIST. The results for cpSGD are extracted from Agarwal et al., (2018, Fig. 2). For we extract the result where each element of the gradient requires 8 bits and for the one requiring 16 bits. We note that when our method requires 12 bits per element.
3 The Subsampled Gaussian Mechanism
We next show how to compute rigorous DP bounds for the subsampled Gaussian mechanism using the method presented here. We consider the Poisson subsampling and -neighbouring relation. For a subsampling ratio and noise level , the continuous PLD is given by Koskela et al., (2020)
We find that as defined in (F.1) has one stationary point which we determine numerically. Using this fact, the numerical values of and can be straightforwardly computed.
and .
Figure 5 illustrates the convergence of the bound given by Lemma 1 as grows and is fixed. For comparison, we also show the numerical values given by Tensorflow moments accountant (Abadi et al.,, 2016).
Conclusions
We have presented a novel approach for computing privacy bounds for discrete-valued mechanisms. The method provides tools for moments-accountant-like techniques for evaluating privacy bounds for discrete output DP-SGD algorithms. More specifically, we have shown how to accurately bound the -DP for the subsampled binomial mechanism, when the gradients are replaced with a sign approximation. Moreover, as the example of Section 6.3 shows, accurate -bounds for continuous mechanisms can also be obtained using the proposed method. Due to the rigorous error analysis the reported -bounds are strict lower and upper privacy bounds.
Acknowledgements
This work has been supported by the Academy of Finland [Finnish Center for Artificial Intelligence FCAI and grants 319264, 325572, 325573].
Appendix A Proofs for the Results of Section 3
Throughout this section we denote for neighbouring datasets and the density function of with and the density function of with . The definition of approximate differential privacy is equivalently given as follows.
We call tightly -DP, if there does not exist such that is -DP.
The auxiliary lemma 2 is needed for Lemma 3. For discrete valued distributions, it is given in (Meiser and Mohammadi,, 2018, Lemma 1) and another version of this result using so called -divergences is given in Barthe and Olmedo, (2013). We prove it here for for completeness, using our formalism. In the proof, if and are discrete valued distributions and if
is tightly -DP with
We get an analogous bound for . Since is tightly -DP, by Definition 1,
To show that the above inequality is tight, consider the set
for given by (A.1). This shows that given by (A.1) is tight. ∎
Recall from the main text that if and are of the form (3.1), then the PLD distribution function is given by
The following lemma gives an integral representation for the tight -bound involving the distribution function of the PLD. For discrete valued distributions, it is originally given in (Sommer et al.,, 2019, Lemma 5).
Let be defined as above. is tightly -DP for
We directly find from the definition of and and from the definition (A.4) that
A.2 Privacy Loss Distribution of Compositions
The following theorem shows that the PLD distribution of discrete non-adaptive compositions is obtain using a discrete convolution. We first recall the definition of convolution of two generalised functions as defined in the main text. Suppose the distributions and are of the form
The result of the following theorem is originally given in (Sommer et al.,, 2019, Thm. 1). For completeness we give a proof using our notation with generalised probability density functions.
Let , , and denote the density functions of , , and , respectively. Denote by the PLD distribution of over and by the PLD distribution of over . Denote by the PLD of the non-adaptive composition . The density function of is given by
By definition of the privacy loss distribution,
Due to the independence of and ,
We see from (A.7) that with convolution defined in (A.5). The expression for follows directly from its definition and from the independence of the mechanisms (A.6). ∎
Theorem 4 directly gives the following representation for tight of compositions.
Consider consecutive applications of a mechanism . Let . The composition is tightly -DP for given by
where denotes the density function obtained by convolving by itself times (an analogous formula holds for ).
Appendix B Proofs for the Results of Section 4
Suppose the distribution of the PLD is of the form
where and , . We define the grid approximations
The claim follows from the definition (B.3) and from the fact that is a monotonously increasing function of . ∎
Lemma 1 directly generalises to convolutions. Namely, if
The following bounds for the moment generating functions will be used in the error analysis.
Using the Lipschitz continuity of the exponential function, we see that
B.2 FFT Evaluation for Truncated Convolutions of Periodic Distributions
We next prove the lemma showing that the truncated convolutions of periodic distributions can be evaluated using FFT. Suppose is defined on such that
where and . The convolutions can then be written as
We define to be a -periodic extension of such that
In case the distribution is defined on an equidistant grid, FFT can be used to evaluate the approximation :
Let be of the form (B.7), such that is even and , . Define
and ⊙k denotes the elementwise power of vectors.
Assume is even and , . From the the truncation and periodisation it follows that is of the form
Denoting , we see that the coefficients in (B.8) are given by the expression
to which we can apply DFT and the convolution theorem Stockham Jr, (1966). I.e., when ,
where denotes the elementwise product of vectors. From (B.9) we find that
By induction this generalises to -fold compositions and we arrive at the claim. ∎
Appendix C Proof of Theorem 10
We next prove step by step the main theorem, i.e., Theorem 10 of the main text. We start by splitting the error induced by Algorithm 1 into three terms.
Let be a generalised distribution and denote by the result of Algorithm 1. Total error of the approximation can be split as follows:
where, for a generalised density function of the form , the absolute value denotes
By adding and subtracting terms and using the triangle inequality, we get
Since for all , we have for the first term on the right hand side of (C.1):
Similarly, adding and subtracting the second term on the right hand side of (C.1), we find that
We next consider separately each of the three terms stated in Theorem 1. Each of them are bounded using the Chernoff bound Wainwright, (2019)
which holds for any random variable and for all . If is of the form
C.2 Error Arising from the Periodisation
We define and via the moment generating function of the PLD as
Using the Chernoff bound, the required error bounds can be obtained using and .
Let be defined as above and suppose for all . Then,
Let and its -periodic continuation be of the form
for some , . By definition of the truncated convolution (see the main text),
since for all such that . Furthermore,
Using the bounds (C.8), (C.9) and the Chernoff bound (C.4), we find that for all
C.3 Error Arising from the Truncation of the Convolution Integrals
Next, assume that the generalised distribution of the PLD is of the form
where and .
The following lemma gives a bound for the truncation error in terms of the moment generating function of . Notice that this result applies also for the case where the support of the PLD distribution are outside of the interval .
Let be defined as above. For all ,
By adding and subtracting , we may write
for some , . Then
Using (C.10), (C.11) and (C.12), we see that for all ,
Using (C.13) recursively, we see that for all ,
C.4 Proof of Theorem 10 (Total Error)
Proof of Theorem 10. Let and be defined as in (C.5). Combining the bound (C.4) and the bounds given by Lemmas 2 and 3, we find that
Appendix D Theorem 11: Tight Bound for Multidimensional Mechanisms via One Dimensional Distributions
The following results shows that the tight -bound for a multidimensional mechanism can be obtained by analysis of one dimensional distributions, in case the neighbouring datasets and leading to the maximal are known.
The claim can be shown simply by observing that the privacy loss distribution generated by and and the privacy loss distribution generated by compositions and are the same. ∎
Appendix E Experiments of Section 6.2
We next show how to use the Fourier accountant for obtaining the -bound of Figure 4. Essentially, we show how to obtain the PLD for a subsampled multivariate mechanism, where the neighbouring distributions are known and fixed (i.e., is fixed and is sampled with probability and with probability ).
Now denote the density functions for one-dimensional mechanisms and by
the density functions are given by the convolutions
By definition, the PLD generated by the distributions
for all . Thus, if we have the distributions
we can form the PLD by the change of variable
and summing the coefficients as in (E.1). On the other hand, we can obtain and by using the Fourier accountant to the -fold convolutions of the distributions
Also, the -probabilities can be evaluated straightforwardly for and .
Appendix F Section 6.3: The Subsampled Gaussian Mechanism
In this Section we give an error analysis for the approximations given in Section 6.3. Recall first the form of the PLD for the subsampled Gaussian mechanism. For a subsampling ratio and noise level , the continuous PLD distribution is given by
where and are as defined in (F.3). We find that as defined in (F.1) has one stationary point which we determine numerically. Using this, the numerical values of and are obtained.
Lemma 1 directly generalises to convolutions:
goes analogously. Inductively, bounding as in (F.5), we also see that
For all and :
where .
where . We see that when , we have . From (F.2) we see that
Furthermore, when , from (F.6) it follows that
where . ∎
where , . Thus
Assuming and , , we further see that
Appendix G Description of Learning Rate Cooling Used for Experiments of Figure 2b.
When running the feedforward network experiment of Figure 2b, we set the initial learning rate . When and , starting from epoch 13, and when and , starting from epoch 5, the learning rate is linearly decreased after each epoch such that it is zero at the end of the training.