RdpAccountant

class RdpAccountant(config: PrivacyConfig, orders: tuple[float, ...] | None = None)[source]

Bases: object

Track cumulative privacy loss using Renyi differential privacy.

This class wraps Google's dp-accounting package while exposing only Flower-owned configuration, event, result, and serialization types.

Methods

compose(event[, count])

Compose one or more identical sampled Gaussian releases.

get_delta(epsilon)

Return cumulative delta at the supplied epsilon.

get_epsilon(delta)

Return cumulative epsilon at the supplied delta.

get_privacy_spent([delta])

Return cumulative privacy expenditure at delta.

load_state_dict(state)

Restore state produced by state_dict().

state_dict()

Return JSON-serializable accountant state.

would_exceed(event[, max_epsilon, count])

Return whether composing an event would exceed an epsilon limit.

Attributes

config

Return the privacy configuration.

num_releases

Return the number of composed private releases.

compose(event: GaussianPrivacyEvent, count: int = 1) None[source]

Compose one or more identical sampled Gaussian releases.

property config: PrivacyConfig

Return the privacy configuration.

get_delta(epsilon: float) float[source]

Return cumulative delta at the supplied epsilon.

get_epsilon(delta: float) float[source]

Return cumulative epsilon at the supplied delta.

get_privacy_spent(delta: float | None = None) PrivacySpent[source]

Return cumulative privacy expenditure at delta.

load_state_dict(state: dict[str, object]) None[source]

Restore state produced by state_dict().

The restored state must use the same privacy configuration as this accountant. Backend numeric state is rebuilt from Flower's event ledger.

property num_releases: int

Return the number of composed private releases.

state_dict() dict[str, object][source]

Return JSON-serializable accountant state.

would_exceed(event: GaussianPrivacyEvent, max_epsilon: float | None = None, count: int = 1) bool[source]

Return whether composing an event would exceed an epsilon limit.

This method does not mutate committed accountant state.