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

FedPM #197

Merged
merged 36 commits into from
Aug 5, 2024
Merged

FedPM #197

merged 36 commits into from
Aug 5, 2024

Conversation

yc7z
Copy link
Collaborator

@yc7z yc7z commented Jul 23, 2024

PR Type

[Feature]

Short Description

This PR implements the "Federated Probabilistic Mask Training" algorithm described in http://arxiv.org/pdf/2209.15328. An example in the `examples/fedpm_example' folder runs this algorithm on the MNIST dataset, and it reproduces part of the experimental results in the original paper.

On a high level, the implementation consists mainly of the following components:

  1. masked_layers.py: this module uses the linear and convolutional layers provided by PyTorch as a basis to implement masked versions of those layers, which ensures that only probability scores receive gradients.
  2. fedpm.py: this module handles the server-side aggregation. The Bayesian aggregation approach described in the paper is implemented here.
  3. The parameter exchanger part: this part is responsible for selecting the probability scores and then use them to sample binary masks to be sent to the server.

Tests Added

Tests have been added to ensure that the newly added masked layers, parameter exchanger, strategy, and functions work correctly.

@yc7z yc7z requested a review from emersodb July 23, 2024 12:33
…since we moved them to a util rather than a component of BasicClient. Also adding init files.
Copy link
Collaborator

@emersodb emersodb left a comment

Choose a reason for hiding this comment

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

PR and Design look really awesome. Fantastic job on all the tests! I learned some new stuff about PyTorch too. Overall, everything looks pretty close to ready. Just some fairly minimal comments and discussion points.

examples/fedpm_example/server.py Outdated Show resolved Hide resolved
examples/fenda_example/config.yaml Outdated Show resolved Hide resolved
fl4health/clients/fedpm_client.py Outdated Show resolved Hide resolved
fl4health/strategies/fedpm.py Show resolved Hide resolved
fl4health/strategies/fedpm.py Outdated Show resolved Hide resolved
fl4health/model_bases/masked_layers.py Outdated Show resolved Hide resolved
fl4health/model_bases/masked_layers.py Outdated Show resolved Hide resolved
fl4health/model_bases/masked_layers.py Outdated Show resolved Hide resolved
fl4health/model_bases/masked_layers.py Show resolved Hide resolved
fl4health/model_bases/masked_layers.py Outdated Show resolved Hide resolved
@jewelltaylor
Copy link
Collaborator

Thanks for contributing Yuchong ❤️

@yc7z yc7z requested a review from emersodb August 5, 2024 05:57
@emersodb emersodb self-requested a review August 5, 2024 14:48
@emersodb
Copy link
Collaborator

emersodb commented Aug 5, 2024

I think the only minor question left before this is read to go is whether the lock file really needs to change (since no toml updates have happened). Outside of that, this is ready to go!

Copy link
Collaborator

@emersodb emersodb left a comment

Choose a reason for hiding this comment

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

Ready to go!

@yc7z yc7z merged commit 118ab8b into main Aug 5, 2024
6 checks passed
@yc7z yc7z deleted the fedpm branch August 5, 2024 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants