yuxiangw / autodp

autodp: A flexible and easy-to-use package for differential privacy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pure Fdp gaussian mechanism doesn't work under composition of multiple rounds

AHabes opened this issue · comments

Computing the get_fDP(delta) for a gaussian mechanism with pure Fdp works fine, but trying to compose the pure-fdp gaussian mechanism for several rounds, the function get_approxDP(delta) always returns inf as the result of composition.

Fdp seems not to work under Composition or AmplificationBySampling

def compute_amplified_fl_privacy(num_rounds=60, noise_multiplier=20, num_users=500, users_per_round=100):
    gm1 = GaussianMechanism(sigma=noise_multiplier, RDP_off=True, approxDP_off=True, fdp_off=False)

    compose = Composition()
    num_rounds = [num_rounds]
    q = users_per_round / num_users
    delta = num_users ** (-1)

    composed_fdp = compose([gm1], num_rounds)

    composed_fdp_eps = composed_fdp.get_fDP(delta)
    composed_fdp_approxdp = composed_fdp.get_approxDP(delta)

    mechanism_fdp_eps = gm1.get_fDP(delta)
    mechanism_fdp_approxdp = gm1.get_approxDP(delta)
    print('---------------------------------------------------')
    print('composed fdp eps = ', composed_fdp_eps, ', at delta = ', delta)
    print('composed fdp eps_approxdp = ', composed_fdp_approxdp, ', at delta = ', delta)

    print('mechanism fdp eps = ', mechanism_fdp_eps, ', at delta = ', delta)
    print('mechanism fdp approxdp = ', mechanism_fdp_approxdp, ', at delta = ', delta)


def main():
    compute_amplified_fl_privacy(num_rounds=60, noise_multiplier=20, num_users=500, users_per_round=100)


if __name__ == '__main__':
    main()
    print('DONE')



Thanks for trying it out!

transformer_zoo.Composition uses RDP for composition by default.

At the moment, our partial support of fDP does not allow generic conversion of fDP to RDP yet. That is the reason you got that error. Similarly privacy amplification by sampling using fDP is not implemented yet either.

More fDP support will be added in the next version.

For your application, it seems that the best choice supported by autodp would be to use ExactGaussianMechanism, AmplificationBySampling and Composition.

If you do not have amplification though, you could get away with using transformer_zoo.ComposeGaussian