LLaMA-Factory is a unified and efficient fine-tuning framework for large language models (LLMs) and vision-language models (VLMs), and its related paper has been accepted by ACL 2024. The project is used by companies such as Amazon, NVIDIA, and Alibaba Cloud, and provides a zero-code CLI and Web UI, allowing users to easily fine-tune over 100 large language models.
[Main Capabilities] Supported models include LLaMA, LLaVA, Mistral, Mixtral-MoE, Qwen3, Qwen3-VL, DeepSeek, Gemma, GLM, Phi, etc. Integrated methods cover (continual) pre-training, (multimodal) supervised fine-tuning, reward modeling, PPO, DPO, KTO, ORPO, etc. Scalable resources include 16-bit full fine-tuning, freeze fine-tuning, LoRA, and 2/3/4/5/6/8-bit QLoRA implemented through AQLM/AWQ/GPTQ/LLM.int8/HQQ/EETQ. Advanced algorithms include GaLore, BAdam, APOLLO, Adam-mini, Muon, OFT, DoRA, LongLoRA, LLaMA Pro, Mixture-of-Depths, LoRA+, LoftQ, and PiSSA. Practical techniques include FlashAttention-2, Unsloth, Liger Kernel, KTransformers, RoPE scaling, NEFTune, and rsLoRA. Broad tasks cover multi-turn dialogue, tool use, image understanding, visual grounding, video recognition, audio understanding, etc. Experiment monitoring supports LlamaBoard, TensorBoard, Wandb, MLflow, SwanLab, etc. Faster inference supports OpenAI-style API, Gradio UI, and CLI with vLLM worker or SGLang worker.
[Usage] Installation is required. Optional dependencies include metrics and deepspeed, and the installation command is: pip install -e . && pip install -r requirements/metrics.txt -r requirements/deepspeed.txt. Additional dependencies for specific features are located in examples/requirements/. Support is provided for creating an isolated Python environment via uv. A Docker image is provided, built on Ubuntu 22.04 (x86_64), CUDA 12.4, Python 3.11, PyTorch 2.6.0, and Flash-attn 2.7.4, available at https://hub.docker.com/r/hiyouga/llamafactory/tags . Cloud training supports Colab (free), PAI-DSW (free trial), and AMD GPU Cloud (free quota). Documentation is located at https://llamafactory.readthedocs.io/en/latest/,AMD GPU documentation and ASCEND NPU documentation are also provided. The official blog is https://blog.llamafactory.net/en/。
[Applicable Scenarios] Suitable for researchers, developers, and enterprise teams that need to fine-tune large language models and vision-language models, covering multiple workflows from zero-code Web UI operation to advanced command-line configuration, and supporting local training and cloud training.
[Limitations] Except for official links, other websites are unauthorized third-party websites. Some datasets need to be confirmed before use, and it is recommended to log in with a Hugging Face account. If the latest features cannot be used, you need to pull the latest code and reinstall LlamaFactory. For base models, the template parameter can be default, alpaca, vicuna, etc., but instruct/chat models must use the corresponding template. If a model has both reasoning and non-reasoning versions, please use the _nothink suffix to distinguish them, for example qwen3 and qwen3_nothink. The same template must be used during training and inference. Some models require installing the main branch of transformers and using DISABLE_VERSION_CHECK=1 to skip version checking, or installing a specific version of transformers. For the complete list of supported models, please refer to constants.py, and custom chat templates can also be added in template.py.