Gaussian

Gaussian noise gradient attack.

class attacks.gaussian.GaussianAttack[source]

Bases: Attack

Gaussian attack, isotropic noise baseline.

Byzantine workers send vectors drawn from an isotropic Gaussian distribution with configurable mean and standard deviation. This attack is independent of the honest gradients.

classmethod generate(honest_gradients: Sequence[Tensor] | Tensor, /, out: Tensor | None = None, *, f: int, mu: float = 0.0, std: float = 200.0, **specialized: Any) Tensor[source]

Generate Gaussian Byzantine gradients.

Parameters:
  • honest_gradients – Sequence of \(h\) gradient vectors, one per honest worker, each of shape \((d,)\). Only the second dimension is used.

  • out – Optional pre-allocated tensor of shape \((f, d)\) to write the result into and return.

  • f – Number of Byzantine gradients to generate.

  • mu – Mean of the Gaussian noise.

  • std – Standard deviation of the Gaussian noise.

  • **specialized – Additional keyword arguments.

Returns:
  • Byzantine gradients of shape `` (f, d)

  • empty tensor of shape `` (0, d)

Raises:
  • ValueError – If \(\sigma\) or \(f\) is negative, or there are no honest gradients.

  • TypeError – If the honest gradients do not use a floating-point dtype.

See also

For a statistic-based attack, see A Little Is Enough. For a full-dataset attack, see Full Gradient Negation.