FLAIR-THU / VFLAIR

THU-AIR Vertical Federated Learning general, extensible and light-weight framework
68 stars 18 forks source link

Paillier-Neural Network #7

Closed Koukyosyumei closed 7 months ago

Koukyosyumei commented 7 months ago

The current implementation has the following limitations:

Specifically, the current implementation adopts the following protocol. Let a data sample $x$ is vertically partitioned to $(x_0, x_1, x2, ..., x{n-1})$ across $n$ parties. The $0$-th party (active party) has the ground truth $y$.

  1. $k$-th passive party ($k = 1, 2, ..., n-1$) encrypts and sends $o_k = f_k(x_k)$ to the active party.
  2. The active party averages the encrypted predictions and constructs the final predictions $[[\hat{y}]] = \frac{1}{n} (o0 + (\sum{k=1} [[o_k]]))$.
  3. The active party calculates the loss gradient w.r.t the output of each local model. For example, if the loss is MSE, $\frac{\nabla \ell}{\nabla o_k} \sim (y - o_k)$.
  4. The active party sends the encrypted gradient to passive parties. Passive parties decrypt the gradient and backward it to update the local models.

Demo

 python3 main_paillier.py --config main/mnist_test_paillier
LindaLydia commented 7 months ago

PR version1