LlamaFactory logo

LlamaFactory

★★★★½ 4.6/5
Visit site
Category
Others
Pricing
Free

Quick Verdict

LlamaFactory is best for engineers who can state what a base language or vision-language model fails to do and already have authorized data, suitable hardware, and an evaluation plan. It unifies model templates, dataset formats, training stages, parameter-efficient methods, quantization, distributed engines, evaluation, chat, and export behind a WebUI and CLI. That integration removes repeated script work, but the WebUI does not remove the risks of fine-tuning. A wrong conversation template, contaminated data, or weak evaluation can produce a model that demos well and regresses in production.

As of July 21, 2026, the canonical repository is hiyouga/LlamaFactory, and the latest stable release is 0.9.5. Its release adds primary Qwen3.5/3.6 and Gemma 4 support plus Transformers v5 compatibility. The project lists more than 100 LLM and VLM families, continued pre-training, supervised fine-tuning, reward modeling, PPO, DPO, KTO, ORPO, and SimPO, together with Full, Freeze, LoRA, QLoRA, OFT, and QOFT approaches. Framework support only means a model can be loaded or trained; it does not equal permission to use, modify, merge, commercialize, or redistribute that model.

Best For

  • Applied ML teams running domain SFT, continued pre-training, reward-model training, or preference optimization on open-weight models.
  • Engineers moving from a WebUI prototype to reproducible CLI or YAML experiments under version control.
  • Platform teams using DDP, DeepSpeed, FSDP/FSDP2, or Ray across a single machine or cluster.
  • Deployment teams exporting adapters or merged models to vLLM or Ollama after validation.
  • Not ideal for teams without authorized data, a frozen validation set, or a clear behavioral objective. If the requirement is current, source-cited knowledge, test retrieval before fine-tuning.

Key Features

  • WebUI and CLI: llamafactory-cli webui exposes training, evaluation and prediction, chat, and export. CLI and YAML are better for automation and exact experiment records.
  • Multiple training stages: Continued pre-training, multimodal SFT, reward modeling, PPO, DPO, KTO, ORPO, and SimPO cover knowledge adaptation, behavior tuning, and preference learning.
  • Parameter update strategies: Full, Freeze, LoRA, QLoRA, OFT/QOFT, and related techniques such as DoRA or PiSSA present different memory, speed, quality, and compatibility trade-offs.
  • Quantization and acceleration: Low-bit QLoRA, FlashAttention-2, Unsloth integration, Liger Kernel, and other optimizations depend on model architecture, GPU, CUDA, PyTorch, and extension versions.
  • Distributed training: DDP, DeepSpeed, FSDP/FSDP2, and Ray can shard or coordinate work. ZeRO and offload may reduce GPU memory while increasing communication, host-memory, or runtime costs.
  • Model and multimodal templates: Support spans Llama, Qwen, DeepSeek, Gemma, GLM, Mistral, Phi, and image, video, or audio tasks. Training and inference must use a compatible prompt template and processor.
  • Evaluation and export: Load a base model and adapter for evaluation or chat, merge LoRA where permitted, export quantized artifacts, and serve through vLLM, SGLang, or an OpenAI-style endpoint.

Use Cases

  • Domain SFT: Train a LoRA on authorized, de-identified support, legal, or product examples, then compare it with the untouched base model on a held-out set.
  • Preference tuning: Use DPO, KTO, or ORPO for ranked responses, while checking that annotator bias, factual errors, unsafe behavior, and brand quirks were not encoded as preferences.
  • Multimodal adaptation: Train image, video, or audio tasks only when copyright, portrait, privacy, and personal-data rights cover the media and intended deployment.
  • Lower-memory experiments: Official guidance gives roughly 6GB as a starting estimate for 4-bit QLoRA on a 7B model and roughly 120GB for 16-bit full training. Sequence length, batch size, optimizer, activations, attention, and modality can change those numbers substantially.
  • Distributed full training: Use DeepSpeed ZeRO-3 or FSDP/FSDP2 to shard parameters, gradients, and optimizer state, but test checkpoint resume and numerical consistency on a small run first.
  • Post-training deployment: Merge or retain the adapter, export the permitted artifact, and test it in the target backend. If the goal is only to run an existing model locally, Transformers or Ollama may be simpler.

Pricing

LlamaFactory framework code is Apache 2.0 licensed and has no official paid edition. The meaningful costs are GPU time, storage, dataset cleaning and annotation, experiment tracking, evaluation, security review, and serving. Release 0.9.5 moves toward Python 3.11 and newer Transformers and PyTorch combinations. Pin the release tag, image, CUDA stack, dependency lock, dataset version, and model hash; do not let changes on main silently enter a production training job.

Licensing has several independent layers. Apache 2.0 governs the covered framework code. Base weights can use Llama, Gemma, Qwen, or other custom licenses with different acceptable-use and redistribution terms. Every listed dataset may have separate copyright, privacy, geographic, and purpose limits. Whether an adapter, merged checkpoint, or generated output can be sold or published depends on the base-model terms, data rights, intended use, and applicable law. Maintain a bill of materials with source URLs, exact license versions, hashes, training configuration, and evaluation evidence.

Pros

  • The WebUI helps discover a working configuration, while CLI and YAML support reproducible training.
  • Broad model, template, training-stage, and PEFT coverage reduces repeated integrations.
  • Hardware estimates and distributed recipes help reject obviously infeasible experiments early.
  • Evaluation, chat, adapter merge, export, and inference integrations cover much of the post-training path.
  • Apache-licensed framework code, active development, and bilingual community material support self-managed use.

Cons

  • The model, template, quantization, optimizer, kernel, and backend matrix is too large for every combination to be equally tested.
  • WebUI convenience can hide missing data versions, seeds, commands, and evaluation design.
  • Memory tables are estimates, not guarantees; long contexts and multimodal batches can exceed them quickly.
  • Framework licensing does not grant model, dataset, adapter, merged-weight, or output rights.
  • Fine-tuning may reduce general ability, safety, or factual accuracy even when training loss improves.

Alternatives

ToolBetter forMain strengthMain trade-off
LlamaFactoryTeams wanting WebUI and CLI across many models and methodsBroad stages, templates, and export workflowLarge compatibility matrix to control
UnslothEfficient single-machine LoRA and QLoRAStrong speed and memory optimizationNarrower end-to-end training orchestration
AxolotlYAML-first engineering training pipelinesMature configuration-driven workflowLess approachable for non-technical users
Transformers TrainerResearchers needing maximum code-level controlFoundational ecosystem and flexibilityMore manual integration of methods and templates
Hugging Face AutoTrainTeams preferring a managed training workflowLess local environment maintenanceCost, data transfer, and customization limits

FAQ

Is LlamaFactory free?

The framework code is free under Apache 2.0, but compute, storage, data work, evaluation, and deployment are not. A base model or dataset may also impose terms that the framework license does not remove.

Should I use the WebUI or CLI?

Use the WebUI to understand parameters and complete a first controlled experiment. For repeatable work, maintain YAML and run the CLI while recording the Git tag, environment, dataset version, model hash, seed, and evaluation command.

Can one consumer GPU fine-tune a model?

Often, if the model is small enough and the experiment uses LoRA or 4-bit QLoRA. The approximately 6GB figure for a 7B 4-bit setup is only a starting estimate. Measure the actual sequence length, batch, optimizer, and checkpoint configuration.

Does Apache 2.0 make a fine-tuned model automatically commercial?

No. It governs LlamaFactory code, not every base model, dataset, adapter, merged weight, or output. Commercial rights must survive all upstream terms and the rights attached to the training material.

Is local fine-tuning private by default?

Not necessarily. Datasets, checkpoints, logs, object storage, temporary files, and experiment trackers create additional copies. External tracking tools may upload prompts or examples unless configured carefully. Apply access, encryption, retention, and deletion controls.

When should I choose RAG instead of fine-tuning?

Choose retrieval first for changing facts and source citations. Fine-tuning is better suited to stable task behavior, formatting, or style when measurable. Production systems often use fine-tuning for behavior and RAG for current evidence.

Bottom Line

LlamaFactory turns a fragmented fine-tuning stack into an approachable WebUI and a reproducible CLI, but results still depend on data quality, evaluation, hardware planning, and a complete rights chain. Begin with one smaller model, one LoRA experiment, and one frozen evaluation set. Compare the base model, retrieval, and fine-tuned result. Merge or deploy only when the improvement repeats, safety regressions are addressed, the environment is reproducible, and model plus dataset terms permit the intended artifact and output use.

Last updated: July 21, 2026

Related tools