More detailed description of arguments in compute_dp_sgd_privacy.

PiperOrigin-RevId: 522693217
This commit is contained in:
Galen Andrew 2023-04-07 15:07:10 -07:00 committed by A. Unique TensorFlower
parent c4628d5dbc
commit d5e41e20ad
2 changed files with 25 additions and 10 deletions

View file

@ -34,10 +34,24 @@ from absl import flags
from tensorflow_privacy.privacy.analysis.compute_dp_sgd_privacy_lib import compute_dp_sgd_privacy_statement from tensorflow_privacy.privacy.analysis.compute_dp_sgd_privacy_lib import compute_dp_sgd_privacy_statement
_NUM_EXAMPLES = flags.DEFINE_integer('N', None, 'Total number of examples.') _NUM_EXAMPLES = flags.DEFINE_integer(
_BATCH_SIZE = flags.DEFINE_integer('batch_size', None, 'Batch size.') 'N', None, 'Total number of examples in the training data.'
)
_BATCH_SIZE = flags.DEFINE_integer(
'batch_size',
None,
(
'Number of examples in a batch *regardless of how/whether they are '
'grouped into microbatches*.'
),
)
_NOISE_MULTIPLIER = flags.DEFINE_float( _NOISE_MULTIPLIER = flags.DEFINE_float(
'noise_multiplier', None, 'Noise multiplier for DP-SGD.' 'noise_multiplier',
None,
(
'Noise multiplier for DP-SGD: ratio of Gaussian noise stddev to the '
'l2 clip norm at each round.'
),
) )
_NUM_EPOCHS = flags.DEFINE_float( _NUM_EPOCHS = flags.DEFINE_float(
'epochs', None, 'Number of epochs (may be fractional).' 'epochs', None, 'Number of epochs (may be fractional).'
@ -52,7 +66,7 @@ _MAX_EXAMPLES_PER_USER = flags.DEFINE_integer(
'max_examples_per_user', 'max_examples_per_user',
None, None,
( (
'Maximum number of examples per user, applicable. Used to compute a' 'Maximum number of examples per user, if applicable. Used to compute a '
'user-level DP guarantee.' 'user-level DP guarantee.'
), ),
) )

View file

@ -51,7 +51,7 @@ def _compute_dp_sgd_user_privacy(
Args: Args:
num_epochs: The number of passes over the data. May be fractional. num_epochs: The number of passes over the data. May be fractional.
noise_multiplier: The ratio of the noise to the l2 sensitivity. noise_multiplier: The ratio of the noise stddev to the l2 sensitivity.
user_delta: The target user-level delta. user_delta: The target user-level delta.
max_examples_per_user: Upper bound on the number of examples per user. max_examples_per_user: Upper bound on the number of examples per user.
used_microbatching: If true, increases sensitivity by a factor of two. used_microbatching: If true, increases sensitivity by a factor of two.
@ -183,7 +183,7 @@ def _compute_dp_sgd_example_privacy(
Args: Args:
num_epochs: The number of passes over the data. num_epochs: The number of passes over the data.
noise_multiplier: The ratio of the noise to the l2 sensitivity. noise_multiplier: The ratio of the noise stddev to the l2 sensitivity.
example_delta: The target delta. example_delta: The target delta.
used_microbatching: If true, increases sensitivity by a factor of two. used_microbatching: If true, increases sensitivity by a factor of two.
poisson_subsampling_probability: If not None, gives the probability that poisson_subsampling_probability: If not None, gives the probability that
@ -244,9 +244,10 @@ def compute_dp_sgd_privacy_statement(
examples in a batch, *regardless of whether/how they are grouped into examples in a batch, *regardless of whether/how they are grouped into
microbatches*. microbatches*.
num_epochs: The number of epochs of training. May be fractional. num_epochs: The number of epochs of training. May be fractional.
noise_multiplier: The ratio of the Gaussian noise to the clip norm at each noise_multiplier: The ratio of the Gaussian noise stddev to the l2 clip norm
round. It is assumed that the noise_multiplier is constant although the at each round. It is assumed that the noise_multiplier is constant
clip norm may be variable if, for example, adaptive clipping is used. although the clip norm may be variable if, for example, adaptive clipping
is used.
delta: The target delta. delta: The target delta.
used_microbatching: Whether microbatching was used (with microbatch size used_microbatching: Whether microbatching was used (with microbatch size
greater than one). Microbatching inflates sensitivity by a factor of two greater than one). Microbatching inflates sensitivity by a factor of two