solvers.ResponsibleEngineeringModel
solvers.ResponsibleEngineeringModel()Models the computational cost of responsible AI practices (Wall 20: Safety).
This model quantifies the ‘Safety Tax’ — the additional compute and data required for differential privacy or fairness guarantees.
Literature Source: 1. Abadi et al. (2016), “Deep Learning with Differential Privacy.” 2. Anil et al. (2022), “Large-Scale Differentially Private BERT.”
Methods
| Name | Description |
|---|---|
| solve | Calculate DP-SGD Gaussian noise scale, step overhead, and subgroup sampling multiplier. |
solve
solvers.ResponsibleEngineeringModel.solve(
base_training_time,
epsilon=1.0,
delta=1e-05,
min_subgroup_prevalence=0.01,
sample_rate=0.001,
steps=10000,
clipping_step_overhead=0.0,
)Calculate DP-SGD Gaussian noise scale, step overhead, and subgroup sampling multiplier.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| base_training_time | Quantity | Positive training duration without DP-SGD per-example clipping (any time unit; the returned effective_training_time preserves this unit). |
required |
| epsilon | float | Positive differential-privacy budget epsilon; smaller values require a larger Gaussian noise multiplier sigma. |
1.0 |
| delta | float | Differential-privacy failure probability in (0, 1). |
1e-5 |
| min_subgroup_prevalence | float | Population prevalence p in (0, 1] of the rarest subgroup. |
0.01 |
| sample_rate | float | Poisson subsampling rate q = L / N in (0, 1] per DP-SGD step. |
0.001 |
| steps | int | Positive count T of DP-SGD optimization steps. |
10000 |
| clipping_step_overhead | float | Nonnegative fractional per-step compute/memory overhead from per-example gradient clipping (e.g., 0.25 for a 1.25x step-time multiplier; 0.0 when unmeasured). Note that privacy budget epsilon governs sigma, whereas per-step wall-clock overhead comes from per-example clipping kernels. |
0.0 |
Returns
| Name | Type | Description |
|---|---|---|
| ResponsibleEngineeringResult | Gaussian mechanism noise multiplier noise_multiplier, step-time multiplier dp_slowdown_factor, effective_training_time, and subgroup sampling multiplier additional_data_requirement. |
Notes
Equation: sigma = q * sqrt(2 * T * ln(1.25 / delta)) / epsilon; dp_slowdown_factor = 1 + clipping_step_overhead; effective_training_time = base_training_time * dp_slowdown_factor; additional_data_requirement = 1 / min_subgroup_prevalence.
Assumptions: Subsampled Gaussian mechanism under moments-accountant / Gaussian composition scaling with subsampling ratio q and T steps; independent random sampling from a population where the target subgroup has prevalence p.
Excludes: Tight numerical Renyi-DP / PRV accountant constants, convergence-step increases needed to recover utility at high sigma, and measured kernel traces.
References
Dwork and Roth (2014), “The Algorithmic Foundations of Differential Privacy,” Theorem A.1. https://doi.org/10.1561/0400000042 (bibliography key: dwork2014). Abadi et al. (2016), “Deep Learning with Differential Privacy,” Theorem 1. https://doi.org/10.1145/2976749.2978318 (bibliography key: abadi2016).
Examples
>>> from mlsysim import Q_
>>> result = ResponsibleEngineeringModel().solve(
... Q_("1 hour"), epsilon=1.0, clipping_step_overhead=0.25
... )
>>> result.effective_training_time > Q_("1 hour") and result.noise_multiplier > 0
True