-
Notifications
You must be signed in to change notification settings - Fork 386
Add PRVAccountant #493
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add PRVAccountant #493
Conversation
|
@tcbegley has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
|
@tcbegley has updated the pull request. You must reimport the pull request before landing. |
|
@facebook-github-bot has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
|
@tcbegley Thank you for contributing to Opacus! Great job! You asked me a few questions in the chat, here is the top of my mind:
|
|
@tcbegley has updated the pull request. You must reimport the pull request before landing. |
|
@facebook-github-bot has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
|
@tcbegley has updated the pull request. You must reimport the pull request before landing. |
|
@facebook-github-bot has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
| total_compositions = sum(max_self_compositions) | ||
|
|
||
| rdp_accountant = RDPAccountant() | ||
| for prv, max_self_composition in zip(prvs, max_self_compositions): | ||
| rdp_accountant.history.append( | ||
| (prv.noise_multiplier, prv.sample_rate, max_self_composition) | ||
| ) | ||
|
|
||
| L_max = rdp_accountant.get_epsilon(delta_error / 4) | ||
|
|
||
| for prv, max_self_composition in zip(prvs, max_self_compositions): | ||
| rdp_accountant = RDPAccountant() | ||
| rdp_accountant.history = [(prv.noise_multiplier, prv.sample_rate, 1)] | ||
| L_max = max( | ||
| L_max, | ||
| rdp_accountant.get_epsilon(delta=delta_error / (8 * total_compositions)), | ||
| ) | ||
|
|
||
| # FIXME: this implementation is adapted from the code accompanying the paper, but | ||
| # disagrees subtly with the theory from remark 5.6. It's not immediately clear this | ||
| # gives the right guarantees in all cases, though it's fine for eps_error < 1 and | ||
| # hence generic cases. | ||
| # cf. https://github.com/microsoft/prv_accountant/discussions/34 | ||
| return max(L_max, eps_error) + 3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm in two minds about whether to keep this as it is which follows the implementation from microsoft/prv_accountant or to follow the paper more precisely. It's not immediately clear to me that this implementation always satisfies the conditions required in the paper without making an assumption like eps_error < 1.
The changes required are minor and would look something like the following
- L_max = rdp_accountant.get_epsilon(delta_error / 4)
+ L_max = rdp_accountant.get_epsilon(delta_error / 4) + eps_error- return max(L_max, eps_error) + 3
+ return L_max + 2|
@tcbegley has updated the pull request. You must reimport the pull request before landing. |
|
@facebook-github-bot has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
|
@tcbegley has updated the pull request. You must reimport the pull request before landing. |
|
@facebook-github-bot has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
|
@tcbegley has updated the pull request. You must reimport the pull request before landing. |
|
@facebook-github-bot has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Code inspired heavily by https://github.com/microsoft/prv_accountant
4d502a4 to
bb2f182
Compare
|
@tcbegley has updated the pull request. You must reimport the pull request before landing. |
|
@facebook-github-bot has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
|
@tcbegley has updated the pull request. You must reimport the pull request before landing. |
|
@facebook-github-bot has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
|
@tcbegley has updated the pull request. You must reimport the pull request before landing. |
|
@facebook-github-bot has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
…ountant default in engine
|
@tcbegley has updated the pull request. You must reimport the pull request before landing. |
|
@facebook-github-bot has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
|
@tcbegley has updated the pull request. You must reimport the pull request before landing. |
|
@facebook-github-bot has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
|
@tcbegley has updated the pull request. You must reimport the pull request before landing. |
|
@facebook-github-bot has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
|
@tcbegley has updated the pull request. You must reimport the pull request before landing. |
|
@facebook-github-bot has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
|
@tcbegley has updated the pull request. You must reimport the pull request before landing. |
|
@facebook-github-bot has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
|
@tcbegley has updated the pull request. You must reimport the pull request before landing. |
|
@facebook-github-bot has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
This PR implements a new accountant
PRVAccountantbased on the paper Numerical Composition of Differential Privacy.Code inspired heavily by the code that accompanied the paper: https://github.com/microsoft/prv_accountant
Types of changes
Motivation and Context / Related issue
See #378
How Has This Been Tested (if it applies)
I have tested these changes with the following scripts, but would welcome suggestions on how to test further or write unit tests to cover these changes:
PRVAccountantinstead ofRDPAccountant.Checklist
I have not yet written docstrings or tests for these changes both as it was slightly unclear to me how best to proceed, but also because I would like to validate the approach taken in this initial implementation before polishing.