alibaba / FederatedScope

An easy-to-use federated learning platform
https://www.federatedscope.io
Apache License 2.0
1.26k stars 206 forks source link

some question about secret sharing #735

Closed tntstation closed 8 months ago

tntstation commented 8 months ago

would like to make some modifications to the secret sharing. Currently, it seems that secret sharing involves exchanging frames between all clients. However, I would like clients to be divided into multiple groups, and clients within each group can exchange frames with each other. Can you give me some suggestions?

qbc2016 commented 8 months ago

Hello, we use an (n, n)-secret sharing scheme, that is, a secret value is partitioned into n pieces. The value can be recovered if and only if one holds all n pieces. For example, if a client has a secret value $s$, he partitions it into $[s_1, s_2, \ldots, s_n]$, and sends $s_i$ to client$_i$. See here. In my opinion, if you want the clients to exchange their frames within a small group, it may be convenient to maintain a list containing the neighbors among the group, and then send it in a similar way. I'm not sure if this has addressed your question.

tntstation commented 8 months ago

Thank you for your answer. I still have some questions about secret sharing. image In this section of the code in sever.py, the AdditiveSecretSharing class sets shared_party_num to int(self._cfg.federate.sample_client_num). However, use_ss is only set to true when all clients participate, so sample_client_num will be -1. image I'm confused because in secret_sharing.py, shared_party_num is required to be greater than -1. I'm not sure where I'm misunderstanding.

qbc2016 commented 8 months ago

"However, use_ss is only set to true when all clients participate, so sample_client_num will be -1." This is not true. When use ss, we assert that cfg.federate.client_num == cfg.federate.sample_client_num , see here

tntstation commented 8 months ago

thank you,it is really helpful for me