Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replicated Sharing Tensor (RST): secret sharing, reconstruction, and linear operations #3856

Merged
merged 23 commits into from
Aug 6, 2020

Conversation

abogaziah
Copy link
Member

@abogaziah abogaziah commented Jul 13, 2020

Description

This PR will implement the basic operations of the replicative secret sharing scheme in order to be able to implement falcon protocol
for more details: #3852

Checklist

Milestones:

  • Secret sharing
  • Reconstruction
  • Public and private addition / sub

@abogaziah abogaziah requested a review from a team July 13, 2020 17:37
@abogaziah abogaziah changed the title Falcon basic operation [WIP] Falcon Basic Operation (Replicative sharing scheme) Jul 14, 2020
@abogaziah abogaziah changed the title [WIP] Falcon Basic Operation (Replicative sharing scheme) [WIP] Falcon Basic Operation (Replicated sharing scheme) Jul 14, 2020
@gmuraru gmuraru linked an issue Jul 16, 2020 that may be closed by this pull request
@abogaziah abogaziah requested a review from gmuraru July 19, 2020 12:34
@codecov

This comment has been minimized.

@abogaziah abogaziah linked an issue Jul 19, 2020 that may be closed by this pull request
3 tasks
@gmuraru gmuraru added this to the Falcon Implementation milestone Jul 23, 2020
@gmuraru
Copy link
Member

gmuraru commented Jul 26, 2020

@abogaziah I removed some points from this task and created other issues for each one individually.
They can be seen in the FALCON Milestone

This was unlinked from issues Aug 2, 2020
@abogaziah abogaziah changed the title [WIP] Falcon Basic Operation (Replicated sharing scheme) Replicated Sharing Tensor (RST): secret sharing, reconstruction, and linear operations Aug 2, 2020
@abogaziah abogaziah added Status: Completed ✔️ Finished with all expected deliverables Status: Review Needed 🙋 This needs someone to approve, deny, comment, or request changes labels Aug 2, 2020
@abogaziah abogaziah marked this pull request as ready for review August 2, 2020 11:48
@@ -909,6 +909,11 @@ def share(
requires_grad (bool): Should we add AutogradTensor to allow gradient computation,
default is False.
"""
if protocol == "falcon":
shared_tensor = syft.ReplicatedSharingTensor(owner=self.owner).share_secret(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: I am thinking if we can keep a dict for those.
Like:

  "falcon": syft.ReplicatedSharingTensor,
  "snn"    : syft.AdditiveSharingTensor
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what would be the use-case of that dict? I don't get it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dict are better to dynamically add options if needed, and are faster to access instead of if / else-ing on all optiosn

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@abogaziah are you making the changes in this PR or we can create a subsequent ticket to do the changes in another issue (we can also mark it as good first issue :D)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it needs to be done later, because sharing doesn't work the same way in both cases for now, (AST is more complex) maybe we should do that after refactoring AST

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good! There is also some refacto going on in the AST file in #3924 :)

@abogaziah abogaziah requested a review from gmuraru August 3, 2020 10:55
workers = [syft.hook.local_worker] + workers
return workers

def generate_shares(self, plain_text, number_of_shares=3):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend taking example on

def generate_shares(self, secret, n_workers, random_type):

i.e. remove the noise you've added to the next share instead of removing the sum of all on the last share

Copy link
Member Author

@abogaziah abogaziah Aug 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LaRiffle What is the difference? in other words, why would you choose this over that?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ping @LaRiffle

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did, I'm looking at how crypten handles it

@gmuraru
Copy link
Member

gmuraru commented Aug 4, 2020

I think it looks great as a first PR that enables us to use RSS.
What I think we should implement more is - have the possibility to do operations using "+", "-", etc (I do not know if that is possible for the moment) - There might be needed some @overloaded work

@abogaziah
Copy link
Member Author

@gmuraru done :)

Copy link
Member

@gmuraru gmuraru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good for me! Probably we will end up iterating over this code, but I think that is perfect!

@abogaziah abogaziah merged commit 00a524c into OpenMined:master Aug 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Completed ✔️ Finished with all expected deliverables Status: Review Needed 🙋 This needs someone to approve, deny, comment, or request changes
Projects
None yet
3 participants