gdpnum
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.
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()
Metadata
Release files for gdpnum 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| gdpnum-0.1.3.tar.gz | 106.8 kB | Without provenance | Details for gdpnum-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gdpnum-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for gdpnum-0.1.3-py3-none-any.whl |
Total release size: 117.3 kB
Release files / gdpnum-0.1.3.tar.gz
| Download URL | gdpnum-0.1.3.tar.gz |
|---|---|
| Size | 106.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1604531aaff09c2036fe21cb62f280825a9cb3d22832c21ecee1b7fb7a617923
|
|
BLAKE2b-256 checksum How to use checksums |
b6fe3815c9423ee78e0ce5a426a7ce62c8faa0066fba225571cf4d7c81f4e25f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / gdpnum-0.1.3-py3-none-any.whl
| Download URL | gdpnum-0.1.3-py3-none-any.whl |
|---|---|
| Size | 10.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6868d104a4ce55d8e27fa0c1fd344e5fc10727e48b72453af93894ca4bfd7b84
|
|
BLAKE2b-256 checksum How to use checksums |
c00a05d3e2e105e0664959a68196adb6348238299c8a24ad97a0461f0f3a4b5d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for gdpnum 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.