LLM-FineTuning-Large-Language-Models  by rohan-paul

LLM fine-tuning examples and techniques

Created 2 years ago
564 stars

Top 57.0% on SourcePulse

GitHubView on GitHub
Project Summary

This repository offers a comprehensive collection of practical techniques and code examples for fine-tuning Large Language Models (LLMs). It caters to AI researchers, engineers, and practitioners looking to adapt pre-trained LLMs for specific tasks and datasets, providing hands-on notebooks and explanations of key concepts.

How It Works

The project leverages popular libraries like Hugging Face Transformers, PEFT (Parameter-Efficient Fine-Tuning), and Unsloth for efficient model adaptation. It demonstrates various fine-tuning methods such as QLoRA, ORPO, and DPO, alongside quantization techniques like GPTQ and 4-bit precision to reduce memory footprint and accelerate inference. The approach emphasizes practical implementation through Colab notebooks, making advanced LLM customization accessible.

Quick Start & Requirements

  • Install: Primarily uses Hugging Face libraries, typically installed via pip install transformers peft bitsandbytes accelerate. Specific examples may require additional libraries like unsloth, bitsandbytes, datasets, gradio, langchain.
  • Prerequisites: Python 3.8+, PyTorch. GPU with sufficient VRAM is highly recommended for fine-tuning, with specific examples targeting 24GB+ GPUs for larger models. CUDA 11.8+ is often required for optimized performance.
  • Resources: Setup involves cloning the repository and running provided notebooks. Resource requirements vary significantly based on the model size and fine-tuning method, ranging from moderate for smaller models to substantial for larger ones.
  • Links: YouTube Video Explanations

Highlighted Details

  • Demonstrates fine-tuning of Llama-3, Mistral, CodeLlama, and Phi models.
  • Covers advanced techniques like ORPO, DPO, and KV Cache for long context.
  • Includes explanations of core LLM concepts: quantization, LoRA rank, RopE, and chat templates.
  • Features practical applications like web scraping with LLMs and building chatbots.

Maintenance & Community

The project is maintained by Rohan Paul, an active AI educator with a large following on Twitter and YouTube. The repository is frequently updated with new techniques and model fine-tuning examples.

Licensing & Compatibility

The repository's code and examples appear to be primarily under a permissive license, likely MIT or Apache 2.0, given the nature of the libraries used and the open-source community focus. However, specific model licenses (e.g., Llama 3) must be adhered to. Compatibility with commercial or closed-source projects is generally high, provided underlying model licenses are respected.

Limitations & Caveats

While comprehensive, the repository focuses on practical demonstrations rather than a unified framework. Users may need to adapt code for specific production environments. Some notebooks might require specific versions of libraries or significant GPU resources, which are not always explicitly detailed for every example.

Health Check
Last Commit

7 months ago

Responsiveness

Inactive

Pull Requests (30d)
0
Issues (30d)
0
Star History
3 stars in the last 30 days

Explore Similar Projects

Starred by Chip Huyen Chip Huyen(Author of "AI Engineering", "Designing Machine Learning Systems"), Junyang Lin Junyang Lin(Core Maintainer at Alibaba Qwen), and
3 more.

Alpaca-CoT by PhoebusSi

0.1%
3k
IFT platform for instruction collection, parameter-efficient methods, and LLMs
Created 2 years ago
Updated 1 year ago
Starred by Casper Hansen Casper Hansen(Author of AutoAWQ), Yineng Zhang Yineng Zhang(Inference Lead at SGLang; Research Scientist at Together AI), and
5 more.

xtuner by InternLM

0.2%
5k
LLM fine-tuning toolkit for research
Created 2 years ago
Updated 22 hours ago
Starred by Junyang Lin Junyang Lin(Core Maintainer at Alibaba Qwen), Vincent Weisser Vincent Weisser(Cofounder of Prime Intellect), and
25 more.

alpaca-lora by tloen

0.0%
19k
LoRA fine-tuning for LLaMA
Created 2 years ago
Updated 1 year ago
Feedback? Help us improve.