save_strategy='steps' vs save_strategy='epoch': what behaviour changes?
save_strategy controls cadence only: steps saves every N optimizer updates, epoch saves at the end of each pass. Both save the same artifacts.
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.
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 withtrainer.save_model()).'steps': write a checkpoint everysave_stepsoptimizer 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
stepsandepochsave 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, andgreater_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.
Situations where this technique stops working.
2–4 min · Everything important, quickly.
| Aspect | save_strategy='steps' | save_strategy='epoch' |
|---|---|---|
| Cadence trigger | Every save_steps optimizer updates | End of each full data pass |
| Artifacts saved | Model + optimizer + scheduler + RNG | Same |
| Best for | Long runs, large datasets, spot instances | Short fine-tunes, small datasets |
| Worst-case loss on crash | save_steps * step_time | Up to a full epoch |
| Disk pressure | Higher (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.
What an interviewer would ask next. Try answering before peeking at the approach.
QHow does save_strategy interact with eval_strategy in practice?
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.
Red flags & common mistakes
The phrases that signal junior thinking. Click to expand.
Red flags & common mistakes
The phrases that signal junior thinking. Click to expand.
Reading the two strategies as different in what they save. They save the same thing (weights, optimizer, scheduler, RNG); only the cadence differs.
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)
Primary sources. Browse if you want the original framing.
Same topic, related formats. Practice these next.