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

Central dp fixed clipping #2765

Closed
wants to merge 26 commits into from
Closed

Conversation

mohammadnaseri
Copy link
Contributor

Issue

Description

The implementation of enabling strategies with central differential privacy. It allows the server to clip (with fix value) the updates and add noise to them.

Related issues/PRs

N/A

Proposal

Explanation

Implement a new wrapper class DPWrapper_fixed_clipping (which itself is a strategy) to first it clips the updates from the clients before passing them to the inner strategy, and second, it adds noise to the aggregated results.

Checklist

  • Implement proposed change
  • Write tests
  • Update documentation
  • Update the changelog entry below
  • Make CI checks pass
  • Ping maintainers on Slack (channel #contributions)

Changelog entry

The strategies now can be wrapped around with a dp class to allow them perform clipping and noise addition.

Any other comments?

N/A

src/py/flwr/server/strategy/dp/dp_strategy_wrapper.py Outdated Show resolved Hide resolved
src/py/flwr/server/strategy/dp/dp_strategy_wrapper.py Outdated Show resolved Hide resolved
src/py/flwr/server/strategy/dp/dp_strategy_wrapper.py Outdated Show resolved Hide resolved
src/py/flwr/server/strategy/dp/dp_strategy_wrapper.py Outdated Show resolved Hide resolved
) -> Tuple[Optional[Parameters], Dict[str, Scalar]]:
"""Aggregate training results using unweighted aggregation."""
if failures:
return None, {}
Copy link
Contributor

Choose a reason for hiding this comment

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

May I know why this DP strategy does not tolerate any failures? Is it fine to proceed with the DP algorithm with a few clients dropping out?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This makes the epsilon computation afterwards very difficult. As we need to know how many clients were selected on each round. I would say let's keep it this way for now and we can investigate those scenarios.

src/py/flwr/server/strategy/dp/dp_strategy_wrapper.py Outdated Show resolved Hide resolved
src/py/flwr/server/strategy/dp/dp_strategy_wrapper.py Outdated Show resolved Hide resolved
@@ -0,0 +1,217 @@
# Copyright 2020 Flower Labs GmbH. All Rights Reserved.
Copy link
Contributor

Choose a reason for hiding this comment

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

The code looks good. Just a few small things. Btw, could you get past all the CI checks?

@mohammadnaseri mohammadnaseri force-pushed the central-DP-fixed-clipping branch from 944bc14 to 7927581 Compare January 9, 2024 23:50
@mohammadnaseri mohammadnaseri force-pushed the central-DP-fixed-clipping branch from 7927581 to 944bc14 Compare January 10, 2024 00:00
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.

2 participants