xref: /aosp_15_r20/external/pytorch/functorch/examples/dp_cifar10/README.md (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1## Differential Privacy with ResNet18
2
3### Differential Privacy
4Differential privacy is a way of training models that ensures no attacker can figure out the training
5data from the gradient updates of the model. Recently, a paper was published comparing the performance of
6Opacus to a JAX-based system.
7
8[Original differential privacy paper](https://people.csail.mit.edu/asmith/PS/sensitivity-tcc-final.pdf)
9[JAX-based differential privacy paper](https://arxiv.org/pdf/2010.09063.pdf)
10
11### Opacus
12Opacus is a differential privacy library built for PyTorch. They have added hooks to PyTorch's
13autograd that compute per sample gradients and a differential privacy engine that computes
14differentially private weight updates.
15
16### Example
17This example runs ResNet18 by either having Opacus compute the differentially private updates or
18getting the per sample gradients using vmap and grad and computing the differentially private update
19from those.
20
21As a caveat, the transforms version may not be computing the exact same values as the opacus version.
22No verification has been done yet for this.
23
24### Requirements
25These examples use Opacus version 1.0.1 and torchvision 0.11.2
26