Coder Social home page Coder Social logo

flamingo's Introduction

Flamingo

Flamingo is a system built for privacy-preserving federated learning, where individual training weights are aggregated using secure aggregation. This implementation accompanies our paper by Yiping Ma, Jess Woods, Sebastian Angel, Antigoni Polychroniadou and Tal Rabin at IEEE S&P (Oakland) 2023.

WARNING: This is an academic proof-of-concept prototype and is not production-ready.

Overview

We integrate our code into ABIDES, an open-source highfidelity simulator designed for AI research in financial markets (e.g., stock exchanges). The simulator supports tens of thousands of clients interacting with a server to facilitate transactions (and in our case to compute sums). It also supports configurable pairwise network latencies.

Flamingo protocol works by steps (i.e., round trips). A step includes waiting and processing messages. The waiting time is set according to the network latency distribution and a target dropout rate. See more details in Section 8 in our paper.

The main branch contains the code for private sum protocol and the fedlearn branch contains the code for private training of machine learning models.

Installation Instructions

We recommend using Miniconda to set up environment. You can donwload Miniconda by the following command:

wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh

To install Miniconda, run

bash Miniconda3-latest-Linux-x86_64.sh

If you use bash, then run

source ~/.bashrc

Now create an environment with python 3.9.12 and then activate it.

conda create --name flamingo-v0 python=3.9.12
conda activate flamingo-v0

Use pip to install required packages.

pip install -r requirements.txt

Private Sum

The code is in branch main.

First enter into folder pki_files, and run

python setup_pki.py

Our program has multiple configs.

-c [protocol name] 
-n [number of clients (power of 2)]
-i [number of iterations] 
-p [parallel or not] 
-o [neighborhood size (multiplicative factor of 2logn)] 
-d [debug mode, if True then output info for every agent]

Flamingo supports batches of clients with size power of 2, starting from 128, e.g., 128, 256, 512.

Example command:

python abides.py -c flamingo -n 128 -i 1 -p 1 

If you want to print out information of every agent, add -d True to the above command.

NOTE: For ease of benchmarking, we separate the setup phase (folder dkg) and the private sum phase (folder flamingo). You can execute the command above directly as we provide the shares of the secret key to decryptors (a small random subset of clients) before the summation begins. If you wish to benchmark the setup independently, run python abides.py -c dkg -n [number of decryptors].

Machine Learning Applications

The code is in branch fedlearn. The machine learning model is a basic multi-layer perceptron classifier that can pull a variety of different datasets from the pmlb website. Users might wish to implement more complex models themselves.

Beyond the aforementioned configs, we provide machine learning training configs below.

-t [dataset name]
-s [random seed (optional)]
-e [input vector length]
-x [float-as-int encoding constant (optional)]
-y [float-as-int multiplier (optional)]

Example command:

python abides.py -c flamingo -n 128 -i 5 -p 1 -t mnist 

Additional Information

The server waiting time is set in util/param.py according to a target dropout rate (1%). Specifically, for a target dropout rate, we set the waiting time according to the network latency (see model/LatencyModel.py). For each iteration, server total time = server waiting time + server computation time.

Acknowledgement

We thank authors of MicroFedML for providing an example template of ABIDES framework.

flamingo's People

Contributors

yiping106283 avatar dependabot[bot] 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.