
Fine-Tune Any LLM Without Writing Training Code: HuggingFace AutoTrain in 5 Minutes
Chris Harper
2 min read
Aug 13, 2026 · 04:04 UTC
HuggingFace AutoTrain lets you SFT, DPO, or ORPO any open model in a web UI or single autotrain command — no training code, no server, adapter pushed to Hub automatically.
What you'll be able to do after this:
- Launch a supervised fine-tuning (SFT), DPO, or ORPO run on any open LLM without writing training code
- Prepare your dataset as JSONL and configure LoRA hyperparameters through AutoTrain's UI or a single CLI command
- Have the fine-tuned LoRA adapter automatically pushed to your HuggingFace Hub repo when training finishes
AutoTrain Advanced is HuggingFace's hosted fine-tuning platform. Pick a model, upload data, configure a few sliders — and it writes and runs the training loop for you. No SFTTrainer boilerplate, no CUDA debugging, no manual Hub upload.
Step 1: Prepare your dataset
AutoTrain expects JSONL with one training example per line. For SFT:
{"prompt": "Classify the sentiment of this review:", "completion": "Positive"}
{"prompt": "Summarize in one sentence:", "completion": "A bear visited a bakery."}
For DPO, each row needs prompt, chosen, and rejected fields.
Step 2: Create a project
Go to huggingface.co/autotrain → Create new project → LLM → pick your base model (e.g. Qwen/Qwen2.5-7B-Instruct or meta-llama/Llama-3.2-3B-Instruct) → upload JSONL → pick hardware (ZeroGPU is free for small runs) → Start Training.
AutoTrain provisions compute, installs the right CUDA stack, and streams training logs in the Space UI.
Or use the CLI (works locally or in CI):
pip install autotrain-advanced
autotrain llm \
--train \
--model "Qwen/Qwen2.5-3B-Instruct" \
--data-path ./data \
--trainer sft \
--lora-r 16 \
--lora-alpha 32 \
--lr 2e-4 \
--batch-size 2 \
--gradient-accumulation 4 \
--num-train-epochs 3 \
--push-to-hub \
--username your-hf-username \
--token $HF_TOKEN
When training ends the LoRA adapter lands in your Hub repo — ready to merge with peft.merge_and_unload() or serve directly via AutoTrain's inference endpoint.
Safe starting defaults:
--lora-r 16,--lora-alpha 32: balanced expressivity vs. adapter size--lr 2e-4: standard for QLoRA SFT--batch-size 2+--gradient-accumulation 4: effective batch size 8, fits on a 16GB GPU
Sources: AutoTrain LLM Fine-tuning — HuggingFace Docs · Low-Code LLM Alignment with AutoTrain — HuggingFace Blog