nvflare.app_common.filters.svt_privacy module

class SVTPrivacy(fraction=0.1, epsilon=0.1, noise_var=0.1, gamma=1e-05, tau=1e-06, data_kinds: [<class 'str'>] = None, replace=True, epsilon_threshold: float = None, epsilon_query: float = None, epsilon_release: float = None)[source]

Bases: DXOFilter

Implementation of the standard Sparse Vector Technique (SVT) differential privacy algorithm.

lambda_rho = gamma / epsilon_threshold threshold = tau + np.random.laplace(scale=lambda_rho)

Parameters:
  • fraction (float, optional) – used to determine dataset threshold. Defaults to 0.1.

  • epsilon (float, optional) – total privacy budget used for the threshold/query selection phase. Defaults to 0.1.

  • noise_var (float, optional) – legacy release-noise control retained for backward compatibility. When epsilon_release is not specified, this implies a total release budget of n_upload * noise_var and preserves the previous release noise scale. Defaults to 0.1.

  • gamma (float, optional) – Defaults to 1e-5.

  • tau (float, optional) – Defaults to 1e-6.

  • data_kinds (str, optional) – Defaults to None.

  • replace (bool) – whether to sample with replacement. Defaults to True.

  • epsilon_threshold (float, optional) – privacy budget used for threshold noise. When omitted, the standard SVT non-monotonic split is used.

  • epsilon_query (float, optional) – privacy budget used for query noise. When omitted, the remainder of epsilon is assigned after applying the selected split.

  • epsilon_release (float, optional) – total privacy budget used for the release-noise phase. When omitted, the budget is derived from noise_var to preserve existing behavior.

get_privacy_ledger() List[dict][source]
get_privacy_spent() float[source]
handle_event(event_type: str, fl_ctx: FLContext)[source]

Handles events.

Parameters:
  • event_type (str) – event type fired by workflow.

  • fl_ctx (FLContext) – FLContext information.

process_dxo(dxo: DXO, shareable: Shareable, fl_ctx: FLContext) None | DXO[source]

Compute the differentially private SVT.

Parameters:
  • dxo – information from client

  • shareable – that the dxo belongs to

  • fl_ctx – context provided by workflow

Returns: filtered result.