solvers.SensitivitySolver
solvers.SensitivitySolver()Identifies the binding constraint via numerical sensitivity analysis (Wall 21).
This solver computes numerical partial derivatives of performance with respect to hardware parameters to identify the ‘binding constraint.’
Literature Source: 1. Williams et al. (2009), “Roofline Model.” 2. Ofenbeck et al. (2014), “Applying the Roofline Model.”
Methods
| Name | Description |
|---|---|
| solve | Solve for parameter sensitivities and identify the binding constraint. |
solve
solvers.SensitivitySolver.solve(
model,
hardware,
precision='fp16',
perturbation_pct=10.0,
efficiency=0.5,
)Solve for parameter sensitivities and identify the binding constraint.
Numerically perturbs each hardware parameter (peak FLOPS, memory bandwidth, memory capacity) by perturbation_pct and re-solves the single-node Roofline. Each sensitivity is the normalized latency response (T_perturbed - T_base) / T_base (dimensionless; negative means the upgrade helps). The binding constraint is the parameter with the largest absolute sensitivity — the resource whose improvement moves latency the most.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| model | Workload | The workload to analyze. | required |
| hardware | HardwareNode | The baseline hardware configuration. | required |
| precision | str | Numerical precision used for both baseline and perturbed solves. | 'fp16' |
| perturbation_pct | float | Perturbation size in percent (default 10.0, i.e. a 1.1x upgrade). | 10.0 |
| efficiency | float | Software efficiency factor in (0, 1]. | 0.5 |
Returns
| Name | Type | Description |
|---|---|---|
| SensitivityResult | Per-parameter sensitivities, the binding constraint name, the baseline latency, and feasible. If the baseline does not fit in memory, feasible is False, binding_constraint is "memory_capacity", and constraint_trace carries the Memory Wall failure: the offload path pins latency, so the sensitivities (typically all zero) do not rank hardware levers. |
See Also
mlsysim.engine.engine.Engine.solve : Baseline and perturbed evaluator.
Notes
Equation: response_j = (T(x_j*(1+p/100)) - T(x)) / T(x), where p is perturbation_pct. The reported response is a finite fractional change, not a derivative divided by the perturbation size.
Assumptions: each hardware field changes alone; all other inputs and the generic engine’s assumptions remain fixed. Use positive p for an upgrade experiment. Capacity-infeasible baselines are labeled separately. Excludes: coupled hardware costs, changes in kernel efficiency, and uncertainty intervals. Near a regime boundary the finite step matters.
References
Derivation: compute a finite difference in latency and normalize by the baseline; rank the absolute responses of compute, bandwidth, and capacity.
Examples
>>> from mlsysim import Hardware, Models
>>> from mlsysim.solvers import SensitivitySolver
>>> r = SensitivitySolver().solve(Models.Language.Llama3_8B, Hardware.Cloud.H100)
>>> sorted(r.sensitivities)
['memory_bandwidth', 'memory_capacity', 'peak_flops']