pub struct DifferentialPrivacyConfig {Show 16 fields
pub target_epsilon: f64,
pub target_delta: f64,
pub noise_multiplier: f64,
pub l2_norm_clip: f64,
pub batch_size: usize,
pub dataset_size: usize,
pub max_steps: usize,
pub noise_mechanism: NoiseMechanism,
pub secure_aggregation: bool,
pub adaptive_clipping: bool,
pub adaptive_clip_init: f64,
pub adaptive_clip_lr: f64,
pub adaptive_clip_target_quantile: f64,
pub adaptive_clip_noise_multiplier: f64,
pub accounting_method: AccountingMethod,
pub acknowledge_aggregate_clipping: bool,
}Expand description
Differential privacy configuration
Fields§
§target_epsilon: f64Target privacy parameter epsilon (the budget that is enforced)
target_delta: f64Delta at which epsilon is reported (typically << 1/n). This is a reporting parameter, not an additively consumed budget.
noise_multiplier: f64Noise multiplier for gradient perturbation (sigma, relative to the clipping norm)
l2_norm_clip: f64L2 norm clipping threshold applied to each per-example gradient
batch_size: usizeExpected batch size (used for the sampling probability)
dataset_size: usizeDataset size for privacy accounting
max_steps: usizeMaximum number of training steps (enforced)
noise_mechanism: NoiseMechanismNoise mechanism to use
secure_aggregation: boolEnable secure aggregation (for federated learning). When set, the optimizer refuses to run unless a secure aggregation backend has been wired in, rather than silently training without it.
adaptive_clipping: boolEnable adaptive clipping (Andrew et al. 2021, differentially private quantile estimation)
adaptive_clip_init: f64Initial clipping threshold for adaptive clipping
adaptive_clip_lr: f64Learning rate (geometric update rate) for adaptive clipping
adaptive_clip_target_quantile: f64Target fraction of per-example gradients that should fall below the clipping threshold (Andrew et al. 2021 use 0.5)
adaptive_clip_noise_multiplier: f64Noise multiplier applied to the privatized above-threshold count used by adaptive clipping. The count has sensitivity 1, so this is the standard deviation of the Gaussian added to it.
accounting_method: AccountingMethodPrivacy accounting method
acknowledge_aggregate_clipping: boolExplicit acknowledgement that the caller understands the semantics of
DifferentiallyPrivateOptimizer::dp_step, which clips an already
aggregated gradient and therefore does not provide per-example
differential privacy. Left false, that entry point returns an error.
Implementations§
Source§impl DifferentialPrivacyConfig
impl DifferentialPrivacyConfig
Sourcepub fn validate(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
Validate the configuration.
Every parameter that can silently void a privacy guarantee is checked
here: a zero noise multiplier, a non-positive clipping norm, a delta
outside (0, 1), a batch larger than the dataset, and so on.
Sourcepub fn sampling_probability(&self) -> f64
pub fn sampling_probability(&self) -> f64
Per-record sampling probability q = batch_size / dataset_size.
Trait Implementations§
Source§impl Clone for DifferentialPrivacyConfig
impl Clone for DifferentialPrivacyConfig
Source§fn clone(&self) -> DifferentialPrivacyConfig
fn clone(&self) -> DifferentialPrivacyConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DifferentialPrivacyConfig
impl Debug for DifferentialPrivacyConfig
Auto Trait Implementations§
impl Freeze for DifferentialPrivacyConfig
impl RefUnwindSafe for DifferentialPrivacyConfig
impl Send for DifferentialPrivacyConfig
impl Sync for DifferentialPrivacyConfig
impl Unpin for DifferentialPrivacyConfig
impl UnsafeUnpin for DifferentialPrivacyConfig
impl UnwindSafe for DifferentialPrivacyConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.