#11 · Primary category: Privacy-Preserving & Federated Data Science

opacus

deep-learning differential-privacy machine-learning neural-network privacy-preserving-machine-learning pytorch

Training PyTorch models with differential privacy

Project last updated:07/13/26

GitHub Stars

2.0K

Forks

397

Contributors

91

License

Apache-2.0

Why we included this project

Opacus is the practical way to add differential privacy to a PyTorch project. Instead of rewriting your training code, you pass your existing model, optimizer, and dataloader to a PrivacyEngine, which clips gradients and adds calibrated noise, so a DP-SGD loop takes only a few extra lines. The library also tracks the cumulative privacy budget as training runs, which gives you a concrete answer to the question regulators and users care about: how much privacy has this run consumed before the model ships. Fast per-sample gradient computation and clipping methods such as Fast Gradient Clipping and Ghost Clipping keep the memory cost far below naive microbatching. The modular internals are easy to tinker with, which suits DP researchers, while the tutorials offer practitioners a solid starting point for image classifiers, text classifiers, and LSTM-based models.

Articles for this project

No articles for this project yet.

To suggest a topic or contribute an article, contact us.

Related projects in this category