llama-factory

Guides fine-tuning of LLMs with LLaMA-Factory using LoRA, QLoRA, and WebUI workflows.

1|Updated Mar 5, 2026
One-click install
npx skills add https://github.com/Clay-HHK/claude-skills --skill llama-factory-clay-hhk
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: llama-factory
Source: https://github.com/Clay-HHK/claude-skills/tree/main/llama-factory
Command: npx skills add https://github.com/Clay-HHK/claude-skills --skill llama-factory-clay-hhk

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires llmtuner, torch, transformers, datasets, peft, accelerate, gradio, and includes references (resource) components.

What problem does it solve? Fine-tuning large language models requires navigating complex training configurations, dataset formats, quantization methods, and distributed setups. This Skill provides expert guidance for LLaMA-Factory, covering everything from installation to deployment so you can fine-tune 100+ models without writing training code from scratch. ## Core Features & Use Cases - No-Code WebUI Fine-Tuning: Launch the Gradio-based WebUI to train, evaluate, chat with, and export models through a visual interface. - Multiple Training Methods: Supports pre-training, SFT, reward modeling, PPO, DPO, KTO, and ORPO with LoRA, QLoRA (2-8 bit), GaLore, BAdam, DoRA, and PiSSA. - Distributed & Accelerated Training: Configure DeepSpeed ZeRO, FSDP, DDP, FlashAttention-2, Unsloth, and Liger Kernel for multi-GPU and multi-node setups, including Ascend NPU support. - Use Case: Fine-tune Llama-3-8B on a custom Alpaca-format dataset with 4-bit QLoRA on a single GPU, then merge the adapter and export a GPTQ-quantized model for deployment. ## Quick Start Ask the assistant to show you how to fine-tune a Llama model with LoRA using LLaMA-Factory, including the YAML configuration and launch command.

Frequently Asked Questions about llama-factory

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fine-tune a Llama model with LLaMA-Factory?▼

Create a YAML config specifying model_name_or_path, stage (sft), finetuning_type (lora), dataset, and template, then run llamafactory-cli train your_config.yaml. Alternatively, launch the WebUI with llamafactory-cli webui for no-code training.

What dataset formats does LLaMA-Factory support?▼

LLaMA-Factory supports Alpaca and ShareGPT formats for supervised fine-tuning, preference datasets for DPO/reward modeling, KTO datasets with binary labels, and multimodal datasets with images, videos, or audio. Custom datasets must be registered in dataset_info.json.

Does LLaMA-Factory support QLoRA and quantized training?▼

Yes, it supports 2/3/4/5/6/8-bit QLoRA fine-tuning using bitsandbytes, HQQ, and EETQ quantization methods. Set quantization_bit and quantization_method in your config, and use finetuning_type: lora.

How do I merge LoRA adapters in LLaMA-Factory?▼

Run llamafactory-cli export merge_config.yaml with the base model path, adapter path, and template specified. Do not use a quantized base model or set quantization bits when merging; quantize afterward if needed.

Can LLaMA-Factory run on Ascend NPU instead of GPU?▼

Yes, LLaMA-Factory supports Huawei Ascend 910b NPUs via torch-npu, installable by Docker or pip. Replace CUDA_VISIBLE_DEVICES with ASCEND_RT_VISIBLE_DEVICES to select NPU cards for training and inference.

LLaMA-Factory vs Axolotl for LLM fine-tuning?▼

LLaMA-Factory emphasizes a no-code WebUI, broad model support (100+ models), and built-in quantization export, while Axolotl is config-file driven with a different ecosystem. Choose LLaMA-Factory when you want a visual interface and integrated merge/export tooling.