PFedGatePersonalization<T>

Models & Types · AiDotNet.FederatedLearning.Personalization

Implements pFedGate — gated layer-wise mixture of local and global parameters.

Inheritance: FederatedLearningComponentBase<T> → PFedGatePersonalization<T>

For Beginners

pFedGate learns a small “gate” per layer that decides how much to use the global model vs. the client’s local model for that layer. Gates are numbers between 0 and 1: gate=0 means “use fully global” and gate=1 means “use fully local.” Each client learns different gate values based on their data distribution. The gates are lightweight (one scalar per layer) and personalized (not aggregated).

How It Works

Per-layer mixing:

Reference: Chen, S., et al. (2023). “pFedGate: Data-Driven Expert Gating for Personalized Federated Learning.” NeurIPS 2023.

Constructors

Constructor Summary
PFedGatePersonalization(double gateInitValue, double gateLearningRate) Creates a new pFedGate personalization strategy.

Properties

Property Summary
IReadOnlyDictionary<string, double> Gates { get; } Gets the gate values for all layers.
double GateInitValue { get; } Gets the initial gate value.
double GateLearningRate { get; } Gets the gate learning rate.

Methods

Method Summary
Dictionary<string, T[]> ApplyGates(Dictionary<string, T[]> globalParams, Dictionary<string, T[]> localParams) Applies gate mixing to produce effective parameters per layer.
double ComputeGateRegularizationLoss(double regularizationStrength) Computes the total gate regularization loss (L2 on gates to prevent extreme values).
void InitializeGates(Dictionary<string, T[]> modelStructure) Initializes gates for a model structure.
void UpdateGate(string layerName, double gradient) Updates gate values based on validation performance.
void UpdateGatesFromLosses(Dictionary<string, double> globalLossPerLayer, Dictionary<string, double> localLossPerLayer) Updates all gates simultaneously by comparing validation loss with global-only vs local-only parameters.