feat: Add FedMD (Federated Model Distillation) support #5826
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
feat: Add FedMD (Federated Model Distillation) support
Issue
Description
Currently, Flower supports traditional federated learning approaches like FedAvg, FedProx, etc., but lacks support for Federated Model Distillation (FedMD). FedMD is an important paradigm that enables knowledge sharing through logit distillation on public data, allowing heterogeneous models to learn from each other without sharing raw data or model parameters.
This approach is particularly valuable for:
Related issues/PRs
This is a new feature request. No related issues found, but this addresses the broader need for more diverse federated learning strategies in Flower.
Proposal
Explanation
This PR introduces comprehensive FedMD support to Flower with the following key components:
Core Protocol & Communication:
Tensor,DistillIns,DistillRes,ConsensusIns) for efficient logit exchangeClient-Side Implementation:
FedMDNumPyClient: Extends NumPyClient with logit generation and distillation capabilitiesServer-Side Strategy:
FedMDStrategy: Handles logit collection, aggregation, and consensus buildingComprehensive Example & Validation:
Key Benefits:
Checklist
#contributions)Any other comments?
This implementation follows Flower's established patterns and integrates seamlessly with existing infrastructure. The example demonstrates successful convergence with clear metrics showing client-consensus distance reduction over training rounds.
The code includes comprehensive error handling, detailed logging, and validation tools to ensure FedMD effectiveness. All new components are properly documented and follow Flower's coding standards.
Example Output: