differentially private model publishing for deep learning · on the other hand, the publishing and...

20
A preliminary version of this paper appears in the proceedings of 40th IEEE Symposium on Security and Privacy (IEEE S&P 2019). This version contains a few refinements, corrections and extensions. Differentially Private Model Publishing for Deep Learning Lei Yu, Ling Liu, Calton Pu, Mehmet Emre Gursoy, Stacey Truex School of Computer Science, College of Computing, Georgia Institute of Technology Email: [email protected], {ling.liu,calton.pu}@cc.gatech.edu, {memregursoy,staceytruex}@gatech.edu Abstract—Deep learning techniques based on neural net- works have shown significant success in a wide range of AI tasks. Large-scale training datasets are one of the critical factors for their success. However, when the training datasets are crowdsourced from individuals and contain sensitive infor- mation, the model parameters may encode private information and bear the risks of privacy leakage. The recent growing trend of the sharing and publishing of pre-trained models further aggravates such privacy risks. To tackle this problem, we propose a differentially private approach for training neural networks. Our approach includes several new techniques for optimizing both privacy loss and model accuracy. We employ a generalization of differential privacy called concentrated differential privacy(CDP), with both a formal and refined pri- vacy loss analysis on two different data batching methods. We implement a dynamic privacy budget allocator over the course of training to improve model accuracy. Extensive experiments demonstrate that our approach effectively improves privacy loss accounting, training efficiency and model quality under a given privacy budget. Keywords-differential privacy; stochastic gradient descent; deep learning; model publishing; privacy budget allocation I. I NTRODUCTION In recent years, deep learning techniques based on artifi- cial neural networks have dramatically advanced the state of the art in a wide range of AI tasks such as speech recognition, image classification, natural language process- ing and game playing. Its success relies on three sources of advancement: high-performance computing, large-scale datasets, and the increasing number of open source deep learning frameworks, such as TensorFlow, Caffe, and Torch. Privacy Concerns in Deep Learning. However, recent studies on membership attacks and model inversion attacks have exposed potential privacy risks from a number of dimensions. First, large-scale datasets are collected from individuals via crowdsourcing platforms, containing private information such as location, images, medical, and financial data of the users. The users usually do not have any control over how their data is being used or shared once collected. Second, deep neural networks have a large number of hidden layers, leading to a large effective capacity that could be sufficient for encoding the details of some individual’s data into model parameters or even memorizing the entire dataset [43]. It has been shown that individual information can be effectively extracted from neural networks [21], [36]. Therefore, there are severe privacy concerns accompanied with the broad deployment of deep learning applications and deep learning as a service . On the other hand, the publishing and sharing of trained deep learning models has been gaining growing interest. Google’s cloud machine learning services provide several pre-trained models usable out-of-the-box through a set of APIs. The model owners can also publish their trained mod- els to the cloud and allow other users to perform predictions through APIs. In mobile applications, entire models are stored on-device to enable power-efficient and low-latency inference. Transfer learning [42], a key technique of deep learning, can leverage and adapt the already existing models to new classes of data, saving the effort of training the entire neural network from scratch. People who only have small datasets can use the model trained on a large dataset as a fixed feature extractor in their neural networks or adapt the model to their own domain. Transfer learning is believed to be the next driver of machine learning success in industry and will significantly stimulate the sharing of pre-trained models. A large number of pre-trained models have been publicly available in model zoo repositories [7]. In these cases, the model parameters are entirely exposed, making it easier for adversaries to launch inference attacks, such as membership attacks [36] or model inversion attacks [21], to infer sensitive data records of individuals in the training datasets. Even by providing only the query APIs to access remote trained models, the model parameters may still be extracted from prediction queries and in turn used to infer the sensitive training data [40]. Therefore, it is imperative to develop principled privacy-preserving deep learning tech- niques to protect private training data against adversaries with full knowledge of model parameters. Deep learning with Differential Privacy. Although privacy-preserving machine learning has attracted much at- tention over the last decade, privacy preserving deep learning was first proposed in 2015 [35]. The proposed approach ar- gues for privacy-preserving model training in a collaborative federated learning system and involves multiple participants jointly training a model by sharing sanitized parameters while keeping their training data private and local. The first proposal for deep learning with differential privacy was presented in 2016 [8]. Differential privacy (DP), a defacto standard for privacy that offers provable privacy guarantees, has been applied for privacy-preserving machine learning [9], [11], [12], [34], [44]. DP characterizes the 1 arXiv:1904.02200v5 [cs.CR] 19 Dec 2019

Upload: others

Post on 19-Aug-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Differentially Private Model Publishing for Deep Learning · On the other hand, the publishing and sharing of trained deep learning models has been gaining growing interest. Google’s

A preliminary version of this paper appears in the proceedings of 40th IEEE Symposium on Security and Privacy (IEEES&P 2019). This version contains a few refinements, corrections and extensions.

Differentially Private Model Publishing for Deep Learning

Lei Yu, Ling Liu, Calton Pu, Mehmet Emre Gursoy, Stacey TruexSchool of Computer Science, College of Computing, Georgia Institute of Technology

Email: [email protected], {ling.liu,calton.pu}@cc.gatech.edu, {memregursoy,staceytruex}@gatech.edu

Abstract—Deep learning techniques based on neural net-works have shown significant success in a wide range of AItasks. Large-scale training datasets are one of the criticalfactors for their success. However, when the training datasetsare crowdsourced from individuals and contain sensitive infor-mation, the model parameters may encode private informationand bear the risks of privacy leakage. The recent growingtrend of the sharing and publishing of pre-trained modelsfurther aggravates such privacy risks. To tackle this problem,we propose a differentially private approach for training neuralnetworks. Our approach includes several new techniques foroptimizing both privacy loss and model accuracy. We employa generalization of differential privacy called concentrateddifferential privacy(CDP), with both a formal and refined pri-vacy loss analysis on two different data batching methods. Weimplement a dynamic privacy budget allocator over the courseof training to improve model accuracy. Extensive experimentsdemonstrate that our approach effectively improves privacyloss accounting, training efficiency and model quality under agiven privacy budget.

Keywords-differential privacy; stochastic gradient descent;deep learning; model publishing; privacy budget allocation

I. INTRODUCTION

In recent years, deep learning techniques based on artifi-cial neural networks have dramatically advanced the stateof the art in a wide range of AI tasks such as speechrecognition, image classification, natural language process-ing and game playing. Its success relies on three sourcesof advancement: high-performance computing, large-scaledatasets, and the increasing number of open source deeplearning frameworks, such as TensorFlow, Caffe, and Torch.Privacy Concerns in Deep Learning. However, recentstudies on membership attacks and model inversion attackshave exposed potential privacy risks from a number ofdimensions. First, large-scale datasets are collected fromindividuals via crowdsourcing platforms, containing privateinformation such as location, images, medical, and financialdata of the users. The users usually do not have any controlover how their data is being used or shared once collected.Second, deep neural networks have a large number ofhidden layers, leading to a large effective capacity that couldbe sufficient for encoding the details of some individual’sdata into model parameters or even memorizing the entiredataset [43]. It has been shown that individual informationcan be effectively extracted from neural networks [21], [36].Therefore, there are severe privacy concerns accompanied

with the broad deployment of deep learning applications anddeep learning as a service .

On the other hand, the publishing and sharing of traineddeep learning models has been gaining growing interest.Google’s cloud machine learning services provide severalpre-trained models usable out-of-the-box through a set ofAPIs. The model owners can also publish their trained mod-els to the cloud and allow other users to perform predictionsthrough APIs. In mobile applications, entire models arestored on-device to enable power-efficient and low-latencyinference. Transfer learning [42], a key technique of deeplearning, can leverage and adapt the already existing modelsto new classes of data, saving the effort of training the entireneural network from scratch. People who only have smalldatasets can use the model trained on a large dataset as afixed feature extractor in their neural networks or adapt themodel to their own domain. Transfer learning is believed tobe the next driver of machine learning success in industryand will significantly stimulate the sharing of pre-trainedmodels. A large number of pre-trained models have beenpublicly available in model zoo repositories [7]. In thesecases, the model parameters are entirely exposed, making iteasier for adversaries to launch inference attacks, such asmembership attacks [36] or model inversion attacks [21],to infer sensitive data records of individuals in the trainingdatasets. Even by providing only the query APIs to accessremote trained models, the model parameters may still beextracted from prediction queries and in turn used to inferthe sensitive training data [40]. Therefore, it is imperativeto develop principled privacy-preserving deep learning tech-niques to protect private training data against adversarieswith full knowledge of model parameters.Deep learning with Differential Privacy. Althoughprivacy-preserving machine learning has attracted much at-tention over the last decade, privacy preserving deep learningwas first proposed in 2015 [35]. The proposed approach ar-gues for privacy-preserving model training in a collaborativefederated learning system and involves multiple participantsjointly training a model by sharing sanitized parameterswhile keeping their training data private and local. Thefirst proposal for deep learning with differential privacywas presented in 2016 [8]. Differential privacy (DP), adefacto standard for privacy that offers provable privacyguarantees, has been applied for privacy-preserving machinelearning [9], [11], [12], [34], [44]. DP characterizes the

1

arX

iv:1

904.

0220

0v5

[cs

.CR

] 1

9 D

ec 2

019

Page 2: Differentially Private Model Publishing for Deep Learning · On the other hand, the publishing and sharing of trained deep learning models has been gaining growing interest. Google’s

difference in output between two input datasets differing byat most one element. This characterization is challengingwith deep learning because the internal representations ofdeep neural networks are notoriously difficult to understand.Prior works [8], [30], [39] suggest using the norm gradientclipping in the stochastic gradient descent (SGD) algorithmto bound the influence of any single example on the gra-dients and then applying differentially private mechanismsto perturb the gradients accordingly. By ensuring that eachgradient descent step is differentially private, the final outputmodel satisfies a certain level of differential privacy giventhe composition property. It is known that the SGD trainingprocess of a deep neural network tends to involve a largenumber of iterations. Given a target differential privacyguarantee, the differentially private training algorithm needsa tight estimation on the privacy loss for the compositionof DP. This is necessary for the algorithm to effectivelytrack cumulative privacy loss during the training processand, if necessary, terminate before the loss exceeds theprivacy budget. Unfortunately, Abadi and his co-authors [8]have shown the existing strong composition theorem [19]for differential privacy does not yield a tight analysis. Toaddress this problem, the moments accountant method isproposed [8], which tracks the log moments of the privacyloss variable and provides a much tighter estimate of theprivacy loss for the composition of Gaussian mechanismsunder random sampling.

In this paper, however, we examine several issues andpossible improvement on using the differentially privateSGD (DP-SGD) algorithm and privacy accounting methodproposed in [8]. The first problem is related to the underes-timation of privacy loss caused by data batching methods.For computational efficiency, the SGD algorithm usuallytakes small batches from the training dataset to iterativelycompute gradients and update model parameters. The DP-SGD approach in [8] exploits the privacy amplification ofrandom sampling to produce a tighter estimation of privacyloss. This is based on the assumption that the data batchesfor mini-batch SGD input are generated through randomsampling with replacement on the training dataset. In prac-tice, for better efficiency, data batching is implemented viarandom reshuffling, which randomly shuffles the trainingdataset and then partitions them into batches of the similarsize [5], [24]. Therefore, it has been implemented as standardAPIs in deep learnig frameworks like Tensorflow. Severalexisting DP-SGD implementations [1], [6], [20], [45] usemoments accountant(MA) method to track privacy loss,while implementing random shuffling or using its APIsto generate data batches which may violate the randomsampling assumption required by MA. Table I demonstratessome examples. Our anlysis shows that random reshufflingincurs higher privacy loss than random sampling. Thus,simply treating reshuffling and random sampling as the samewill lead to the underestimation of privacy loss and the

privacy accounting should depend on how data is accessed.The second issue is the need for a tight analysis on cumu-

lative privacy loss for DP-SGD which tends to have a largenumber of iterations. To address this problem, we proposethe use of concentrated differential privacy (CDP), a general-ization of differential privacy recently introduced by Dworkand Rothblum [18]. CDP focuses on cumulative privacy lossfor a large number of computations and provides a sharperanalysis tool. Based on CDP, we analyze the privacy lossunder random reshuffling and random sampling respectively.In particular, our CDP based privacy accounting method forrandom reshuffling provides a tighter estimation of privacyloss even than the result produced by the strong compositiontheorem with having privacy amplification effect of randomsampling. In addition, we also consider using CDP for theprivacy loss analysis under random sampling based databatching. We find that CDP is not able to capture the privacyamplification effect of random sampling. Accordingly, wepropose to consider a relaxation of CDP and convert it totraditional (ε, δ)-differential privacy. Our method provides aslightly loose but easy method to approximately estimate theprivacy loss for random sampling.

The third novelty of our approach to differentially privatedeep learning is our development of a dynamic privacybudget allocation to improve model accuracy under dif-ferentially private training. The perturbed gradients duringthe training process inevitably degrade model accuracy. Weaim to provide differential privacy guarantees on the finaloutput models. This means that we are much less concernedwith the privacy loss of a single iteration. This providesopportunities to optimize the model accuracy via adjustingprivacy budget allocation for every training iteration. In thispaper, we propose a set of dynamic privacy budget allocationmethods and our extensive experiments demonstrate benefitsfor improving the model accuracy. It is worth noting that thetechniques proposed in this paper not only apply to neuralnetworks but also may apply to any other iterative learningalgorithms.

The remainder of the paper is as follows. We reviewnecessary background in Section II, provide an overviewof our approach in Section III, and then give a detailedtechnical development in Section IV. Section V describesexperimental results. Some discussions are given in SectionVI. Section VII presents related work and Section VIIIconcludes the paper. Deferred proofs are provided in theAppendix.

II. BACKGROUNDA. Deep Learning

Deep learning uses neural networks that are defined asa hierarchical composition of parameterized functions tomodel the input data. For supervised learning, the trainingdata are labeled with correct classes, and a multi-layer neuralnetwork is deployed to model the correlation between data

Page 3: Differentially Private Model Publishing for Deep Learning · On the other hand, the publishing and sharing of trained deep learning models has been gaining growing interest. Google’s

Table I: We examine a few data batching APIs in Tensorflow. Given a list of numbers from 0 to 9 as input data, we usethem to generate batches of size 1 and show the output batch for each training iteration in an epoch. In addition, we runthe true random sampling that samples each number with probability batch size/data size=0.1 to generate batches in 10iterations. The source code of our test is given in Appendix H.

Batching methods Input data example of output batches in one epochtf.train.shuffle batch [0,1,2,. . . ,9] [2],[6],[8],[0],[5],[7],[1],[4],[9],[3]tf.estimator.inputs.numpy input fn [0,1,2,. . . ,9] [5],[1],[4],[9],[8],[3],[7],[2],[6],[0]random sampling with prob=0.1 [0,1,2,. . . ,9] [2], [1 7], [] ,[4 5], [], [7] ,[5 7 9] ,[], [1], [1 3 7]

instances and their labels. A typical neural network consistsof n(n > 1) layers of neurons. Each layer of neurons isparameterized by a weight matrix W (l) and a bias vectorb(l). Layers apply an affine transformation to the previouslayer’s output and then computes an activation function σover that. Typical examples of the activation function σ aresigmoid, rectified linear unit(ReLU) and tanh.

The training of a neural network aims to learn the pa-rameters θ = {W (l), b(l)|1 ≤ l ≤ n} that minimize a lossfunction L defined to represent the penalty for misclassifyingthe training data. It is usually a non-convex optimizationproblem and solved by gradient descent. The gradient de-scent method iteratively computes the gradient of the lossfunction L and updates the parameters every step until theloss converges to a local optimum. In practice, the trainingof neural networks uses the mini-batch stochastic gradientdescent (SGD) algorithm, which is much more efficient forlarge datasets. At each step a batch B of examples is sampledfrom the training dataset and the gradient of the averageloss is computed, i.e., 1

|B|∑x∈B ∇θL(θ, x) as ∇θL(θ). The

SGD algorithm then applies the following update rule forparameters θ

θ = θ − α∇θL(θ) (1)

where α is the learning rate. The running time of the mini-batch SGD algorithm is usually expressed as the numberof epochs. Each epoch consists of all of the batches ofthe training dataset, i.e., in an epoch every example hasbeen seen once. Within an epoch, the pass of one batch ofexamples for updating the model parameters is called oneiteration.

B. Differential Privacy

Differential privacy is a rigorous mathematical frameworkthat formally defines the privacy properties of data analysisalgorithms. Informally it requires that any changes to asingle data point in the training dataset can only causestatistically insignificant changes to the algorithm’s output.

Definition 1 (Differential Privacy [15]). A randomizedmechanism A provides (ε, δ)-differential privacy if for anytwo neighboring database D and D′ that differ in only asingle entry, ∀S ⊆ Range(A),

Pr(A(D) ∈ S) ≤ eε Pr(A)(D′) ∈ S) + δ (2)

If δ = 0, A is said to be ε-differential privacy. In the restof this paper, we write (ε, δ)-DP for short.

The standard approach to achieving differential privacyis the sensitivity method [15], [16] that adds to the outputsome noise that is proportional to the sensitivity of the queryfunction. The sensitivity measures the maximum change ofthe output due to the change of a single database entry.

Definition 2 (Sensitivity [16]). The sensitivity of a queryfunction q : D → Rd is

∆ = maxD,D′

||q(D)− q(D′)|| (3)

where D, D′ ∈ D are any two neighboring datasets thatdiffer at most one element, || · || denotes L1 or L2 norm.

In this paper, we choose the Gaussian mechanism thatuses L2 norm sensitivity. It adds zero-mean Gaussian noisewith variance ∆2σ2 in each coordinate of the output q(D),as

q(D) +N (0,∆2σ2I) (4)

It satisfies (ε,δ)-DP if σ2 > 2 log(1.25δ )/ε2 and ε ∈

(0, 1) [17].

C. Concentrated Differential Privacy

Concentrated differential privacy (CDP) is a generaliza-tion of differential privacy recently introduced by Dworkand Rothblum [18]. It aims to make privacy-preservingalgorithms more practical for large numbers of computationsthan traditional DP while still providing strong privacy guar-antees. It allows the computation to have much less concernabout single-query loss but high probability bounds for thecumulative loss, and provides sharper and more accurateanalysis on the cumulative loss for multiple computationscompared to the popular (ε, δ)-DP.

CDP considers privacy loss on an outcome o as a randomvariable when the randomized mechanism A operates ontwo adjacent database D and D′:

L(o)(A(D)||A(D′))

∆= log

Pr(A(D) = o)

Pr(A(D′) = o)(5)

The (ε, δ)-DP guarantee ensures that the privacy loss vari-able is bounded by ε but exceeds that with probability nomore than δ. As a relaxation to that, (µ, τ)-concentrateddifferential privacy, (µ, τ)-CDP for short [18], ensures thatthe mean (i.e., expectation) of the privacy loss is no more

Page 4: Differentially Private Model Publishing for Deep Learning · On the other hand, the publishing and sharing of trained deep learning models has been gaining growing interest. Google’s

than µ and the probability of the loss exceeding its meanby an amount of t · τ is bounded by e−t

2/2. An al-ternative formulation of CDP to Dwork and Rothblum’s(µ, τ)-CDP is proposed by Bun and Steinke [10], called“zero-concentrated differential privacy” (zCDP for short).Instead of mean concentrated as (µ, τ)-CDP, zCDP makesprivacy loss concentrated around zero (hence the name), stillfollowing sub-Gaussian such that larger deviations from zerobecome increasingly unlikely.

Definition 3 (Zero-Concentrated Differential Privacy(zCDP) [10]). A randomized mechanism A is ρ-zero con-centrated differentially private (i.e., ρ-zCDP) if for any twoneighboring databases D and D′ that differ in only a singleentry and all α ∈ (1,∞),

Dα(A(D)||A(D′))∆=

1

α− 1log(E[e(α−1)L(o)

] )≤ ρα

(6)Where Dα(A(D)||A(D′)) called α-Renyi divergence be-tween the distributions of A(D) and A(D′).

The (ε, δ)-DP bounds the privacy loss by ensuringPr(L(o) > ε) ≤ δ. In contrast, zCDP entails a bound on themoment generating function of privacy loss L(o), indicatedby an equivalent form of (6)

E[e(α−1)L(o)

]≤ e(α−1)αρ (7)

This implies that for zCDP, privacy loss L(o) is assumed tobe a sub-Gaussian random variable such that it has a strongtail decay property, namely, Pr(L(o) > t+ρ) ≤ e−t2/(4ρ) forall t > 0 [10]. The following propositions are restatementsof some zCDP results given in [10] that will be used in ourpaper.

Proposition 1. If A provides ρ-zCDP, then A provides (ρ+2√ρ log(1/δ), δ)-DP for any δ > 0.

Proposition 2. The Gaussian mechanism with noiseN (0,∆2σ2I) satisfies ( 1

2σ2 )-zCDP.

We use zCDP instead of original (µ, τ)-CDP becausezCDP is comparable to (ε, δ)-DP, as indicated by Proposition1 and is immune to post-processing while (µ, τ)-CDP is notclosed under post-processing [10].

D. Composition

Differential privacy offers elegant composition propertiesthat enable more complex algorithms and data analysistask via the composition of multiple differentially privatebuilding blocks. The composition should have privacy guar-antees degraded gracefully with multiple outputs that maybe subjected to the joint analysis from building blocks.

For a sequential composition of k mechanismsA1, . . . ,Ak satisfying (εi, δi)-DP for i=1,. . ., k respectively,the basic composition result [17] shows that the privacycomposes linearly, i.e., the sequential composition satisfies

(∑ki εi,

∑ki δi)-DP. When εi = ε and δi = δ, the strong

composition bound from [19] states that the compositionsatisfies (ε

√2klog(1/δ′) + kε(eε − 1), kδ + δ′)-DP. For

zCDP, it has a simple linear composition property [10]:

Theorem 1. Two randomized mechanisms A1 and A2

satisfy ρ1-zCDP and ρ2-zCDP respectively, their sequentialcomposition A = (A1,A2) satisfies (ρ1 + ρ2)-zCDP.

Compared with (ε, δ)-DP, CDP provides a tighter boundon the cumulative privacy loss under composition, whichmakes it more suitable for algorithms running a largenumber of iterations. In other words, while providing thesame privacy guarantee, CDP allows lower noise scaleand thus better accuracy. Consider k iterative compo-sition of a Gaussian mechanism with noise N (0, σ2I).To guarantee the final (ε, δ)-DP, in terms of (εi, δi)-DP for every iteration, the permitted loss εi of each it-eration is εi = ε/(2

√2k log(1/(δ − kδi))), which will

be very low when k is large. The noise scale isσ =

√kε (4

√log(1.25/δi) log(1/(δ − kδi))). Suppose δi =

δ/(k + 1), we then have σ >√kε (4 log((k + 1)/δ)). In

contrast, with using ρi-zCDP for every iteration, becauseρ ≈ ε2/(4 log(1/δ)) zCDP satisfies (ε, δ)-DP [10] andρi = 1

kρ. It is easy to show that the noise scale σ =√kε

√2log(1/δ) which is multiple times smaller than the

noise scale derived under (ε, δ)-DP. On the other hand,a single parameter ρ of zCDP and its linear compositionnaturally fit the concept of a privacy budget. Thus, zCDP isan appropriate choice for privacy accounting.

III. OVERVIEW

Because it is difficult to characterize the maximumdifference of the model parameters over any two neigh-boring datasets for neural networks, differentially privatedeep learning [8], [30], [39] relies on differentially pri-vate stochastic gradient descent (DP-SGD) to control theinfluence of training data on the model. This approachexplicitly bounds per-example gradients ∇θL(θ, x) in everyiteration by clipping the L2 norm of gradient vectors. Givena clipping threshold C, this is done by replacing the gradientvector g with g/max(1, ||g||2C ) which scales g down tonorm C if ||g||2 > C. A Gaussian mechanism with L2

norm sensitivity of C is then applied to perturb the gradientsbefore the gradient descent step in Eq. (1) updates the modelparameters. Because each SGD step is differentially private,by the composition property of differential privacy, the finalmodel parameters are also differentially private. The problemwith DP-SGD is that the training of a deep neural network(DNN) tends to have a large number of iterations, whichcauses large cumulative privacy loss at the end. Therefore, atight estimation of privacy loss under composition is criticalfor allowing lower noise scale or more training iterations(for desired accuracy) when we have a fixed privacy budget.

Page 5: Differentially Private Model Publishing for Deep Learning · On the other hand, the publishing and sharing of trained deep learning models has been gaining growing interest. Google’s

To analyze the cumulative privacy loss of DP-SGD, weemploy concentrated differential privacy(CDP) which wasdeveloped to accommodate a larger number of computationsand provides sharper and tighter analysis of privacy lossthan the strong composition theorem of (ε, δ)-DP. Oneway to track the privacy loss of DP-SGD is the MomentsAccountant (MA) method proposed by Abadi et al. [8].It assumes that the data batches for mini-batch SGD aregenerated by randomly sampling examples from the trainingdataset with replacement, MA takes advantage of the privacyamplification effect of random sampling to achieve a muchtighter estimate on privacy loss than the strong compositiontheorem. It has been shown in [29] that running an (ε, δ)differentially private mechanism over a set of exampleseach of which is independently sampled with probability q(0 < q < 1) achieves (log(1 + q(eε− 1)), qδ)-DP. However,in practice, random batches are generated by randomlyshuffling examples and then partitioning them into batchesfor computation efficiency, which is distinct from randomsampling with replacement. By analyzing the privacy lossunder these two data batching methods, random samplingwith replacement and random reshuffling respectively, weshow that 1) random sampling with replacement and randomreshuffling result in different privacy loss; and 2) privacyaccounting using the MA method underestimates the actualprivacy loss of their neural network training, because itsimply regards random reshuffling as random samplingwith replacement. To address these problems, we developa privacy accounting method for random reshuffling, andour algorithm makes proper choices depending on whichmethod is used for data batching. For privacy accountingunder random sampling based batching, we show that CDPis unable to capture the privacy amplification effect ofrandom sampling. To address that, we propose a relaxationof zCDP and convert it to (ε, δ)-DP. Compared with MA, ourapproach provide an explicit expression to approximatelyestimate the privacy loss. It is easy to compute and can beuseful when the users need to decide proper training time,noise scale and sampling ratio during the planning phase.

In our approach, dynamic privacy budget allocation isapplied to DP-SGD to improve the model accuracy. In modelpublishing the privacy loss of each learning step is not ourprimary concern. This allows us to allocate different privacybudgets to different training epochs as long as we maintainthe same overall privacy guarantee. Our dynamic budgetallocation approach is in contrast to the previous work [8],which employs a uniform privacy budget allocation, and usesthe same noise scale in each step of the whole trainingprocess. Our dynamic privacy budget allocation approachleverages several different ways to adjust the noise scale. Ourexperimental results demonstrate that this approach achievesbetter model accuracy while retaining the same privacyguarantee.

Algorithm 1 presents our DP-SGD algorithm. In each

Algorithm 1: Differentially Private SGD AlgorithmInput: Training examples {x1, . . . , xN}, learning rate ηt,

group size L, gradient norm bound C, total privacybudget ρtotal

1 Initialize w0 ;2 Initialize cumulative privacy loss cprivt = 0;3 for t = 1 : T do4 Dynamic privacy budget allocation:5 σt ← AdpBudgetAlloc(ρtotal, t, T, schedule);6 update cprivt according to data batching method, t and σt;7 If cprivt > ρtotal, break ;8 data batching:9 Take a batch of data samples Bt from the training

dataset;10 B = |Bt|;11 Compute gradient:12 For each i ∈ Bt, gt(xi)←5wtL(wt, xi);13 Clip gradient:14 gt(xi)← gt(xi)/max

(1, ||gt(xi)||2

C

);

15 Add noise:16 gt ← 1

B

(∑i gt(xi) +N (0, σ2

tC2I));

17 Descent:18 wt+1 ← wt − ηtgt ;19 Output wT ;

iteration, a batch of examples is sampled from the trainingdataset and the algorithm computes the gradient of the losson the examples in the batch and uses the average in thegradient descent step. The gradient clipping bounds per-example gradients by l2 norm clipping with a threshold C.The Gaussian mechanism adds random noise N (0, σ2

tC2I)

to∑i gt(xi) to perturb the gradients in every iteration. We

have a total privacy budget ρtotal and cumulative privacycost cprivt . The way to update cprivt depends on whichbatching method is used. If the privacy cost exceeds thetotal budget, then the training is terminated. In the pseudocode, the function AdpBudgetAlloc(ρtotal, t, T, schedule)is used to obtain the noise scale σt for the current trainingstep t, according to schedule that decides how the noisescale is adjusted during the training time.

IV. DETAILS OF OUR APPROACH

In this section, we present the details of our approachfor differentially private deep learning. We first proposeour dynamic privacy budget allocation techniques and thendevelop privacy accounting methods based on zCDP fordifferent data batching methods.

A. Dynamic Privacy Budget Allocation

In Algorithm 1, the privacy budget allocated to an epochdecides the noise scale of Gaussian mechanism used by eachiteration within that epoch. For a given privacy budget ρtotal,the final model accuracy depends on how the privacy budgetis distributed over the training epochs. Our approach aimsto optimize the budget allocation over the training process

Page 6: Differentially Private Model Publishing for Deep Learning · On the other hand, the publishing and sharing of trained deep learning models has been gaining growing interest. Google’s

to obtain a differentially private DNN model with betteraccuracy.

Concretely, our dynamic privacy budget allocation fol-lows the idea that, as the model accuracy converges, it isexpected to have less noise on the gradients, which allowsthe learning process to get closer to the local optimal spotand achieve better accuracy. A similar strategy has beenapplied to the learning rate of DNNs in common practice.It is often recommended to reduce the learning rate as thetraining progresses, instead of using a constant learning ratethroughout all epochs, to achieve better accuracy [3], [13].Therefore, we propose a set of methods for privacy budgetallocation, which effectively improve the model accuracy bydynamically reducing the noise scale over the training time(as demonstrated by our experiments).

1) Adaptive schedule based on public validation dataset:One approach for adjusting the noise scale is to monitor thevalidation error during training and reduce the noise scalewhenever the validation error stops improving. We proposean adaptive privacy budget allocation that dynamically re-duces the noise scale according to the validation accuracy.Every time when the validation accuracy improves by lessthan a threshold δ, the noise scale is reduced by a factorof k until the total privacy budget runs out. However, whenthe validation dataset is sampled from the private trainingdataset, the schedule has some dependency on the privatedataset, which adds to the privacy cost. In this case, if wecan leverage a small publicly available dataset from the samedistribution and use it as our validation dataset, then it willnot incur any additional privacy loss.

In our approach, with a public validation dataset, the val-idation accuracy is checked periodically during the trainingprocess to determine if the noise scale needs to be reducedfor subsequent epochs. The epochs over which the validationis performed are referred to as validation epochs. Let σe bethe noise scale for the DP-SGD training in the validationepoch e, and Se be the corresponding validation accuracy .The noise scale for the subsequent epochs is adjusted basedon the accuracy difference between current epoch e and theprevious validation epoch e− 1. Initially, S0 = 0,

σ′e =

{kσe, if Se − Se−1 ≤ δ (8)σe (9)

The updated noise scale σ′e is then applied to the traininguntil the next validation epoch e + 1. The above equationsamount to say that if the improvement on the validationaccuracy Se − Se−1 is less than the threshold δ, it triggersthe decay of noise scale σe = kσe where k (0 < k < 1)is decay rate, a hyperparameter for the schedule. We notethat the validation accuracy may not increase monotonicallyas the training progresses, and its fluctuations may causeunnecessary reduction of noise scale and thus waste onthe privacy budget. This motivates us to use the movingaverage of validation accuracy to improve the effectiveness

of validation-based noise scale adjustment: at validationepoch e, we define an averaged validation accuracy Se overthe previous m validation epochs from e, including itself, asfollows:

Se =1

m

e∑i=e−m+1

Si (10)

The schedule checks the averaged validation accuracy everyperiod (period ≥ m) number of validation epochs andcompares the current result with that of the last checkingtime to decide if the noise scale needs to be reducedaccording to Eq. (8).

2) Pre-defined schedules: When the public validationdataset is not available, we propose to use an alternativeapproach that pre-defines how the noise scale decreases overtime without accessing any datasets or checking the modelaccuracy. Concretely, in our approach, the noise scale isreduced over time according to some decay functions. Thedecay functions update the noise scale by epoch, while thenoise scale keeps the same for every iteration within anepoch. By leveraging the Gaussian mechanism that addsnoise from N (0, σ2

tC2I), we provide four instances of decay

functions, all of which take the epoch number t as anargument.a) Time-Based Decay: It is defined with the mathematicalform

σt = σ0/(1 + kt)

where σ0 is the initial noise parameter for σ, t is the epochnumber and k (k > 0) is decay rate. when k < 1, it isknown as “search-then-converge” [14], which decreases thenoise scale linearly during the SGD search phase when t isless than the “search time” 1/k, and decreases the noise by1/t when t is greater than 1/k.b) Exponential Decay: It has the mathematical form

σt = σ0e−kt

where k (k > 0) is decay rate.c) Step Decay: Step decay reduces the learning rate by somefactor every few epochs. The mathematical form is

σt = σ0 ∗ kbt/periodc

where k (1 > k > 0) is the decay factor and period decideshow often to reduce noise in terms of the number of epochs.d) Polynomial Decay: It has the mathematical form

σt = (σ0 − σend) ∗ (1− t/period)k + σend

where k(k > 0) is the decay power and t < period. Apolynomial decay function is applied to the initial σ0 withinthe given number of epochs defined by period to reach σend(σend < σ0). When k = 1, this is a linear decay function.

The schedules for noise decay are not limited to the abovefour instances. In this paper we choose to use these fourbecause they are simple, representative, and also used bylearning rate decay in the performance tuning of DNNs.

Page 7: Differentially Private Model Publishing for Deep Learning · On the other hand, the publishing and sharing of trained deep learning models has been gaining growing interest. Google’s

Users can apply them in various ways. For example, a usercan use them in the middle of training phase, but keepconstant noise scale before and after. Note that in the time-based decay and exponential decay, t can be replaced bybt/periodc as done in the step decay such that the decayingis applied every period number of epochs. The polynomialdecay requires a specific end noise scale after period epochs,and we make the noise scale constant after the training timeexceed period epochs.

3) Privacy Preserving Parameter Selection: The pro-posed schedules require a set of pre-defined hyperparam-eters, such as decay rate and period. Their values decidethe training time and affect the final model accuracy. It isexpected to find the optimal hyperparameters for the sched-ules to produce the most accurate model. A straightforwardapproach is to test a list of k candidates by training kneural networks respectively and trivially choose the one thatachieves the highest accuracy, though this adds the privacycost up to kρtotal. A better approach is to apply differentiallyprivate parameter tuning, such as the mechanism proposedby Gupta et al. [12]. The idea is to partition the dataset tok+ 1 equal portions, train k models with using k scheduleson k different data portions respectively, and evaluate thenumber of incorrect predictions for each model, denotedby zi (1 ≤ i ≤ k), on the remaining data portion. Then,the Exponential Mechanism [31] is applied, which selectsand outputs a candidate with the probability proportional toexp(−εzi2 ). This parameter tuning procedure satisfies ε-DP,and accordingly satisfies 1

2ε2-zCDP [10].

B. Refined Privacy Accountant

The composition property of zCDP allows us to easilycompute cumulative privacy loss for the iterative SGDtraining algorithm. Suppose that each iteration satisfies ρ-zCDP and the training runs T iterations, then the wholetraining process satisfies (Tρ)-zCDP. In this section we showthat 1) the composition can be further refined by consideringthe property of the mini-batch SGD algorithm, and 2) moreimportantly, different batching methods lead to differentprivacy loss. In particular, we analyze the privacy losscomposition under two common batching methods: randomsampling with replacement and random reshuffling. Withrandom reshuffling, the training dataset is randomly shuffledand then partitioned into batches of similar size and SGDsequentially processes one batch at a time. It is a randomsampling process without replacement. For random samplingwith replacement, each example in a batch is independentlysampled from the training dataset with replacement. Becausethese two data batching methods have different privacyguarantees, for tracking privacy loss correctly, it is importantfor the users to choose the right accounting method basedon the batching method they use.

1) Under random reshuffling: SGD takes disjoint databatches as input within an epoch with random reshuffling.

We note that the existing results [10], [16], [18] on the com-position of a sequence of differential private mechanismsA1, . . . ,Ak assume that each mechanism Ai runs with thesame dataset X as input. It is expected that their compositionhas less cumulative privacy loss if each of differentiallyprivate mechanisms runs on disjoint datasets. The formalcomposition result in this scenario is detailed in Theorem 2.All the proofs of lemmas and theorems in this paper can befound in Appendix.

Theorem 2. Suppose that a mechanism A consists of asequence of k adaptive mechanisms, A1, . . . ,Ak, whereeach Ai :

∏i−1j=1Rj × D → Ri and Ai satisfies ρi-zCDP

(1 ≤ i ≤ k). Let D1,D2, . . . ,Dk be the result of a random-ized partitioning of the input domain D. The mechanismA(D) = (A1(D ∩ D1), . . . ,Ak(D ∩ Dk)) satisfies max

iρi-

zCDP.

Corollary 1. Suppose that a mechanism A consists of asequence of k adaptive mechanisms, A1, . . . ,Ak, whereeach Ai :

∏i−1j=1Rj × D → Ri and Ai satisfies ρ-zCDP

(1 ≤ i ≤ k). Let D1,D2, . . . ,Dk be the result of a random-ized partitioning of the input domain D. The mechanismA(D) = (A1(D ∩ D1), . . . ,Ak(D ∩ Dk)) satisfies ρ-zCDP.

Theorem 2 provides a tighter characterization of privacyloss for the composition of mechanisms having disjointinput data. Assume for all i ∈ (1, . . . , k), ρi = ρ. GivenTheorem 2, it is trivial to show that mechanism A satisfiesρ-zCDP, stated in Corollary 1. Compared with a guaranteeof (kρ)-zCDP using the composition property in Proposition1, we demonstrate that the total privacy loss of sequentialcomputations on disjoint datasets is just ρ, equivalent withone computation step in the sequence. For ε-DP, the similarresult in [32] of the parallel composition theorem says thatwhen each εi-differentially private mechanism queries a dis-joint subset of data in parallel and work independently, theircomposition provides (maxi εi)-DP instead of the

∑i εi

derived from a naive composition.In the differentially private mini-batch SGD algorithm

shown in Algorithm 1, each iteration step t satisfies ( 12σ2t)-

zCDP according to Proposition 2. In this paper, we supposethat each iteration in the same epoch uses the same noisescale σ and each uses a disjoint data batch. Then, byTheorem 2, we know that the computation of this epochstill satisfies ( 1

2σ2 )-zCDP. Because the training dataset isrepeatedly used every epoch, the composition of the epochlevel computations follows normal composition of Proposi-tion 1. Thus, when the training runs a total of E epochs andeach epoch e satisfies ρe-zCDP, the whole training proceduresatisfies (

∑Ee=1 ρe)-zCDP.

Note: In our previous conference version the statement ofTheorem 2 that uses an average 1

k

∑ρi-zCDP only holds

when all ρi are the same, i.e., ρi = ρ. Generally, it shouldbe replaced with the max as stated in the revised Theorem 2

Page 8: Differentially Private Model Publishing for Deep Learning · On the other hand, the publishing and sharing of trained deep learning models has been gaining growing interest. Google’s

of this paper. Because our algorithm and experiments in [?]assume the same noise scale in each iteration within thesame epoch, i.e., the same ρi, our analysis and experimentresults remain correct.

2) Under random sampling with replacement: We haveshown a privacy amplification effect resulting from thedisjoint data access of every iteration within one epochunder random reshuffling. In contrast, the MA method [8]exploits the privacy amplification effect of random samplingwith replacement. In this section, we examine how randomsampling with replacement affects the privacy loss in termsof zCDP. Intuitively, the random sampling with replacementintroduces more uncertainty than the random reshufflingprocess which samples data batches without replacement.However, our analysis shows that CDP cannot characterizethe privacy amplification effect of random sampling. Itis because of the restrictive notion of sub-Gaussianity inCDP which requires moment constraints on all orders, i.e.,α ∈ (1,∞) in Eq. (7). To address this problem, we proposea relaxation of zCDP and convert it to (ε, δ)-DP. This thenallows us to capture the privacy amplification of randomsampling.

Suppose a new mechanism A′ that runs ρ-zCDP mech-anism A on a random subsample of dataset D where eachexample is independently sampled with probability q. With-out loss of generality, we fix D and consider a neighboringdataset D′= D ∪ de. we use Λ(∗) to denote the samplingprocess over dataset ∗, let T be any subsample that doesnot include de and T ′ = T ∪ de. Because de is randomlysampled with probability q, A′(D′) is distributed identicallyas u0

∆= Pr(Λ(D) = T )A(T ) with probability (1 − q), and

as u1∆= Pr(Λ(D′) = T ′|de ∈ T ′)A(T ′) with probability q.

Therefore, the following holds:

A′(D) ∼ u0, A′(D′) ∼ qu1 + (1− q)u0 (11)

By Pr(Λ(D) = T

)=Pr

(Λ(D′) = T ′|de ∈ T ′

)due to T ′ =

T ∪de, it is easy to prove that A′ still satisfies ρ-zCDP. Theproof details can be found in the Appendix C.No privacy amplification for A′ in terms of CDP.Consider

(α− 1)Dα(A′(D′)||A′(D))

= log

(Eu0

[(qu1 + (1− q)u0

u0

)α])> log

(Eu0

[(qu1

u0

)α])= α log q + (α− 1)Dα(u1||u0) (12)

When α→∞, we have

Dα(A′(D′)||A′(D)) > αρ+α

α− 1log q → αρ+log q (13)

This shows that the sampling does not produce any reductionwith regard to q on ρ and still Dα(A′(D′)||A′(D)) = Θ(αρ).Therefore, by definition, zCDP is not able to capture theprivacy amplification effect of random sampling.

The reason there is no privacy amplification with random

sampling on zCDP is that concentrated DP requires a sub-Gaussian distribution for privacy loss, and thus momentsmust be bounded by exp(O(α2)) at all orders α ∈ (1,+∞).This is a fairly strong condition. Alternatively, it requiresthat a mechanism A has α-Renyi divergence bounded byαρ for all α ∈ (1,+∞). To demonstrate that, we assumea Gaussian mechanism A that A(T ) ∼ N(0, σ2) andA(T ′) ∼ N(1, σ2). Denote N(0, σ2) by p0 and N(1, σ2)by p1. It is trivial to show that Dα(u1||u0) = Dα(p1||p0)and Dα(qu1+(1−q)u0||u0) = Dα(qp1+(1−q)p0||p0). Wecan then numerically compute Dα(u1||u0) and Dα(qu1 +(1 − q)u0||u0) with q = 0.01 and σ = 4. Results areshown in Figure 1. Dα(u1||u0) is linear in α becauseDα(u1||u0) = αρ = α/(2σ2). However, we can see thatDα(qu1 + (1− q)u0||u0) has a changing point at α = 147.Before this changing point it is close to zero, because q =0.01 is very small and the two distributions qu1 + (1− q)u0

and u0 are close to each other. At higher orders, the samplingeffect vanishes and the divergence increases at the rate ofDα(u1||u0). This indicates that the privacy amplificationeffect from random sampling does not hold for all ordersα ∈ (1,+∞), and we cannot improve the privacy metricin terms of zCDP under the random sampling. On the otherhand, Figure 1 suggests that we need to analyze the α-Renyidivergence within a limited range of α to capture the privacyamplification effect. We will show that having a bound onDα(·||·) within a limited range of α makes it possible tocapture the privacy amplification effect of random sampling.However, such constraint does not fit into the definitionof CDP since it indicates a sub-exponential privacy lossvariable, a relaxation to sub-Gaussianity in the definition ofCDP. Therefore, in this paper we address it by convertingthe α-Renyi divergence under such relaxation to traditional(ε, δ)-DP.

In the following we show the conversion to (ε, δ)-DP ina general form for a Gaussian mechanism with bounded α-Renyi divergence in some limited range of α parameterizedby q and σ, and then consider specific cases with concretevalues for the range of α and bounds on α-Renyi divergence.

Suppose that f : D → Rp with ||f(·)||2 ≤ 1. Considera mechanism A′ that runs a Gaussian mechanism addingnoise N (0, σ2I) over a random subsample J ⊆ D whereeach example is independently sampled with probabilityq, i.e., A′(D) =

∑i∈J f(xi) + N (0, σ2I). Let Dα(·||·)

be the α-Renyi divergence between A′(D) and A′(D′) fortwo neighboring datasets D and D′. Consider P (∗) andUα(∗) as some finite functions of q and σ. We assumeDα(·||·) is bounded by α ·P (q, σ) within a limited range of1 < α ≤ Uα(q, σ). Then, we have the following theorem:

Theorem 3. Let ρ = P (q, σ) and uα = Uα(q, σ). If themechanism A′ has

Dα(A′(D)||A′(D′)) ≤ αρ (14)

Page 9: Differentially Private Model Publishing for Deep Learning · On the other hand, the publishing and sharing of trained deep learning models has been gaining growing interest. Google’s

0 50 100 150 2000

2

4

6

8

D

D (qu1+(1-q)u

0||u

0)

D (u1||u

0)

Figure 1: α-Renyi divergence under sampling(q=0.01, σ=4)

for 1 < α ≤ uα, it satisfies(ρ+ 2

√ρ log(1/δ), δ

)−DP, if δ ≥ 1/ exp(ρ(uα − 1)2) (15)(

ρuα −log δ

uα − 1, δ)−DP, otherwise (16)

Theorem 3 shows in a general form the connection to (ε,δ)-DP when we have α-Renyi divergence bounded within alimited range of α. Proper choice of Uα(q, σ) for the rangeof α (for example, let Uα(q, σ) < 147 in Figure 1) with acorresponding P (q, σ) can capture the privacy amplificationeffect of random sampling with replacement, which we willdiscuss later.Composition. Now we consider the composition of asequence of Gaussian mechanisms with random sampling.Suppose k mechanisms, denoted byM=(A′1,. . . , A′k) whereeach A′i uses sampling ratio qi and noise scale σi. Becausethe constraint of α in Eq. (14) depends on the sampling ratioand noise scale, we examine their composition in two cases:

1.) Each mechanism uses the same q and σ. For 1 < α ≤uα, by the composition property of α-Renyi divergence [10],we have Dα(M(D)||M(D′)) ≤ kαP (q, σ). The conversionto (ε, δ)-DP can be done by letting ρ = kP (q, σ) in (15)and (16) in Theorem 3.

2.) The sampling ratio and noise scale are differ-ent for each mechanism. Then, for each Ai, we haveDα(Ai(D)||Ai(D′)) ≤ αP (qi, σi) for 1 < α ≤ Uα(qi, σi).To allow the composition of α-Renyi divergence of mech-anisms with different qi and σi, we constrain α to therange 1 < α ≤ mini{Uα(qi, σi)}. It is then clear thatDα(M(D)||M(D′)) ≤ α(

∑i P (qi, σi)) holds within this α

range. Letting ρ =∑i P (qi, σi) and replacing q and σ by

qj and σj where j = arg mini{Uα(qi, σi)|1 ≤ i ≤ k} in Eq.(15) and (16), we can still obtain the corresponding (ε,δ)-DP.

When random sampling is used for batching, Algorithm1 follows the above method to estimate privacy loss interms of (ε, δ)-DP. In particular, the algorithm specifies afixed δ = δ0 and a total privacy budget εtotal, and atevery iteration step t, it updates ρ =

∑ti=0 P (qi, σi) and

computes the corresponding cumulative privacy loss εt. Ifεt > εtotal, the training is terminated and the final modelsatisfies (εtotal, δ0)-DP.The empirical settings of P and Uα. To put Theorem 3and its composition in use to estimate privacy loss while

capturing the privacy amplification effect of random sam-pling, proper Uα(q, σ) and P (q, σ) have to be determined.However, the α-Renyi divergence for Gaussian mechanismwith sampling appears to be analytically intractable. Wenoted an asymptotic bound on the log moment was givenin previous work [8] when q ≤ 1

16σ . By definition, α-Renyi divergence is equal to the log moment multiplied by afactor of 1

α−1 . Then, under the same condition, Dα(·||·) hasan asymptotic bound of q2

1−qα/σ2 + O(q3(α − 1)2/σ3) for

1 < α ≤ σ2 log 1qσ + 1. This bound exhibits the privacy am-

plification by having a factor of q2. Therefore, our solutionhere is to empirically find an appropriate P (q, σ) around theasymptotic bound within 1 < α ≤ Uα(q, σ) = σ2 log 1

qσ +1

given q ≤ 116σ .

We set P (q, σ) = q2/σ2 which is originally derivedwith the log moment bound given in the proof statementof Theorem 1 of [8]. It was brought to our attentionthat this bound misses an asymptotic term. However, byconducting numerical comparison, we observed that withusing P (q, σ) = q2/σ2, the bound αq2/σ2 for α-Renyidivergence in (14) empirically holds for a wide of parametersettings of q and σ. Our numerical validations on thisbound and the details are given in Appendix G. Therefore,this approach enables a quick estimation of privacy losswhich can be easily used to decide appropriate noise scale,sampling ratio and the number of training steps during theplanning phase. especially when we choose dynamic privacybudget allocation. It is worth to note, for privacy accountingwith a provable guarantee in a more general setting andtighter results, the MA method [8] should be used.Summary. We have shown that CDP is not able to capturethe privacy amplification effect of random sampling. Weconsider bounding α-Renyi divergence over a constrainedrange of α instead of (1,∞) and convert to (ε, δ)-DP. Ourempirical solution can be used as an approximate privacyloss estimation and easy to compute especially when we usedifferent sampling ratios and noise scales for each iterationof DP-SGD for dynamic privacy budget allocation.

More importantly, we have provided formal analysis toshow that the compositions of differential privacy undertwo batching methods are distinct. As demonstrated byour experimental results, this causes different privacy loss.Therefore, we argue that the privacy accounting method hasto be chosen according to which data batching method isused. In our implementation, we focus on random reshuf-fling, because it is a common practice [5], [24] followed byexisting deep learning implementations and it is also numer-ically observed that random reshuffling outperforms randomsampling with replacement in the convergence rate [25].Note: In our previous conference version we set P (q, σ) =q2/σ2 directly based on the derivation from the log momentbound stated in the proof of Theorem 1 of [8] which missesan asymptotic term. Our experiment numerically validates

Page 10: Differentially Private Model Publishing for Deep Learning · On the other hand, the publishing and sharing of trained deep learning models has been gaining growing interest. Google’s

this bound ready to use in a wide range of parameter settings.

C. DP Composition Under Dynamic Schedules

For pre-defined schedules, once the hyperparameters arespecified, they follow the decay functions to update the noisescale without accessing the data and the model, and thus donot incur any additional privacy cost. Since the noise scale isupdated by epoch, each iteration step within an epoch usesthe same noise scale. Suppose the epoch t uses the noisescale σt. Each iteration of epoch t is then ρ = 1/(2σ2

t )zCDP by Proposition 2, and the total privacy cost of epocht can be calculated by Theorem 2 or 3 depending on whichbatching method is used. Over the course of training, thecumulative privacy loss is updated at each epoch, and oncethe cumulative privacy loss exceeds the fixed privacy budgetρtotal, the training is terminated. To achieve a target trainingtime under a given total privacy budget, we can determinethe exact values of hyperparameters for these schedules inadvance before the training time.

For the validation-based schedule, the access to the publicvalidation dataset does not incur additional privacy cost.With this schedule, the composition of differential privacyinvolves adaptive choices of the privacy parameter ρ at everyepoch, which is corresponding to the noise scale σ of theGaussian mechanism. This means that the choice of privacyparameters itself is a function of the realized outcomes of theprevious rounds. It has been shown by Rogers et al. [33] thatthe strong composition theorem for (ε, δ)-DP fails to holdin this adaptive privacy parameter setting since the theoremrequires the privacy parameters to be pre-defined ahead oftime. To address this problem, they define the privacy loss asa random variable as done in Eq. (5) for CDP and developthe composition for (ε, δ)-DP using privacy filters. Privacyfilters provide a way to halt the computation with probability1−δ before the realized privacy loss exceeds ε. Our approachrelies on zCDP which defines privacy loss as in Eq. (5) bynature and therefore the composition accumulating privacycost with regard to Renyi divergence holds for the adaptiveparameter settings.

V. EXPERIMENTAL RESULTS

In this section, we evaluate the proposed privacy account-ing methods, and demonstrate the effectiveness of dynamicprivacy budget allocation on different learning tasks. Our im-plementation is based on the TensorFlow implementation [1]of DP-SGD in the paper [8].

A. Comparing Privacy Accounting Approaches

In Section IV-B we derive different privacy accountingmethods for two data batching methods: random reshuffling(RF) and random sampling with replacement (RS). Werefer to them as zCDP(RF) and zCDP(RS) respectively. Tonumerically compare them with other privacy accountingmethods including strong composition [19] and the moments

accountant (MA) method [8], we unify them into (ε, δ)-DP.Following [8], we assume that the batches are generatedwith RS for both the strong composition and MA. We usethe implementation of [8] in TensorFlow to compute MA.For strong composition, we apply the strong compositiontheorem in [19] to the composition of (log(1+q(eε−1)), qδ)-DP mechanisms that are the privacy amplified version of(ε, δ)-DP mechanisms running with random sampling ratioq. We compute (ε, δ)-DP for zCDP(RF) with Proposition 1and for zCDP(RS) with the methods in Section IV-B2.

In our experimental setting, we assume a batch size Bfor random reshuffling. For random sampling we assume asampling ratio q = B

N given a total of N samples. In thefollowing, when we vary q, it is equivalent to change thebatch size for random reshuffling. The number of iterationsin one epoch is 1

q . For simplicity, we use the same noise scalefor Gaussian mechanism N (0, C2σ2I) for every iterationand set q = 0.01 and σ = 6 by default. Given σ = 6, theGaussian mechanism satisfies both (ε = 0.808, δ = 1e− 5)-DP and ρ = 0.0139-zCDP. We track the cumulative privacyloss by epoch with different privacy accounting methods andconvert the results to ε in terms of (ε, δ)-DP with fixed δ =1e− 5.

Figure 2 shows the growth of privacy loss metric εduring the training process. It shows that zCDP(RF) haslower estimation on privacy loss than that of the strongcomposition during the training. The final spent ε at epoch400 by zCDP(RF) and strong composition are 21.5 and 34.3respectively. Although random sampling introduces higheruncertainty and thus less privacy loss than random shuffling,zCDP(RF) still achieves lower and thus tighter privacy lossestimation even than the strong composition with randomsampling. This demonstrates the benefit of CDP for com-position of a large number of computations. The results forzCDP(RS) and MA are very close to each other becausethat they both exploit the moment bounds of privacy loss toachieve tighter tail bound and take advantage of the privacyamplification of random sampling. The final spent ε is 2.37and 1.67 for zCDP(RS) and MA respectively. The reasonfor zCDP(RS) to have a slightly higher estimation is thatits conversion to (ε, δ)-DP explicitly uses an upper boundfor the log moment instead of the numerical computationof log moments. The benefit of zCDP(RS) is that it issimple to compute with explicit expressions in Theorem 3,and its composition is easy under dynamic privacy budgetallocation.

Figure 2 shows that zCDP(RF) has higher privacy losscompared to MA and zCDP(RS), because more uncertaintyis introduced with RS. However, it is worth noting that thecommon practice in deep learning is to use RF, including theimplementation of [8]. Thus, zCDP(RF) is the proper choicefor them and also straightforward due to the compositionproperty of ρ-zCDP which simply adds up on ρ values. Theresults show that MA underestimates the real privacy loss

Page 11: Differentially Private Model Publishing for Deep Learning · On the other hand, the publishing and sharing of trained deep learning models has been gaining growing interest. Google’s

0 100 200 300 400epoch

0

5

10

15

20

25

30

35

epsi

lon

strong composition(RS)moment accoutant(RS)zCDP(RF)zCDP(RS)

Figure 2: Privacy parameter ε v.s. epoch

0.02 0.04 0.06 0.08 0.1sampling ratio q

0

5

10

15

20

epsi

lon

zCDP(RF)zCDP(RS)

(a) ε v.s. q

5 6 7 8 9 10 11 12 13 14noise scale

0

5

10

15

20

epsi

lon

zCDP(RF)zCDP(RS)

(b) ε v.s. σ

Figure 3: privacy loss ε v.s. sampling ratio q & noise scaleσ

when treating the random reshuffling as random samplingwith replacement.

We further examine how zCDP(RF) and zCDP(RS)change with the sampling ratio q and the noise scale σ.Using the default σ = 6, Figure 3a shows the privacyloss ε at the end of 200 training epochs with varying qvalues. For zCDP(RF), the cumulative privacy loss doesnot change with q. This is because the composition of ρ-zCDP iterations within one epoch still satisfies ρ-zCDP byTheorem 2 and across epochs the linear composition of ρ-zCDP in Theorem 1 is applied, which makes the final privacyloss depend exclusively on the number of training epochs.We have fixed 200 epochs so the final privacy loss doesnot change. In contrast, the privacy loss given by zCDP(RS)increases with the sampling ratio q, which can be seen inEq. (15) where ε increases with ρ which is proportionalto q2. Similarly, Figure 3b shows the privacy loss after200 epochs by varying noise scales with the same q=0.01.We observe that increasing σ from 5 to 14 significantlyreduces ε for zCDP(RF) but has noticeably less impacton zCDP(RS). It suggests that under random sampling, asmall sampling ratio contributes much more on privacy thanthe noise scale σ. This indicates that we may reduce thenoise scale to improve the model accuracy without degradingmuch privacy. However, for random reshuffling, the privacyloss does not depend on the sampling ratio (i.e., the batchsize) but is decided by σ, so it is more critical to achieve agood trade-off between privacy and model accuracy in thiscase. Our privacy budget allocation techniques optimize thistrade-off by dynamically adjusting σ during the training toimprove model accuracy while retaining the same privacyguarantee.

B. Evaluating Dynamic Privacy Budget Allocation

In this section we evaluate the effectiveness of dynamicprivacy budget allocation compared to uniform privacy bud-get allocation adopted by Abadi et al. [8]. Since the Ten-sorFlow implementation uses random reshuffling to generatebatches, privacy accounting in Section IV-B1 should be usedto avoid the underestimation of privacy loss. We thereforeuse ρ as the metric to represent the privacy budget andloss. Because the techniques for adjusting noise scales areindependent of the batching method, the benefit of dynamicprivacy budget allocation on model accuracy demonstratedunder random reshuffling also applies to random sampling.

1) Datasets and Models: Our experiments use threedatasets and different default neural networks for eachdataset.MNIST. This is a dataset of handwritten digits consists of60,000 training examples and 10,000 testing examples [28]formatted as 28X28 size gray-level images. In our ex-periment, the neural network model for MNIST followsthe settings in previous work [8] for comparison: a 60-dimensional PCA projection layer followed by a simplefeed-forward neural network comprising a single hiddenlayer of 1000 ReLU units. The output layer is softmax of10 classes corresponding to the 10 digits. The loss functioncomputes cross-entropy loss. A batch size 600 is used. Thenon-private training of this model can achieve 0.98 accuracywith 100 epochs.Cancer Dataset. This dataset [2] consists of 699 patientexamples. Each example has 11 attributes including an idnumber, a class label that corresponds to the type of breastcancer (benign or malignant), and the 9 features describingbreast fine-needle aspirates. After excluding 16 exampleswith missing values, we use 560 examples for training and123 examples for testing. A neural network classifier with3 hidden layers, containing 10, 20, and 10 ReLU units, istrained to predict whether a breast tumor is malignant orbenign. Each iteration takes the whole training data set as abatch and thus each iteration is one epoch. The non-privatetraining of this model achieves testing and training accuracy0.96 with 800 epochs.CIFAR-10. The CIFA-10 dataset consists of 32×32 colorimages with three channels (RGB) in 10 classes includingships, planes, dogs and cats. Each class has 6000 images.There are 40,000 examples for training, 10,000 for testingand 10,000 for validation. For experiments on CIFAR,we use a pre-trained VGG16 neural network model [37].Following the previous work [8], we assume the non-privateconvolutions layers that are trained over a public dataset(ImageNet [4] for VGG16) and only retrain a hidden layerwith 1000 units and a softmax layer with differential privacy.We use 200 training epochs and batch size of 200. Thecorresponding non-private training achieves 0.64 trainingaccuracy and 0.58 testing accuracy.

Page 12: Differentially Private Model Publishing for Deep Learning · On the other hand, the publishing and sharing of trained deep learning models has been gaining growing interest. Google’s

Table II: Budget Allocation Schedules under Fixed Budget ρtotal = 0.78125, initial noise scale σ0 = 10 for dynamicschedules

Uniform[8] (σc =8)

Time(k=0.05)

Step(k=0.6,period=10)

Exp(k=0.01)

Poly(k=3,σend=2,period=100)

Validation(k=0.7,m=5,δ=0.01,period=10)

epochs 100 38 31 71 44 64training accuracy 0.918 0.934 0.928 0.934 0.930 0.930testing accuracy 0.919 0.931 0.929 0.929 0.932 0.930non-private SGD 0.978/0.970 0.959/0.957 0.955/0.954 0.971/0.965 0.963/0.959 0.97/0.964uniform/same #epochs 0.922/0.925 0.921/0.925 0.922/0.925 0.925/0.929 0.924/0.926

2) Results on MNIST: In differentially private modeltraining, we keep the batch size at 600, clip the gradientnorm of every layer at 4, and use fixed noise scale σpca = 16for differentially private PCA. Note that, since the PCApart has constant privacy cost 1/(2σ2

pca) in terms of ρ-zCDP, we exclude it from the total privacy budget ρtotalin our experiment, i.e., ρtotal is only for the DP-SGDin Algorithm 1. A constant learning rate 0.05 is used bydefault. We evaluate the model accuracy during trainingunder different privacy budget allocation schedules. For thevalidation-based schedule, we divide the training datasetinto 55,000 examples for training and 5000 examples forvalidation, and perform validation every epoch.

The results in Table II demonstrate the benefit of dynamicprivacy budget allocations and the effect of earlier trainingtermination on the model accuracy. For comparison, weconsider the uniform privacy budget allocation in [8] with aconstant noise scale σc=8 for every epoch as our baseline.We choose a fixed total privacy budget ρtotal=0.78125. Thisresults in 100 training epochs in the baseline case. We testall dynamic schedules with the hyperparameters given inthe table and present their testing and training accuracy innumbers rounded to two decimals. The training is terminatedwhen the privacy budget runs out, and the hyerparametersare chosen from a set of candidates to demonstrate variedtraining times in epochs which are reported in the table. Wealso ran a non-private version of SGD with using the sametraining time as these schedules to see the impact of DP-SGD on accuracy. We can see from Table II that the baselinewith constant σc=8 achieves 0.918 training accuracy and0.919 testing accuracy. By comparison, all non-uniform pri-vacy budget allocation schedules improve the testing/trainingaccuracy by 1%∼1.6% while running fewer epochs. BecauseDP-SGD is a randomized procedure and the numbers in thetable vary among trials, we repeat all the experiments 10times and report in Figure 5 the mean accuracy along withthe min-max bar for every schedule. These results show thatdynamic schedules consistently achieve higher accuracy thanthe baseline. Therefore, given a fixed privacy budget, thedynamic budget allocation can achieve better accuracy thanusing the uniform budget allocation.

The accuracy improvement shown with dynamic sched-ules in the above example comes from two sources: lesstraining time and non-uniformity of budget allocation (i.e.,

0 20 40 60 80 100epoch number

2

4

6

8

10

nois

e sc

ale

Uniform Time-based Step ExponentialPolynomialValidation based

Figure 4: The change of noise scale σ during training

decaying of the noise scale). With uniform allocation undera fixed privacy budget, reducing the training time increasesthe privacy budget allocated to every epoch and thus de-creases the noise scale used by the Gaussian mechanism.Therefore, when the model training benefits more fromthe reduced perturbation rather than longer training time,using less training time can improve the model accuracy.As verification, we apply uniform budget allocation withthe noise scale

√T/(2ρtotal) to achieve the same training

time T as the corresponding dynamic schedule. The trainingaccuracy and testing accuracy are presented respectivelyin the final row of Table II. All cases outperform thebaseline case with σc = 8 with less than 100 trainingepochs, indicating the benefit of trading the training timefor more privacy budget per epoch. however, it is worthnoting that in certain cases, increasing the noise scale toprolong the training time may help improve the accuracy,exemplified by the result of the validation-based scheduleon the Cancer dataset. Overall, when compared with theuniform allocation under the same training time, dynamicschedules demonstrate higher accuracy, therefore illustratingthe benefit of non-uniformity and dynamic budget allocation.

Figure 4 shows how the noise scale σ changes with theepochs under different schedules in Table II. The curvesterminate at the end of the training due to the depletedprivacy budget. For the validation-based decay, the durationof the noise scale keeping unchanged decreases over thetraining time. The noise scale keeps 10 for 29 epochs, 7for 20 epochs and 4.9 for 10 epochs. It is because that, asthe model converges, the increment rate of the validationaccuracy declines and it is more often to find that theaccuracy increment does not exceed the given threshold.

We additionally manipulate different hyperparamters in-dividually while keeping the rest constant to demonstrate

Page 13: Differentially Private Model Publishing for Deep Learning · On the other hand, the publishing and sharing of trained deep learning models has been gaining growing interest. Google’s

0.905

0.91

0.915

0.92

0.925

0.93

0.935

0.94

training accuracy

0.90.905

0.910.915

0.920.925

0.930.935

0.94

testing accuracy

Figure 5: The accuracy comparison of different schedulesSheet3

Page 1

30 40 50 60 70 80 90 1000.905

0.91

0.915

0.92

0.925

0.93

0.935

0.94

sub-title

Time-based decay step decay Exp decay Poly decay uniform

30 40 50 60 70 80 90 1000.905

0.91

0.915

0.92

0.925

0.93

0.935

0.94Training accuracy Testing accuracy

# epochs # epochs

Figure 6: The accuracy under fixed training time

their effects on training/testing accuracy and training time..By default all accuracy numbers are the average of five trials.The effect of decay functions. In our previous experiments,we evaluate four types of decay functions for the pre-definedschedules. Here we compare their effects on the modelaccuracy with constant training time. Given the total privacybudget and initial noise scale, we can use the compositiontheorem of ρ-zCDP to search for proper values of theparameter k in these functions for the schedule to achievea target training time. Table III in Appendix E provides thevalues of k for different decay functions to achieve trainingtimes of 60, 70, 80, 90, and 100 epochs respectively. Thesevalues are derived via search in step size 1e − 4, with thesame initial noise scale and other parameters as stated inTable II.

Figure 6 shows the training and testing accuracy of pre-defined schedules under different training times along withthe accuracy achieved by uniform budget allocation [8] usingthe same privacy budget. We observe that all training in-stances using pre-defined schedules achieve higher accuracycompared to the uniform budget allocation given a fixedtraining time. However, there is no clear winner among thedifferent decay functions. Their accuracy increases from 30to 50 or 60 epochs and then decreases as the training timeincreases from 50 or 60 to 100 epochs. At 100 epochs, allpre-defined schedules have an accuracy closer to that of theuniform budget allocation schedule running 100 epochs. Dueto the similar behaviors of the different decay functions, wechoose to simply set the decay function to the exponentialdecay in subsequent experiments unless otherwise stated.Decay rate. The decay rate k decides how fast the noisescale decays. Keeping other parameters as the same as thosereported in Table II, we vary k from 0.005 to 0.5 forexponential decay and from 0.3 to 0.9 for validation-based

decay. Figure 7 and 8 show the accuracy and training timeunder different values of k. We make three observations.First, in both cases, there exists an optimal decay rate toachieve maximum accuracy. For exponential decay, the bestaccuracy occurs at k=0.2; for validation-based decay, itoccurs at k=0.7. Second, for exponential decay, with theincrease of k, the noise scale decreases at a higher rate.The privacy budget is therefore spent faster and the trainingtime strictly decreases. For the validation-based decay, itreduces the noise scale to a k fraction of the original, sothe decay rate is actually 1-k and the training time shouldincrease with k. Figure 8 shows that the training time overallincreases with k but with some random fluctuations. Thisis because that the validation-based decay adjusts the noisescale according to the validation accuracy which may changeduring the training in a non-deterministic way.

Third, the results at the ends of the x-axis in both figuresindicate two interesting facts. At one end, although thelowest decay rate leads to the longest training time, italso produces the worst accuracy because the noise scaledecays more slowly in this case and therefore more epochswill suffer relatively higher noise scales. This degrades theefficiency of the learning process and lowers the accuracy.At the other end of the axis, the highest decay rate causesthe training to stop much earlier, resulting in an insufficienttraining time which also degrades the accuracy.Learning rate. Next we fix the decay rate k=0.0138 forexponential decay. Given a privacy budget 0.78125, thetraining lasts 60 epochs. With an initial learning rate 0.1, welinearly decrease the learning rate to endlr over 10 epochsand then fix it at endlr thereafter. We vary endlr from0.01 to 0.07. Figure 9 shows that the accuracy decreasessignificantly when the learning rate is too small or too large.Number of hidden units/layers. Next, we vary the numberof hidden units in the model from 200 to 1600. The resultsare shown in Figure 10. Although more hidden units increasethe sensitivity of the gradient, leading to more noise addedat each iteration, we observe that increasing the number ofhidden units does not decease the model accuracy underthe exponential decay schedule. This is consistent with theobservation in [8] using uniform budget allocation. Thisshows that the effectiveness of dynamic budget allocationschedules scales to neural networks of different sizes. Wealso vary the number of hidden layers from 1 to 3, eachwith 1000 hidden units. The accuracy results are given inAppendix D and are consistent with [8] under the uniformallocation wherein the authors claim that, for MNIST, onehidden layer combined with PCA works better than networkswith more layers.Initial noise scale. In the previous experiments, the initialnoise scale σ0=10 is set as the default. To examine theeffect of σ0, we vary its value from 7 to 20 and measurethe model accuracy under the fixed privacy budget 0.78125in two cases: 1) for each σ0, we choose the exponential

Page 14: Differentially Private Model Publishing for Deep Learning · On the other hand, the publishing and sharing of trained deep learning models has been gaining growing interest. Google’s

A

Figure 7: exponential decay

Sheet5

Page 1

0.3 0.4 0.5 0.6 0.7 0.8 0.90.914

0.916

0.918

0.92

0.922

0.924

0.926

0.928

0.93

0.932

0.934

0

10

20

30

40

50

60

70

80

90

100

testing accuracy training accuracy #epochs

decay rate k

Acc

urac

y

num

ber

of e

poch

s

Figure 8: validation-based

Sheet6

Page 1

0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.080.9160.918

0.920.9220.9240.9260.928

0.930.9320.9340.936

testing accuracytraining accuracy

end_lr

Accu

racy

Figure 9: learning rate

Sheet6

Page 1

200 400 600 800 1000 1200 1400 16000.9

0.905

0.91

0.915

0.92

0.925

0.93

0.935

0.94

testing accuracy

training accuracy

number of hidden layer units

Acc

urac

y

Figure 10: hidden units

decay rate to achieve a fixed training time of 60 epochs;2) the exponential decay rate is fixed to 0.015, leading tovariation in training time. Figure 11a and 11b show that,overall, increasing the initial noise scale reduces accuracy. Incomparing the two figures, we observe that when the trainingtime is fixed, the choice of σ0 has less impact on accuracy.This is because, when the training time is fixed, a largerσ0 results in a higher decay rate of the noise scale whichbenefits accuracy. However, for fixed decay rate, althoughhigher σ0 leads to more training epochs, there is no accuracyimprovement. This indicates that the model accuracy is moresensitive to the noise scale than the training time.Accuracy and privacy in training. Figure 12 and 13illustrate the change of model accuracy and privacy lossduring training time for schedules with the same parametersas in Table II except the parameters explicitly noted in thefigures. Figure 13 shows that the uniform privacy budgetallocation in [8] incurs linear growth of privacy loss in termsof ρ-zCDP while our dynamic budget allocation scheduleshave faster growth rate due to the reduction of noise scalewith time. All instances stop when the given total privacybudget of 0.78125 is reached. Combined with Figure 12,we can see that the exponential decay schedule consistentlyachieves better accuracy before the training ends comparedto the uniform allocation, thanks to its faster noise scale re-duction, while the validation-based schedule performs moreconservatively and has a relatively longer training time.

An important implication of Figure 12 is that the gapbetween uniform budget allocation and non-private SGDindicates the maximum potential for the accuracy improve-ment through dynamic budget allocation over the uniformallocation. The proposed dynamic budget allocation sched-ules provide users a way to improve the accuracy of DP-SGD to approach that of non-private SGD. It is not possiblefor dynamic budget allocation to completely close thisgap because gradient perturbation inevitably hurts modelaccuracy. Therefore, we argue that the effectiveness ofdynamic privacy budget allocation should be evaluated onhow much it can reduce the gap between non-private SGDand DP-SGD with uniform allocation. In our experiment,the accuracy difference between non-private SGD and DP-SGD of uniform case is 0.05 at the end of training. Theexemplified schedules reduce this difference by 20%∼30%.One of our ongoing research directions is to investigate the

Sheet6

Page 1

7 8 9 10111213141516171819200.905

0.91

0.915

0.92

0.925

0.93

0.935

0.94

testing accuracy

training accuracy

initial noise scale

Acc

urac

y

(a) fixed training time

Sheet6

Page 1

7 8 9 10111213141516171819200.905

0.91

0.915

0.92

0.925

0.93

0.935

0.94

0

20

40

60

80

100

120

#epochs

testing accuracy

training accuracy

initial noise scale

Acc

urac

y

(b) fixed decay rate

Figure 11: Initial noise scaleSheet12

Page 1

0 7 14 21 28 35 42 49 56 63 70 77 84 91 980.75

0.8

0.85

0.9

0.95

1

Non-private Uniforrm(σ=8) Exp(k=0.02) Validation(k=0.8)

Epoch number

test

ing

accu

racy

Figure 12: Accuracy in training

Sheet12

Page 1

0 20 40 60 80 100 1200

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

Uniforrm(σ=8)

Exp(k=0.02)

Validation(k=0.8)

Epoch number

priv

acy

loss

(ρ)

Figure 13: Privacy in trainingSheet10

Page 1

0 60 120

180

240

300

360

420

480

540

600

660

720

780

0.4

0.5

0.6

0.7

0.8

0.9

1

Non-private

Uniforrm(σ=25)

Exp(σ_0=30, k=0.001)

Validation

epoch number

test

ing

acc

ura

cy

Figure 14: Accuracy (Cancer)

Sheet13

Page 1

0 50 100 150 200 2500

0.1

0.2

0.3

0.4

0.5

0.6

0.7

Non-private

Uniforrm(σ=8)

Exp(σ_0=6, k=0.001)

Validation

Epoch number

test

ing

accu

racy

Figure 15: Accuracy (Cifar-10)

ways to effectively find the best hyperparameters to applythese schedules.

3) Results on other datasets: We repeat the experimentson the Cancer Dataset and CIFAR-10 datasets. By applyingexponential decay and validation-based decay to each learn-ing task, we compare corresponding model accuracy with theuniform allocation method [8]. In this set of experiments,we first consider a uniform schedule that uses a constantnoise scale to achieve a desired training time under thegiven privacy budget. Then we choose a value around thisnoise scale as the initial noise scale for decay schedules.A set of candidates for the decay rate is evaluated, and weuse each candidate to train a model and compare achievedmodel accuracy. The parameters for the schedules we usedare given in Table V in Appendix F.

Results for testing and training accuracy are show inFigures 14 and 15. For the Cancer dataset, the exponential

Page 15: Differentially Private Model Publishing for Deep Learning · On the other hand, the publishing and sharing of trained deep learning models has been gaining growing interest. Google’s

decay produces the model accuracy closer to the non-privateSGD, about 3% higher accuracy than the uniform allocationcase, and reduces the gap between non-private SGD andDP-SGD with uniform allocation by 70%. The validation-based schedule produces about 1.8% higher accuracy thanthe uniform case, with taking advantage of a longer trainingtime as shown in Figure 14. For CIFAR-10, the exponentialdecay achieves 2% higher accuracy than the uniform case,and reduces the gap by about 12%. The validation-basedschedule improves model accuracy by 4% over the uniformcase, and reduces the gap by about 19%.

VI. DISCUSSION

We discuss a number of nuances/caveats as take-awayremarks for deploying differentially private deep learningin practice for model publishing.Understanding privacy parameter. Although differentialprivacy (DP) as a theory has evolved through different forms,today it is still not clear how a realistic privacy benefitcan be realized as a function of the privacy parametersin the DP definitions such as the ε and δ parameters intraditional DP and the ρ in zCDP. These privacy parameterslack understandable interpretations to the end-users. For ρ-zCDP, results like Proposition 1 would help if ε and δ hadstraightforward privacy-related interpretations. Advancementin interpretability and usability of DP parameters by end-users and domain-scientists can have profound impact onthe practical deployment of differential privacy.Data Dependency. The characteristics of input data, forexample, dependency among training instances or depen-dency in the presence of training instances can render adifferentially private mechanism ineffective for protectingthe privacy of individuals [26], [27], [30]. The baselinedefinition of differential privacy is focused on the privacyof a single instance and therefore when multiple instancesof the same user are present, a DP mechanism needs tobe extended to group-level differential privacy to providesufficient protection. One direction of our future work is toinvestigate and explore the ways of extending our DP-SGDtechniques to provide a group-level privacy guarantee.Resilience to Privacy Risks and Attacks. Differentiallyprivate deep learning aims to compute model parameters ina differentially private manner to limit the privacy risk as-sociated with output model parameters. There are a numberof known attacks in deep learning such as model inversionattacks and membership inference attacks. Model inversionattacks exploit the prediction output along with model accessto infer an input instance. Membership inference attacksexploit the black box access to the prediction API to infer themembership of individual training instances. However, thereis no formal study on whether or not a differentially privatedeep learning model is resilient to such attacks and whattypes of privacy risks known in practice can be protectedwith high certainty by a differentially private DNN model.

In fact, DP only absolves the differentially-private release asa (quantifiably) strong cause of an inference. The work [23]provides an upper bound on the inferential privacy guaranteefor differentially private mechanisms. DP, however, does notprevent the inference. This is another grand challenge indifferential privacy and data privacy in general.

VII. RELATED WORK

Privacy threats in machine learning Existing works [21],[22], [36], [38] have shown that machine learning modelsand their usage may leak information about individuals inthe training dataset and input data. Fredrikson, et al. [22]proposed a model inversion attack, which uses the out-put/prediction produced by a model to infer the unknownfeatures of the input data and apply this attack againstdecision trees and neural networks in a pharmacogeneticsscenario [21]. Reza et al. [36] developed a membershipinference attack that aims to determine if an individualrecord was used as part of the training dataset for themodel using only the black-box access to the target model.Song et al. [38] proposed training phase attacks whichperform minor modifications to training algorithms to makethem output models which encode a significant amountof information about the training dataset while achievinghigh quality metrics like accuracy and generalizability. Inaddition, model extraction attacks proposed in [40] aimto duplicate the functionality of the model with black-boxaccess. Such attacks can be leveraged to infer informationabout the model’s training dataset.Privacy-preserving deep learning To enable deep learningover the data from multiple parties while preserving theprivacy of each party’s training dataset, Reza et al [35]proposed a distributed deep learning framework that letsthe participants train their model independently on theirown dataset and only selectively share a subsets of theirmodels’ parameters during training. Abadi et al. [8] proposeda differentially private SGD algorithm for deep learningto offer provable privacy guarantees on the output model.DP [15] as a defacto standard for privacy has been appliedto various machine learning algorithms, such as logisticregression [11], [44], support vector machines [34] and riskminimization [9], [12], aiming to limit the privacy riskassociated with the output model parameters on the trainingdataset. Our work in this paper is primarily related to [8]. Weimprove their approach in a number of ways. For example,instead of using traditional (ε, δ)-differential privacy, weapply concentrated differential privacy [10], [18] to providetight cumulative privacy loss estimation over a large numberof computations. Furthermore, we characterize the effect ofdata batching methods on the composition of differentialprivacy and propose a dynamic privacy budget allocationframework for improving the model accuracy.

Page 16: Differentially Private Model Publishing for Deep Learning · On the other hand, the publishing and sharing of trained deep learning models has been gaining growing interest. Google’s

VIII. CONCLUSION

We have presented our approach to differentially privatedeep learning for model publishing with three originalcontributions. First, since the training of neural networksinvolves a large number of iterations, we apply CDP forprivacy accounting to achieve tight estimation on privacyloss. Second, we distinguish two different data batchingmethods and propose privacy accounting methods for pri-vacy loss estimation under each respectively. Third, wehave implemented several dynamic privacy budget alloca-tion techniques for improving model accuracy over existinguniform budget allocation schemes. Our experiments onmultiple datasets demonstrate the effectiveness of dynamicprivacy budget allocation.

ACKNOWLEDGMENT

The authors would like to thank our anonymous reviewersfor their valuable comments and suggestions. This researchwas partially sponsored by NSF under grants SaTC 156409,CISEs SAVI/RCN (1402266, 1550379), CNS (1421561),CRISP (1541074), SaTC (1564097) programs, an REUsupplement (1545173), an RCN BD Fellowship, providedby the Research Coordination Network (RCN) on Big Dataand Smart Cities, an IBM Faculty Award, and gifts, grants,or contracts from Fujitsu, HP, Intel, and Georgia TechFoundation through the John P. Imlay, Jr. Chair endowment.Any opinions, findings, and conclusions or recommendationsexpressed in this material are those of the author(s) and donot necessarily reflect the views of the funding agencies andcompanies mentioned above.

REFERENCES

[1] https://github.com/tensorflow/models/tree/master/research/differential privacy.

[2] Breast cancer wisconsin (original) data set.http://archive.ics.uci.edu/ml/datasets/Breast+Cancer+Wisconsin+%28Original%29.

[3] Decaying the learning rate.https://www.tensorflow.org/api guides/python/train.

[4] Imagenet. http://www.image-net.org/.

[5] Input pipeline performance guide.https://www.tensorflow.org/performance/datasets performance.

[6] Tensorflow privacy library.https://github.com/tensorflow/privacy.

[7] Model zoo. http://caffe.berkeleyvision.org/model zoo.html,accessed 2017.

[8] M. Abadi, A. Chu, I. Goodfellow, H. B. McMahan,I. Mironov, K. Talwar, and L. Zhang. Deep Learning withDifferential Privacy. In Proc. of ACM CCS, pages 308–318,New York, NY, USA, 2016.

[9] R. Bassily, A. D. Smith, and A. Thakurta. Private empiricalrisk minimization, revisited. CoRR, abs/1405.7085, 2014.

[10] M. Bun and T. Steinke. Concentrated Differential Privacy:Simplifications, Extensions, and Lower Bounds. CoRR, 52016.

[11] K. Chaudhuri and C. Monteleoni. Privacy-preserving logisticregression. In Proc of NIPS, pages 289–296, USA, 2008.

[12] K. Chaudhuri, C. Monteleoni, and A. D. Sarwate. Differen-tially private empirical risk minimization. J. Mach. Learn.Res., 12:1069–1109, July 2011.

[13] F. Chollet. Xception: Deep learning with depthwise separableconvolutions. 2017 IEEE Conference on Computer Vision andPattern Recognition (CVPR), pages 1800–1807, 2017.

[14] C. Darken and J. Moody. Note on learning rate schedulesfor stochastic optimization. In Proc of Advances in NeuralInformation Processing Systems (NIPS), pages 832–838, SanFrancisco, CA, USA, 1990.

[15] C. Dwork. Differential privacy. In Automata, Languages andProgramming, volume 4052 of Lecture Notes in ComputerScience, pages 1–12. 2006.

[16] C. Dwork, F. McSherry, K. Nissim, and A. Smith. Calibratingnoise to sensitivity in private data analysis. In Proc. ofTheory of Cryptography, TCC’06, pages 265–284, Berlin,Heidelberg, 2006.

[17] C. Dwork and A. Roth. The algorithmic foundations ofdifferential privacy. Found. Trends Theor. Comput. Sci.,9:211–407, Aug. 2014.

[18] C. Dwork and G. N. Rothblum. Concentrated DifferentialPrivacy. CoRR, 3 2016.

[19] C. Dwork, G. N. Rothblum, and S. Vadhan. Boosting anddifferential privacy. In 2010 IEEE 51st Annual Symposiumon Foundations of Computer Science, pages 51–60, Oct 2010.

[20] C. Esteban, S. L. Hyland, and G. Ratsch. Real-valued(medical) time series generation with recurrent conditionalgans. CoRR, abs/1706.02633, 2018.

[21] M. Fredrikson, S. Jha, and T. Ristenpart. Model Inver-sion Attacks That Exploit Confidence Information and BasicCountermeasures. In Proc. of ACM CCS, pages 1322–1333,New York, NY, USA, 2015.

[22] M. Fredrikson, E. Lantz, S. Jha, S. Lin, D. Page, and T. Ris-tenpart. Privacy in pharmacogenetics: An end-to-end casestudy of personalized warfarin dosing. In USENIX SecuritySymposium, pages 17–32, San Diego, CA, 2014.

[23] A. Ghosh and R. Kleinberg. Inferential privacy guaranteesfor differentially private mechanisms. CoRR, abs/1603.01508,2016.

[24] I. Goodfellow, Y. Bengio, and A. Courville. Deep Learning.MIT Press, 2016.

Page 17: Differentially Private Model Publishing for Deep Learning · On the other hand, the publishing and sharing of trained deep learning models has been gaining growing interest. Google’s

[25] M. Gurbuzbalaban, A. Ozdaglar, and P. Parrilo. Why RandomReshuffling Beats Stochastic Gradient Descent. ArXiv e-prints, Oct. 2015.

[26] B. Hitaj, G. Ateniese, and F. Perez-Cruz. Deep models underthe gan: Information leakage from collaborative deep learn-ing. In Proceedings of the 2017 ACM SIGSAC Conferenceon Computer and Communications Security, CCS ’17, pages603–618, New York, NY, USA, 2017.

[27] D. Kifer and A. Machanavajjhala. No free lunch in dataprivacy. In Proceedings of the 2011 ACM SIGMOD Inter-national Conference on Management of Data, SIGMOD ’11,pages 193–204, New York, NY, USA, 2011.

[28] Y. Lecun, L. Bottou, Y. Bengio, and P. Haffner. Gradient-based learning applied to document recognition. Proceedingsof the IEEE, 86(11):2278–2324, 1998.

[29] N. Li, W. Qardaji, and D. Su. On sampling, anonymization,and differential privacy or, k-anonymization meets differentialprivacy. In Proc. of ASIACCS, pages 32–33, New York, NY,USA, 2012.

[30] H. B. McMahan, D. Ramage, K. Talwar, and L. Zhang.Learning differentially private language models without los-ing accuracy. CoRR, abs/1710.06963, 2017.

[31] F. McSherry and K. Talwar. Mechanism design via differentialprivacy. In Proceedings of the 48th Annual IEEE Symposiumon Foundations of Computer Science, FOCS ’07, pages 94–103, Washington, DC, USA, 2007.

[32] F. D. McSherry. Privacy integrated queries: An extensibleplatform for privacy-preserving data analysis. In Proc. ofACM SIGMOD, pages 19–30, New York, NY, USA, 2009.

[33] R. M. Rogers, S. P. Vadhan, A. Roth, and J. Ullman. Privacyodometers and filters: Pay-as-you-go composition. In D. D.Lee, M. Sugiyama, U. von Luxburg, I. Guyon, and R. Garnett,editors, NIPS, pages 1921–1929, 2016.

[34] B. I. P. Rubinstein, P. L. Bartlett, L. Huang, and N. Taft.Learning in a large function space: Privacy-preserving mech-anisms for svm learning. CoRR, abs/0911.5708, 2009.

[35] R. Shokri and V. Shmatikov. Privacy-Preserving Deep Learn-ing. In Proc. of ACM CCS, pages 1310–1321, New York,NY, USA, 2015.

[36] R. Shokri, M. Stronati, and V. Shmatikov. MembershipInference Attacks against Machine Learning Models. In IEEESymposium on Security and Privacy (S&P), 2017.

[37] K. Simonyan and A. Zisserman. Very deep convolu-tional networks for large-scale image recognition. CoRR,abs/1409.1556, 2014.

[38] C. Song, T. Ristenpart, and V. Shmatikov. Machine learningmodels that remember too much. In Proc. of ACM CCS, pages587–601, New York, NY, USA, 2017.

[39] S. Song, K. Chaudhuri, and A. D. Sarwate. Stochastic gradi-ent descent with differentially private updates. In 2013 IEEEGlobal Conference on Signal and Information Processing,pages 245–248, Dec 2013.

[40] F. Tramer, F. Zhang, A. Juels, M. K. Reiter, and T. Ristenpart.Stealing Machine Learning Models via Prediction APIs. InUSENIX Security Symposium, pages 601–618, Austin, TX,2016.

[41] T. van Erven and P. Harremos. Renyi divergence andkullback-leibler divergence. IEEE Transactions on Informa-tion Theory, 60(7):3797–3820, July 2014.

[42] J. Yosinski, J. Clune, Y. Bengio, and H. Lipson. Howtransferable are features in deep neural networks? CoRR,abs/1411.1792, 2014.

[43] C. Zhang, S. Bengio, M. Hardt, B. Recht, and O. Vinyals. Un-derstanding deep learning requires rethinking generalization.CoRR, abs/1611.03530, 2016.

[44] J. Zhang, Z. Zhang, X. Xiao, Y. Yang, and M. Winslett.Functional mechanism: Regression analysis under differentialprivacy. Proc. VLDB Endow., 5(11):1364–1375, July 2012.

[45] X. Zhang, S. Ji, and T. Wang. Differentially private releasingvia deep generative model. CoRR, abs/1801.01594, 2018.

Page 18: Differentially Private Model Publishing for Deep Learning · On the other hand, the publishing and sharing of trained deep learning models has been gaining growing interest. Google’s

APPENDIX

A. Proof of Theorem 2

Theorem 2. Suppose that a mechanism A consists of asequence of k adaptive mechanism A1, . . . ,Ak where eachAi :

∏i−1j=1Rj × D → Ri and Ai satisfies ρi-zCDP. Let

D1,D2, . . . ,Dk be the result of a randomized partition ofthe input domain D. The mechanism A(D) = (A1(D ∩D1), . . . ,Ak(D ∩ Dk)) satisfies{

ρ-zCDP, if ρi = ρ,∀imaxiρi-zCDP, if ρi 6= ρj for some i, j

(17)

Proof: Suppose two neighboring datasets D and D′.Without loss of generality, assume that D contains one moreelement de than D′. Let Di = D ∩ Di and D′i = D′ ∩ Di.Accordingly, there exists j such that Dj contains onemore element than D′j , and for any i 6= j, Di = D′i.Consider any sequence of outcomes o = (o1, . . . , ok) ofA1(D1), . . . ,Ak(Dk).

Because only Dj is different from D′j , for any i 6= j, wehave

Pr[Ai(Di) = oi|Ai−1(Di−1) = oi−1, . . . ,A1(D1) = o1]equal to

Pr[Ai(D′i) = oi|Ai−1(D′i−1) = oi−1, . . . ,A1(D′1) = o1]

Then, we have

L(o)j

∆= log

(Pr(A(D) = o

Pr(A(D′) = o)

)= log

(∏i∈[n] Pr[ADii = oi|ADi−1

i−1 = oi−1, ..,AD11 = o1]∏

i∈[n] Pr[AD′i

i = oi|AD′i−1

i−1 = oi−1, ..,AD′11 = o1]

)

= log

(Pr[ADjj = oj |A

Dj−1

j−1 = oj−1, ..,AD11 = o1]

Pr[AD′j

j = oj |AD′j−1

j−1 = oj−1, ..,AD′11 = o1]

)∆= cj(oj ; o1, . . . , oj−1)

where ADii denotes Ai(Di) for short.Once the prefix (o1, . . . , oj−1) is fixed,

Cj∆= cj(oj ; o1, . . . , oj−1) = log

(Pr(Aj(Dj) = oj)

Pr(Aj(D′j) = oj)

)By the ρj-zCDP property of Aj , E

[e(α−1)Cj

]≤

e(α−1)αρj , thus

E[e(α−1)L

(o)j

]= E

[exp

((α− 1)Cj

)]≤ e(α−1)αρj

Because of randomized partition of the input domain D,the extra element de of D is randomly mapped to k parti-tions. Therefore, j is uniformly distributed over {1, . . . , k},and thus the privacy loss L(o) under random data partition isthe mixture of independent random variables L(o)

1 , · · · , L(o)k ,

f(L(o)) =1

kf(L

(o)1 ) + . . .+

1

kf(L

(o)k )

where f(X) is the probability distribution function of X .

We have

E[e(α−1)L(o)

]=

1

k

k∑j=1

E[exp

((α− 1)L

(o)j

)]

Because L(o)j satisfies zCDP, by (7) then we have

≤ 1

k

k∑j=1

exp((α− 1)αρj)

If ρj = ρ ∀j, we have E[e(α−1)L(o)

]≤ exp((α− 1)αρ),

and thus the mechanism A(D) satisfies ρ-zCDP.If not all ρj are the same, we replace each ρj with max

jρj ,

we have E[e(α−1)L(o)

]≤ exp((α − 1)αmax

jρj), and the

mechanism A(D) satisfies maxi ρi-zCDP.

B. Proof of Theorem 3

Theorem 3. Let ρ = P (q, σ) and uα = Uα(q, σ). If themechanism A′ has

Dα(A′(D)||A′(D′)) ≤ αρ (18)for 1 < α ≤ uα, it satisfies(ρ+ 2

√ρ log(1/δ), δ

)−DP, if δ ≥ 1/ exp(ρ(uα − 1)2)(

ρuα −log δ

uα − 1, δ)−DP, otherwise

Proof:Let Z = L

(o)(M(D)||M(D′)) be privacy loss random variable,

then for 1 < α ≤ uα,E[e(α−1)Z

]= e(α−1)Dα(M(D)||M(D′)) ≤ e(α−1)αρ (19)

By Markov’ inequality,

P (Z ≥ ε) =P (e(α−1)Z > e(α−1)ε) ≤E[e(α−1)Z

]e(α−1)ε

(20)

≤ exp((α− 1)(ρα− ε)) (21)The unconstrained minimum of function g(α) = (α −

1)(ρα− ε) occurs at α∗ = (ε+ ρ)/(2ρ), and the minimumvalue is −(ε − ρ)2/(4ρ). If α∗ ≤ uα, this unconstrainedminimum corresponds to the constrained minimum as wellthat is subject to α ≤ uα. Let δ = exp

(− (ε − ρ)2/(4ρ)

),

and then we have ε = ρ+2√ρlog(1/δ), which has the same

form as in Proposition 1. In this case,α∗ = (2ρ+ 2

√ρlog(1/δ))/(2ρ)

, and it requires

(2ρ+ 2√ρlog(1/δ))/(2ρ) ≤ uα (22)

From (22) we haveδ ≥ 1/ exp(ρ(uα − 1)2) (23)

Otherwise, ifδ < 1/ exp(ρ(uα − 1)2) (24)

which meansα∗ > uα

Then, because the function g(α) is monotonically decreasingin the interval (0, α∗], the constrained minimum is achieved

Page 19: Differentially Private Model Publishing for Deep Learning · On the other hand, the publishing and sharing of trained deep learning models has been gaining growing interest. Google’s

Table III: decay rate values for different training times

#epochs 30 40 50 60 70 80 90 100Time 0.076 0.0441 0.0281 0.019 0.0132 0.0093 0.0067 0.0048Step 0.5459 0.7008 0.7922 0.851 0.891 0.919 0.94 0.956Exp 0.0442 0.0282 0.0193 0.0138 0.0101 0.0075 0.0056 0.0041Poly 6.2077 3.5277 2.1948 1.4317 0.9549 0.6382 0.4167 0.1626

at the boundary pointα+ = uα

and accordingly we let δ = exp((α+ − 1)(ρα+ − ε)

)and

haveε = ρα+ − logδ

α+ − 1

.

C. ρ-zCDP mechanism A with random sampling still satis-fies ρ-zCDP

Suppose A′ that runs ρ-zCDP mechanism A on a randomsubsample of dataset D. Following the result (11) in thepaper, the proof is as follows:

Because Pr(Λ(D′) = T ′|de ∈ T ′) = Pr(Λ(D) = T ) andA satisfies ρ-zCDP, Renyi divergence

Dα(u0||u1) ≤ Dα(A(T )||A(T ′)) ≤ αρ (25)Dα(u1||u0) ≤ Dα(A(T ′)||A(T )) ≤ αρ (26)

Using jointly quasi-convexity of Renyi divergence [41], wehave

Dα(u0||qu1 + (1− q)u0) ≤ Dα(u0||u1) ≤ αρ (27)Dα(qu1 + (1− q)u0 || u0) ≤ Dα(u1||u0) ≤ αρ (28)

and thus A′ still satisfies ρ-zCDP.

D. The Impact of number of hidden layers for MNIST

See Table IV.

Table IV: Accuracy results under different number of layers

Layer num-bers

1 2 3

trainingaccuracy

0.9315 0.9228 0.902

testing accu-racy

0.931 0.921 0.898

E. Decay rate values for different training times

Table III list the values of decay rate used for each decayfunction to achieve the corresponding training times.

F. Schedule parameters for the Cancer and CIFAR-10datasets

See Table V.

Table V: Schedule parameters

Dataset Uniform Exp Decay ValidationCancer σ=25,

#epochs=500σ0=30,k=0.001

σ0=35,k=0.99,period=50,δ=0.01, m=1

CIFAR-10 σ=8,#epochs=200

σ0=6,k=0.001

σ0=6,k=0.99,period=10,δ=0.05, m=5

G. Validation of emperical settings for bounding α-Renyidivergence

1 2 3 4 5 60

1

2

3

4

5

6di

verg

ence

10 -4

(a) σ = 1, q = 0.01

0 20 40 600

1

2

3

dive

rgen

ce

10 -4

(b) σ = 4, q = 0.01

Figure 16: Bound v.s. α-Renyi divergenceIn this section we describe our numerical

validation of the bound P = q2α/σ2 of α-Renyidivergence for the Gaussian mechanism with randomsampling given the condition q ≤ 1

16σ and α∈ (1, Uα = σ2 log 1

qσ + 1]. We compute the α-Renyidivergence with the code for moments accountant (namedas Renyi differential privacy (RDP) analysis in Tensor-flow)(https://github.com/tensorflow/privacy/blob/master/privacy/analysis/rdp accountant.py).

We test σ and q at a precision of 0.001, by varying σfrom 1 to 30 and q from 0.001 to 1

16σ with a step size of0.001, α ∈ (1, Uα = σ2 log 1

qσ + 1] with step size 0.01.In our validation, the bound q2α/σ2 is close but alwayshigher than the α-Renyi divergence. We plot Figure 16 fordemonstration. We also did randomly additional tests forcases such as a smaller step size and a wide σ value upto 50. We found that the empirical bound q2α/σ2 alwaysholds under the given conditions. Therefore, we have theconjecture that q2α/σ2 is a valid bound for the α-Renyidivergence of sampled Gaussian mechanism and seek itsformal proof in our future work. With using P and Uαas stated above for Theorem 3, we can have an effectiveestimation on the privacy loss in terms of (ε, δ)-DP in ourtested parameter settings of σ and q.

Page 20: Differentially Private Model Publishing for Deep Learning · On the other hand, the publishing and sharing of trained deep learning models has been gaining growing interest. Google’s

i m p o r t numpy as npi m p o r t t e n s o r f l o w as t fd a t a = np . a r r a y ( r a n g e ( 1 0 ) )n = 1l i m i t e d t e n s o r = t f . t r a i n . l i m i t e p o c h s ( da t a , n )b a t c h s i z e = 1b a t c h = t f . t r a i n . s h u f f l e b a t c h ( [ l i m i t e d t e n s o r ] , b a t c h s i z e = b a t c h s i z e ,

enqueue many=True , c a p a c i t y = b a t c h s i z e *100 , m i n a f t e r d e q u e u e = b a t c h s i z e *10)i n p u t f n = t f . e s t i m a t o r . i n p u t s . numpy inpu t fn ( da t a , b a t c h s i z e = b a t c h s i z e ,

num epochs=n , s h u f f l e =True )d a t a o p s = i n p u t f n ( )

# t r u e random s a m p l i n g wi th s a m p l in g r a t i o q = b a t c h s i z e / i n p u t s i z ed a t a s i z e = d a t a . shape [ 0 ]q= b a t c h s i z e / f l o a t ( d a t a s i z e )p r i n t ( q )f o r s t e p i n r a n g e ( d a t a s i z e / b a t c h s i z e ) :

s = np . random . un i fo rm ( 0 , 1 , s i z e = d a t a s i z e )p r i n t ( d a t a [ s<=q ] )

wi th t f . S e s s i o n ( ) a s s e s s :s e s s . run ( t f . i n i t i a l i z e l o c a l v a r i a b l e s ( ) )t f . t r a i n . s t a r t q u e u e r u n n e r s ( )p r i n t ( ” t e s t t f . t r a i n s h u f f l e b a t c h ” )t r y :

w h i l e True :d a t a b a t c h = s e s s . run ( b a t c h )p r i n t ( d a t a b a t c h )# p r o c e s s d a t a

e x c e p t t f . e r r o r s . OutOfRangeError :p a s s

p r i n t ( ” t e s t t f . e s t i m a t o r . i n p u t s . numpy inpunt fn ” )t r y :

w h i l e True :d a t a b a t c h = s e s s . run ( d a t a o p s )p r i n t ( d a t a b a t c h )# p r o c e s s d a t a

e x c e p t t f . e r r o r s . OutOfRangeError :p a s s

H. Code for testing Tensorflow batch APIs