GEAR

Implementation of the GEAR [GEAR22] algorithm.

References

[GEAR22]

Chen Chen, Jie Zhang, Lingjuan Lyu. GEAR: A Margin-based Federated Adversarial Training Approach. In FL@AAAI (2022). URL: https://federated-learning.org/fl-aaai-2022/Papers/FL-AAAI-22_paper_34.pdf

Classes included in fluke.algorithms.gear

Classes

class fluke.algorithms.gear.GEARClient(index: int, train_set: FastDataLoader, test_set: FastDataLoader, optimizer_cfg: OptimizerConfigurator, loss_fn: Module, local_epochs: int, fine_tuning_epochs: int = 0, clipping: float = 0, eps: float = 0.1, delta: float = 0.01, alpha: float = 0.00784313725490196, adv_iters: int = 10, **kwargs: dict[str, Any])[source]

Bases: Client

generate_adversarial(model: Module, inputs: Tensor, targets: Tensor, eps: float = 0.1, alpha: float = 0.00784313725490196, iters: int = 10) Tensor[source]

Generates adversarial examples using Projected Gradient Descent (PGD).

Parameters:
  • model (nn.Module) – The neural network model.

  • inputs (Tensor) – Input samples.

  • targets (Tensor) – True labels for the inputs.

  • alpha (float) – Step size for each iteration.

  • iters (int) – Number of attack iterations.

Returns:

Adversarial examples.

Return type:

Tensor

class fluke.algorithms.gear.GEAR(n_clients: int, data_splitter: DataSplitter, hyper_params: DDict | dict[str, Any], **kwargs: dict[str, Any])[source]

Bases: CentralizedFL