hiyouga/LlamaFactory
Unified Efficient Fine-Tuning of 100+ LLMs & VLMs (ACL 2024)
LlamaFactory – One‑click fine‑tuning for dozens of LLMs
What it is – LlamaFactory is an open‑source Python toolkit that lets you fine‑tune, evaluate, and serve more than 100 large language models (LLMs) with virtually no code. It ships a command‑line interface and a Gradio‑based web UI (the LlamaBoard) so you can run experiments locally or in the cloud (Colab, SageMaker, AMD/Ascend GPUs, etc.).
Why it matters – Training or adapting modern LLMs usually requires deep knowledge of distributed training, quantization, and optimizer tricks. LlamaFactory bundles a huge collection of state‑of‑the‑art methods (LoRA, QLoRA, FlashAttention‑2, GaLore, BAdam, ORPO, DPO, PPO, KTO, …) and makes them selectable via a simple YAML config. The result is a “zero‑code” workflow that still gives you access to the latest research.
Core capabilities
| Category | What you can do |
|---|---|
| Model coverage | LLaMA‑1/2/3/4, LLaVA, Mistral, Mixtral‑MoE, Qwen 2/3/2.5‑VL, DeepSeek, Gemma 3, GLM‑4, Phi‑4, InternLM, MiniCPM‑o, PaliGemma, etc. |
| Training paradigms | Full‑parameter, freeze‑tuning, 8‑bit/4‑bit/2‑bit QLoRA, LoRA+, LongLoRA, DoRA, block‑expansion, continuous pre‑training, supervised fine‑tuning, multimodal (image/video/audio) fine‑tuning, reward‑modeling, PPO/DPO/ORPO/KTO, reinforcement‑learning via EasyR1 |
| Optimizers & tricks | GaLore, BAdam, APOLLO, Adam‑mini, Muon, OFT/OFTv2, NEFTune, rsLoRA, RoPE scaling, FlashAttention‑2, Unsloth, Liger‑Kernel, KTransformers, SGLang/vLLM inference back‑ends |
| Hardware support | NVIDIA GPUs, AMD ROCm, Ascend NPU, Intel Gaudi, SageMaker HyperPod, Docker containers, Colab notebooks |
| Monitoring | TensorBoard, Weights & Biases, MLflow, SwanLab, built‑in LlamaBoard UI |
| Deployment | OpenAI‑compatible REST API, Gradio UI, vLLM or SGLang workers for high‑throughput serving |
| Data handling | Built‑in dataset loaders, data‑centric pipelines (DataFlow, DataFlex), automatic packing to avoid contamination |
Typical workflow (quick‑start)
- Install –
pip install llamafactoryor pull the Docker imagehiyouga/llamafactory. - Prepare data – place your training set in a folder or use one of the provided examples (e.g.,
glaive_toolcall_enfor tool‑use). LlamaFactory can also download from ModelScope/Modelers Hub. - Create a config – a short YAML file selects the model, dataset, tuning method (e.g.,
lora), quantization bits, and any special tricks (use_unsloth: true). - Run –
llamafactory train path/to/config.yaml(CLI) or launch the GUI withllamafactory guiand start the job with a few clicks. - Track – metrics appear in LlamaBoard; optionally push logs to WandB/MLflow/SwanLab.
- Serve – after training, run
llamafactory serve path/to/ckpt.yamlto expose an OpenAI‑style endpoint or a Gradio chat interface.
Who should use it?
- Researchers who need to prototype new fine‑tuning recipes without writing boiler‑plate training loops.
- Product teams that want to adapt a public LLM (e.g., Llama 3, Qwen 3) to a domain‑specific corpus quickly.
- Educators & students looking for a ready‑made environment for labs on RL‑HF, preference learning, or multimodal LLMs.
- Ops engineers who prefer a containerised, reproducible pipeline that can run on cloud GPUs, SageMaker, or on‑prem NPU clusters.
Installation & deployment options
- Pip –
pip install llamafactory(addsllamafactoryCLI). - Docker –
docker pull hiyouga/llamafactorythen run with your GPU device mounted. - Colab / DSW – ready‑made notebooks linked in the README for free‑tier experiments.
- vLLM / SGLang – set
infer_backend: vllm(orsglang) in the serving config for up to 2‑3× faster inference.
Community & ecosystem
- Stars & activity – > 1 k GitHub stars, CI tests, frequent releases.
- Industry adoption – used by Amazon, NVIDIA, Alibaba Cloud for production fine‑tuning.
- Support channels – Discord, WeChat groups, official blog, and a growing list of tutorials.
- Citation – a paper “LlamaFactory: Unified Efficient Fine‑Tuning of 100+ Language Models” (arXiv) is provided for academic credit.
TL;DR
LlamaFactory is a comprehensive, zero‑code platform for fine‑tuning a wide variety of LLMs on many hardware back‑ends. It bundles the latest training tricks, offers both CLI and a friendly GUI, supports experiment tracking, and can instantly spin up an OpenAI‑compatible API for serving the resulting model.
Related
- Project
- Project
- Project
- Project
- Project