Post

LLama Factory is one of the best Open-source tools

LLM Finetuning

๐ŸŽŠ If youโ€™re new to fine-tuning LLMs and prefer a GUI based or low-code approach, LlaMA-Factory is one of the best open-source tools out there!

Iโ€™ve been trying out different open-source fine-tuning tools, and I really enjoyed using LlaMA Factory. It has a user-friendly GUI option (suitable for single GPU use-cases) which makes fine-tuning super easy with just a few clicks.

Some other cool features include:

  • ๐ŸŒ Diverse LLM Support
    • Supports a wide range of models, including all versions of LLaMA, Mistral, Mixtral-MoE, Qwen, Gemma and more.
  • ๐Ÿ›  Tuning Methods
    • Offers a comprehensive suite of integrated methods for fine-tuning, including continuous pre-training, supervised fine-tuning, reward modeling, PPO , DPO, and ORPO (Online Reinforcement Policy Optimization).
  • ๐Ÿ”Ž PEFT methods & Quantization
    • Supports 32-bit full-tuning and popular PEFT approaches like 16-bit freeze-tuning, 16-bit LoRA, and 2/4/8-bit QLoRA and many more!
  • ๐Ÿ“ˆ Advanced Fine-Tuning Approaches
    • Implements advanced algorithms such as GaLore, BAdam, DoRA , LongLoRA Mixture-of-Depths, LoRA+, LoftQ and Agent Tuning. These algorithms contribute to improved model performance and efficiency during fine-tuning.
  • ๐Ÿงโ€โ™€๏ธ Practical Tricks
    • Incorporates practical tricks and techniques to enhance fine-tuning outcomes, including FlashAttention-2, Unsloth, RoPE scaling, NEFTune and many more. These tricks help address common challenges and optimize model performance in various scenarios.
  • ๐Ÿ“Š Experiment Monitors
    • Supports multiple experiment monitoring tools, including LlamaBoard, TensorBoard, Wandb (Weights & Biases), MLflow, and more.
  • ๐Ÿš€ Faster Inference
    • Facilitates faster inference through OpenAI-style API, Gradio UI, and CLI with vLLM worker. This enables seamless deployment and usage of fine-tuned models in real-world applications with efficient inference capabilities.

The GitHub repo already has about 17k stars! Go check it out here: https://github.com/hiyouga/LLaMA-Factory?tab=readme-ov-file

๐Ÿšจ I share #genai content daily, follow along for the latest updates! #llms #finetuning ( from Aishwarya Naresh Reganti)

Translate to Korean

๐ŸŽŠ LLM์„ ๋ฏธ์„ธ ์กฐ์ •ํ•˜๋Š” ๊ฒƒ์ด ์ฒ˜์Œ์ด๊ณ  GUI ๊ธฐ๋ฐ˜ ๋˜๋Š” ๋กœ์šฐ ์ฝ”๋“œ ์ ‘๊ทผ ๋ฐฉ์‹์„ ์„ ํ˜ธํ•˜๋Š” ๊ฒฝ์šฐ LlaMA-Factory๋Š” ์ตœ๊ณ ์˜ ์˜คํ”ˆ ์†Œ์Šค ๋„๊ตฌ ์ค‘ ํ•˜๋‚˜์ž…๋‹ˆ๋‹ค!

๋‹ค์–‘ํ•œ ์˜คํ”ˆ ์†Œ์Šค ๋ฏธ์„ธ ์กฐ์ • ๋„๊ตฌ๋ฅผ ์‚ฌ์šฉํ•ด ๋ณด์•˜๊ณ  LlaMA Factory๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด ์ •๋ง ์ฆ๊ฑฐ์› ์Šต๋‹ˆ๋‹ค. ์‚ฌ์šฉ์ž ์นœํ™”์ ์ธ GUI ์˜ต์…˜(๋‹จ์ผ GPU ์‚ฌ์šฉ ์‚ฌ๋ก€์— ์ ํ•ฉ)์ด ์žˆ์–ด ๋ช‡ ๋ฒˆ์˜ ํด๋ฆญ๋งŒ์œผ๋กœ ๋งค์šฐ ์‰ฝ๊ฒŒ ๋ฏธ์„ธ ์กฐ์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๋‹ค๋ฅธ ๋ฉ‹์ง„ ๊ธฐ๋Šฅ์€ ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค.

  • ๐ŸŒ ๋‹ค์–‘ํ•œ LLM ์ง€์›
    • LLaMA, Mistral, Mixtral-MoE, Qwen, Gemma ๋“ฑ์˜ ๋ชจ๋“  ๋ฒ„์ „์„ ํฌํ•จํ•œ ๋‹ค์–‘ํ•œ ๋ชจ๋ธ์„ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค.
  • ๐Ÿ›  ํŠœ๋‹ ๋ฐฉ๋ฒ•
    • ์ง€์†์ ์ธ ์‚ฌ์ „ ํ•™์Šต, ์ง€๋„ ๋ฏธ์„ธ ์กฐ์ •, ๋ณด์ƒ ๋ชจ๋ธ๋ง, PPO, DPO ๋ฐ ORPO(Online Reinforcement Policy Optimization)๋ฅผ ํฌํ•จํ•˜์—ฌ ๋ฏธ์„ธ ์กฐ์ •์„ ์œ„ํ•œ ํฌ๊ด„์ ์ธ ํ†ตํ•ฉ ๋ฐฉ๋ฒ• ์ œํ’ˆ๊ตฐ์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.
  • ๐Ÿ”Ž PEFT ๋ฐฉ๋ฒ• & ์–‘์žํ™”
    • 32๋น„ํŠธ ํ’€ ํŠœ๋‹ ๋ฐ 16๋น„ํŠธ ๋™๊ฒฐ ํŠœ๋‹, 16๋น„ํŠธ LoRA ๋ฐ 2/4/8๋น„ํŠธ QLoRA ๋“ฑ๊ณผ ๊ฐ™์€ ๋„๋ฆฌ ์‚ฌ์šฉ๋˜๋Š” PEFT ์ ‘๊ทผ ๋ฐฉ์‹์„ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค!
  • ๐Ÿ“ˆ ๊ณ ๊ธ‰ ๋ฏธ์„ธ ์กฐ์ • ์ ‘๊ทผ ๋ฐฉ์‹
    • GaLore, BAdam, DoRA, LongLoRA Mixture-of-Depths, LoRA+, LoftQ ๋ฐ Agent Tuning๊ณผ ๊ฐ™์€ ๊ณ ๊ธ‰ ์•Œ๊ณ ๋ฆฌ์ฆ˜์„ ๊ตฌํ˜„ํ•ฉ๋‹ˆ๋‹ค. ์ด๋Ÿฌํ•œ ์•Œ๊ณ ๋ฆฌ์ฆ˜์€ ๋ฏธ์„ธ ์กฐ์ • ์ค‘์— ๋ชจ๋ธ ์„ฑ๋Šฅ๊ณผ ํšจ์œจ์„ฑ์„ ๊ฐœ์„ ํ•˜๋Š” ๋ฐ ๊ธฐ์—ฌํ•ฉ๋‹ˆ๋‹ค.
  • ๐Ÿง โ™€๏ธ ์‹ค์šฉ์ ์ธ ํŠธ๋ฆญ
    • FlashAttention-2, Unsloth, RoPE ์Šค์ผ€์ผ๋ง, NEFTune ๋“ฑ์„ ํฌํ•จํ•œ ๋ฏธ์„ธ ์กฐ์ • ๊ฒฐ๊ณผ๋ฅผ ํ–ฅ์ƒ์‹œํ‚ค๊ธฐ ์œ„ํ•ด ์‹ค์šฉ์ ์ธ ํŠธ๋ฆญ๊ณผ ๊ธฐ์ˆ ์„ ํ†ตํ•ฉํ•ฉ๋‹ˆ๋‹ค. ์ด๋Ÿฌํ•œ ํŠธ๋ฆญ์€ ์ผ๋ฐ˜์ ์ธ ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๊ณ  ๋‹ค์–‘ํ•œ ์‹œ๋‚˜๋ฆฌ์˜ค์—์„œ ๋ชจ๋ธ ์„ฑ๋Šฅ์„ ์ตœ์ ํ™”ํ•˜๋Š” ๋ฐ ๋„์›€์ด ๋ฉ๋‹ˆ๋‹ค.
  • ๐Ÿ“Š ์‹คํ—˜ ๋ชจ๋‹ˆํ„ฐ
    • LlamaBoard, TensorBoard, Wandb(๊ฐ€์ค‘์น˜ ๋ฐ ํŽธํ–ฅ), MLflow ๋“ฑ์„ ํฌํ•จํ•œ ์—ฌ๋Ÿฌ ์‹คํ—˜ ๋ชจ๋‹ˆํ„ฐ๋ง ๋„๊ตฌ๋ฅผ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค.
  • ๐Ÿš€ ๋” ๋น ๋ฅธ ์ถ”๋ก 
    • vLLM ์ž‘์—…์ž๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ OpenAI ์Šคํƒ€์ผ API, Gradio UI ๋ฐ CLI๋ฅผ ํ†ตํ•ด ๋” ๋น ๋ฅธ ์ถ”๋ก ์„ ์šฉ์ดํ•˜๊ฒŒ ํ•ฉ๋‹ˆ๋‹ค. ์ด๋ฅผ ํ†ตํ•ด ํšจ์œจ์ ์ธ ์ถ”๋ก  ๊ธฐ๋Šฅ์„ ํ†ตํ•ด ์‹ค์ œ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์—์„œ ๋ฏธ์„ธ ์กฐ์ •๋œ ๋ชจ๋ธ์„ ์›ํ™œํ•˜๊ฒŒ ๋ฐฐํฌํ•˜๊ณ  ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

GitHub ์ €์žฅ์†Œ์—๋Š” ์ด๋ฏธ ์•ฝ 17๊ฐœ์˜ ๋ณ„์ด ์žˆ์Šต๋‹ˆ๋‹ค! ์—ฌ๊ธฐ์—์„œ ํ™•์ธํ•˜์‹ญ์‹œ์˜ค : https://github.com/hiyouga/LLaMA-Factory?tab=readme-ov-file

This post is licensed under CC BY 4.0 by the author.