FedBABUPersonalization<T>
Models & Types · AiDotNet.FederatedLearning.Personalization
Implements FedBABU (Body And Bottom Update) personalization strategy.
Inheritance: FederatedLearningComponentBase<T> → FedBABUPersonalization<T>
For Beginners
FedBABU takes a deliberately simple approach to personalization: during federated training, only the model body (feature extractor) is trained and aggregated, while the classification head is frozen at random initialization. After FL converges, each client locally fine-tunes just the head on their own data. This works surprisingly well because a good feature extractor transfers across clients, and a few local epochs on the head are enough for personalization.
How It Works
Algorithm:
Reference: Oh, J., et al. (2022). “FedBABU: Toward Enhanced Representation for Federated Image Classification.” ICLR 2022.
Constructors
| Constructor | Summary |
|---|---|
FedBABUPersonalization(double headFraction, int localFineTuneEpochs) |
Creates a new FedBABU personalization strategy. |
Properties
| Property | Summary |
|---|---|
double HeadFraction { get; } |
Gets the head fraction. |
int LocalFineTuneEpochs { get; } |
Gets the local fine-tuning epochs. |
Methods
| Method | Summary |
|---|---|
Dictionary<string, T[]> ExtractBody(Dictionary<string, T[]> fullParameters) |
Extracts the body parameters (shared/aggregated) from the full model. |
Dictionary<string, T[]> ExtractHead(Dictionary<string, T[]> fullParameters) |
Extracts the head parameters (frozen during FL, fine-tuned locally after convergence). |
Dictionary<string, T[]> InitializeRandomHead(Dictionary<string, T[]> headParams, int seed) |
Initializes the classification head with random values (Kaiming uniform initialization). |
Dictionary<string, T[]> MaskHeadGradients(Dictionary<string, T[]> gradients) |
Applies a gradient mask that zeros out head gradients during FL body training. |
Dictionary<string, T[]> MergeBodyAndHead(Dictionary<string, T[]> aggregatedBody, Dictionary<string, T[]> localHead) |
Merges aggregated body with local head parameters. |