Zenaique

save_strategy='steps' vs save_strategy='epoch': what behaviour changes?

MCQ·Easy·4.0 · 0·~1 min·Asked atCitadelNotionPalantir·Relevant atDatabricks
Attempt it
TL;DR

save_strategy controls cadence only: steps saves every N optimizer updates, epoch saves at the end of each pass. Both save the same artifacts.

Memory aid
Sign in to see the mnemonic that makes this stick.
Easy to grasp

Imagine writing a long letter and choosing when to hit save in your word processor. One option saves every fifteen minutes regardless of where you are; the other saves only when you reach the end of a chapter. Both produce identical save files. The only difference is the timing. If the power goes out, the every fifteen minutes option loses at most fifteen minutes of work. The end of chapter option might lose hours if you were deep into a long chapter. That is exactly the trade-off in fine-tuning checkpoints. Step-based cadence bounds the worst-case loss; chapter-based cadence ties saves to natural data milestones. Pick steps for long runs, chapter-end for short ones.

Concept explanation~2 min read

Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.

save_strategy is one of those small training-configuration knobs that looks trivial but has outsized consequences when you start running long fine-tunes on real hardware. The flag controls when a checkpoint is written, and nothing more. But the choice between steps and epoch is the difference between losing 30 minutes to a crash and losing 8 hours.

This deep dive separates four things that often get conflated. First, what save_strategy actually does (cadence control). Second, what it does not do (artifact selection, best-model selection, distributed coordination). Third, the cost of crash math that should drive the choice between the two modes. Fourth, the surrounding flags (save_steps, save_total_limit, save_only_model, load_best_model_at_end) that compose with save_strategy to give a full checkpointing policy.

The headline rule is simple. Use steps cadence for any run where a single epoch takes more than an hour, with save_steps bounded so worst-case loss is acceptable. Use epoch cadence for short fine-tunes where one epoch is fast and the per-epoch milestone is a natural checkpoint. Both modes save the same artifacts; the choice is purely about timing.

The Hugging Face Trainer is the dominant reference implementation for this flag, but the same concept appears in TRL's SFTTrainer, Axolotl's YAML config, and most community fine-tuning tooling because they all wrap or inherit from the Trainer. The vocabulary is portable; if you understand save_strategy in Trainer you understand it everywhere.

What save_strategy controls and what it does not

What it controls

The sole job of save_strategy is to determine when the trainer writes a full checkpoint to disk during training. There are three legal values:

  • 'no': never write checkpoints (final model can still be saved with trainer.save_model()).
  • 'steps': write a checkpoint every save_steps optimizer updates.
  • 'epoch': write a checkpoint at the end of each full pass through the training data.

That is the entire scope. The flag is purely a cadence selector.

What it does not control

Three common misconceptions:

  • What gets saved. Both steps and epoch save the same artifacts: model weights, Adam optimizer state (first and second moment buffers), learning-rate scheduler state, and the RNG state. The choice does not change which artifacts hit disk; only when.
  • Distributed-rank coordination. In multi-GPU training (FSDP, DeepSpeed, plain DDP), only rank 0 writes the consolidated checkpoint after gathering shards. This protocol fires the same way regardless of save_strategy.
  • Best-by-metric selection. That is controlled by load_best_model_at_end, metric_for_best_model, and greater_is_better. save_strategy only determines which checkpoints exist on disk; the selection logic then picks the best from the available set.

Why the confusion exists

The flag name implies a strategy, which sounds like a policy. In practice it is a cadence selector. The richer policy is composed from several flags (save_strategy, save_steps, save_total_limit, save_only_model, load_best_model_at_end) and many candidates pattern-match a single concept onto the wrong flag.

Step cadence vs epoch cadence
Cost-of-crash math and disk pressure
How save_strategy composes with surrounding flags
Sign in to unlock the full deep dive.

Situations where this technique stops working.

Sign in to see when this approach fails.

2–4 min · Everything important, quickly.

Sign in to see the quick scan of the deep dive.
Aspectsave_strategy='steps'save_strategy='epoch'
Cadence triggerEvery save_steps optimizer updatesEnd of each full data pass
Artifacts savedModel + optimizer + scheduler + RNGSame
Best forLong runs, large datasets, spot instancesShort fine-tunes, small datasets
Worst-case loss on crashsave_steps * step_timeUp to a full epoch
Disk pressureHigher (more frequent saves)Lower (one per epoch)

Real products, models, and research that use this idea.

  • TRL's SFTTrainer accepts the same save_strategy argument, with steps cadence the default in most community fine-tuning recipes.
  • Axolotl exposes save_strategy in its YAML config, paired with save_steps and save_total_limit for typical multi-day runs.
Sign in to see more production examples.

What an interviewer would ask next. Try answering before peeking at the approach.

QHow does save_strategy interact with eval_strategy in practice?
A

They are independent but commonly set together. eval_strategy controls when validation runs; save_strategy controls when checkpoints are written. For best-model selection (load_best_model_at_end=True) the two cadences should align so that every saved checkpoint has a matching eval metric.

2 more follow-ups an interviewer would ask next. Sign in to reveal them.

Red flags & common mistakes

The phrases that signal junior thinking. Click to expand.

Most common mistake

Reading the two strategies as different in what they save. They save the same thing (weights, optimizer, scheduler, RNG); only the cadence differs.

Sign in to see all red flags and common mistakes.

60 second bullets to scan on the way to the call.

  • The three legal values for save_strategy

  • What both modes save (same artifacts, different cadence)

Sign in to unlock the revision sheet.

Primary sources. Browse if you want the original framing.

Similar questions

Same topic, related formats. Practice these next.

4 curated
Next question
What is RLHF, and why is it used after pretraining?
MCQ·Easy