← Back to Leaderboard
Lhiyouga

hiyouga/LlamaFactory

A unified Python framework for LLM and VLM fine-tuning with pluggable inference

Engineering Health (Methodology)
A+ · 92/100
Maintenance Activity
● Updated 3d ago
Latest Release
v0.9.5
Commercial License Check
Apache-2.0 · Commercial Friendly

Automated SPDX check for reference only — not legal advice. Disclaimer

Maintenance35/35
Fork Adoption23/25
Release Cadence14/20
License Clarity20/20
DockerCLIGPU
Total Stars
★ 76,384
24h Growth
+28
7d Growth
+86
Forks
9,430

GitHub Star History

Full-history star trajectory from GitHub official history. Switch ranges or hover any point for exact counts.

hiyouga/LlamaFactory Star History (2023-05-28 - 2026-12-04) ALL-TIME STAR HISTORY (2023-05 – 2026-12) +76.4k in 1286d · avg +59/day 80.7k 40.3k 0 2023-05-28: ★ 122023-08-19: ★ 2,7652023-11-11: ★ 5,6782024-02-03: ★ 10,6302024-04-27: ★ 19,2032024-07-20: ★ 26,1552024-10-12: ★ 31,1512025-01-04: ★ 36,0512025-03-29: ★ 44,3422025-06-21: ★ 51,4372025-09-13: ★ 56,9202025-12-06: ★ 62,4992026-02-28: ★ 66,7432026-05-23: ★ 70,8832026-08-15: ★ 73,7672026-12-04: ★ 76,384 ★ 76.4k 2023-05 2025-03 2026-12

Evidence-Backed Technical Brief

AI Deep Review

Architecture & Core Mechanics

LlamaFactory is a Python/PyTorch training framework with an inference layer, not a standalone inference engine. A typical run starts by matching a model family to its input template, then choosing a training objective such as supervised fine-tuning (SFT) or DPO and a parameter-update method such as full tuning or LoRA. These are separate decisions: switching to LoRA changes which parameters are updated, not what the training objective optimizes.

The package uses Hatchling, with source under src/ and separate data/, examples/, and docker/ directories. The CLI and LlamaBoard provide scripted and browser-based workflows respectively. Inference has its own OpenAI-style API, Gradio UI, and CLI, with vLLM and SGLang available as worker integrations. The API is the application integration point; the worker is the execution backend.

Key Capabilities & Differentiators

The model catalog spans text and multimodal families, including Llama, Qwen3-VL, DeepSeek, and Gemma. Model selection includes the template: DeepSeek 3 and DeepSeek R1, for example, use deepseek3 and deepseekr1 respectively. Training covers continued pretraining, multimodal SFT, reward modeling, PPO, DPO, KTO, and ORPO. Supported task types include tool use and image, video, and audio understanding, depending on the chosen model.

The tuning matrix covers 16-bit full tuning, freeze tuning, LoRA, QLoRA, OFT, and QOFT. Quantized LoRA options span 2–8 bits through integrations such as AQLM, AWQ, GPTQ, HQQ, and EETQ. FlashAttention-2 and Liger Kernel are optional acceleration integrations; TensorBoard, W&B, MLflow, and SwanLab cover experiment monitoring. Treat these as choices to validate, not features that can necessarily be combined in one run.

Trade-offs & Limitations

Choose LlamaFactory when the work spans training and inference validation across model families. Compared with maintaining separate training scripts, its shared workflows reduce repeated setup for common experiments. The cost is a larger compatibility surface: a model, template, tuning method, quantizer, and acceleration kernel may each be supported without working together in the combination you want. Validate the exact combination on a small run first.

For serving an existing checkpoint, deploying vLLM or SGLang directly avoids the training framework layer. For training, LoRA reduces trainable state and QLoRA also shrinks the base-weight footprint, but neither eliminates activation memory or makes long contexts cheap. Size training and serving independently. Apache-2.0 applies to the framework; model weights and training data retain their own terms.

Hardware & Deployment Guide

Use Python 3.11 or later; v0.9.4 moved the minimum version past Python 3.9 and 3.10. For a source install, clone the repository and run pip install -e . from its root. The quickstart separately installs metrics dependencies with pip install -r requirements/metrics.txt. The repository includes a docker/ directory, but the available details do not establish a specific image tag or launch command.

For self-hosting, stage the model weights and datasets and check that the GPU runtime matches the quantization, kernel, or serving backend you intend to use. Start with a small training and inference smoke test before adding optional components. For upgrades, v0.9.5 adds support for Qwen3.5, Qwen3.6, and Gemma 4 as well as Transformers v5 compatibility. Pin and test the model, template, and dependency versions together, especially when introducing a new model or worker.

Model adaptation: Family-specific templates include deepseek3, deepseekr1, gemma3, and glm4_moe.
Training objectives: Continued pretraining and multimodal SFT sit alongside reward modeling, PPO, DPO, KTO, and ORPO.
Parameter updates: The training matrix separates full and freeze tuning from LoRA, QLoRA, OFT, and QOFT.
Quantized tuning: QLoRA options span 2–8 bits across integrations including AQLM, AWQ, GPTQ, HQQ, and EETQ; supported combinations vary.
Inference interfaces: OpenAI-style API, Gradio UI, and CLI, with vLLM or SGLang worker integrations.
Release compatibility: v0.9.5 adds Qwen3.5, Qwen3.6, and Gemma 4 support, plus Transformers v5 compatibility.
Best For

Teams comparing LLM or VLM fine-tuning recipes across model families and validating the resulting checkpoints through a local UI, CLI, or self-hosted API.

Skip If

You already have a checkpoint and only need inference serving, or you need a managed service rather than maintaining GPU and backend dependencies.

Reviewed on 2026-12-02 · Grounded in GitHub README, root file tree & releasesMethodology

Quick Start & Installation

DockerCLIGPU
git clone --depth 1 https://github.com/hiyouga/LlamaFactory.git
cd LlamaFactory
pip install -e .
pip install -r requirements/metrics.txt

Comparison vs. Top LLMs & Inference Alternatives

Full comparison →
RepositoryStars7d TrendStackLicenseCore Positioning
LlamaFactory ★76.4k+86PythonApache-2.0A unified Python framework for LLM and VLM fine-tuning with pluggable inference
peft21.9k+32PythonApache-2.0Python/PyTorch adapters for fine-tuning large models without updating base weigh
axolotl12.8k+15PythonApache-2.0YAML-driven GPU trainer for LLM and multimodal post-training
minimind75.4k+3.1kPythonApache-2.0Native PyTorch dense and MoE models for end-to-end LLM training on local GPUs

AI Context Briefing (for Claude / Cursor / Windsurf)

Standardized architecture summary & quickstart commands ready to paste into coding agents.

Raw .md ↗
curl -sL https://repoforai.com/repo/hiyouga/LlamaFactory.md

Embed Star History Chart & Badges in README.md

Full-history Star History SVGs and velocity cards on GitHub Camo: drop-in replacement for OSSInsight and Star History widgets.

hiyouga/LlamaFactory Star History on RepoForAI

Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).

Frequently Asked Questions about LlamaFactory

How do I connect a fine-tuning run to an existing application?

Select the model and its matching template, then choose a training objective and a tuning method. The CLI is the natural fit for scripted runs; LlamaBoard provides a browser-based workflow. For application integration, LlamaFactory exposes an OpenAI-style inference API and supports vLLM or SGLang workers. Validate the endpoints, model features, and request options your client actually uses rather than assuming full OpenAI API parity.

How should I size GPU memory for training and serving?

There is no single VRAM requirement. On the Python/PyTorch stack, training memory depends on model size, precision, sequence length, batch size, and tuning method; multimodal inputs can add to that load. LoRA reduces trainable state, while QLoRA also quantizes the base weights. Run a small job at your intended sequence length before sizing the training hardware, and test serving separately at your target context length and concurrency.

Can I self-host it commercially and distribute the resulting model?

LlamaFactory's Apache-2.0 license generally permits commercial use and self-hosting of the framework, subject to its terms. It does not grant rights to model weights, datasets, or all optional dependencies. Review their terms separately, especially if you plan to redistribute an adapter or checkpoint or expose the tuned model as a commercial service.

When should I use LlamaFactory instead of vLLM or SGLang directly?

If the model is already trained and you only need to serve it, start by evaluating vLLM or SGLang directly. Use LlamaFactory when you also need to prepare model-specific inputs, compare training methods, or test checkpoints across model families. Its vLLM and SGLang integrations provide access to those engines; they do not establish a throughput advantage over running them directly.

Upstream README & Documentation

This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.

Maintaining hiyouga/LlamaFactory? Pin to Homepage + competitor /alternatives pages with a custom Cloud/Demo CTA.Feature hiyouga/LlamaFactory on Homepage & Alternatives ($19)
WEEKLY BREAKOUT DIGEST

Top 10 Breakout Open-Source AI Repos, Every Thursday

Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.

Zero spam · 1-click unsubscribe · Privacy Policy

Saved in your browser · Export Markdown RFC tables or jump into /vs compare