Most LLM fine-tunes need 1 to 3 epochs, and validation loss should pick the exact number: train a little past your guess, score held-out rows each epoch and keep the best checkpoint. Nodus builds this into its SFT runtime, with an epochs setting, a validation split and early stopping in one capped training job, so you pay for one run instead of a sweep. Datasets of about 1,000 rows can need more passes, and datasets past 100,000 rows rarely need more than one or two.
What do the published fine-tunes and docs actually use?
Published recipes cluster around 3 epochs, with small datasets as the exception. The Hugging Face transformers library sets num_train_epochs to 3.0 by default in TrainingArguments, and TRL's SFTConfig inherits it. Unsloth's LoRA hyperparameter guide recommends 1 to 3 epochs and says more than 3 gives diminishing returns and more overfitting risk on most instruction datasets.
Stanford's Alpaca trained LLaMA-7B for 3 epochs and LLaMA-13B for 5 on 52K instruction rows, per its README. Meta's LIMA paper went the other way: 15 epochs on just 1,000 examples, then picked a checkpoint between the 5th and 10th epoch by hand using a 50-example development set. OpenAI's InstructGPT paper trained its SFT model for 16 epochs on about 13k prompts.

Among these recipes, the smallest datasets got the most passes.
OpenAI's own fine-tuning API doesn't ask you for a number at all. Its n_epochs parameter defaults to auto and accepts 1 to 50, per the API reference. The best-practices guide says to start with the default chosen from your dataset size, then add 1 or 2 epochs if the model doesn't follow the training data, or remove 1 or 2 if its outputs become less diverse than expected.
Why does a fixed epoch count go wrong?
An epoch count is only a proxy for how much the model has learned. Each extra pass shows it the same examples again: early passes teach the pattern, later ones teach the exact wording of each answer.
The research on repeated data puts limits on how far repetition helps. Muennighoff et al., in Scaling Data-Constrained Language Models, found that up to 4 epochs of repeated pretraining data changed loss negligibly compared with fresh data, and that with more repetition the value of extra compute decays to zero. Xue et al., in To Repeat or Not To Repeat, found repeated pretraining data leads to overfitting and "multi-epoch degradation", with dataset size and model size among the main factors and dropout as the one regularizer that clearly helped. Both studies are about pretraining, but the direction carries over: repetition is cheap at first and then stops paying.
Fine-tuning adds a twist. InstructGPT's SFT model overfit on validation loss after 1 epoch, yet training for more epochs still improved reward model scores and human preference ratings.
LIMA reported that perplexity did not correlate with generation quality. Validation loss tells you when memorization starts. It does not always tell you which checkpoint writes the best answers.
How do you tell if your fine-tune is overfitting?
The clearest signal is training loss that keeps falling while validation loss turns upward. Log both at least once per epoch, or the turn happens between measurements and you miss it.
Watch for these too:
- Training loss approaching zero on a dataset of a few thousand rows. The model is reciting, not generalizing.
- Answers to new prompts that reuse whole phrases or names from training examples.
- Less varied output on open-ended prompts, the symptom OpenAI's guide ties to too many epochs.
- Correct format with wrong facts, where the model has learned your template better than your content.
Underfitting looks different. Validation loss is still dropping at the last checkpoint, and the model ignores your format or labels. That is the case for more epochs, or a higher learning rate if loss has barely moved.
None of this works without a validation split that has no overlap with training. If the same prompt appears on both sides, validation loss keeps falling while the model memorizes, and you never see the turn. Our post on training a model on your own data covers splitting rows into train, validation and test sets.
How many epochs should you start with for your dataset?
Use this table as a starting point, then let validation decide. It is our rule of thumb, built from the published recipes and guidance above. It is not a measured benchmark.
| Training rows | Task | Start with | Upper bound to train to | Pick the checkpoint by |
|---|---|---|---|---|
| Under 1,000 | Style, tone, chat format | 3 | 5 to 10 | Validation loss, then reading outputs side by side |
| 1,000 to 10,000 | Classification, extraction, structured output | 3 | 5 | Accuracy or exact match on held-out rows |
| 1,000 to 10,000 | Open-ended generation | 2 | 3 | Validation loss plus a diversity check |
| 10,000 to 100,000 | Any | 1 to 2 | 3 | Validation loss every half epoch |
| Over 100,000 | Any, including continued pretraining | 1 | 2 | Validation loss; more data beats more passes |
The decision rule that goes with it has four branches:
- If the best checkpoint is the last one and validation loss is still falling, train longer.
- If it sits in the middle, use that checkpoint and set future runs to that count.
- If it is the first epoch and loss rises right after, cut the learning rate or add data before you try fewer epochs.
- If validation loss and output quality disagree, trust a task metric on a separate test set.
Single-answer tasks like classification tolerate more epochs, and open-ended tasks lose diversity sooner, as OpenAI's guidance notes. Full fine-tuning updates every weight, and Unsloth's guide says it generally wants a lower learning rate than LoRA, so do not copy a LoRA epoch count across without checking validation loss. Our LoRA vs full fine-tuning post covers that tradeoff.
How do you stop at the best epoch automatically?
Train to an upper bound, evaluate every epoch, and let the trainer keep the best checkpoint. This script uses Hugging Face TRL's SFTTrainer with a LoRA adapter and stops one epoch after validation loss stops improving:
import hashlib from datasets import load_dataset from peft import LoraConfig from transformers import EarlyStoppingCallback from trl import SFTConfig, SFTTrainer MODEL = "Qwen/Qwen3-0.6B" # any causal LM you can load MAX_EPOCHS = 5 # an upper bound, not a target # Rows look like {"prompt": "...", "completion": "..."}. rows = load_dataset("json", data_files="data.jsonl", split="train") # Split by prompt, not by row, so repeated prompts never land on both sides. def in_val(row): return int(hashlib.sha256(row["prompt"].encode()).hexdigest(), 16) % 10 == 0 train = rows.filter(lambda r: not in_val(r)) val = rows.filter(in_val) args = SFTConfig( output_dir="runs/epoch-search", num_train_epochs=MAX_EPOCHS, learning_rate=2e-4, # LoRA-scale rate; use ~2e-5 for full fine-tuning lr_scheduler_type="constant_with_warmup", # keeps per-epoch checkpoints comparable warmup_steps=0.03, # a float below 1 is a ratio of total steps per_device_train_batch_size=4, gradient_accumulation_steps=4, eval_strategy="epoch", # score the validation split after every pass save_strategy="epoch", # keep a checkpoint for every pass save_total_limit=2, # the best one and the latest one survive load_best_model_at_end=True, metric_for_best_model="eval_loss", greater_is_better=False, logging_steps=10, ) trainer = SFTTrainer( model=MODEL, args=args, train_dataset=train, eval_dataset=val, peft_config=LoraConfig(r=16, lora_alpha=32, target_modules="all-linear"), callbacks=[EarlyStoppingCallback(early_stopping_patience=1)], ) trainer.train() for entry in trainer.state.log_history: if "eval_loss" in entry: print(f"epoch {entry['epoch']:.0f}: eval_loss {entry['eval_loss']:.4f}") print("best checkpoint:", trainer.state.best_model_checkpoint) trainer.save_model("runs/best") We ran this end to end with TRL 1.19.0 and transformers 5.26.0, swapping in a tiny test model and CPU flags, to check the arguments rather than model quality. One failure we hit: warmup_ratio, which most older tutorials use, raised a TypeError in transformers 5.26.0. Pass a float below 1 to warmup_steps instead. save_total_limit=2 is safe with load_best_model_at_end, because the Trainer docs say the best checkpoint is always retained alongside the most recent one.
The constant learning rate matters. With a cosine schedule over 5 epochs, the epoch-2 checkpoint was trained at a higher learning rate than a true 2-epoch run would end on, so it is a slightly different model. Use a constant rate to find the count, then run the final job with your usual schedule if you want.
How do you run the epoch search on Nodus?
On Nodus, the nodus/sft runtime does the same thing from a manifest. Its runtime reference lists epochs (default 1, range 0.01 to 100), evalSteps, saveSteps, lrScheduler with constant_with_warmup, and validation.patience (default 3). The training guide adds data.validationFraction, which splits by prompt so repeated prompts stay on one side, and exports the checkpoint with the lowest validation loss.
apiVersion: nodus.dev/v1beta1 kind: TrainingJob metadata: name: epoch-search spec: runtime: nodus/sft model: uri: hf://Qwen/Qwen3-0.6B@c1899de289a04d12100db370d81485cdf75e47ca data: volume: support-chats path: chats.jsonl format: JSONL validationFraction: "0.1" parameters: epochs: 5 evalSteps: 1125 saveSteps: 1125 lrScheduler: constant_with_warmup validation: patience: 2 minImprovement: 0.001 maxCostUSD: "5.00" Here evalSteps: 1125 is half an epoch for the 40,000-row example below, so a patience of 2 stops the run one epoch after the best checkpoint. The guide requires evalSteps to be no larger than saveSteps. Price it, run it and read the result:
$ nodus apply -f epoch-search.yaml --dry-run -o yaml $ nodus apply -f epoch-search.yaml $ nodus cp tj/epoch-search:outputs/results.json ./results.json results.json records the starting model's validation loss, the selected loss, the checkpoint it came from and whether it improved. By default, the run fails its evaluation if the selected checkpoint doesn't beat the starting model, and the weights stay downloadable. When maxCostUSD is reached, the run is suspended, not failed, and raising the cap resumes it from its checkpoint. Training is in Beta on Nodus, so check the guide for field changes.
What does an epoch sweep cost?
One run with a checkpoint per epoch costs less than half as much as separate runs. Here is the arithmetic for a 40,000-row dataset:
- A 10% validation split leaves about 36,000 training rows. The
nodus/sftdefaults of 4 examples per step and 4 accumulation steps put 16 rows in each optimizer step, so one epoch is 2,250 steps. - The runtime publishes the step time its dry-run estimates use: 0.45 seconds on an H100. One epoch is 2,250 x 0.45 = 1,012.5 seconds, or 0.28125 hours.
- The NVIDIA H100 SXM is listed at $2.60/hr on the Nodus pricing page, so one epoch costs 0.28125 x $2.60 = $0.73.
- Separate runs of 1, 2, 3 and 5 epochs train 11 epochs in total: 11 x $0.73125 = $8.04.
- One 5-epoch run with a checkpoint each epoch trains 5: $3.66, which is 55% less.
- If validation loss bottoms out at epoch 2 and early stopping ends the run after epoch 3, you pay for 3 epochs: $2.19, which is 73% less than separate runs.

Separate runs repeat the early epochs four times. One run with checkpoints pays for each epoch once.
These are GPU time only. Validation passes, model caching and data preparation add a little, and the published step times come from the runtime's own nightly measurement runs. A larger model or longer examples will take longer per step, so the dry run on your own manifest is the number to trust. The ratios hold either way, because they count epochs, not seconds.
The GPU choice matters as much as the epoch count. The same 2,250-step epoch, at each GPU's published step time and its price on the Nodus pricing page, costs $0.22 on an RTX 4090 listed at $0.290/hr, $0.27 on an RTX A6000 at $0.333/hr, $0.48 on an A100 80GB at $1.090/hr and $0.50 on an L40S at $0.793/hr.

For a small model that fits, the cheapest GPU finds your epoch count for under a quarter per pass.
Prices checked December 5, 2026.
To compare learning rates or LoRA ranks as well, a Nodus Sweep runs one Job across a matrix of parameter values under one maxCostUSD cap. Keep epochs out of that matrix and let early stopping handle them. Our guide to hyperparameter sweeps on cloud GPUs shows how to prune losing trials early.
FAQ
Is one epoch enough to fine-tune an LLM?
Often, yes, for datasets past about 10,000 rows, especially with LoRA at a learning rate near 2e-4. Check that validation loss was still falling at the end. If it was, a second epoch is likely to help.
Can you fine-tune for less than one epoch?
Yes. Hugging Face accepts a fractional num_train_epochs, and the Nodus sft runtime accepts epochs as low as 0.01, or a fixed steps count. Fractional epochs make sense on very large datasets where the model converges before it has seen every row.
Should DPO or other preference training use more epochs than SFT?
There is no fixed rule, so start low and watch held-out results closely. InstructGPT trained its reward model for a single epoch because multiple epochs quickly overfit it, and the Nodus training guide warns that lower DPO loss does not prove better generated answers. Judge preference runs on held-out prompts, not on loss.
Does validation loss tell you which checkpoint is best?
It tells you when memorization starts, which is enough to pick an epoch count. The final call should come from a task metric on a test set the run never touched, because both LIMA and InstructGPT found loss and output quality could disagree.
Originally published on the Nodus blog.
