wikis / Unsloth / wiki / syntheses / end-to-end-fine-tune.md view as markdown report a mistake
End-to-End: Fine-tune to Deployment
The complete Unsloth workflow, tying the concept pages together.
1. Decide & pick a model
Confirm fine-tuning fits (vs RAG/prompting β fine-tuning-basics). Choose a base model sized to your GPU and task.
2. Set up
Install locally, or just open the matching notebook (zero setup).
3. Prepare data
Build a clean dataset in chat/instruction format; apply the model's chat template; hold out an eval slice. Quality beats quantity.
4. Configure
Load with FastLanguageModel (unsloth-library), add QLoRA (4-bit) adapters, set hyperparameters: rank/alpha, target_modules, LR ~2e-4, 1β3 epochs, effective batch size via grad-accum.
5. Train
Run SFTTrainer for supervised fine-tuning, or GRPO for reasoning/RL (with a robust reward function β watch for reward hacking). Monitor train vs eval loss for overfitting.
6. Evaluate
Test the fine-tune with in-framework inference on held-out prompts before exporting.
7. Save & export
Save adapters (iterate), or merge to 16-bit/4-bit, or export GGUF (Dynamic 2.0 quant) / Ollama Modelfile / push to the Hub.
8. Deploy
Run/serve: Ollama or LM Studio (local), vLLM (production throughput), llama.cpp (edge/CPU). Or use the Studio UI for the whole loop.
Common pitfalls
Wrong/missing chat template (garbled outputs), too many epochs (overfit), LR too high (instability/loss spikes), OOM (drop to QLoRA, lower batch/seq-len, raise grad-accum), and RL reward hacking. Model-specific gotchas: the per-model guides (model-catalog-and-notebooks).
