Giter Site home page Giter Site logo

samuelgong / flashe Goto Github PK

View Code? Open in Web Editor NEW
17.0 3.0 6.0 235.44 MB

[arXiv'21] Additively Symmetric Homomorphic Encryption for Cross-Silo Federated Learning

License: Apache License 2.0

Python 57.48% Shell 6.32% Java 34.11% Jupyter Notebook 2.09%
federated-learning homomorphic-encryption cross-silo

flashe's Introduction

FLASHE

This repository contains scripts and instructions for reproducing the experiments in our arXiv '21 paper FLASHE. FLASHE is integrated as a pluggable module in FATE v1.2.0, an open-source industrial platform crafted by WeBank for cross-silo federated learning. You may want to use commands like git diff to see what have been changed since the fork (i.e., the first commit).

Overview

Run Experiments and Validate Results

The output of the experiment will validate the following major claims in our background part (section 2 in paper) and evaluation part (section 6 in paper):

Cluster Deployment

  1. FLASHE outperforms batching versions of the three baselines by 3.2×-15.1× in iteration time and 2.1×-42.4× in network footprint. Compared to plaintext training, FLASHE achieves near-optimality efficiency with overhead ≤6% and 0% in traffic (§6.2) —> Figure 7 and 8.
  2. FLASHE brings down at least 13×-63× of the computation overhead and 48× of the communication overhead of general HEs when sparsification is employed (§6.4) —> Figure 10 and 11.
  3. FLASHE's mask precomputation effectively eliminates the cryptographic overhead (rendering it < 0.1s) (§6.6) —> Figure 13.

Local Simulation and Projection

  1. The enormous performance of general HE schemes like Paillier, FV, and CKKS raises significant efficiency and scalability concerns. Even with the aid of batch encryption, the message inflation factor remains suboptimal (§2.2 and §2.3) —> Table 2.
  2. FLASHE exhibits near-optimality when it comes to economic cost (≤5%). Compared with batching versions of the baselines, the savings are significant (up to 73%-94%) (§6.3) —> Figure 9 and Table 4.
  3. FLASHE's double masking scheme achieves optimal latency when the client dropout is mild (§6.5) —> Figure 12.

Cluster Deployment

Please go to ./deployment directory and follow the deployment README to run related scripts.

Local Simulation and Projection

Please go to ./simulation directory and follow the simulation README to run related scripts.

Repo Structure

Repo Root
|---- arch                  # (FATE internal)
|---- cluster-deploy        # (FATE internal)
|---- examples              # Example datasets and configurations of FLASHE
|---- deployment            # Procedures for deploying and evaluating FLASHE
|---- fate_flow             # (FATE internal)
|---- federatedml           # (FATE internal)
|---- simulation            # Procedures related to simulation in FLASHE
|---- utils                 # Tools helpful for playing with FATE/FLASHE
|---- eggroll               # (FATE generated)
|---- fate-flow             # (FATE generated)

Notes

Please consider to cite our paper if you use the code or data in your research project.

@inproceedings{FLASHE-arxiv21,
  title={FLASHE: Additively Symmetric Homomorphic Encryption for Cross-Silo Federated Learning},
  author={Zhifeng Jiang and Wei Wang and Yang Liu},
  booktitle={arXiv:2109.00675},
  year={2021}
}

Recent activity Time period

Timeline graph Issue status graph Pull request status graph Activity map

Acknowledgement

Thanks to Chengliang Zhang and Junzhe Xia for their engineering advice regarding FATE. Thanks to Minchen Yu for his suggestions on development automation.

Contact

Zhifeng Jiang ([email protected])

flashe's People

Contributors

samuelgong avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

flashe's Issues

about generate data

您好,在我运行您的代码是,当生成数据是负数的时候,最后的结果是错的
e.g. 我只是简单的将生成的random数,变成了负数
’plaintext = np.random.random(plaintext_length) - 2
最后的结果就不正确了。
image

加密算法部分

打扰到您了,请问加密算法是否采用的是AES算法呢?如果是用的AES,可是AES算法应该不是同态的吧。

issue about “element_bits,int_bits,additional_bits"

您好,作者!
很抱歉又一次打扰到您.
在您的代码中:https://github.com/SamuelGong/FLASHE/blob/master/encrypt_test/final_big_table.ipynb 请问element_bits,int_bits,additional_bits分别代表什么? 对这些位数的设置有要求吗?
以及在https://github.com/SamuelGong/FLASHE/blob/master/federatedml/secureprotol/jzf_quantize.py 中 关于 batch_size = int_bits // element_bits 这个又是怎么去理解呢?
期待您的回复!

issue about "jzf_flashe.py"

您好,作者!

issue 1

请问下面这个function的目的是什么?

def chunks_idx(l, n):

issue 2

在下面这个文件中的line 24-26,meaning of the variables

issue 3

请问如果要将您的这个方案应用至deep Learning中,在每个epoch完成后,需要重新设置这两个吗?

flashe.set_iter_index(epoch)
flashe.idx = 0

劳烦,作者回答上述的3个issue。
如果我有表达不清楚的地方,请您指出,谢谢您!

能否给出不同的明文在同态加密后计算的接口

您好,由于FATE太过庞大,我想在单台计算机上复现您的论文的隐私保护方案。但是在您的final_big_table.ipynb给出的示例代码中的“Addition”步骤计算的是ciphertext_list = [ciphertext] * num_clients,即num_client个ciphertext求和,这里的ciphertext是相同的,而没有给出不同的ciphertext进行求和的接口。请问能否给出不同的明文在同态加密后计算的接口呢,即一个像ckks.sum()那样通用的接口。

如果可能的话麻烦添加以下内容的演示:
存在两个等长的不同向量A,B,A, B中的元素为[-1, 1]之间的小数

  1. 利用flashe加密A, B,得到A_e, B_e;
  2. 演示您的同态加密方案可以在密文状态下进行的不同的计算,如A_e+B_e, A_e-B_e, A_e dot B_e......;
  3. 解密第二步的计算结果,并与明文状态下的计算结果进行比较。

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.