Attend the Women in ML Symposium on December 7 Register now

tff.aggregators.EliasGammaEncodedSumFactory

UnweightedAggregationFactory encoding values using Elias Gamma code.

Inherits From: UnweightedAggregationFactory

The created tff.templates.AggregationProcess encodes the input tensor as a bitstring. The value_type is expected to be a Type of integer tensors, with the expecataion that it should have relatively large amount of zeros. Each value is encoded according to the following protocol.

First, one more than the number of zeros preceding the first non-zero integer in the tensor is encoded using the Elias Gamma code, a universal code which maps positive integers to a bitstring representation. Next, the sign of the non-zero integer is encoded with a single bit. The magnitude of the integer is encoded using the Elias Gamma code. This process is repeated for the remaining elements of the integer tensor and the substrings are concatenated into a single bitstring.

Information about the Elias Gamma code can be found here: https://ieeexplore.ieee.org/document/1055349 Notably, the Elias Gamma code is used to compress positive integers whose values are unbounded but for which smaller values are more likely to occur than larger values.

The bitstrings are aggregated at tff.SERVER and decoded to the same shape as the original input integer tensors. This aggregator computes the sum over decoded client values at tff.SERVER and outputs the sum placed at tff.SERVER.

The process returns an empty state, the summed client values in result and optionally records the average number of encoded bits sent from tff.CLIENT to tff.SERVER in measurements as a dictionary with key avg_bitrate using the bitrate_mean_factory, if provided.

bitrate_mean_factory A tff.aggregators.UnweightedAggregationFactory that is used to compute the average bitrate across clients in each round. Note that the aggregator state does not change between rounds. If this is set to None, then the AggregationProcess created through this factory returns empty measurements.

Methods

create

View source

Creates a tff.aggregators.AggregationProcess without weights.

The provided value_type is a non-federated tff.Type object, that is, value_type.is_federated() should return False.

The returned tff.aggregators.AggregationProcess will be created for aggregation of values matching value_type placed at tff.CLIENTS. That is, its next method will expect type <S@SERVER, {value_type}@CLIENTS>, where S is the unplaced return type of its initialize method.

Args
value_type A non-federated tff.Type (value_type.is_federated() returns False).

Returns
A tff.templates.AggregationProcess.