Coder Social home page Coder Social logo

thomashopkins32 / dpsgd-optimizer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from thecml/dpsgd-optimizer

0.0 0.0 0.0 7.36 MB

Amortized version of the differentially private SGD algorithm published in "Deep Learning with Differential Privacy" by Abadi et al. Enforces privacy by clipping and sanitising the gradients with Gaussian noise during training.

License: MIT License

Python 100.00%

dpsgd-optimizer's Introduction

Differentially Private Stochastic Gradient Descent

This is an implementation of the differentially private SGD optimizer described in the Deep Learning with Differential Privacy paper using a Gaussian sanitizer to sanitize gradients and a amortized momemnts accountant to keep track of used privacy. Very useful for deep learning projects that require some level of privacy guarantee during training. The AmortizedGaussianSanitizer sanitizes gradients with Gaussian noise in an amoritzed way. AmortizedAccountant accumulates the privacy spending by assuming all the examples are processed uniformly at random, so the spending is amortized among all the examples. Implementation is done in Tensorflow 2.3.

Note: The scripts will be slow without CUDA enabled.

Requirements

python >= 3.6

Results

MNIST

Results are shown in Table 1 and Table 2, with the parameters eps=1.0, delta=1e-7, target_eps=16. For DENSE network, we used a max_eps=16 and max_delta=1e-3. For CNN network, we used max_eps=64, max_delta=1e-3.

Table 1. results of 100 epochs training with the learning rate of 0.01

Model Train acc. Valid acc. Test acc. Eps used Delta used Training time
DPSGD-DENSE 47.14% 47.37% 48.89% 13.99 0.00036839 14M 52S
DPSGD-CNN 67.35% 67.68% 71.06% 2.29 0.00012746 52M 15S

Table 2. results of 200 epochs training with the learning rate of 0.01

Model Train acc. Valid acc. Test acc. Eps used Delta used Training time
DPSGD-DENSE 47.93% 48.11% 49.14% 19.79 0.00073558 28M 48S
DPSGD-CNN 73.97% 74.22% 76.83% 3.23 0.00024880 1H 46M

The accuracy for DPSGD-CNN on MNIST for 200 epochs:

The loss for DPSGD-CNN on MNIST for 200 epochs:

Acknowledgements

Acknowledgements given to marcotcr.

References

Martín Abadi, Andy Chu, Ian Goodfellow, H. Brendan McMahan, Ilya Mironov, Kunal Talwar, Li Zhang. Deep Learning with Differential Privacy. Proceedings of the 2016 ACM SIGSAC Conference on Computer and Communications Security (ACM CCS), pp. 308-318, 2016.

dpsgd-optimizer's People

Contributors

thecml avatar thomashopkins32 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.