LocalDpModΒΆ

class LocalDpMod(clipping_norm: float, sensitivity: float, epsilon: float, delta: float)[source]ΒΆ

Bases: object

Modifier for local differential privacy.

This mod clips the client model updates and adds noise to the params before sending them to the server.

It operates on messages of type MessageType.TRAIN.

Parameters:
  • clipping_norm (float) – The value of the clipping norm.

  • sensitivity (float) – The sensitivity of the client model.

  • epsilon (float) – The privacy budget. Smaller value of epsilon indicates a higher level of privacy protection.

  • delta (float) – The failure probability. The probability that the privacy mechanism fails to provide the desired level of privacy. A smaller value of delta indicates a stricter privacy guarantee.

Examples

Create an instance of the local DP mod and add it to the client-side mods:

>>> local_dp_mod = LocalDpMod( ... )
>>> app = fl.client.ClientApp(
>>>     client_fn=client_fn, mods=[local_dp_mod]
>>> )

Methods