Daily Tech Briefing
AI 科技速览

每天 5 分钟内学习 AI。获取最新的人工智能新闻,理解其重要性,并学习如何将其应用于您的工作。

AI 快讯
MarkTechPost · 2026/7/22 09:16:40

Unsloth vs Axolotl vs TRL vs LLaMA-Factory: A Fine-Tuning Framework Comparison on Speed, VRAM, and Multi-GPU

AI 中文解读
大模型微调框架迎来大比拼!Unsloth、Axolotl、TRL和LLaMA-Factory四个开源项目,虽然底层都依赖PyTorch和Hugging Face,但各有绝活。Unsloth通过手工重写底层内核,在单卡训练上做到了速度翻倍,比如Llama 3.1 8B模型训练快了2倍,某些MoE模型甚至快了7倍多;Axolotl则擅长组合并行策略,适合多GPU集群;TRL是其他框架依赖的组件库,提供各种训练器;LLaMA-Factory主打零代码操作,支持超100种模型,甚至有个图形界面。 这些竞争对普通人意味着什么呢?简单说,就是AI模型训练的门槛越来越低、成本越来越小。以前公司想训练自己的聊天机器人或客服系统,可能需要花大价钱买顶级显卡,等上好几天。现在有了这些开源框架,用普通显卡也能快速完成,速度提升几倍到几十倍,内存占用还更少。最终结果就是,更多中小企业甚至个人都能训练出专属AI助手,比如定制化写作文档、自动生成报告、个性化学习辅导等。如果你在用任何AI产品,背后模型的迭代速度会更快,响应更流畅,而你自己也可能很快就能在自家电脑上「调教」出一个专属AI了。
Four open source projects dominate LLM fine-tuning today. Unsloth, Axolotl, TRL, and LLaMA-Factory all wrap the same underlying PyTorch and Hugging Face stack. They diverge on where they spend engineering effort. Unsloth rewrites kernels. Axolotl composes parallelism strategies. TRL defines the trainer APIs the others build on. LLaMA-Factory optimizes for breadth of model coverage and zero-code operation. This comparison covers three axes engineers actually hit: training throughput, peak VRAM, and multi-GPU scaling. Understand each framework TRL is the reference implementation layer. It ships SFTTrainer, DPOTrainer, GRPOTrainer, KTOTrainer, RewardTrainer, and RLOOTrainer. Axolotl and LLaMA-Factory both call into it. The current stable release line is v1.8.0. Unsloth replaces parts of the modeling code with hand-written Triton kernels. Backpropagation steps are manually derived rather than autograd-generated. Hugging Face’s own writeup notes accuracy degradation is 0% versus standard QLoRA, because no approximations are introduced. Axolotl is a YAML-driven wrapper over Transformers, PEFT, TRL, Accelerate, and DeepSpeed. Its differentiator is composability of parallelism strategies, not kernel work. LLaMA-Factory is an ACL 2024 system demonstration paper with a Gradio web UI called LlamaBoard. The repository covers 100+ LLMs and VLMs. (function(){ var f=document.getElementById('mtp-ft-frame'); if(!f) return; window.addEventListener('message',function(e){ if(!e.data||typeof e.data!=='object') return; var h=e.data.mtpFtHeight; if(typeof h==='number'&&h>200&&h Speed Unsloth: kernel-level gains on a single GPU Unsloth's published benchmarks show 2x training speed for Llama 3.1 8B and Llama 3.3 70B. The setup used the Alpaca dataset, batch size 2, and gradient accumulation 4. QLoRA ran at rank 32 on all linear layers. The MoE results are larger. Unsloth fine-tuned unsloth/gpt-oss-20b-BF16 on an NVIDIA B200. It reports 712.33 ms per step at 8K context, versus 5,226.86 ms for Transformers v5. That is a 7.3x gap. At 4K the gap is 4.82x, and at 1K it is only 1.37x. The trend direction is model-dependent, and Unsloth's docs scope this claim to gpt-oss. There, the speedup grows with sequence length, credited to Flex Attention and the MoE kernels. Qwen3-30B-A3B on B200 runs the other way. Its reported speedup falls from 1.7x at 1K to 1.1x at 16K. Memory savings move the opposite direction, rising from about 2% to 15%. Qwen3-30B-A3B on H100 reaches up to 1.77x. GLM-4.7-Flash on RTX PRO 6000 reaches 2.1x. A collaboration with AMD measured Llama-3.1-8B LoRA SFT at 2.07 s/step. TRL plus FlashAttention-2 took 2.87 s/step, a 1.39x gap with matching loss curves. Axolotl: kernels borrowed, parallelism native Axolotl added custom Triton kernels and autograd functions for LoRA in February 2025, explicitly citing Unsloth as inspiration. They are opt-in through lora_mlp_kernel, lora_qkv_kernel, and lora_o_kernel. Recent release notes add SonicMoE LoRA support. It delivers up to 1.45x speedup and 30% memory reduction over a grouped_mm baseline. That figure is for Qwen3.5-35B-A3B 8-bit LoRA on a single H100 SXM. Axolotl also ships FlashAttention 2/3/4, xFormers, Flex Attention, SageAttention, Liger Kernel, Cut Cross Entropy, and ScatterMoE. TRL: the baseline everyone measures against TRL is usually the reference point rather than the winner on raw single-GPU throughput. It compensates with breadth of memory and speed levers documented in Reducing Memory Usage and Speeding Up Training. Those levers include packing, padding-free batching, truncation, Liger Kernel, and vLLM sleep mode for GRPO. TRL also has a first-party Unsloth integration, so the two are not mutually exclusive. LLaMA-Factory: speed by delegation LLaMA-Factory does not write its own kernels. It exposes other people's work through config flags. Setting use_unsloth: true activates
分享
阅读原文