Skip to content
BIASED

Cost and efficiency of ML systems

Block 1 of 6~3 min

Choose the useful denominator

A server can become cheaper per processed item while the monthly bill grows. More capacity may sit idle; a faster model may trigger more retries; a lower token price may encourage longer prompts. We need a denominator tied to useful work and a workload against which configurations can be compared.

All prices, capacities and durations below are fictional inputs to an original arithmetic example. They are neither vendor quotations nor measured accelerator results.

Name the unit of useful work

For the preview service, define success as a usable preview delivered within the agreed delay. Count failed attempts and retries in cost, but count the completed preview once in the denominator. If CC is total cost and U>0U>0 useful completions, unit cost is C/UC/U. A low cost per attempted request can coexist with a high cost per completion.

Separate costs that follow volume from costs that remain when traffic stops. A permanently allocated worker costs money during idle time. Storage depends on retained bytes and duration. Human review depends on the decision policy. Recording those terms prevents an optimization in inference from concealing increased work elsewhere.

Training and inference occur on different clocks

A training run is a bounded job; inference is a continuing workload. For a reporting period, write

Ctotal=Ctrain+Cserve+Cdata+Creview.C_{\mathrm{total}}=C_{\mathrm{train}}+C_{\mathrm{serve}}+C_{\mathrm{data}}+C_{\mathrm{review}}.

The terms are accounting categories defined for this example. Include failed experiments and repeated evaluation in training cost. Amortizing a run over future requests requires an assumed useful lifetime. If a model is replaced sooner, its actual cost per useful completion rises.

For a service with hourly price hh and sustained useful throughput of q>0q>0 completions per hour, the fully utilized compute cost per completion is h/qh/q. That expression does not include storage, network or review, and it does not apply at capacity when actual arrival rate is lower.

Answers are saved on the server and tied to this browser until you sign in.

Go deeper — optional

Code and labs do not count toward the main percentage or the certificate.

  • Useful completions and feasible costsoptional

    All configurations, prices, capacities, p95s and power figures are invented. Capacity costs assume full stated utilization. At lower actual demand use actual useful completions in the denominator. A Pareto comparison is limited to its chosen dimensions.

    ~20 min · easier on a computer · The corresponding lesson and basic Python functions.

    Self-check in the notebook — not part of mastery or the certificate.