Bypassing the Ambient Dimension: Private SGD with Gradient Subspace Identification
Yingxue Zhou, Zhiwei Steven Wu, Arindam Banerjee
Introduction
In this paper, we aim to overcome such dependence on the ambient dimension by leveraging the structure of the gradient space in the training of neural networks. We take inspiration from the empirical observation from Li et al. (2020); Gur-Ari et al. (2018); Papyan (2019) that even though the ambient dimension of the gradients is large, the set of sample gradients at most iterations along the optimization trajectory is often contained in a much lower-dimensional subspace. While this observation has been made mostly for non-private SGD algorithm, we also provide our empirical evaluation of this structure (in terms of eigenvalues of the gradient second moments matrix) in Figure 1. Based on this observation, we provide a modular private ERM optimization framework with two components. At each iteration , the algorithm performs the following two steps:
We provide both theoretical analyses and empirical evaluations of PDP-SGD:
where is the complexity measure of the a set considering metric (Definition 2). We provide low-complexity examples of that are supported by empirical observations and show that their function only scales logarithmically with .
Convergence for convex and non-convex optimization. Building on the reconstruction error bound, we provide convergence and sample complexity results for our method PDP-SGD in two types of loss functions, including 1) smooth and non-convex, 2) Lipschitz convex. For smooth and non-convex function, ignoring constants and certain other details, an informal version of the convergence rate is as follows:
where is uniformly sampled from and is the size of public dataset . For Lipschitz convex funcntion, ignoring constants and certain other details, an informal version of the convergence rate is as follows:
where , and is the minima of . Compared to the error rate of DP-SGD for convex functions (Bassily et al., 2014, 2019a) and non-convex and smooth functions (Wang and Xu, 2019). PDP-SGD demonstrates an improvement over the dependence on to in the error rate. The error rate of PDP-SGD also involves the subspace reconstruction error which depends on function and size of public dataset. As discussed above, function only scales logarithmically with supported by empirical observations and our rates only scale logarithmically on .
Empirical evaluation. We provide an empirical evaluation of PDP-SGD on two real datasets. In our experiments, we construct the “public" datasets by taking very small random sub-samples of these two datasets (100 samples). While these two public datasets are not sufficient for training an accurate predictor, we demonstrate that they provide useful gradient subspace projection and substantial accuracy improvement over DP-SGD.
Related work. Beyond the aforementioned work, there has been recent work on private ERM that also leverages the low-dimensional structure of the problem. Jain and Thakurta (2014); Song et al. (2020) show dimension independent excess empirical risk bounds for convex generalized linear problems, when the input data matrix is low-rank. Kairouz et al. (2020) study convex empirical risk minimization and provide a noisy AdaGrad method that achieves dimension-free excess risk bound, provided that the gradients along the optimization trajectory lie in a known constant rank subspace. In comparison, our work studies both convex and non-convex problems and our analysis applies to more general low-dimensional structures that can be characterized by small functions (Talagrand, 2014; Gunasekar et al., 2015) (e.g., low-rank gradients and fast decay in the magnitude of the gradient coordinates). Recently, Tramer and Boneh (2021) show that private learning with features learned on public data from a similar domain can significantly improve the utility. Zhang et al. (2021) leverage the sparsity of the gradients in deep nets to improve the dependence on dimension in the error rate. We also note a recent work (Yu et al., 2021) that proposes an algorithm similar to PDP-SGD. However, in addition to perturbing the projected gradient in the top eigenspaces in the public data, their algorithm also adds noise to the residual gradient. Their error rate scales with dimension in general due to the noise added to the full space. To achieve a dimension independent error bound, their analyses require fresh public samples drawn from the same distribution at each step, which consequently requires a large public data set with size scaling linearly with . In comparison, our analysis does not require fresh public samples at each iteration, and our experiments demonstrate that a small public data set of size no more than 150 suffices.Note that the requirement of a large public data set may remove the need of using the private data in the first place, since training with the large public data set may already provide an accurate model.
Preliminaries
We first state the standard definition of differential privacy which requires that no single private example has a significant influence on the algorithm’s output information.
A randomized algorithm is -differentially private if for any pair of datasets differ in exactly one data point and for all event in the output range of , we have where the probability is taken over the randomness of .
To establish the privacy guarantee of our algorithm, we will combine three standard tools in differential privacy, including 1) the Gaussian mechanism (Dwork et al., 2006) that releases an aggregate statistic (e.g., the empirical average gradient) by Gaussian perturbation, 2) privacy amplification via subsampling (Kasiviswanathan et al., 2008) that reduces the privacy parameters and by running the private computation on a random subsample, and 3) advanced composition theorem (Dwork et al., 2010) that tracks the cumulative privacy loss over the course of the algorithm.
Projected Private Gradient Descent
Under Assumption 1, there exist constants and so that given the number of iterations , for any , where , PDP-SGD (Algorithm 1) is -differentially private for any , if .
The privacy proof essentailly follows from the same proof of DP-SGD (Abadi et al., 2016). At each iteration, the update step PDP-SGD is essentially post-processing of Gaussian Mechanism that computes a noisy estimate of the gradient . Then the privacy guarantee of releasing the sequence of is exactly the same as the privacy proof of Theorem 1 of Abadi et al. (2016).
However, this concentration bound does not hold for in general, since the public dataset is reused over the iterations and the parameter depends on . To handle the dependency issue, we bound uniformly over all iterations to bound the worst-case counterparts that consider all possible iterates. Our uniform bound analysis is based on generic chaining (GC) (Talagrand, 2014), an advanced tool from probability theory. Eventually, the error bound is expressed in terms of a complexity measure called function (Talagrand, 2014). Note that one may consider the idea of sample splitting to bypass the dependency issue by splitting public samples into disjoint subsets for each iteration. Based on Ahlswede-Winter Inequality, the deviation error scales with leading to a worse trade-off between the subspace construction error and optimization error due to the dependence on .
For a metric space , an admissible sequence of is a collection of subsets of , , with and for all , the functional is defined by where the infimum is over all admissible sequences of .
with probability at least , where is an absolute constant.
Using the result in Theorem 2 and Davis-Kahan sin- theorem (McSherry, 2004), we obtain the subspace construction error in the following theorem.
Under Assumption 1 and 2, with to be the top- eigenvectors of the population second moment matrix and be the eigen-gap at -th iterate such that , for the in Algorithm 1, if , we have
Theorem 3 gives the sample complexity of the public sample size and the reconstruction error, i.e., the difference between evaluated on the public dataset and given by the population second moment . The sample complexity and the reconstruction error both depend on the function and eigen-gap . A small eigen-gap requires larger public sample .
2 Empirical Risk Convergence Analysis
For -smooth function , under Assumptions 1 and 2, let , for any , with and , PDP-SGD achieves:
Additionally, assuming the principal component of the gradient dominates, i.e., there exist , such that , we have
where is uniformly sampled from .
Theorem 4 shows that PDP-SGD reduces the error rate of a factor of to compared to existing results for non-convex and smooth functions (Wang and Xu, 2019). The error rate also includes a term depending on the function and the eigen-gap , i.e., . This term comes from the subspace reconstruction error. As discussed in the previous section, as the gradients stay in a union of ellipsoids, the is a constant. The term depends on the eigen-gap , i.e, . As shown by the Figure 1, along the training trajectory, there are a few dominated eigenvalues and the eigen-gap stays significant (even at the last epoch). Then the term will be a constant and the bound scales logarithmically with . If one considers the eigen-gap decays as training proceed, e.g., for , then we have . In this case, with , PDP-SGD requires the public data size .
For the convex and Lipschitz functions, we consider the low-rank structure of the gradient space, i.e, the population gradient second momment is of rank-, which is a special case of the principal gradient dominate assumption when . We present the error rate of PDP-SGD for such case in the following theorem.
For -Lipschitz and convex function , under Assumptions 1,2 and assuming is of rank-, let , for any , with , step size , the PDP-SGD achieves
where , and is the minima of .
Compared to the error rate of DP-SGD for convex functions Bassily et al. (2014, 2019a), PDP-SGD also demonstrates an improvement from a factor of to . PDP-SGD also involves the subspace reconstruction error, i.e., depending on the function and eigen-gap term . Based on the discussion in previous section and a more detailed discussion in Appendix A.2, with suitable assumptions of the gradient structure, e.g., ellipsoids, the is a constant. For the eigen-gap term, if stays as a constant in the training procedure as shown by Figure 1, will be a constant and the bound scales logarithmically with . If we assume the eigen-gap decays as training proceed, e.g., for , then we have . In this case, with , PDP-SGD requires public data size .
Experiments
Datasets and Network Structure. The MNIST and Fashion MNIST datasets both consist of 60,000 training examples and 10,000 test examples. To construct the private training set, we randomly sample samples from the original training set of MNIST and Fashion MNIST, then we randomly sample samples from the rest to construct the public dataset. Note that the smaller private datasets make the private learning problem more challenging. For both datasets, we use a convolutional neural network that follows the structure in Papernot et al. (2020).
Training and Hyper-parameter Setting. Cross-entropy is used as our loss function throughout experiments. The mini-batch size is set to be 250 for both MNIST and Fashion MNIST. For the step size, we follow the grid search method with search space and step size used for DP-SGD, PDP-SGD and RPDP-SGD listed in Appendix D. For training, a fixed budget on the number of epochs i.e., 30 is assigned for the each task. We repeat each experiments 3 times and report the mean and standard deviation of the accuracy on the training and test set. For PDP-SGD, we use Lanczos algorithm to compute the top eigen-space of the gradient second moment martix on public dataset. We use for MNIST and for Fashion MNIST. For RPDP-SGD, we use for both datasets. Instead of doing the projection for all epochs, we also explored a start point for the projection, i.e., executing the projection from the 1-st epoch, 15-th epoch. We found that for Fashion MNIST, PDP-SGD and RPDP-SGD perform better when starting projection from the 15-th epoch.
Privacy Parameter Setting: We consider different choices of the noise scale, i.e., for MNIST and for Fashion MNIST. Since gradient norm bound is unknow for deep learning, we follow the gradient clipping method in Abadi et al. (2016) to guarantee the privacy. We choose gradient clip size to be for both datasets. We follow the Moment Accountant (MA) method (Abadi et al., 2016; Bu et al., 2019) to calculate the accumulated privacy cost, which depends on the number of epochs, the batch size, , and noise . With 30 epochs, batch size , training samples, and fixing , the is for for Fashion MNIST. For MNIST, is for . Note that presented in this paper is w.r.t. a subset i.e., samples from MNIST and Fashion MNIST.
Experimental Results. The training accuracy and test accuracy for different , are reported in Figure 3. For small regime, i.e., with MNIST (Figure 3 (a)) and with Fashion MNIST (Figure 3 (b)), PDP-SGD outperforms DP-SGD. For large (small noise scale), we think DP-SGD performs better than PDP-SGD because the subspace reconstruction error dominates the error from the injected noise. For most choices of , RPDP-SGD fails to improve the accuracy over DP-SGD because the subspace reconstruction error introduced by the random projector is larger than the noise error reduced by projection. To the best of our knowledge, we noticed that when for MNIST, PDP-SGD and DP-SGD perform better than the benchmark reported in Papernot et al. (2020) even with a subset from MNIST (Figure 3 (a)). We acknowledge that Papernot et al. (2020) report the test accuracy as a training dynamic in terms of privacy loss . Figure 4 provides two examples of the training dynamics, i.e., MNIST with and Fashion MNIST with , showing that PDP-SGD outperforms DP-SGD for large noise scale since PDP-SGD efficiently reduces the noise. We also validate this observation on larger training samples in Appendix D.
We also study the role of projection dimension and pubic sample size . Figure 5(a) and Figure 5(b) present the training and test accuracy for PDP-SGD with and PDP-SGD with for for MNIST dataset. Among the choices of , PDP-SGD with achieves the best accuracy. DP-SGD with proceeds slower than the rest, due to the larger reconstruction error introduced by projecting the gradient to a much smaller subspace, i..e, . However, compared to the gradient dimension , it is impressive that PDP-SGD with can achieve better accuracy than DP-SGD for a certain range of . Figure 5(b) shows that the accuracy of PDP-SGD improves as the increases from 50 to 150. This is consistent with the theoretical analysis that increasing helps to reduce the subspace reconstruction error. Also, PDP-SGD with performs similar to PDP-SGD with . The results suggest that while a small number of public datasets are not sufficient for training an accurate predictor, they provide useful gradient subspace projection and accuracy improvement over DP-SGD.
To reduce the computation complexity introduced by eigen-value decomposition, we explored PDP-SGD with sparse eigen-space computation, i.e., update the projector every iterates. Note that PDP-SGD with means computing the top eigen-space at every iteration. Figure 6 reports PDP-SGD with for (a) MNIST and (b) Fashion MNIST showing that PDP-SGD with a reduced eigen-space computation also outperforms DP-SGD, even though there is a mild decay for PDP-SGD with fewer eigen-space computations.
Conclusion and Future Work
While differentially-private stochastic gradient descent (DP-SGD) algorithms and variants have been well studied for solving differentially private empirical risk minimization (ERM), the error rate of DP-SGD has a dependence on the ambient dimension . In this paper, we aim at bypassing such dependence by leveraging a special structure of gradient space i.e., the stochastic gradients for deep nets usually stay in a low dimensional subspace in the training process. We propose PDP-SGD which projects the noisy gradient to an approximated subspace evaluated on a public dataset. We show that the subspace reconstruction error is small and PDP-SGD reduces the factor in the error rate to the projection dimension. We evaluate the proposed algorithms on two popular deep learning tasks and demonstrate the empirical advantages of PDP-SGD over DP SGD.
There are several interesting directions for future work. First, it will be interesting to provide an private optimization method that can identify the gradient subspace at each iteration without access to a public dataset. The existing "analyze-Gauss" techniques in Dwork et al. (2014) will give a bound with reconstruction error scaling with , which will be propagated to the optimization error. More recently, Song et al. (2020) show that, for a class of generalized linear problems, DP gradient descent (without any projection) achieves an excess empirical risk bound depending on the rank of the feature matrix instead of the ambient dimension. It will also be interesting to explore whether their rank-dependent bounds hold for a more general class of problems. Finally, a question that applies both to private and non-private optimization is to characterize the class of optimization problems with low-dimensional gradient subspaces.
Acknowledgement
The research was supported by NSF grants IIS-1908104, OAC-1934634, IIS-1563950, a Google Faculty Research Award, a J.P. Morgan Faculty Award, and a Mozilla research grant. We would like to thank the Minnesota Super-computing Institute (MSI) for providing computational resources and support.
References
Appendix A Uniform Convergence for Subspaces: Proofs for Section 3.1
In this section, we provide the proofs for Section 3.1. We first show that the second moment matrix converges to the population second moment matrix uniform over all iterations , i.e., . Then we show that the top- subspace of uniformly converges to the top- subspace of , i.e., for all . Our bound depends on where is the set of all possible parameters along the training trajectory. In Section A.2, we show that the bound can be derived by as well, where is the set of population gradients along the training trajectory. Then, we provide examples of the set and corresponding value of .
Our proofs of Theorem 2 heavily rely on the advanced probability tool, Generic Chaining (GC) [Talagrand, 2014]. Typically the results in generic chaining are characterized by the so-called function (see Definition 2). Talagrand shows that for a process and a given metric space , if satisfies the increment condition
then the size of the process can be bounded as
We first show that the variable satisfies the increment condition as stated in (9) in Lemma 1. Before we present the proof of Lemma 1, we introduce the Ahlswede-Winter Inequality [Horn and Johnson, 2012, Wainwright, 2019], which will be used in the proof of Lemma 1. Ahlswede-Winter Inequality shows that positive semi-definite random matrix with bounded spectral norm concentrates to its expectation with high probability.
To make the argument clear, we use a more informative notation for and . Recall the notation of and such that
With Assumption 2 and 1 hold, for any and , we have
By triangle inequality and the construction of , we have
By Assumption 1 and Assumption 2 and definition
Let , with (19), we have
Based on the above result, now we come to the proof of Theorem 2. The proof follows the Generic Chaining argument, i.e., Chapter 2 of Talagrand .
Note that equation (4) is a uniform bound over iteration . To bound , it is sufficient to bound
where contains all the possible trajectorys of .
We consider a sequence of subsets of , and
where
Let be the approximation of any . We decompose the as
which holds since for large enough.
with probability at most .
For any and , the number of possible pairs is
Apply union bound over all the possible pairs of , following Talagrand (Chapter 2.2), for any , , and , we have
where is a universal constant.
with probability at most .
with ptobability at most .
with probability at most .
Recall that is the top- eigenspace of . Let be the top- eigenspace of .
where denotes the projection to the top- subspace of the symmetric PSD and denotes the projection to the top- subspace of the symmetric PSD . Then, from Davis-Kahan (Corollary 8 in McSherry ) and using the fact for symmetric PSD matrices eigen-values and singular values are the same, we have
Recall, from Horn and Johnson (Section 4.3) and Golub and Van Loan (Section 8.1.2), e.g., Corollary 8.1.6, we have
From Theorem 2 and Lemma 2, with , , and , we have
Let . For , we have
Combining these two bounds and (41), with , we have
Using (42) such that , we have
Consider a r.v. which satisfies
for certain numbers and . Then
In this section, we provide more intuitions and explanations of functions. We justify our assumptions about the gradient space and provide more examples of the gradient space structure and the corresponding functions.
At a high level, for a metric space , is related to where is the covering number of with balls with metric , but it is considerably sharper. Such sharpening has happened in two stages in the literature: first, based on chaining, which considers an integral over all yielding the Dudley bound, and subsequently, based on generic chaining, which considers a hierarchical covering, developed by Talagrand and colleagues, and which yields the sharpest bounds of this type. The official perspective of generic chaining is to view as an upper (and lower) bound on suprema of Gaussian processes indexed on and with metric [Theorem 2.4.1 in Talagrand ].
Composition. Based on the composition properties of functions Talagrand , one can construct additional examples of the gradient spaces. If , the Minkowski sum, then (Theorem 2.4.15 in Talagrand ), where is an absolute constant. If is a union of several subset, i.e., , then by using an union bound on Theorem 2, we have . Thus, if is an union of ellipsoids, i.e., polynomial in , then .
Appendix B Proofs for Section 3.2
In this section, we present the proofs for Section 3.2. Then we present the error rate for convex problems in the subsequent section.
Let and Then we have
Since is a zero mean Gaussian vector, we have
For -smooth The Assumption 2 suggests that the is -smooth. function , conditioned on , we have
where is and is the projection. is the null space of .
Bringing the above to (54), the right-hand side of (54) becomes
Bringing the upper bound of to (61), setting , using telescoping sum and taking the expectation over all iterations, we have
With triangle inequality and Theorem 3, we have
where .
Let and .
where is uniformly sampled from . ∎
Appendix C Error Rate of Convex Problems
For the convex and Lipschitz functions, we consider the low-rank structure of the gradient space, i.e, the population gradient second momment is of rank-, which is a special case of the principal gradient dominate assumption when .
Proof: By the convexity of , we have
Let and Then we have
By convexity, conditioned at , we have
and For convex problem, we consider , where ..
Let , taking the expectation over all iterations and sum over , we have
where the last inequality holds because the is of rank and .
Bring this to (75), use the fact that , with Jensen’s inequality we have
where .
With , let , we have
Appendix D Experimental Setup and Additional Results
Datasets and Network Structure. The MNIST and Fashion MNIST datasets both consist of 60,000 training examples and 10,000 test examples. To construct the private training set, we randomly sample samples from the original training set of MNIST, then we randomly sample samples from the rest to construct as the public dataset PDP-SGD can work with larger training set as well. We randomly sample 10,000 samples due to the limitation of computation resources, e.g., GPUs. . Details refer to Table 2. For both MNIST and Fashion MNIST, we use a convolutional neural network that follows the structure in Papernot et al. whose architecture is described in Table 1. All experiments have been run on NVIDIA Tesla K40 GPUs.
Hyper-parameter Setting. We consider different choices of the noise scale, i.e., for MNIST and for Fashion MNIST. Cross-entropy is used as our loss function throughout experiments. The mini-batch size is set to be 250 for both MNIST and Fashion MNIST. For the step size, we follow the grid search method with search space to tune the step size for MNIST and the search space is for Fashion MNIST. We choose the step size based on the training accuracy at the last epoch. The best step sizes for DP-SGD and PDP-SGD for different privacy levels are presented in Table 3 and Table 4 for MNIST and Fashion MNIST, respectively. For training, a fixed budget on the number of epochs i.e., 30 is assigned for the each task. We repeat each experiments 3 times and report the mean and standard deviation of the accuracy on the training and test set. For PDP-SGD, the projection dimension is a hyper-parameter and it illustrates a trade-off between the reconstruction error and the noise reduction. A small implies more noise amount will be reduced, and a larger reconstruction error will be introduced. We explored for MNIST and for Fashion MNIST, and we found that and achieve the best performance for MNIST and Fashion MNIST respectively among the search space we consider. Instead of doing the projection for all epochs, we also explored a start point for the projection, i.e., executing the projection from the -th epoch, -th epoch. The information of projection dimension and the starting epoch for projection are also given in Table 3 and Table 4 for MNIST and Fashion MNIST, respectively.
Privacy Parameter Setting. Since gradient norm bound is unknow for deep learning, we follow the gradient clipping method in Abadi et al. to guarantee the privacy. We implement the micro-batch clipping method in PyTorch We implement the clipping method based on this repository: https://github.com/ChrisWaites/pyvacy.. We use micro-batch = 1 and micro-batch = 5 for MNIST and Fashion MNIST, respectively. Note that training with micro-batch clipping will need the noise scaled by micro-batch size to guarantee the same privacy. But it takes less time than training with per-sample clipping, i.e., micro-batch = 1. We follow the Moment Accountant (MA) method [Bu et al., 2019] to calculate the accumulated privacy cost, which depends on the number of epochs, the batch size, , and noise variance . With 30 epochs, batch size , training samples, and fixing , the is for for Fashion MNIST. For MNIST, is corresponding to . Note that the presented in this paper is w.r.t. a subset i.e., samples from MNIST and Fashion MNIST. Also, one can fix the value of and do a search over the epochs, batch size and noise scale to boost the performance for a fixed privacy level . We omit such a complicated hyper-parameter tuning since it has a high risk of privacy leakage.
Additional Experimental Results. Training dynamics of DP-SGD and PDP-SGD with different privacy levels are presented in Figure 7 and Figure 8 respectively for MNIST and Fashion MNIST. The results suggest that for small , PDP-SGD can effeciently reduce the noise variance injected to the gradient, which improves the training and test accuracy over DP-SGD.
In order to understand the role of projection dimension , we run PDP-SGD with projection starting from the first epoch. Figure 9 reports the PDP-SGD with for MNIST with (Figure 9(a)) and (Figure 9(b)). Among the choice of , we can see that PDP-SGD with performs better that the others in terms of the training and test accuracy. PDP-SGD with proceeds slower than PDP-SGD with and . This is due to the larger reconstruction error introduced by projecting the gradient to a much smaller subspace, i..e, . However, compared to the gradient dimension , it is impressive that PDP-SGD with which projects the gradient to the a much smaller subspace, can achieve better accuracy than DP-SGD.
We also empirically evaluate the effect of the public sample size . Figure 11(a) and Figure 11(b) present the training and test accuracy for PDP-SGD with for and for Fashion MNIST dataset. The training and test accuracy of PDP-SGD increases as the public sample size increases from 50 to 150. This is consistent with the theoretical analysis that increasing helps reducing the subspace reconstruction error as suggested by the theoretical bound. Also, PDP-SGD with and performs slightly better that in terms of the training and test accuracy. The results suggest that while a small amount of public datasets are not sufficient for training an accurate predictor, they provide useful gradient subspace projection and accuracy improvement over DP-SGD.
We also compare PDP-SGD and DP-SGD for different number of training samples, i.e., MNIST with 20,000 samples (Figure 12(a)) and Fashion MNIST with 50,000 samples (Figure 12(a)) (100 public samples for both case). The observation that PDP-SGD outperforms DP-SGD for small regime in Figure 3 also holds for other number of training samples.
We also explore PDP-SGD with sparse eigen-space computation, i.e., update the projector every iterates. Note that PDP-SGD with means computing the top eigen-space at every iteration. Figure 13 reports PDP-SGD with for (a) MNIST with 50,000 samples and (b) Fashion MNIST with 50,000 samples showing that there is a mild decay for PDP-SGD with fewer eigen-space computation. PDP-SGD with a reduced eigen-space computation also improves the accuracy over DP-SGD.