Fine-tuning, RLHF & Alignment·Question 8 of 61Basic

What are the key hyperparameters for fine-tuning, and what are sensible starting values?

Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.

Model answer: the part to lead with

The ones that matter, in order:

Learning rate - the highest-leverage knob, and it differs by regime:

  • Full fine-tuning: ~1e-5 to 5e-5 (often 1e-5-2e-5 for larger models). Too high and you get loss spikes and forgetting.
  • LoRA/QLoRA: ~1e-4 to 2e-4 - roughly 10× higher, because you're training a small freshly-initialized subnetwork, not perturbing 7B tuned weights.
Full worked answer

The ones that matter, in order:

Learning rate - the highest-leverage knob, and it differs by regime:

  • Full fine-tuning: ~1e-5 to 5e-5 (often 1e-5-2e-5 for larger models). Too high and you get loss spikes and forgetting.
  • LoRA/QLoRA: ~1e-4 to 2e-4 - roughly 10× higher, because you're training a small freshly-initialized subnetwork, not perturbing 7B tuned weights.

Epochs: 1-3 is the sweet spot for most SFT; small datasets sometimes tolerate up to ~5 with LoRA. More epochs on small data = memorisation. Watch held-out loss, not train loss.

Schedule and warmup: cosine or linear decay with ~3% (up to 10%) warmup steps. Warmup matters because Adam's second-moment estimates are garbage early; skipping it causes early loss spikes.

Effective batch size: 16-128 sequences typically, achieved via per-device batch × gradient accumulation × data parallelism. Larger batches stabilise gradients but flatten per-step learning; if you change batch size significantly, revisit LR.

Sequence length and packing: set max length to cover your real data (check the token-length histogram - don't truncate 20% of your responses silently). Packing concatenates multiple short examples into one sequence to avoid wasting compute on padding - big throughput win for short-example datasets, but requires correct per-example loss masking and (ideally) block-diagonal attention so examples don't attend to each other.

LoRA-specific: r (8-64), alpha (≈ r or 2r), dropout (0-0.1), target modules (all attention projections; add MLP for more capacity).

What I'd actually do: take the framework defaults (TRL/Axolotl are sane), sweep LR over 3 values on a subset, train 1-2 epochs, and pick by held-out eval - not train loss. Hyperparameter heroics matter far less than data quality.

What a good answer covers

  • Learning rate - the highest-leverage knob, and it differs by regime
  • Too high and you get loss spikes and forgetting
  • Epochs: 1-3 is the sweet spot for most SFT; small datasets sometimes tolerate up to ~5 with LoRA
  • More epochs on small data = memorisation
  • Watch held-out loss, not train loss

Key terms: Learning rate · Epochs · Schedule and warmup · Effective batch size · Sequence length and packing · Packing · LoRA-specific · What I'd actually do

Interviewer follow-ups to expect

  1. Why do LoRA runs tolerate ~10× higher LR than full fine-tuning?

  2. Your loss curve has a spike at step 50 and never recovers - what do you check?

Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep