# meta-pytorch/opacus

Training PyTorch models with differential privacy

Repository: https://github.com/meta-pytorch/opacus
Canonical: https://ross.abutalabs.com/products/opacus
Homepage: https://opacus.ai
Language: Python
License: Apache-2.0
License Family: permissive
Topics: differential-privacy, privacy-preserving-machine-learning, deep-learning, machine-learning, neural-network, pytorch
Last push: 2026-07-13T21:37:10+00:00

## Health v2 (maintenance only)
Score: 79/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 92, release rhythm 50, longevity 100
- inputs: {"age_days": 2462, "days_push": 51, "days_rel": 120, "gap_med": 220.0, "n_releases_24m": 3}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1952, forks 398 (observed 2026-08-28T04:05:58.348948+00:00)

## What it is
Opacus is a PyTorch library for training neural networks with differential privacy via DP-SGD, requiring minimal code changes through its PrivacyEngine API. It supports fast per-sample gradient computation, privacy budget tracking, and is extensible for differential privacy research.

## Use cases
- train pytorch models with differential privacy
- add dp-sgd to my neural network training
- track privacy budget epsilon during model training
- fine-tune transformers with differential privacy
- research differentially private deep learning algorithms
- reduce memory usage of dp-sgd with ghost clipping

## When to choose
- you train models in PyTorch and need formal differential privacy guarantees
- you want minimal code changes and online privacy budget tracking
- you are a DP researcher needing an extensible, modular implementation

## When to avoid
- you use TensorFlow, JAX, or non-PyTorch frameworks
- you need privacy guarantees for inference or data release rather than training
- your model architecture is incompatible with per-sample gradient computation

## Facets
- artifact type: library
- maturity: active
- function: machine-learning, deep-learning, privacy, llm-training
- domain: machine-learning, privacy, deep-learning, large-language-models
- platform: python, cross-platform
- tags: differential-privacy, dp-sgd, pytorch, privacy-preserving-machine-learning, gradient-clipping, privacy-budget, lora, gpu

## Member repositories
- meta-pytorch/opacus (main) score 79

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:05:58.348948+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T03:06:36.078604+00:00, confidence not recorded.
  - readme: https://github.com/meta-pytorch/opacus (fetched 2026-08-28T04:05:58.348948+00:00, sha 0be5df5b6c4b)
  - homepage: https://opacus.ai (fetched 2026-08-29T10:46:32.618282+00:00, sha 3c87ebef9d2f)
  - site_page: https://opacus.ai/docs/introduction (fetched 2026-08-29T10:46:32.637670+00:00, sha ae0cd5e345cf)
  - site_page: https://opacus.ai/docs/faq (fetched 2026-08-29T10:46:32.669529+00:00, sha 7bb713dde164)
  - site_page: https://opacus.ai/docs/introduction.html (fetched 2026-08-29T10:46:32.712158+00:00, sha ae0cd5e345cf)
- Data as of 2026-08-30T08:39:29.467469+00:00.
