Git Product home page Git Product logo

mpcformer's Introduction

MPCFormer: fast, performant, and private transformer inference with MPC.

Paper | Usage | Citation | Video |

This repository contains the official code for our ICLR 2023 spotlight paper MPCFormer: fast, performant, and private transformer inference with MPC. We design MPCFormer to protect users' data privacy by using Secure Multiparty Computation(MPC). It also meets other real-world requirements:

  • inference latency: by replacing bottleneck functions by their MPC-friendly ones.
  • ML performance: by introducing a subsequent Knowledge-Distillation(KD) procedure.

Performance

It achieves 5.26x speedup for Bert-Base MPC inference, while preserving a similar ML accuracy. More comprehensive results such as on Bert-Large, Roberta, can be found in the paper.

Usage

To install necessary packages, install the transformer directory in editor mode:

git clone https://github.com/MccRee177/MPCFormer
cd MPCFormer/transformers
pip install -e .

Step 1: Obtain a teacher Transformer model by fine-tuning on downstream tasks Here

We support GLUE and Imdb, other datasets can be easily supported via the ransformers library.

Step 2: perform approximation and distillation of MPCFormer Here.

(Optional) evaluate baselines in the paper Here.

(Optional) Benchmark the inference time of approximated model: Here.

Citation

If you find this repository useful, please cite our paper using

@article{li2022mpcformer,
  title={MPCFormer: fast, performant and private Transformer inference with MPC},
  author={Li, Dacheng and Shao, Rulin and Wang, Hongyi and Guo, Han and Xing, Eric P and Zhang, Hao},
  journal={arXiv preprint arXiv:2211.01452},
  year={2022}
}

mpcformer's People

Contributors

dachengli1 avatar rulinshao 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.