engine.solvers.goodput
engine.solvers.goodput
Fleet goodput solvers: ML productivity goodput and runtime goodput.
Domain implementations behind mlsysim.solvers (the public import path, derived from engine.solvers.__init__). Added 2026-10-20.
Classes
| Name | Description |
|---|---|
| GoodputModel | ML productivity goodput: the share of offered capacity-time that becomes |
| RuntimeGoodputModel | Runtime goodput of one job: the share of its held time spent on retained steps. |
GoodputModel
engine.solvers.goodput.GoodputModel()ML productivity goodput: the share of offered capacity-time that becomes ideal-rate work, MPG = S x R x P.
Scheduling goodput S is held over offered capacity-time, runtime goodput R retained over held time, and program goodput P ideal over retained time. Each factor divides by what the previous one passed, so the factors multiply and every lost interval is charged once, at the first boundary it fails: 1 = (1 - S) + S(1 - R) + SR(1 - P) + SRP. One point of a factor is worth the product of the other two, and a lever that lifts a factor to its ceiling multiplies MPG by the ceiling’s ratio. A useful accelerator-hour costs the offered rate divided by MPG.
Literature Source: 1. Wongpanich et al. (2025), “Machine Learning Fleet Efficiency: Analyzing and Optimizing Large-Scale Google TPU Systems with ML Productivity Goodput.”
Methods
| Name | Description |
|---|---|
| solve | Partition offered capacity-time into retained work and stage losses. |
solve
engine.solvers.goodput.GoodputModel.solve(
scheduling,
runtime,
program,
ceilings=None,
device_hour_rate=None,
)Partition offered capacity-time into retained work and stage losses.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| scheduling | float | Scheduling fraction S in (0, 1], measured over offered capacity-time. | required |
| runtime | float | Runtime fraction R in (0, 1], measured over scheduled capacity-time. | required |
| program | float | Program fraction P in (0, 1], measured over retained runtime. | required |
| ceilings | dict of str to float | Proposed fractions in (0, 1] keyed by S, R, or P; each change is evaluated alone with the other factors held fixed. |
None |
| device_hour_rate | Quantity | Nonnegative price per offered device-hour, convertible to USD/hour. | None |
Returns
| Name | Type | Description |
|---|---|---|
| GoodputResult | Dimensionless goodput, disjoint loss shares, factor sensitivities, and one-factor ceiling gains. useful_rate is USD/hour of useful work, or None when no price is supplied. |
Notes
Equation: MPG = S*R*P; losses are 1-S, S*(1-R), and S*R*(1-P). A factor’s marginal point value is the product of the other two factors; useful_rate = device_hour_rate / MPG.
Assumptions: factors have consecutive nested denominators. Positive factors are required because costs and relative gains divide by them.
Excludes: correlated responses to simultaneous interventions, capital costs, and forecasts of attainable ceilings. Inputs are supplied fractions.
References
Derivation: expand 1 = (1-S) + S*(1-R) + S*R*(1-P) + S*R*P; the partition charges each lost interval only at its first failed boundary.
Examples
>>> result = GoodputModel().solve(0.5, 0.5, 1.0)
>>> result.mpg == 0.25
True
>>> result.scheduling_share + result.runtime_share + result.program_share + result.mpg == 1
TrueRuntimeGoodputModel
engine.solvers.goodput.RuntimeGoodputModel()Runtime goodput of one job: the share of its held time spent on retained steps.
The loss is the sum of five owners’ terms on one denominator, held time (first order; each term is small):
- startup: restart, checkpoint load, and warmup once per held window;
- input waits: complete allocations stalled on the input pipeline;
- checkpoint waste at the Young-Daly interval, write share plus rework;
- recovery: the four-term cold-restart budget over the failure interval (rework is already counted in the checkpoint term);
- forced preemption: rate times (work since the last save + startup).
Reuses CheckpointIntervalModel for the checkpoint term and the recovery profile’s cold_restart_time for recovery, startup, and the preemption relaunch (the same source as RecoveryBudgetModel and PreemptionTaxModel).
Literature Source: 1. Young (1974); Daly (2006), optimal checkpoint interval. 2. Wongpanich et al. (2025), runtime goodput.
Methods
| Name | Description |
|---|---|
| solve | Account for first-order runtime losses on one held-time denominator. |
solve
engine.solvers.goodput.RuntimeGoodputModel.solve(
mtbf,
checkpoint_bytes,
recovery,
input_wait,
window,
lost_work,
preemption_rate,
)Account for first-order runtime losses on one held-time denominator.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| mtbf | Quantity | Positive mean time between job failures, convertible to hours. | required |
| checkpoint_bytes | Quantity | Nonnegative bytes written and reloaded per checkpoint. | required |
| recovery | object | Recovery profile with positive checkpoint_write_bw_gbs and a cold_restart_time method returning time, including optional detection. |
required |
| input_wait | float | Fraction of held time lost to input stalls, between zero and one. | required |
| window | Quantity | Positive held-time window over which one startup is amortized. | required |
| lost_work | Quantity | Nonnegative work duration discarded by each forced preemption. | required |
| preemption_rate | Quantity | Nonnegative forced-preemption frequency, convertible to inverse hours. | required |
Returns
| Name | Type | Description |
|---|---|---|
| RuntimeGoodputResult | Checkpoint and recovery time budgets, dimensionless loss shares, and runtime_goodput = 1 - summed losses. The value is not clipped; a negative result signals that the small-loss approximation is outside its regime. |
See Also
mlsysim.engine.solvers.reliability.CheckpointIntervalModel.solve : Checkpoint waste accounting.
Notes
Equation: loss = startup/window + input_wait + checkpoint_waste + recovery_time/mtbf + preemption_rate*(lost_work + startup). The effective interruption interval is 1/(1/mtbf + preemption_rate).
Assumptions: terms are small, disjoint first-order charges. The checkpoint term includes failure rework; the recovery term excludes that rework. Startup excludes failure detection for a scheduler-initiated restart.
Excludes: overlapping outages, correlated preemptions, recovery queueing, and dynamic checkpoint adaptation. The interruption checkpoint interval is reported separately rather than substituted into the primary loss budget.
References
Derivation: amortize each event duration over its observation window or multiply it by its event frequency, then sum losses on held time. The checkpoint submodel supplies its separately documented interval rule.
Examples
>>> from mlsysim import Systems, Q_
>>> result = RuntimeGoodputModel().solve(Q_("100 hour"), Q_("1 GB"),
... Systems.Reliability.Recovery, 0.0, Q_("24 hour"), Q_("0 s"), Q_("0 / hour"))
>>> result.preemption_share == 0
True
>>> result.runtime_goodput == 1 - result.runtime_loss
True