tff.backends.mapreduce.MapReduceForm

Standardized representation of logic deployable to MapReduce-like systems.

Inherits From: TypedObject

This class docstring describes the purpose of MapReduceForm as a data structure; for a discussion of the conceptual content of an instance mrf of MapReduceForm, including how precisely it maps to a single federated round, see the package-level docstring.

This standardized representation can be used to describe a range of computations representable as a single round of MapReduce-like processing, and deployable to MapReduce-like systems that are only capable of executing plain TensorFlow code.

Processes that do not originate at the server can be described by MapReduceForm, as well as degenerate cases like computations which use exclusively one of the two possible aggregation paths.

Instances of this class can be generated by TFF's transformation pipeline and consumed by a variety of backends that have the ability to orchestrate their execution in a MapReduce-like fashion. The latter can include systems that run static data pipelines such Apache Beam or Hadoop, but also platforms like that which has been described in the following paper:

"Towards Federated Learning at Scale: System Design" https://arxiv.org/pdf/1902.01046.pdf

It should be noted that not every computation that proceeds in synchronous rounds is representable as an instance of this class. In particular, this representation is not suitable for computations that involve multiple phases of processing, and does not generalize to arbitrary static data pipelines. Generalized representations that can take advantage of the full expressiveness of Apache Beam-like systems may emerge at a later time, and will be supported by a separate set of tools, with a more expressive canonical representation.

The requirement that the variable constituents of the template be in the form of pure TensorFlow code (not arbitrary TFF constructs) reflects the intent for instances of this class to be easily converted into a representation that can be compiled into a system that does not have the ability to interpret the full TFF language (as defined in computation.proto), but that does have the ability to run TensorFlow. Client-side logic in such systems could be deployed in a number of ways, e.g., as shards in a MapReduce job, to mobile or embedded devices, etc.

The individual TensorFlow computations that constitute a computation in this form are supplied as constructor arguments. Generally, this class will note be instantiated by a programmer directly but targeted by a sequence of transformations that take a tff.Computation and produce the appropriate pieces of logic.

type_signature The type signature of the corresponding tff.Computation that is equivalent to the pieces of logic encoded in this data structure.
prepare The computation that prepares the input for the clients.
work The client-side work computation.
zero The computation that produces the initial state for accumulators.
accumulate The computation that adds a client update to an accumulator.
merge The computation to use for merging pairs of accumulators.
report The computation that produces the final server-side aggregate for the top level accumulator (the global update).
secure_sum_bitwidth The computation that produces the bitwidth for bitwidth-based secure sums.
secure_sum_max_input The computation that produces the maximum input for max_input-based secure sums.
secure_modular_sum_modulus The computation that produces the modulus for secure modular sums.
update The computation that takes the global update and the server state and produces the new server state, as well as server-side output.

TypeError If the Python or TFF types of the arguments are invalid or not compatible with each other.
AssertionError If the manner in which the given TensorFlow computations are represented by TFF does not match what this code is expecting (this is an internal error that requires code update).

accumulate

client_data_label

merge

prepare

report

secure_modular_sum_modulus

secure_sum_bitwidth

secure_sum_max_input

securely_aggregates_tensors Whether the MapReduceForm uses secure aggregation.
server_state_label

type_signature Returns the TFF type of the equivalent tff.Computation.
update

work

zero

Methods

summary

View source

Prints a string summary of the MapReduceForm.

Args
print_fn Print function to use. It will be called on each line of the summary in order to capture the string summary.