GeoMed

GeoMed aggregation rule, vector-level medoid.

Reference:

Dong Yin, Yudong Chen, Kannan Ramchandran, and Peter Bartlett. “Byzantine-Robust Distributed Learning: Towards Optimal Statistical Rates.” In Proceedings of the 35th International Conference on Machine Learning (ICML 2018).

class aggregators.geomed.GeoMed[source]

Bases: Aggregator

GeoMed aggregation rule, vector-level medoid.

The geometric median is the gradient \(V_i\) that minimises \(\sum_j \|V_i - V_j\|\). Ties are broken by the smallest index. This is a vector-level operator (one of the submitted vectors is selected as-is) — distinct from the coordinate-wise median, which computes a median per coordinate.

classmethod aggregate(gradients: Sequence[Tensor] | Tensor, /, out: Tensor | None = None, *, n: int, f: int, **specialized: Any) Tensor[source]

Aggregate gradients by selecting the geometric median.

Parameters:
  • gradients – Sequence of 1-D tensors containing gradients from workers.

  • out – Optional pre-allocated tensor to write the result into.

  • n – Total number of workers.

  • f – Number of Byzantine workers to tolerate. \(f\) is accepted for API uniformity with other aggregators but is not consulted here (the geometric median is defined for any \(n \ge 1\)).

  • **specialized – Additional keyword arguments.

Returns:

Selected worker gradient of shape `` (d,)

Raises:

ValueError – If \(n\), \(f\), or the gradients count is invalid.

See also

For the most-clumped subset, see Brute. For coordinate-wise median, see Median.