Git Product home page Git Product logo

deep-learning-with-gdp-pytorch's Introduction

What is this?

This project contains scripts to reproduce experiments from the paper Deep Learning with Gaussian Differential Privacy by Zhiqi Bu, Jinshuo Dong, Weijie Su and Qi Long.

The Problem of Interest

Deep learning models are often trained on datasets that contain sensitive information such as individuals' shopping transactions, personal contacts, and medical records. Many differential privacy definitions arise for the study of trade-off between models' performance and privacy guarantees. We consider a recently proposed privacy definition termed f-differential privacy (https://arxiv.org/abs/1905.02383) for a refined privacy analysis of training neural networks. Using GDP instead of (epsilon,delta)-DP, we can get much better privacy guarantee and alternatively, trade off some privacy for better accuracy.

Description of Files

You need to install Pytorch privacy package pytorch-dp to run the following codes. This can be done easily by

pip install pytorch-dp

However, for latest version of Pytorch privacy package opacus, you should do

pip install opacus

Tutorial to Start

---------------- Update on 2021/4/28-----------------

I write a new notebook for tutorial of training deep neural network with Gaussian differential privacy. This works under the Opacus package, which merged the old pytorch-dp and is different from Tensorflow Privacy package in many ways.

Two datasets:

mnist.py: private CNN on MNIST

adult.py: private FFNN on Adult data

Note that the Embedding Layer can be used in private training in Tensorflow but not in Pytorch.

Privacy Accountants

gdp_accountant.py computes the moments accountant (MA), central limit theorem (CLT) and dual relation (Dual) between \delta,\epsilon,\mu. This computation does not have any TensorFlow dependencies and is data-independent, and thus is extremely fast.

For example, if you run MNIST dataset (60,000 samples) for 15 epochs, batch size 256, noise level 1.3 and \delta 1e-5, then your \epsilon is

By Moments Accountant:

compute_epsilon(15,1.3,60000,256,1e-5)=1.1912

%% this has been improved by Tensorflow-privacy using new Moments Accountant to epsilon = 0.9545.

By GDP CLT (Uniform subsampling):

compute_epsU(15,1.3,60000,256,1e-5)=1.0685

By GDP CLT (Poisson subsampling):

compute_epsP(15,1.3,60000,256,1e-5)=0.8345

For example, MNIST in Figure 4 of our paper shows that our GDP CLT is both more accurate and more private then existing MA method. mnist GDP

deep-learning-with-gdp-pytorch's People

Contributors

woodyx218 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.