Opacus

github.com/pytorch/opacus Models & ML Research Open-source projectOpen source

A library that enables training PyTorch models with differential privacy.

github.com/pytorch/opacus
Opacus homepage screenshot

About Opacus

Opacus is an open-source library for training PyTorch models with differential privacy. Users create a PrivacyEngine and pass their model, optimizer, and data loader to its make_private() method with settings such as noise multiplier and maximum gradient norm.

It includes tracking of the privacy budget expended during training, support for Fast Gradient Clipping and Ghost Clipping, and examples and tutorials covering MNIST, BERT text classification, image classification, and LSTM name classification.

Key features

  • Train PyTorch models with differential privacy via PrivacyEngine
  • Convert model, optimizer, and data loader using make_private()
  • Track privacy budget expended during training
  • Support Fast Gradient Clipping and Ghost Clipping
  • Compatible with LoRA and peft library for DP-SGD training
  • Include examples for MNIST, BERT, image classifier, and LSTM
Best for: ML practitioners and differential privacy researchers who train PyTorch models with differential privacy.
Good for
  • Requires passing model, optimizer, and data loader to make_private()
  • Allows tracking of privacy budget expended during training
  • Provides examples and IPython-based tutorials for common model types
Watch out for
  • Installing directly from source may include quirks and occasional bugs

Opacus at a glance

Type
Open-source project
Pricing
Not confirmed. Check the site
Open source
Yes · Source code
Language
English
Last checked
Oct 5, 2026 · Online when checked
Listed
Oct 5, 2026

Opacus alternatives

Tools and sites you could use instead, ranked by how closely they match.

All 24 alternatives

Popular in Models & ML Research

Well-known listings from the same topic.

All 69

Opacus FAQ

How do I install Opacus?
Install the latest release with pip install opacus or conda install -c conda-forge opacus.
How do I make a PyTorch training run private?
Create a PrivacyEngine and pass the model, optimizer, and data loader to make_private() with noise_multiplier and max_grad_norm settings.
Can Opacus be used with LoRA?
A tutorial shows how the LoRA and peft library can be used with DP-SGD.
Is something wrong or out of date?

Tell us and an editor will check it.

Own this website?

Claim the listing and suggest updates yourself. An editor checks every claim first.

Claim this listing