jax_privacy.execution_plan.PerformanceFlags#
- class jax_privacy.execution_plan.PerformanceFlags(dtype=<class 'numpy.float32'>, noise_seed=None, intermediate_strategy=ShardingStrategies.DEFAULT, microbatch_size=None, batch_axis_name=None, spmd_axis_name=None, keep_batch_dim=True, param_specs=None)[source]#
Bases:
objectPerformance-only flags that do not affect mechanism behavior or privacy.
These flags control implementation details such as numerical precision, sharding strategy, and memory/compute trade-offs. Changing them should not alter the privacy properties or the mathematical definition of the DP mechanism.
- Variables:
dtype – The dtype to use for noise generation and gradient aggregation.
noise_seed – Deprecated; pass
noise_seedtomake()orDPTrainerinstead.intermediate_strategy – Strategy for generating intermediate noise, controls sharding behavior for noise addition.
microbatch_size – If set, per-example gradient computation is broken into sequential microbatches to reduce peak memory at the cost of compute.
batch_axis_name – Mesh axis name (or tuple of axis names) along which the batch dimension is sharded in SPMD settings.
spmd_axis_name – Deprecated alias for
batch_axis_name.keep_batch_dim – Whether to keep the batch dimension when computing per-example gradients.
param_specs – Optional PyTree of
jax.sharding.PartitionSpec(or prefix thereof) matching the parameter PyTree structure. When set, wraps the noise addition transform withwith_sharding_specs().
Methods
__init__Attributes
- dtype#
alias of
float32
-
noise_seed:
int|None= None#
-
intermediate_strategy:
ShardingStrategies= (<function ShardingStrategies.<lambda>>, <function ShardingStrategies.<lambda>>)#
-
microbatch_size:
int|None= None#
-
batch_axis_name:
str|tuple[str,...] |None= None#
-
spmd_axis_name:
str|tuple[str,...] |None= None#
-
keep_batch_dim:
bool= True#
-
param_specs:
Any|None= None#