Skip to content
This repository has been archived by the owner on Aug 30, 2022. It is now read-only.

generalised scalar extension #496

Merged
merged 7 commits into from
Aug 21, 2020
Merged

generalised scalar extension #496

merged 7 commits into from
Aug 21, 2020

Conversation

finiteprods
Copy link
Contributor

@finiteprods finiteprods commented Aug 17, 2020

Currently, the PET protocol requires that model scalars be in the range [0,1] and that they are essentially public data (in particular, known by the coordinator). This merge request extends the protocol to deal with private scalars, local to participants in a similar way that local models are. In addition, the extension generalises scalars to be arbitrarily large i.e. [0, infinity).

The changes are summarised as follows.

  • Removal of existing scalar distribution mechanism. Instead, scalars are now computed on the participant side.
  • Adjustment of masking. Masking a model now additionally produces the masked scalar.
  • Adjustment of update message. The message payload now additionally contains a masked scalar.
  • Aggregation of masked scalars. The coordinator now additionally tracks the aggregation of masked scalars.
  • Aggregation of scalar masks. Seeds are now used to additionally compute a scalar mask, aggregated by sum participants.
  • Adjustment of sum2 message. The message payload now additionally contains an aggregated scalar mask.
  • Adjustment of unmasking. Unmasking now additionally includes that of the scalar.
  • Application of correction. An extra step is applied to correctly scale an unmasked model by the unmasked scalar.

@finiteprods finiteprods changed the title generalised scalar protocol extension generalised scalar extension Aug 17, 2020
@little-dude little-dude self-requested a review August 17, 2020 09:24
Copy link
Contributor

@little-dude little-dude left a comment

Choose a reason for hiding this comment

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

The code changes look good to me. The message parsing tests are going to be annoying to fix, let me know if you need help with that.

@codecov
Copy link

codecov bot commented Aug 20, 2020

Codecov Report

Merging #496 into master will increase coverage by 1.24%.
The diff coverage is 56.42%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #496      +/-   ##
==========================================
+ Coverage   54.37%   55.61%   +1.24%     
==========================================
  Files          67       67              
  Lines        3187     3231      +44     
==========================================
+ Hits         1733     1797      +64     
+ Misses       1454     1434      -20     
Impacted Files Coverage Δ
rust/src/client/mobile_client/client.rs 0.00% <0.00%> (ø)
rust/src/client/mobile_client/participant/sum2.rs 17.85% <0.00%> (-3.89%) ⬇️
...ust/src/client/mobile_client/participant/update.rs 38.46% <0.00%> (ø)
rust/src/client/mod.rs 14.91% <0.00%> (+0.74%) ⬆️
rust/src/mask/object/serialization.rs 80.28% <ø> (ø)
rust/src/rest.rs 0.00% <ø> (ø)
rust/src/services/fetchers/mask_length.rs 70.00% <0.00%> (-17.50%) ⬇️
rust/src/services/fetchers/mod.rs 0.00% <0.00%> (ø)
rust/src/services/fetchers/model.rs 70.00% <0.00%> (-17.50%) ⬇️
rust/src/services/fetchers/round_parameters.rs 62.50% <0.00%> (-20.84%) ⬇️
... and 20 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ef99441...cb66c7d. Read the comment docs.

@finiteprods finiteprods marked this pull request as ready for review August 20, 2020 15:10
Copy link
Contributor

@Robert-Steiner Robert-Steiner left a comment

Choose a reason for hiding this comment

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

Looks good to me👍
I think it makes sense if we have a ticket to remove the expected_participants field in our code base so that we don't forget this

rust/src/client/mobile_client/client.rs Show resolved Hide resolved
rust/src/client/mod.rs Outdated Show resolved Hide resolved
@little-dude little-dude self-requested a review August 21, 2020 09:40
Copy link
Contributor

@little-dude little-dude left a comment

Choose a reason for hiding this comment

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

Very nice. Let's squash or split this into a few meaningful commits before merging though.

@finiteprods
Copy link
Contributor Author

Looks good to me+1
I think it makes sense if we have a ticket to remove the expected_participants field in our code base so that we don't forget this

indeed, added this additional task to the follow-up story.

=====================================================================

update msg payload from bytes with masked scalar

masked scalar to bytes

scalar aggregation in state machine update phase

pass scalar agg from update to sum2 phase

derive scalar mask from seed; aggregate scalar masks

add aggregate scalar mask to sum2 message payload

rename aggregation to model_agg and scalar_agg

collect scalar mask sums
=================================================

pass scalar pair sum2 -> unmask; rename mask_dict

add scalar agg & mask dict to unmask phase

correction step

rename agg fields
fmt

float literal; docstring for correction fn
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants