Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.Renting instead of owning
A company that needs a truck for one week rents it; one that needs trucks every day may lease them; and some rental firms offer trucks very cheaply on condition that they can take them back at short notice. Cloud computing works the same way. Training a model on cheap reclaimable machines saves most of the bill, as long as the work is saved often enough that losing a machine costs little. Serving a model raises the same question in another form: pay per request, pay per hour, or commit for a year.
Bars: mean cost of a 40-hour training job (spot $0.90, on-demand $3.00 per GPU-hour; 5-minute checkpoints, 10-minute restarts). Without checkpoints the job would take about 545 hours at 0.1 interruptions per hour.
N3-3, seed 0. Checkpointing near Young's interval, the square root of twice the checkpoint cost times the mean time between interruptions, makes spot capacity 35 to 44% of the on-demand cost; when interruptions are frequent and a deadline matters, on-demand is safer.
In Exercise 2, a 40-hour training job on spot instances cost $41.70 instead of $120 on demand when it saved a checkpoint every 1.3 hours, but without checkpoints it would have taken about 545 hours on average.
- 1. Spot or preemptible instances are cheap because…
- 2. A checkpoint is…
- 3. Serverless endpoints charge…
Level 1: Beginner
★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.By hand
- Managed ML platforms: Amazon SageMaker, Google Vertex AI, Azure Machine Learning, Databricks; they provide notebooks, training jobs, tuning, pipelines, registries, endpoints and monitoring on rented compute.
- On-demand instances: billed per second or hour, available until released.
- Spot / preemptible instances: spare capacity at a large discount (often 60 to 90%) that can be reclaimed with little warning.
- Checkpointing: saving model, optimizer and data-loader state so training resumes after an interruption.
- Serverless inference: the platform starts containers per request and bills per request and GB-second; idle endpoints cost nothing but suffer cold starts.
- Commitments: reserved instances, savings plans or committed-use discounts lower the price of capacity paid for whether used or not.
- Managed tuning: hyperparameter search services with early stopping (successive halving, Hyperband, Bayesian optimization).
- Egress and storage: moving data out of a cloud or region is billed; compute usually goes where the data are.
- 1. Checkpointing lets a job…
- 2. A cold start is…
- 3. A commitment discount applies to capacity…
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 25 minUndergraduate students and practising engineers.Training on capacity that can disappear
Exercise 1.
- A job needs 40 hours of GPU compute; spot costs $0.90 and on-demand $3.00 per GPU-hour (illustrative prices).
- Interruptions arrive as a Poisson process (0.1 or 0.5 per hour); a restart takes 10 minutes and resumes from the last checkpoint; a checkpoint takes 5 minutes.
- Simulation of wall-clock and billed hours, and the exact expected time without checkpoints from a renewal argument.
- Young’s (1974) interval: the square root of twice the checkpoint cost times the mean time between interruptions.
Practice.
- Checkpoint at about Young’s interval and make checkpoints cheap (asynchronous writes, sharded state).
- Use spot capacity for interruptible work (training with checkpoints, batch scoring, tuning trials), on-demand for deadlines.
- Choose serverless for low or bursty traffic, provisioned endpoints for steady traffic.
- Commit to the capacity you use most of the time, buy the rest on demand or spot.
- Stop bad tuning trials early.
def run_spot(work, interval, rate, ckpt, restart, rng):
t = saved = 0.0
while saved < work:
step = min(interval, work - saved)
need = step + (ckpt if saved + step < work else 0)
gap = rng.exponential(1 / rate)
if gap >= need:
t += need; saved += step # segment finished and saved
else:
t += gap + restart # lost the unsaved segment
return t- 1. Checkpointing too often…
- 2. Checkpointing too rarely…
- 3. For a job with a hard deadline and frequent interruptions…
Level 3: Advanced
★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.Theory
Young’s interval. With checkpoints every τ hours of work costing C each, and interruptions at rate r, the time lost per hour of work is about C/τ for writing checkpoints plus r·τ/2 for the work redone after an interruption, which on average strikes halfway through a segment. Minimizing C/τ + rτ/2 gives τ* = √(2C/r); Daly (2006) added higher-order corrections. The loss near the optimum is flat: doubling or halving τ costs little.
Without checkpoints. A job of w hours succeeds in one attempt with probability e^(−rw). A renewal argument gives the expected time (e^(rw) − 1)(1/r + R) with restart time R: exponential in the job length, so a 40-hour job at one interruption per 10 hours needs about 545 hours.
Scale. If any of k workers can be interrupted and synchronous training must stop for each, interruptions arrive at rate k·r, so the best interval shrinks like 1/√k and the time lost grows like √k: spot savings disappear for large synchronous jobs unless training is elastic.
Commitments. Committing the k-th instance costs the discounted price every hour and saves the on-demand price in the hours when at least k are needed; it pays when that happens more often than the discount ratio, so the best commitment is a quantile of demand (the newsvendor rule).
- 1. Young's interval grows with…
- 2. Without checkpoints, expected time grows with job length…
- 3. The best commitment level is…
Level 4: Expert
★★★★★ Expert⏱ 30 minResearchers: original papers and open problems.How should a training job buy compute: on demand, or on cheap spot capacity with checkpoints, and how often should it save?
History.
- J. W. Young (1974) derived the first-order optimal checkpoint interval for long computations; J. T. Daly (2006) refined it for high-performance computing.
- Amazon EC2 (2006) began renting compute by the hour and introduced spot instances in 2009; Google’s preemptible VMs followed in 2015.
- Managed ML platforms arrived with Amazon SageMaker (2017), Google AI Platform (2018, now Vertex AI, 2021) and Azure Machine Learning; L. Li and colleagues’ Hyperband (2017) and Google Vizier (D. Golovin and colleagues, 2017) shaped managed tuning.
Exercise 2.
- A 40-hour job, 5-minute checkpoints, 10-minute restarts; 2,000 simulated runs per strategy; deadline 60 hours.
- Interruption rates 0.1 per hour (one per 10 hours) and 0.5 per hour (a busy region or GPU type).
Seed 0:
| strategy | rate | mean hours | p95 hours | mean cost | within 60 h |
|---|---|---|---|---|---|
| on-demand | – | 40.0 | 40.0 | $120.00 | 100% |
| spot, no checkpoints | 0.1 | 544.9 (exact) | – | $490.42 | – |
| spot, every 4 h | 0.1 | 51.4 | 63.7 | $46.28 | 89.6% |
| spot, every 1 h | 0.1 | 46.5 | 49.6 | $41.88 | 100% |
| spot, Young (1.29 h) | 0.1 | 46.3 | 50.1 | $41.70 | 100% |
| spot, every 15 min | 0.1 | 55.0 | 56.5 | $49.54 | 100% |
| spot, every 4 h | 0.5 | 144.7 | 211.1 | $130.19 | 0% |
| spot, every 1 h | 0.5 | 62.3 | 71.1 | $56.07 | 34.6% |
| spot, Young (0.58 h) | 0.5 | 58.7 | 63.9 | $52.81 | 68.0% |
| spot, every 15 min | 0.5 | 62.8 | 66.3 | $56.52 | 8.0% |
At 0.5 interruptions per hour, the job without checkpoints would take about 10^9 hours.
Seeds 1 and 2: Young’s interval cost $41.67 and $41.65 at rate 0.1, $52.91 and $52.77 at rate 0.5, finishing within 60 hours in 66.3% and 68.2% of runs; it was the cheapest strategy at both rates in every seed, with checkpoints every hour within $0.20 at rate 0.1.
Findings.
- Checkpointing near Young’s interval made spot capacity cost 35% (rate 0.1) to 44% (rate 0.5) of on-demand in every seed.
- Without checkpoints a 40-hour job is impractical on spot capacity, and with checkpoints every 4 hours at a high interruption rate it cost more than on-demand.
- Deadlines change the answer: at 0.5 interruptions per hour even the best interval finished within 60 hours only two runs in three, while on-demand always did.
Cloud ML platforms in practice
- Managed training (SageMaker, Vertex AI, Azure ML) supports spot capacity with automatic checkpoint upload to object storage and resumption; large-model training adds asynchronous and sharded checkpoints.
- Serving options range from serverless endpoints to autoscaled GPU endpoints and batch transform jobs; the choice follows the traffic pattern (topics N3-1 and N3-2).
- Cost controls: budgets and alerts, tagging, spot for experiments, commitments for steady serving, and keeping compute in the region where the data live to avoid egress charges.
- Science and space data centres increasingly process mission archives in commercial clouds, where reproducible containers and checkpointed batch jobs on spot capacity cut costs.
References
- J. W. Young (1974). “A first order approximation to the optimum checkpoint interval.” Communications of the ACM.
- J. T. Daly (2006). “A higher order estimate of the optimum checkpoint interval for restart dumps.” Future Generation Computer Systems.
- L. Li, K. Jamieson, G. DeSalvo, A. Rostamizadeh and A. Talwalkar (2017). “Hyperband: a novel bandit-based approach to hyperparameter optimization.” JMLR.
- D. Golovin and colleagues (2017). “Google Vizier: a service for black-box optimization.” KDD.
- E. Jonas and colleagues (2019). “Cloud programming simplified: a Berkeley view on serverless computing.” UC Berkeley technical report.