-
Notifications
You must be signed in to change notification settings - Fork 42
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
Add support for stateful clients #289
Comments
Thanks for using FedJAX and filing this issue! Can you please give an example of what you would like to store as part of client states and give the link to the TensorflowFederated example that you are interested in. |
I would like the clients to store local model parameters which are used during training but are not send to the server. This would be usefull to implement personalisation strategies such as Federated Learning with Personalization Layers or Adaptive Personalized Federated Learning. The TensorflowFederated example can be found here: https://github.com/tensorflow/federated/tree/main/tensorflow_federated/examples/stateful_clients. |
We just checked in an example of federated averaging with stateful clients. Similar to the example you linked, it keeps track of number of steps per client across rounds. Some important notes about this example:
|
Thank you for adding the example. I'll try to implement the two personalized federating learning algorithms using this as a template. Would these algorithms be of interested as potential contributions to the fedjax library? |
Thanks for offering to contribute! We are happy to accept contributions on published algorithms. For any algorithm, please consider adding relevant tests and experimental scripts to reproduce numbers on at least one dataset e.g., https://github.com/google/fedjax/blob/main/experiments/fed_avg/run_fed_avg.py |
I am happy to contribute. I have already implemented the algorithms and written test analogous to the ones for Federated Averaging. Unfortunately, writing the experimental scripts will require a few more changes, e.g. in https://github.com/google/fedjax/blob/main/fedjax/training/federated_experiment.py. The evaluation of the personalised models can only be performed per client, in contrast to Federated Averaging which can be evaluated using a single centralised model. I can also offer my contribution here, but this might be better solved on a separate pull request. |
Rather than modify fedjax.training.federated_experiment, I would suggest writing your own experiment loop since your experiment set up is pretty unique and federated_experiment is pretty straightforward. You should be able to reuse a lot of the underlying modules like fedjax.core.client_samplers and fedjax.training.checkpoint. You could start by just adding a directory fedjax/experiments/YOUR_ALGO and putting your experiment scripts there for at least one dataset. But I do think that should be added along with the algo implementation so we can verify it trains properly and reproduces paper results etc. |
I opened a pull request #297 for the Adaptive Personalized Federated Learning Algorithm. I could add the other algorithm in a similar fashion after getting your feedback on this PR. |
At this moment I don't see how to implement a
fedjax.FederatedAlgorithm
with stateful clients. Which would be necessary to implement personalised federated algorithms. It would be great to include an example similar to the one e.g. in TensorflowFederated.The text was updated successfully, but these errors were encountered: