Skip to content

Conversation

@ahzero7d1
Copy link
Collaborator

  1. Gaussian noise calibration implementation

    • Added Gaussian noise calibration for differential privacy (DP) based on privacy budget (epsilon), failure possibility (delta) and weight clipping radius
  2. Adaptive clipping mechanism

    • Implemented adaptive clipping radius using historical moving average of weight updates
  3. cli testing tool modification

  4. Webapp interface updates

    • Added UI fields for the new DP parameters

Copy link
Collaborator

@tharvik tharvik left a comment

Choose a reason for hiding this comment

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

thanks for the great work! I added a few comments on how to improve parts of it but the core feature is there 🎉

btw, I don't remember if we talked about adding a test for the feature. for an integration test, you can add one in server/tests/e2e/federated.spec.ts trying out the feature and if you have some hardening/units tests in mind, you can also some in discojs/src/privacy.spec.ts to ensure that it works in many conditions.

ret = privacy.addNoise(ret, options.noiseScale);
// Adding Gaussian noise for DP
if (options.noiseScale !== undefined && options.delta !== undefined){
const dpDefaultRadius = options.dpDefaultClippingRadius; // options.dpDefaultClippingRadius should be a number
Copy link
Collaborator

Choose a reason for hiding this comment

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

there are two type of radius, one for BFT and one for DP, consider adding a specific object for BFT in the privacy's schema and rename dpDefaultClippingRadius to clippingRadius

you can also set defaults directly in the schema with the default method

Comment on lines 221 to 229
if (options.clippingRadius !== undefined){
/** When clipping radius for BFT is smaller than the improved clipping radius */
if (Array.isArray(dpClippingRadius)&&options.clippingRadius < Math.min(...dpClippingRadius))
ret = current.add(await privacy.addNoise(weightsProgress, epsilon, delta, options.clippingRadius));
else if(typeof dpClippingRadius == "number" && options.clippingRadius < dpClippingRadius)
ret = current.add(await privacy.addNoise(weightsProgress, epsilon, delta, options.clippingRadius));
}else{
ret = current.add(await privacy.addNoise(weightsProgress, epsilon, delta, dpClippingRadius));
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

theses three code branches are quite similar, surely there is a way to commonize logic

<div v-show="differentialPrivacy" class="flex flex-col">
<FormLabel
label="Default clipping norm: Initial limit on weight update size for differential privacy"
type="required"
Copy link
Collaborator

Choose a reason for hiding this comment

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

here is it required but not in the schema, is it wanted?

type="required"
>
<FormField
name="trainingInformation.privacy.delta"
Copy link
Collaborator

Choose a reason for hiding this comment

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

we have to readd (yeah, that's bothering but I wasn't able to find a way to map over zod schema to transform theses) in the nonLocalNetwork schema below. that let the form manager know what is a valid value and warn the user about it. it has to have the same shape as the base schema otherwise it will get rejected by the server.

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