adaptiveclipping_mod¶

adaptiveclipping_mod(msg: Message, ctxt: Context, call_next: Callable[[Message, Context], Message]) Message[source]¶

Client-side adaptive clipping modifier.

This mod needs to be used with the DifferentialPrivacyClientSideAdaptiveClipping server-side strategy wrapper.

The wrapper sends the clipping_norm value to the client.

This mod clips the client model updates before sending them to the server.

It also sends KEY_NORM_BIT to the server for computing the new clipping value.

It operates on messages of type MessageType.TRAIN.

Notes

Consider the order of mods when using multiple.

Typically, adaptiveclipping_mod should be the last to operate on params.