simran-arora / focus

This repo contains code for the paper: "Can Foundation Models Help Us Achieve Perfect Secrecy?"

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can Foundation Models Help Us Achieve Perfect Secrecy? A simple baseline for personal & private ML.

This repository explores the baseline of using in-context learning for personal & private machine learning! We include scripts to download data and evaluate foundation models of various sizes and types across popular personal machine learning benchmarks from the privacy literature. Additional information can be found in the paper: https://arxiv.org/abs/2205.13722. Contributions of additional benchmarks and baselines are welcome in the form of PRs to the benchmarks folder and additions of a data loader. Exciting future questions:

  • Do we see further personalization with more in-context examples and longer contexts?
  • Can we understand the limits of this baseline in a more principled manner? Are the tasks we've evaluated on so far too similar to the pretraining distribution? Maybe we should construct new privacy benchmarks!
  • Can we enable better in-context learning quality in smaller & open-source models? (Checkout recent work: Ask Me Anything)
  • Other ways of using the FMs -- is it better to generate synthetic data with the FMs and then train locally?

Setup

Use the following commands to clone and install this package. We highly recommend you use conda environments.

# environment
conda create -n py37 python=3.7
conda activate py37

# installations
git clone git@github.com:simran-arora/focus.git
cd focus
pip install -e .
pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu113

cd benchmarks/leaf
git submodule init
git submodule update

If you want to run inference with the API models, first obtain your OpenAI inference API key here OpenAI API. Then set the environment variables:

export OPENAI_API_KEY="<YOUR API KEY>"

Obtain the datasets

Download benchmark datasets to the ``focus/benchmarks/'' directory

cd benchmarks/
bash download_data.sh

The LEAF Federated Learning benchmark suite provides: Sent140, Reddit, FEMNIST, and CELEB-A. The FedNLP suite provides 20News and MRQA. The FedML suite provides CIFAR-10.

Run the code

The focus/scripts/ directory provides scripts to run experiments for each benchmark.

For example:

bash scripts/cifar.sh
bash scripts/sent140.sh

We include examples for running inference with the API in the script files. Note that this requires providing the openai_key command line argument.

Citation

Please use the following Bibtex for this work:

@misc{arora2022focus,
      title={Can Foundation Models Help Us Achieve Perfect Secrecy?}, 
      author={Simran Arora and Christopher Ré},
      year={2022},
      url={https://arxiv.org/abs/2205.13722},
      journal={The Fourth AAAI Workshop on Privacy-Preserving Artificial Intelligence (PPAI)},
      primaryClass={cs.LG}
}

We welcome contributions and feel free to reach out at simarora@stanford.edu.

About

This repo contains code for the paper: "Can Foundation Models Help Us Achieve Perfect Secrecy?"


Languages

Language:Python 94.1%Language:Shell 5.9%