Giter Club home page Giter Club logo

adadps's Introduction

Private Adaptive Optimization with Side Information

This repository contains the code and experiments for the paper (ICML'22):

Private Adaptive Optimization with Side Information

Adaptive optimization methods have become the default solvers for many machine learning tasks. Unfortunately, the benefits of adaptivity may degrade when training with differential privacy, as the noise added to ensure privacy reduces the effectiveness of the adaptive preconditioner. To this end, we propose AdaDPS, a general framework that uses non-sensitive side information to precondition the gradients, allowing the effective use of adaptive methods in private settings. We formally show AdaDPS reduces the amount of noise needed to achieve similar privacy guarantees, thereby improving optimization performance. Empirically, we leverage simple and readily available side information to explore the performance of AdaDPS in practice, comparing to strong baselines in both centralized and federated settings. Our results show that AdaDPS improves accuracy by 7.7% (absolute) on average—yielding state-of-the-art privacy-utility trade-offs on large-scale text and image benchmarks.

Prepare Datasets

  • MNIST with autoencoder: under the folder AE/, the code will automatically download MNIST

  • IMDB

    • Download the data in this Google Drive link, unzip it
    • logistic regression with BoW features: put imdb_10000d_train_bow.npz and imdb_10000d_test_bow.npz under imdb/data/
    • LSTM with raw feature: put imdb_10000d_test.npz and imdb_10000d_train.npz under imdb/data
  • StackOverflow (federated dataset)

cd federated/data/stackoverflow
mkdir data/test/test_np
mkdir data/train/train_np
python create_data.py
python preprocess.py 
  • StackOverflow (centralized dataset)
cd stackoverflow_centralized/
python generate_data.py

Usage

Each dataset has a separate folder. Under each folder, the algorithms are implemented under trainers for centralized training, or flearn/trainers for the federated learning application. File names indicate method names. AdaDPS is implemented in SGD or DP-SGD with the options use_public or scale on, specified in run.sh. We provide some concrete examples of running the linear regression toy problem or IMDB below.

Running Examples

  • linear regression toy problem (Figure 3 in the paper)
cd toy
python3 main.py --method sgd --scale 0 --lr 0.03  --iters 40000 --eval_every_iter 1000 # SGD
python3 main.py --method sgd --scale 1 --lr 0.003 --iters 40000 --eval_every_iter 1000 # AdaS
python3 main.py --method dp-sgd --scale 0 --clipping_bound 0.5 --lr 0.1 --sigma 0.7 --iters 2250 # DP-SGD
python3 main.py --method dp-sgd --scale 1 --clipping_bound 0.5 --lr 0.2 --sigma 0.7 --iters 2250 # AdaDPS
  • IMDB (BoW)

    • Prepare data as described previously, and put the four files under imdb/data
    • Run
     bash run1.sh # DP-SGD 
     bash run2.sh # AdaDPS w/ public data
    

See hyperparameter tuning and their values reported in the manuscript (Appendix B).

adadps's People

Contributors

litian96 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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.