pytorch / opacus

Training PyTorch models with differential privacy
https://opacus.ai
Apache License 2.0
1.65k stars 328 forks source link

Different models and different image sizes can get the same epsilon #583

Closed oneheartforone closed 1 year ago

oneheartforone commented 1 year ago

Hi, When I used the official cifar10 classification example, I found that using different models (such as conv, resnet18, or even a linear layer) will get the same epsilon without changing the parameters. why does this problem happen?

After that, I tried different image input sizes and found that when other conditions remained unchanged, epsilon was still the same.

Similar results can be obtained when sigma is fixed.

Environment

alexandresablayrolles commented 1 year ago

This is because the privacy budget (epsilon) only depends on three factors: the number of steps (or epochs), the batch size and the level of noise (sigma). In particular, the budget does not depend on the architecture or the loss function or the optimizer.