Skip to main content

Numeric computation of the privacy parameter in Gaussian Differential Privacy

Project description

gdpnum

pypi CI arXiv

Library for numerically computing the correct, non-asymptotic Gaussian Differential Privacy (GDP) guarantees for DP-SGD or similar privacy-preserving algorithms. Correct, non-asymptotic GDP accurately and faithfully represents the privacy guarantees of many practical algorithms with just a single mu parameter, enabling correct comparisons (unlike fixed epsilon/delta), and accurate conversions to interpretable notions of risk. See Gomez et al. (2026)[^1].

[^1]: Gaussian DP for Reporting Differential Privacy Guarantees in Machine Learning. IEEE SatML 2026.

If you make use of the library or methods, please cite:

@inproceedings{gomez2026gaussian,
  title={Gaussian DP for Reporting Differential Privacy Guarantees in Machine Learning},
  author = {Gomez, Juan Felipe and Kulynych, Bogdan and Kaissis, Georgios and du Pin Calmon, Flavio and Hayes, Jamie and Balle, Borja and Honkela, Antti},
  booktitle={2026 IEEE Conference on Secure and Trustworthy Machine Learning (SaTML)},
  year={2026},
  organization={IEEE}
}

Quickstart

You can install the library with pip:

pip install gdpnum

DP-SGD

To analyze DP-SGD, you can use:

import gdpnum

mu, regret = gdpnum.dpsgd.get_mu_and_regret_for_dpsgd(
    noise_multiplier=9.4,
    sample_rate=0.328,
    num_steps=2000
)
# (1.5685621993129137, 0.0010208130697719753)

We get the numerically computed GDP mu parameter, and regret which shows the goodness-of-fit of the GDP.

The library also includes an Opacus-compatible accountant interface:

import gdpnum

acct = gdpnum.dpsgd.CTDAccountant()
acct.step(noise_multiplier=9.4, sample_rate=0.328)
acct.get_mu_and_regret()

General mechanisms

For general mechanisms, the library relies on the privacy loss distribution objects from the dp_accounting package:

import gdpnum

pld = ...

converter = gdpnum.PLDConverter(pld)
mu, regret = converter.get_mu_and_regret()

See an example for the US Census TopDown mechanism in the notebooks folder.

To get the tabulation of the trade-off curve function at recommended values of alpha from the paper, simply run:

converter.get_beta()

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

gdpnum-0.1.2.tar.gz (153.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gdpnum-0.1.2-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file gdpnum-0.1.2.tar.gz.

File metadata

  • Download URL: gdpnum-0.1.2.tar.gz
  • Upload date:
  • Size: 153.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.6

File hashes

Hashes for gdpnum-0.1.2.tar.gz
Algorithm Hash digest
SHA256 ed0a673e518f82d4806d7312d3f4e0dca45b5e427c48dc156bdcc0805fc935cc
MD5 df74940549c331518bacfd0649ea66ec
BLAKE2b-256 f69f8cc6901e77cfa45fb3e8370af3c36399993667cb49e43014ae173936d5e4

See more details on using hashes here.

File details

Details for the file gdpnum-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: gdpnum-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.6

File hashes

Hashes for gdpnum-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 dc5d6eb100dc69b1eeb036b93f82c166ff7aa72b82e5272f1c0e9a178c4c1d0a
MD5 a67602c7b57abcab00cbec0d9846ba9e
BLAKE2b-256 065ad01ba1a1f763c281826c98c5f6e5c90809fa825fbcfb343089686dc0cea2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page