Skip to content

Commit d5e41e2

Browse files
galenmandrewtensorflower-gardener
authored andcommitted
More detailed description of arguments in compute_dp_sgd_privacy.
PiperOrigin-RevId: 522693217
1 parent c4628d5 commit d5e41e2

File tree

2 files changed

+25
-10
lines changed

2 files changed

+25
-10
lines changed

tensorflow_privacy/privacy/analysis/compute_dp_sgd_privacy.py

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,24 @@
3434
from tensorflow_privacy.privacy.analysis.compute_dp_sgd_privacy_lib import compute_dp_sgd_privacy_statement
3535

3636

37-
_NUM_EXAMPLES = flags.DEFINE_integer('N', None, 'Total number of examples.')
38-
_BATCH_SIZE = flags.DEFINE_integer('batch_size', None, 'Batch size.')
37+
_NUM_EXAMPLES = flags.DEFINE_integer(
38+
'N', None, 'Total number of examples in the training data.'
39+
)
40+
_BATCH_SIZE = flags.DEFINE_integer(
41+
'batch_size',
42+
None,
43+
(
44+
'Number of examples in a batch *regardless of how/whether they are '
45+
'grouped into microbatches*.'
46+
),
47+
)
3948
_NOISE_MULTIPLIER = flags.DEFINE_float(
40-
'noise_multiplier', None, 'Noise multiplier for DP-SGD.'
49+
'noise_multiplier',
50+
None,
51+
(
52+
'Noise multiplier for DP-SGD: ratio of Gaussian noise stddev to the '
53+
'l2 clip norm at each round.'
54+
),
4155
)
4256
_NUM_EPOCHS = flags.DEFINE_float(
4357
'epochs', None, 'Number of epochs (may be fractional).'
@@ -52,8 +66,8 @@
5266
'max_examples_per_user',
5367
None,
5468
(
55-
'Maximum number of examples per user, applicable. Used to compute a'
56-
' user-level DP guarantee.'
69+
'Maximum number of examples per user, if applicable. Used to compute a '
70+
'user-level DP guarantee.'
5771
),
5872
)
5973

tensorflow_privacy/privacy/analysis/compute_dp_sgd_privacy_lib.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def _compute_dp_sgd_user_privacy(
5151
5252
Args:
5353
num_epochs: The number of passes over the data. May be fractional.
54-
noise_multiplier: The ratio of the noise to the l2 sensitivity.
54+
noise_multiplier: The ratio of the noise stddev to the l2 sensitivity.
5555
user_delta: The target user-level delta.
5656
max_examples_per_user: Upper bound on the number of examples per user.
5757
used_microbatching: If true, increases sensitivity by a factor of two.
@@ -183,7 +183,7 @@ def _compute_dp_sgd_example_privacy(
183183
184184
Args:
185185
num_epochs: The number of passes over the data.
186-
noise_multiplier: The ratio of the noise to the l2 sensitivity.
186+
noise_multiplier: The ratio of the noise stddev to the l2 sensitivity.
187187
example_delta: The target delta.
188188
used_microbatching: If true, increases sensitivity by a factor of two.
189189
poisson_subsampling_probability: If not None, gives the probability that
@@ -244,9 +244,10 @@ def compute_dp_sgd_privacy_statement(
244244
examples in a batch, *regardless of whether/how they are grouped into
245245
microbatches*.
246246
num_epochs: The number of epochs of training. May be fractional.
247-
noise_multiplier: The ratio of the Gaussian noise to the clip norm at each
248-
round. It is assumed that the noise_multiplier is constant although the
249-
clip norm may be variable if, for example, adaptive clipping is used.
247+
noise_multiplier: The ratio of the Gaussian noise stddev to the l2 clip norm
248+
at each round. It is assumed that the noise_multiplier is constant
249+
although the clip norm may be variable if, for example, adaptive clipping
250+
is used.
250251
delta: The target delta.
251252
used_microbatching: Whether microbatching was used (with microbatch size
252253
greater than one). Microbatching inflates sensitivity by a factor of two

0 commit comments

Comments
 (0)