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.
Detailed answer & concept explanation~6 min readEverything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
5 min: what save_strategy controls + steps vs epoch cadence + identical artifacts saved + worst-case loss math + interactions with save_total_limit and save_only_model + independence from best by metric.
| 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.
- Hugging Face's autotrain default is save_strategy='steps' with save_steps tied to total step count for predictable artifact counts.
- DeepSpeed-integrated runs respect save_strategy and handle the cross-rank consolidation internally, transparent to the choice.
- Llama-Factory, LLaMA-Adapter, and other community tooling default to save_strategy='steps' for fine-tunes on large mixed datasets.
What an interviewer would ask next. Try answering before peeking at the approach.
QHow does save_strategy interact with eval_strategy in practice?
QWhy might you set save_only_model=True, and what does it cost?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes 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.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.