Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TFF Aggregators placement #1

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft

TFF Aggregators placement #1

wants to merge 4 commits into from

Conversation

jvmncs
Copy link
Member

@jvmncs jvmncs commented May 4, 2020

TF Federated Aggregators Placement

Rendered

Status Proposed
RFC # https://github.com/tensorflow/community/pull/TODO
Author(s) Jason Mancuso ([email protected])
Sponsor Michael Reneer ([email protected])
Updated 2020-05-04

Objective

This document proposes adding a tff.AGGREGATORS placement to the Federated Core (FC) in TensorFlow Federated (TFF). This would lift the requirement that all aggregations be computed on tff.SERVER while still allowing users to express custom aggregation logic using FC & TF.

@jvmncs jvmncs marked this pull request as draft May 4, 2020 22:06
@jvmncs jvmncs self-assigned this May 4, 2020
Copy link

@michaelreneer michaelreneer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is nice. I think I should share this out on my side and we should iterate and get more detailed on the design? Or maybe wait for feedback on the motivations. I left some minor comments.

multiple alternatives, be sure to use sub-sections for better separation of the
idea, and list pros/cons to each approach. If there are alternatives that you
have eliminated, you should also list those here, and explain why you believe
your chosen approach is superior.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should terminate in an asterisk, this is throwing the formatting off elsewhere?

have eliminated, you should also list those here, and explain why you believe
your chosen approach is superior.

Adding the `tff.AGGREGATORS` placement for federated types involves adding a new `Placement` and `PlacementLiteral`, and then extending the compiler to recognize federated values with this placement when computing intrinsics. The compiler generally defines separate intrinsics by placement; e.g., `tff.federated_value(value, placement)` is actually interpreted by the compiler as `federated_value_at_clients(value)` or `federated_value_at_server(value)`, depending on the provided `placement`. This means we we will want to add new intrinsics that correspond to `tff.AGGREGATORS`, e.g. `federated_value_at_aggregators`.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like (possibly because of the missing asterisk above) hard line wrapping in your IDE stopped working?


Adding the `tff.AGGREGATORS` placement for federated types involves adding a new `Placement` and `PlacementLiteral`, and then extending the compiler to recognize federated values with this placement when computing intrinsics. The compiler generally defines separate intrinsics by placement; e.g., `tff.federated_value(value, placement)` is actually interpreted by the compiler as `federated_value_at_clients(value)` or `federated_value_at_server(value)`, depending on the provided `placement`. This means we we will want to add new intrinsics that correspond to `tff.AGGREGATORS`, e.g. `federated_value_at_aggregators`.

Existing federated computation that will need modification fall into the two categories below:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not clear to me that we need to include non-federated intrinsics in this list? sequence_sum/reduce

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took a deeper look, and you're likely right about not needing to modify the IntrinsicDefs for these. But their factory functions will need to be adjusted to account for the new placement due to checks like this one.

Copy link
Member Author

@jvmncs jvmncs May 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main reason I included them is that they need to be able to handle federated values that have placement tff.AGGREGATORS in order to maintain closure (as described later in the section), so maybe this calls for an additional section for "affected code" or similar.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd actually suggest that (in the code you linked) the check should be pushed into the constructor of federated_map. Which it looks like it already is... https://github.com/tensorflow/federated/blob/c671f0b8857a3be18208db7a1c460f51650a7c60/tensorflow_federated/python/core/impl/intrinsic_factory.py#L177

@jvmncs
Copy link
Member Author

jvmncs commented May 10, 2020

@michaelreneer it looks like you were commenting on an outdated commit, hence some of those formatting issues you mentioned. The newer commit should resolve those.

@jvmncs
Copy link
Member Author

jvmncs commented May 11, 2020

I think I should share this out on my side and we should iterate and get more detailed on the design?

This works for me. I was considering expanding the Design Proposal to be more comprehensive in terms of changes that might be needed, but perhaps that can wait for more iteration? Feel free to share out unless there's anything obvious that we can address first.

- `sequence_map`
2. Intrinsics that will need to be parameterized by placement, but currently
aren't.
- `federated_aggregate`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be probably the interesting one. I think the accumulate / merge / report operators should be allowed to be parameterized by the tff.AGGREGATORS-placed values.

ecosystem.

## Questions and Discussion Topics

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps you can add a pointer to here, which is an example of current inefficiency that would be possible to address using tff.AGGREGATORS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants