Xin Pan 107e72cc78 Add differential privacy training. 9 rokov pred
..
dp_mnist 107e72cc78 Add differential privacy training. 9 rokov pred
dp_optimizer 107e72cc78 Add differential privacy training. 9 rokov pred
per_example_gradients 107e72cc78 Add differential privacy training. 9 rokov pred
README.md 107e72cc78 Add differential privacy training. 9 rokov pred
__init__.py 107e72cc78 Add differential privacy training. 9 rokov pred

README.md

Deep Learning with Differential Privacy

Authors: Martín Abadi, Andy Chu, Ian Goodfellow, H. Brendan McMahan, Ilya Mironov, Kunal Talwar, Li Zhang

Open Sourced By: Xin Pan (xpan@google.com, github: panyx0718)

Machine learning techniques based on neural networks are achieving remarkable results in a wide variety of domains. Often, the training of models requires large, representative datasets, which may be crowdsourced and contain sensitive information. The models should not expose private information in these datasets. Addressing this goal, we develop new algorithmic techniques for learning and a refined analysis of privacy costs within the framework of differential privacy. Our implementation and experiments demonstrate that we can train deep neural networks with non-convex objectives, under a modest privacy budget, and at a manageable cost in software complexity, training efficiency, and model quality.

paper: https://arxiv.org/abs/1607.00133

Requirements:

  1. Tensorflow 0.10.0 (master branch)

Note: r0.11 might experience some problems

  1. Bazel 0.3.1

  2. Download MNIST data

TODO(xpan): Complete the link: train test

Alternatively, download the tfrecord format MNIST from: https://github.com/panyx0718/models/tree/master/slim

How to run:

# Clone the codes under differential_privacy.
# Create an empty WORKSPACE file.
# Download the data to the data/ directory.
ls -R
.:
data  differential_privacy  WORKSPACE

./data:
mnist_test.tfrecord  mnist_train.tfrecord

./differential_privacy:
dp_mnist  dp_optimizer  __init__.py  per_example_gradients  README.md

./differential_privacy/dp_mnist:
BUILD  dp_mnist.py

./differential_privacy/dp_optimizer:
accountant.py  BUILD  dp_optimizer.py  dp_pca.py  sanitizer.py  utils.py

./differential_privacy/per_example_gradients:
BUILD  __init__.py  per_example_gradients.py

# Build the codes.
bazel build -c opt differential_privacy/...

# Run the mnist differntial privacy training codes.
bazel-bin/differential_privacy/dp_mnist/dp_mnist \
    --training_data_path=data/mnist_train.tfrecord \
    --eval_data_path=data/mnist_test.tfrecord \
    --save_path=/tmp/mnist_dir

...
step: 1
step: 2
...
step: 9
spent privacy: eps 0.1250 delta 0.72709
spent privacy: eps 0.2500 delta 0.24708
spent privacy: eps 0.5000 delta 0.0029139
spent privacy: eps 1.0000 delta 6.494e-10
spent privacy: eps 2.0000 delta 8.2242e-24
spent privacy: eps 4.0000 delta 1.319e-51
spent privacy: eps 8.0000 delta 3.3927e-107
train_accuracy: 0.53
eval_accuracy: 0.53
...

ls /tmp/mnist_dir/
checkpoint  ckpt  ckpt.meta  results-0.json