Numerical privacy accounting for random allocation and subsampling using PLDs.
Project description
PLD_accounting
PLD_accounting is a Python package for tight differential privacy accounting of random allocation and subsampling using Privacy Loss Distributions (PLDs) as described in: Efficient privacy loss accounting for subsampling and random allocation
Purpose
- Compute tight upper/lower DP bounds for random allocation.
- Support both Gaussian mechanisms and explicit PLD realizations.
- Return
dp_accountingPLDs for epsilon/delta queries and composition workflows.
Random Allocation Model
The package accounts for the following sampling pattern:
- Per epoch: choose
ksteps out oftuniformly at random. - Across training: repeat this for
num_epochsepochs.
Parameter Mapping
num_steps = t(total candidate steps per epoch)num_selected = k(selected steps per epoch)num_epochs(number of repeated epochs)
Internal composition:
floor_steps = floor(num_steps / num_selected)remainder = num_steps - num_selected * floor_stepsfloor_epochs = (num_selected - remainder) * num_epochsceil_steps = floor_steps + 1ceil_epochs = remainder * num_epochs- We compute 1-out-of-
floor_stepsthen self compose itfloor_epochstimes, compute 1-out-of-ceil_stepsthen self compose itceil_epochstimes, and finally compose them with each other
API Overview
Random Allocation APIs
Gaussian path (most common):
gaussian_allocation_epsilon_range(delta, sigma, num_steps, num_selected=1, num_epochs=1, epsilon_accuracy=-1.0)- Adaptive upper/lower bounds for epsilon.
gaussian_allocation_delta_range(epsilon, sigma, num_steps, num_selected=1, num_epochs=1, delta_accuracy=-1.0)- Adaptive upper/lower bounds for delta.
gaussian_allocation_epsilon_extended(params, config, bound_type=BoundType.DOMINATES)- Single epsilon query with explicit discretization/convolution config.
gaussian_allocation_delta_extended(params, config, bound_type=BoundType.DOMINATES)- Single delta query with explicit discretization/convolution config.
gaussian_allocation_PLD(params, config, bound_type=BoundType.DOMINATES)- Build a reusable
dp_accounting.PrivacyLossDistribution.
- Build a reusable
Realization path (advanced):
general_allocation_PLD(num_steps, num_selected, num_epochs, remove_realization, add_realization, config, bound_type=BoundType.DOMINATES)- Build PLD from explicit
PLDRealizationinputs.
- Build PLD from explicit
general_allocation_epsilon(delta, num_steps, num_selected, num_epochs, remove_realization, add_realization, config, bound_type=BoundType.DOMINATES)- Epsilon query from explicit realizations.
general_allocation_delta(epsilon, num_steps, num_selected, num_epochs, remove_realization, add_realization, config, bound_type=BoundType.DOMINATES)- Delta query from explicit realizations.
Common notes:
BoundType.DOMINATESgives an upper (pessimistic) bound.BoundType.IS_DOMINATEDgives a lower (optimistic) bound.- Builders do not accept
BoundType.BOTH; build two PLDs if both bounds are needed.
Subsampling APIs
PLD-based subsampling helpers:
subsample_PLD(pld, sampling_probability)- Applies subsampling amplification to a
dp_accountingPLD.
- Applies subsampling amplification to a
subsample_PMF(base_pld, sampling_prob, direction)- Lower-level helper for
PLDRealizationinputs (REMOVE/ADD direction).
- Lower-level helper for
Subsampling helpers use DOMINATES semantics (upper-bound style).
Install
pip install PLD_accounting
Where To Start
- Usage examples: usage_example.py
- Implementation details: IMPLEMENTATION_OVERVIEW.md
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pld_accounting-0.3.0.tar.gz.
File metadata
- Download URL: pld_accounting-0.3.0.tar.gz
- Upload date:
- Size: 34.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f32c6ce8bd3bf93ff36667d7632fb968bcc15c9ad7ae6e218fcf76427626e06
|
|
| MD5 |
07e6777fb08bebb9361ccf290d96223a
|
|
| BLAKE2b-256 |
ccef8e18f81b73747dbde7011356a6f55f85da5229cf7c068fe94792789cad2f
|
File details
Details for the file pld_accounting-0.3.0-py3-none-any.whl.
File metadata
- Download URL: pld_accounting-0.3.0-py3-none-any.whl
- Upload date:
- Size: 39.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d6c0a6682ca7e195902620373532013412cf5e9a6f50045cccace622226c818b
|
|
| MD5 |
ab3b7a4ee9ede288230bcaab564af552
|
|
| BLAKE2b-256 |
1a988cbbda34e99f7aba5ace4db55425e5b2a9facc6fdc09c8e6154116ef679b
|