Missed TensorFlow World? Check out the recap. Learn more

tff.utils.build_dp_query

View source on GitHub

Makes a DPQuery to estimate vector averages with differential privacy.

tff.utils.build_dp_query(
    clip,
    noise_multiplier,
    expected_total_weight,
    adaptive_clip_learning_rate=0,
    target_unclipped_quantile=None,
    clipped_count_budget_allocation=None,
    expected_num_clients=None,
    use_per_vector=False,
    model=None
)

Supports many of the types of query available in tensorflow_privacy, including nested ("per-vector") queries as described in https://arxiv.org/pdf/1812.06210.pdf, and quantile-based adaptive clipping as described in https://arxiv.org/abs/1905.03871.

Args:

  • clip: The query's L2 norm bound.
  • noise_multiplier: The ratio of the (effective) noise stddev to the clip.
  • expected_total_weight: The expected total weight of all clients, used as the denominator for the average computation.
  • adaptive_clip_learning_rate: Learning rate for quantile-based adaptive clipping. If 0, fixed clipping is used. If per-vector clipping is enabled, the learning rate of each vector is proportional to that vector's initial clip, such that the sum of all per-vector learning rates equals this.
  • target_unclipped_quantile: Target unclipped quantile for adaptive clipping.
  • clipped_count_budget_allocation: The fraction of privacy budget to use for estimating clipped counts.
  • expected_num_clients: The expected number of clients for estimating clipped fractions.
  • use_per_vector: If True, clip each weight tensor independently. Otherwise, global clipping is used. The clipping norm for each vector (or the initial clipping norm, in the case of adaptive clipping) is proportional to the sqrt of the vector dimensionality while the total bound still equals clip.
  • model: A tff.learning.Model to determine the structure of model weights. Required only if use_per_vector is True.

Returns:

A DPQuery suitable for use in a call to build_dp_aggregate to perform Federated Averaging with differential privacy.