Abadi 2016 - Hyperparameter Tuning and Privacy Cost of Search
Summary
Trying several hyperparameter settings on private data costs privacy: naively the costs add. Because only the best model is kept, Theorem D.1 (Gupta et al.) shows the search can be done at a total cost near , so about 6,700 settings can be tried on a 10,000-example validation set at with at most a 1% accuracy loss. Theory also gives rules of thumb for lot size, learning rate and noise.
Overview
Section 3.3 identifies the hyperparameters that trade privacy, accuracy and performance. The experiments (Figure 5) show that accuracy depends more on training parameters such as lot size and noise level than on network structure.
Main Content
Guidance from theory and experiment.
- Accuracy is more sensitive to batch (lot) size and noise level than to network topology.
- DP optimization of convex objectives is best with batch sizes as small as 1; non-convex learning is less stable and benefits from larger lots. Yet by Theorem 1 making lots too large raises the privacy cost, so a reasonable tradeoff is to take the number of lots per epoch of the same order as the desired number of epochs. (Experiments find the best lot size is about .)
- Unlike non-private training, the learning rate need not be decreased to a very small value, because private training never reaches that regime. A small benefit comes from starting large and decaying linearly to a smaller value over a few epochs, then holding constant.
- If several settings are tried, one can add all costs (possibly via the moments accountant), or do better as below.
Theorem D.1 (Gupta et al., Theorem 10.2)
Let be an -differentially private mechanism such that for a query function with sensitivity 1 and a parameter , for some . Then for any and any there is a mechanism with:
- ;
- makes calls to ;
- is -differentially private.
Application to hyperparameter search. Suppose each of hyperparameter choices yields a DP mechanism . Let pick a random choice and run . Let be the number of validation examples labeled correctly by outcome and a target accuracy. If one setting achieves at least , meets the preconditions with , so with high probability the mechanism implied by the theorem achieves accuracy close to . The proof of Theorem D.1 actually gives the stronger -DP for this use.
Examples
How many settings can be tried
Setup: target accuracy 95% on a validation set of size 10,000, so ; take and . Solution: the accuracy loss in counts is . A 1% loss is 100 counts, so we need , i.e. , i.e. . With the extra privacy cost is , hence “one can try 6,700 different parameter settings at privacy cost for the validation set.” Interpretation: the bound is generous in the number of candidates because the cost is logarithmic in , but it is a worst-case bound and the privacy cost of 4 is not small. In the paper’s experiments no more than about 100 settings were tried and the actual is much larger than , so a smaller should suffice.
import numpy as np
eps0, delta = 0.5, 0.05
loss_budget = 100 # 1% of 10,000 validation examples
# need loss_budget > (4/eps0) * ln(1/(eps0*delta*p))
p_min = 1.0 / (eps0 * delta) / np.exp(loss_budget * eps0 / 4)
print(p_min, 1.0 / p_min) # about 1.49e-4 -> 1/p ~ 6,700
print("extra privacy cost 8*eps0 =", 8 * eps0)Connections
- Tuning that peeks at private data leaks information; the same logic appears in the census paper, where the TDA was deliberately tuned on 2010 data and not on the 2020 data it protects: Abowd 2022 - Privacy-Loss Budget Allocation and Tuning.
- Selecting the best of many fitted models and reporting it is a multiplicity problem even without privacy: Model Selection and Overfitting.
- Marketing relevance: tuning an MMM or a conversion-prediction model on user-level private data consumes privacy budget just like training does; see Abadi 2016 - Related Work, Limitations and Marketing Relevance.