text
stringlengths
0
59.1k
LF[LLaMA Factory] --> MODELS[Model Support]
LF --> METHODS[Training Methods]
LF --> DEPLOY[Deployment]
MODELS --> LLM[100+ LLMs]
MODELS --> VLM[Vision-Language Models]
METHODS --> SFT[Supervised Fine-Tuning]
METHODS --> PREF[Preference Alignment]
METHODS --> LORA[LoRA/QLoRA]
METHODS --> QUANT[Quantization]
PREF --> PPO[PPO]
PREF --> DPO[DPO]
PREF --> KTO[KTO]
PREF --> ORPO[ORPO]
DEPLOY --> API[OpenAI-compatible API]
DEPLOY --> VLLM[vLLM Worker]
DEPLOY --> SGLANG[SGLang Worker]
style LF fill:#121E1B,stroke:#50C878,stroke-width:2px,color:#50C878
style MODELS fill:#0F1A15,stroke:#50C878,stroke-width:2px,color:#50C878
style METHODS fill:#0F1A15,stroke:#50C878,stroke-width:2px,color:#50C878
style DEPLOY fill:#0F1A15,stroke:#50C878,stroke-width:2px,color:#50C878`} />
## Why Use LLaMA‑Factory?
LLaMA-Factory hits a sweet spot between power and usability:
- **Accessible to All Levels**: ML engineers and newcomers can get models training quickly. It exposes cutting-edge research methods while hiding most boilerplate.
- **Compute Efficiency**: The focus on efficiency keeps compute costs under control. Fine-tuning can be computationally intensive, and anything that keeps costs reasonable is valuable.
- **Stay Current**: The maintainers actively incorporate new models and methods. Since it's open-source, the community continually improves it.
> **Note:** LLaMA‑Factory is open‑source and updated frequently. You benefit from the latest research without having to re-implement it yourself. Below are highlights added since spring 2025.
### What's New in 2025?
Recent additions include:
- **Orthogonal Finetuning (OFT) and OFTv2 (Aug 22 2025).** Parameter-efficient tuning methods that constrain updates to an orthogonal subspace, improving memory and compute efficiency. LLaMA-Factory supports both OFT and OFTv2.
- **Intern-S1-mini model support (Aug 20 2025).** Smaller InternLM models (Intern-S1-mini) can be fine-tuned through the toolkit.
- **GPT-OSS model support (Aug 6 2025).** Open-source GPT-OSS models are supported for fine-tuning.
- **New model families.** Earlier 2025 releases added support for GLM-4.1V, Qwen3, InternVL3, Llama 4, Qwen2.5-Omni and other models. Optimizers (Muon, APOLLO) were integrated, and SGLang was added as an inference backend. Support includes audio models (Qwen2-Audio, DeepSeek-R1) and multimodal models (MiniCPM-V).
To use these capabilities, update your repository and refer to the examples in the changelog.
:::tip Update Frequency
LLaMA-Factory receives regular updates. The developers add support for new models, and the open-source community contributes improvements.
:::
## Getting Started
Ready to try LLaMA-Factory? Here's how to get up and running.
### Requirements and Installation
First, check the LLaMA-Factory GitHub for their hardware requirements table (GPU, RAM, etc.) — requirements vary significantly based on model size and the tuning method you choose.
Clone the repository:
```bash
git clone --depth 1 https://github.com/hiyouga/LLaMA-Factory.git
cd LLaMA-Factory
```
Install with pip. It's Python, so use a virtual environment (future you will thank you):
```bash
pip install -e ".[torch,metrics]" # extras like bitsandbytes enable QLoRA
```
They also have extra installation options. For example, `bitsandbytes` for QLoRA, or `vllm` for fast inference.
**Docker alternative**: If Docker is your preference, they provide Dockerfiles in the `docker` directory for CUDA, NPU, and ROCm configurations. This can simplify environment management.
:::important A Note on Production Scale
LLaMA-Factory is excellent for experimentation and fine-tuning, and includes deployment APIs. However, scaling a model to a high-load production environment with significant traffic might still require additional MLOps tools and infrastructure beyond what LLaMA-Factory provides. It gets you very far, but it's worth not...
:::
### Data Preparation
Your data needs to be in a format LLaMA-Factory can read, usually JSON files. You might have customer support dialogues to learn from, or product descriptions you want the model to write in a specific tone.
One key file is `data/dataset_info.json`. You'll edit this to tell LLaMA-Factory about your custom dataset — where it is, what format it's in, etc. The toolkit supports:
- Local JSON files
- Hugging Face datasets
- ModelScope Hub content
Their `data/README.md` is worth reading for this step. It specifies the required formats and includes example datasets showing the structure.
### Running Fine-Tuning
**The CLI way**: For command-line users, you'll run fine-tuning via the `llamafactory-cli` tool:
```bash
llamafactory-cli train examples/train_lora/llama3_lora_sft.yaml
```