pytorch / opacus

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

functorch-based per sample gradients don't match with vanilla #511

Open ffuuugor opened 1 year ago

ffuuugor commented 1 year ago

See #510

One of the new tests introduced in PR #510 fails. When running a module with two different custom implementations of a "linear-like" layer, per sample gradients computed by functorch-based hooks don't match with per sample gradients obtained by microbatching.

Interesting observations:

I've verified and I think the test is working correctly and the problem is likely genuine