nvflare.app_opt.he.intime_accumulate_model_aggregator module

class HEInTimeAccumulateWeightedAggregator(exclude_vars: str | Dict[str, str] | None = None, aggregation_weights: Dict[str, Any] | Dict[str, Dict[str, Any]] | None = None, expected_data_kind: DataKind | Dict[str, DataKind] = 'WEIGHT_DIFF', weigh_by_local_iter=False)[source]

Bases: InTimeAccumulateWeightedAggregator

In time aggregator for Shareables encrypted using homomorphic encryption (HE) with TenSEAL https://github.com/OpenMined/TenSEAL.

Needed to register FOBS decomposer for HE (e.g. for CKKSVector).

Parameters:
  • exclude_vars ([list], optional) – variable names that should be excluded from aggregation (use regular expression). Defaults to None.

  • aggregation_weights ([dict], optional) – dictionary of client aggregation. Defaults to None.

  • weigh_by_local_iter (bool, optional) – If true, multiply client weights on first in encryption space (default: False which is recommended for HE, first multiply happens in HEModelEncryptor)].

  • expected_data_kind (str, optional) – the data_kind this aggregator can process. Defaults to “WEIGHT_DIFF”.

aggregate(fl_ctx: FLContext) Shareable[source]

Called when workflow determines to generate shareable to send back to contributors

Parameters:

fl_ctx (FLContext) – context provided by workflow

Returns:

the weighted mean of accepted shareables from contributors

Return type:

Shareable