blog

We killed the same training run 40 times

27 November 2026 · Jonathan Vecchione

A training run on rented GPUs dies more often than anyone plans for: a spot reclaim, a host that vanishes, an out-of-memory crash in the middle of a save. What happens next is usually a restart “from a good place”: reload the weights, maybe the optimizer, and carry on. The run continues and the loss curve looks fine. But the learning-rate schedule, the random state and the order of the data have quietly started somewhere else, and it is no longer the run you started.

We wanted to see how big that difference is, and to show that it can be zero. So we took one small training run and killed it 40 times.

The experiment

A character-level GPT (two transformer blocks, width 64) learns a small text for 2,000 steps with AdamW, a warm-up and a cosine schedule. We ran it three ways:

The kills alternate between SIGKILL, where the process is gone with no warning, like a host that disappears, and SIGTERM, where it gets a moment to react, like a spot reclaim. On SIGTERM Ravex finishes the current step, writes a checkpoint and exits; on SIGKILL nothing runs, and the steps since the last checkpoint are trained again.

# What most training scripts do on a restart
state = torch.load("last.pt")
model.load_state_dict(state["model"])
optimizer.load_state_dict(state["optimizer"])
step = state["step"]
# ...and the LR scheduler, the RNG and the data order start over.
@ravex.train_loop(max_steps=2000, checkpoint_every=50)
def train():
    data, model, optimizer, scheduler = build(2000)
    while ravex.step() < 2000:
        train_step(data, model, optimizer, scheduler)

The result

0.511.522.530500100015002000
Never stoppedRavex, killed 40 timesHand-written resume, killed 40 timesA kill
0.511.522.53075150225300
Never stoppedRavex, killed 40 timesHand-written resume, killed 40 timesA kill
RunRestartsSteps with the reference's exact lossLargest differenceSteps trained twiceFinal weights
Ravex402000 / 20000370identical, bit for bit
Hand-written resume4050 / 20000.5031073different

With Ravex every one of the 2,000 losses is the same number as in the run that was never stopped, and the final weights hash to the same value. The 370 steps trained twice are the ones a SIGKILL threw away; they were trained again and came out the same, because the random state and the data position came back too.

The hand-written resume matches only up to step 50. The first kill came at step 92, a SIGKILL; the restart loaded the checkpoint of step 50 and trained on from there, with the scheduler back at the start of its warm-up and other batches. The gap is plain during the first 250 steps, where the loss is still falling. After that the curves look the same to the eye, and this is why the problem goes unnoticed: nothing crashes and nothing warns, the run just is not the one you configured.

What a resume has to put back

Weights and optimizer are the obvious part. A run that continues exactly also needs the LR scheduler, the AMP loss scale if there is one, the random generators of Python, NumPy, torch and CUDA, and the position in the data: which epoch, how many batches of it were already seen, in what order. Ravex finds the model, optimizer, scheduler, scaler and data loader as the training function builds them, and saves and restores all of it. State that is not a torch object, such as an EMA kept in a dict or an early-stopping counter, is declared with one line, ravex.track(state=...).

What this does not show

Several processes are covered by Ravex's own tests, which hold DDP and FSDP to the same bit-for-bit standard. A run of the same kind on GPUs is next, and will be written up here.

Run it yourself

On Linux or macOS (on Windows the two signals are the same hard stop), with Python 3.11 or later. It takes a few minutes on a laptop and needs no GPU.

pip install "ravex[moonclip]" matplotlib
curl -O https://gpuzero.dev/blog/40-kills/kill_resume.py
python kill_resume.py --kills 40 --steps 2000 --every 50 --out results

The script is kill_resume.py. It prints the table above and writes the losses as CSV and a chart. Our run used Ravex 0.21.0, Moonclip 0.4.3 and torch 2.15.0 on CPU, in a Linux container with one thread per process. If you get a different number, we would like to know: open an issue.

Ravex and Moonclip are open source under Apache-2.0. We build them, and GPU Zero on top of them.