-
Notifications
You must be signed in to change notification settings - Fork 215
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
Task Runner API: Secure Aggregation #1346
base: develop
Are you sure you want to change the base?
Task Runner API: Secure Aggregation #1346
Conversation
Signed-off-by: Pant, Akshay <[email protected]>
Signed-off-by: Pant, Akshay <[email protected]>
… tensor db Signed-off-by: Pant, Akshay <[email protected]>
…allbacks at the component Signed-off-by: Pant, Akshay <[email protected]>
…laborators to handle secure aggregation setup phase Signed-off-by: Pant, Akshay <[email protected]>
…o task-runner-api/secure-aggregation
…o task-runner-api/secure-aggregation
Signed-off-by: Pant, Akshay <[email protected]>
Signed-off-by: Pant, Akshay <[email protected]>
@@ -94,6 +94,7 @@ def run(self): | |||
'tensorboardX', | |||
'protobuf>=4.22,<6.0.0', | |||
'grpcio>=1.56.2,<1.66.0', | |||
'pycryptodome' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we keep this as setup, even when secure aggregation not needed by customer, they need to install it.
@@ -0,0 +1,154 @@ | |||
# Copyright 2020-2025 Intel Corporation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is cryptography package in openfl. Isn't secagg packages more suitable inside cryptography.
Signed-off-by: Pant, Akshay <[email protected]>
Signed-off-by: Pant, Akshay <[email protected]>
Signed-off-by: Pant, Akshay <[email protected]>
…o task-runner-api/secure-aggregation
Signed-off-by: Pant, Akshay <[email protected]>
Signed-off-by: Pant, Akshay <[email protected]>
Signed-off-by: Pant, Akshay <[email protected]>
…o task-runner-api/secure-aggregation
Signed-off-by: Pant, Akshay <[email protected]>
shape (Tuple): Shape of the numpy array to be generated. | ||
|
||
Returns: | ||
np.ndarray: array with pseudo-randomly generated numbers. |
Check notice
Code scanning / Bandit
Standard pseudo-random generators are not suitable for security/cryptographic purposes. Note
Signed-off-by: Pant, Akshay <[email protected]>
""" | ||
super().__init__(batch_size, **kwargs) | ||
|
||
# TODO: We should be downloading the dataset shard into a directory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can remove this comment - refer #1333 (comment)
@@ -168,6 +175,18 @@ def set_available_devices(self, cuda: Tuple[str] = ()): | |||
def run(self): | |||
"""Run the collaborator.""" | |||
# Experiment begin | |||
|
|||
# FIXME: Not working when added to callbacks on line 157. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MasterSkepticista Need your input on this.
@@ -0,0 +1,118 @@ | |||
# Copyright (C) 2020-2021 Intel Corporation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it not possible to refer the original file, if there is no sec_agg specific changes in here?
If not possible, we can change name to utils.py, mnist is already in the path.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have followed the same format as all other workspaces where the funnction definition is in all of them.
Changed file name in 1579c05.
@@ -168,6 +175,18 @@ def set_available_devices(self, cuda: Tuple[str] = ()): | |||
def run(self): | |||
"""Run the collaborator.""" | |||
# Experiment begin | |||
|
|||
# FIXME: Not working when added to callbacks on line 157. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please fix this or remove the comment if no longer required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need input on this. Refer #1346 (comment).
tensor_name = named_tensor.name | ||
# Check if all collaborators have sent their data for the | ||
# current key. | ||
all_collaborators_sent = self.secagg.wait_for_all_collaborators(tensor_name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in case of staggler, will it hang indefinitely?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no wait in this method. Only checks if all collaborators have shared "tensor_name", will rename it appropriately.
Signed-off-by: Pant, Akshay <[email protected]>
…al for agg function Signed-off-by: Pant, Akshay <[email protected]>
Signed-off-by: Pant, Akshay <[email protected]>
@theakshaypant are we are storing keys and cipher text right in persistent storage? |
Introduction
This PR introduces secure aggregation to Task Runner API.
Would specially apprecaite comments on how tensors are exchanged between the participants.
Changes
on_experiment_begin
.CollaboratorSecAgg
callback.openfl.utilities.secagg.Setup
whcih performs "aggregation" of the tensors sent by the collaborators..send_local_task_results
is modfied to save secure aggregation setup stage tensors to aggregator tensor db.SecureAggregation
is used for "metric"s when enabled instead ofWeightedAverage
.secure_aggregation: bool
flag to the plan underaggregator.settings
collaborator.settings
NOTE
Testing
Aggregator logs (with extra debug prints)
![Screenshot 2025-02-11 at 1 52 04 AM](https://private-user-images.githubusercontent.com/16561942/411728697-1a5e9c81-8ae2-43f2-a04e-4c97aa060c21.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0MjQyMDksIm5iZiI6MTczOTQyMzkwOSwicGF0aCI6Ii8xNjU2MTk0Mi80MTE3Mjg2OTctMWE1ZTljODEtOGFlMi00M2YyLWEwNGUtNGM5N2FhMDYwYzIxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEzVDA1MTgyOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTBmZGM5ODRlMWUyNTlkNTllZjQ4NzU1ZDAzOTMwOWIzYTczODVhMDMxMTc5NGRjNzJjYzQ1ZGJkMWJmNGE4MmEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.HV_0K9LnRCZQH0ZYXwhqxLN9bWyHSxxKI2wnWGZj6C0)
Collaborator 1 logs
![Screenshot 2025-02-11 at 1 52 41 AM](https://private-user-images.githubusercontent.com/16561942/411728932-42b5b2ea-fd1f-4cec-8a94-aec842926a2f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0MjQyMDksIm5iZiI6MTczOTQyMzkwOSwicGF0aCI6Ii8xNjU2MTk0Mi80MTE3Mjg5MzItNDJiNWIyZWEtZmQxZi00Y2VjLThhOTQtYWVjODQyOTI2YTJmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEzVDA1MTgyOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTQ3MzcxM2U2NTkxYjFkMmIzYTdmNTk5ZTBlNDU1NmRmNWExMDQxZThjYTA1MGM1ODRkOGEzZGE2NGZmZjc1NTcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.gnpBQggoxyXyAp5uvNgzLhoZqiZj82DNVp-tMjeVbYk)
Collaborator 2 logs
![Screenshot 2025-02-11 at 1 53 02 AM](https://private-user-images.githubusercontent.com/16561942/411729126-22980f59-8348-401c-9a1b-a5cc7582147c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0MjQyMDksIm5iZiI6MTczOTQyMzkwOSwicGF0aCI6Ii8xNjU2MTk0Mi80MTE3MjkxMjYtMjI5ODBmNTktODM0OC00MDFjLTlhMWItYTVjYzc1ODIxNDdjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEzVDA1MTgyOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWMwYzc5NDJhM2I3NmEyMGIzZGMxMmU4NWVmMGZlYjc4OTJmMDRhNTJjMTQ1MWQxMWM5ZTIwODFkMThlMjkzYjImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.tpqevaiO-Ld5Di8OgqgaKPAlGAvZxuOTyQ82TgLfrws)