Skip to main content
QUICK REVIEW

[Paper Review] LlamaFactory: Unified Efficient Fine-Tuning of 100+ Language Models

Yaowei Zheng, Richong Zhang|arXiv (Cornell University)|Mar 20, 2024
Natural Language Processing TechniquesComputer Science12 citations
TL;DR

LlamaFactory presents a modular framework and web UI for unified, efficient fine-tuning of hundreds of LLMs, integrating multiple optimization and computing techniques. It supports 100+ models and 50+ datasets with minimal coding.

ABSTRACT

Efficient fine-tuning is vital for adapting large language models (LLMs) to downstream tasks. However, it requires non-trivial efforts to implement these methods on different models. We present LlamaFactory, a unified framework that integrates a suite of cutting-edge efficient training methods. It provides a solution for flexibly customizing the fine-tuning of 100+ LLMs without the need for coding through the built-in web UI LlamaBoard. We empirically validate the efficiency and effectiveness of our framework on language modeling and text generation tasks. It has been released at https://github.com/hiyouga/LLaMA-Factory and received over 25,000 stars and 3,000 forks.

Motivation & Objective

  • Demonstrate a unified framework that integrates diverse efficient fine-tuning methods for hundreds of LLMs.
  • Provide modular components (Model Loader, Data Worker, Trainer) to minimize integration cost across models and datasets.
  • Offer a web-based, code-free interface (LlamaBoard) for easy configuration and execution of fine-tuning tasks.
  • Show empirical evidence of efficiency gains in memory, speed, and task performance across language modeling and text generation tasks.

Proposed method

  • Develop a three-module architecture (Model Loader, Data Worker, Trainer) with a model registry, data description specification, and plug-and-play fine-tuning methods.
  • Integrate optimization techniques (e.g., Freeze-tuning, GaLore, LoRA, DoRA, LoRA+, QLoRA) and computation techniques (mixed precision, activation checkpointing, flash attention, S2 attention, quantization, Unsloth) into a cohesive framework.
  • Attach adapters automatically via a registry, support 8-bit/4-bit quantization with QLoRA compatibility, and enable precision adaptation across devices (CUDA, Ascend, AMD).
  • Provide a flexible training setup that supports FT, SFT, RLHF, and DPO, including a model-sharing RLHF approach to run on consumer devices.
  • Utilize LlamaBoard (Gradio-based) for codeless configuration, monitoring, evaluation, and multilingual UI support.

Experimental results

Research questions

  • RQ1How can diverse efficient fine-tuning methods be unified to work across 100+ LLMs with minimal integration effort?
  • RQ2What are the memory, throughput, and perplexity trade-offs of combining multiple optimization and computation techniques?
  • RQ3Can RLHF and other training paradigms be performed on consumer hardware within a unified framework?
  • RQ4How does the framework perform on downstream text generation tasks in terms of ROUGE and other metrics across multiple models?
  • RQ5Does a web-based UI enable effective, codeless fine-tuning and evaluation at scale?

Key findings

  • QLoRA consistently yields the smallest memory footprint compared to other methods.
  • LoRA and QLoRA deliver strong downstream ROUGE performance across several models and datasets, with some model-task exceptions.
  • GaLore offers improved perplexity on large models, while LoRA shows advantages on smaller models.
  • The framework enables fine-tuning of hundreds of LLMs with materials like a 0.6 bytes per parameter memory footprint when using certain optimization/computation combinations.
  • LlamaFactory demonstrates significant throughput gains and supports distributed training via DeepSpeed ZeRO to reduce memory usage.
  • LlamaFactory is widely adopted in the community, with substantial GitHub engagement and usage in open-source models.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.