Add SlaClip adaptive clipping optimizer for DP-SGD (algorithm of ICML 2026 spotlight paper) - #824
Add SlaClip adaptive clipping optimizer for DP-SGD (algorithm of ICML 2026 spotlight paper)#824ZsyRock wants to merge 2 commits into
Conversation
|
Hi @ZsyRock! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
|
Hi maintainers, thanks for taking a look. It seems the workflows are still awaiting approval and the PR has not been imported yet. Please let me know if there is anything I should do on my side. |
|
Hi @ZsyRock, for emerging research related to DP-SGD we recommend committing changes to the research folder. Once a method becomes established enough in the community, we can move it into the main folder. This prevents the core Opacus code from becoming difficult to maintain with the addition of new methods. |
|
This pull request has been imported. If you are a Meta employee, you can view this in D110207613. (Because this pull request was imported automatically, there will not be any future comments.) |
|
Thanks for the guidance. I revised the PR to move SlaClip into I verified the research tests locally with: conda run -n opacus python -m pytest research/slaclip -qwhich passes with |
f22599f to
ccb09fc
Compare
ccb09fc to
14d2df2
Compare
|
Thanks for the review. I have updated the implementation and documentation The PR is now a self-contained research prototype under The branch has also been rebased onto the latest Could you please re-review the updated PR and approve the workflow runs when |
Thanks for the suggestion. I added a research-scoped Users can now call the standard Omitting the controller enables the indicator-only mode, while passing The implementation remains entirely under |
|
Hi @iden-kalemaj, just a gentle follow-up on PR #824. |
Summary
This PR adds SlaClip as a self-contained research prototype under
research/slaclip.SlaClip uses the norm budget left unused by clipping to jointly release a
private Slack Indicator—a noisy, binned estimate of the gradient-norm CDF—
together with the standard DP-SGD gradient.
The extended per-sample vector preserves the original L2 norm bound. Under the
same sampling rule, normalization, clipping threshold, and noise multiplier,
the gradient and Slack Indicator are therefore released as one Gaussian
mechanism with the same per-step privacy-accounting parameters as vanilla
DP-SGD.
Usage
The implementation exposes two composable steps:
SlaClipDPOptimizerjointly releases the DP gradient and private SlackIndicator. Without a controller, the clipping threshold remains fixed.
SlaClipControllerconsumes the released indicator and applies equations(28)-(30) from the paper to adapt the clipping threshold as post-processing.
Using both components implements the paper's SlaClip method. Users may also use
the first component independently to obtain private CDF information for other
DP-safe post-processing methods.
The recommended entry point is
SlaClipPrivacyEngine, a research-scopedsubclass of Opacus
PrivacyEngine. Users can call its inheritedmake_private()ormake_private_with_epsilon()APIs directly; modelwrapping, data-loader preparation, secure RNG selection, optimizer
construction, and privacy-accountant hooks are handled automatically. Full integration instructions, examples,
privacy assumptions, parameters, automatic K selection, and limitations are
provided in
research/slaclip/README.md.Scope
This PR:
research/slaclip;PrivacyEngineor other Opacus core APIs;DPOptimizerpath;Tests
Result:
The tests cover:
SlaClipPrivacyEngineentry point;make_private_with_epsilon()support;Black, flake8, isort, and git diff --check also pass.
Reference
This implementation is based on:
SlaClip: Gradient Norm Slacks can be Indicator for Adaptive Clipping in DP-SGD, ICML 2026 Spotlight.