5.1.1.1.1.6. FedEval.aggregator.norm_clipping
Norm clipping aggregator. Proposed in Ziteng Sun, Peter Kairouz, Ananda Theertha Suresh, and H Brendan McMahan. 2019. Can you really backdoor federated learning?. In NeurIPS FL Workshop.
5.1.1.1.1.6.1. Module Contents
5.1.1.1.1.6.1.1. Functions
|
|
|
Clip the model updates by norm. |
|
Aggregate the given client-side params by norm clipping. |
- FedEval.aggregator.norm_clipping._weight_delta(param: FedEval.aggregator.ModelWeight.ModelWeights, prev_param: FedEval.aggregator.ModelWeight.ModelWeights) FedEval.aggregator.ModelWeight.ModelWeights
- FedEval.aggregator.norm_clipping._norm_clip(model_updates: Iterable[FedEval.aggregator.ModelWeight.ModelWeights], threshold: float | None = 0.5) FedEval.aggregator.ModelWeight.ModelWeights
Clip the model updates by norm.
$$delta_{w_{t+1}} = sum_{kin S_t}
rac{delta_{w_{t+1}^k}}{max(1, ||delta_{w_{t+1}^k}||_2/Threshold)}$$
- Args:
model_updates (Iterable[ModelWeights]): the updates from different clients, ordered like [update1, update2, …] threshold (Optional[float], optional): the threshold of the norm. Defaults to 0.5.
- Raises:
ValueError: If threshold is invalid.
- Returns:
ModelWeights: the clipped and aggregated update
- FedEval.aggregator.norm_clipping.norm_clip(client_params: Iterable[FedEval.aggregator.ModelWeight.ModelWeights], server_param: FedEval.aggregator.ModelWeight.ModelWeights, threshold: float | None = 0.5) FedEval.aggregator.ModelWeight.ModelWeights
Aggregate the given client-side params by norm clipping.
- Parameters:
client_params (Iterable[ModelWeights]) – the weights form different clients, ordered like [params1, params2, …]
server_param (ModelWeights) – the weights at the server-side
threshold (Optional[float], optional) – the threshold of the norm. Defaults to 0.5.
- Raises:
ValueError – If threshold is invalid.
- Returns:
the aggregated model weights.
- Return type:
ModelWeights