OpenMined / PyDP

The Python Differential Privacy Library. Built on top of: https://github.com/google/differential-privacy
Apache License 2.0
497 stars 136 forks source link

FEAT: Expose SeededLaplaceMechanism for deterministic RNG #407

Open mjbommar opened 2 years ago

mjbommar commented 2 years ago

Feature Description

For research and CI/CD testing purposes, full transparency or determinism w.r.t. random state is often desirable. differential-privacy makes a SeededLaplaceMechanism available for this purpose, but it looks like we only make LaplaceMechanism available in this library.

Is your feature request related to a problem?

Two issues:

What alternatives have you considered?

Alternatives rely on asymptotic results and thresholds that may be arbitrary or result in false negative test results, especially on small sample sizes or for some metrics.

mjbommar commented 2 years ago

PS: this looks pretty trivial but happy to help implement too!

mjbommar commented 2 years ago

I thought I could PR this in 15 minutes but ran into an issue. I see that the SeededXYZ mechanisms are in numerical-mechanisms-testing.h, not numerical-mechanisms.h, which results in them being blocked from linking due to bazel's testonly behavior. I guess the options are to "re-implement" the seeded behavior or explore moving these Mechanisms in the differential-privacy repo itself.

Open to thoughts (or just closing as Won't Fix).

chinmayshah99 commented 2 years ago

@dvadym what do you think about this?

dvadym commented 2 years ago

I think this is a good feature to have, it can be definitely useful for some use cases.