Git Product home page Git Product logo

llm-finetuning-hub's Introduction

LLM Finetuning Hub

LLM Finetuning Hub contains code and insights to finetune various large language models for your use-case.

We stress-test both open-source and close-source LLMs through our Evaluation Framework to check their applicability for real-life business use-cases. Finetuning LLMs has never been easier.

Evaluation FrameworkGetting StartedLLM RoadmapContributing

Evaluation Framework

For a holistic evaluation, we will make use of the Evaluation Framework that contains 4 pillars:

  • Performance
  • Time to Train
  • Cost to Train
  • Inferencing

For each of the above four pillars, we are sharing our codebase and insights to:

  • Assist you to leverage LLMs for your business needs and challenges
  • Decide which LLM suits your needs from a performance and cost perspective
  • Boost reproducibility efforts which are becoming increasingly difficult with LLMs

We are providing scripts that are ready-to-use for:

  • Finetuning LLMs on your proprietary dataset via PeFT methodologies such as LoRA and Prefix Tuning
  • Performing hyperparameter optimization to get the maximum performance out of these models

Getting Started

You can start fine-tuning your choice of LLM in 4 easy steps:

  1. Setup conda environment

    wget https://repo.anaconda.com/miniconda/Miniconda3-py38_4.11.0-Linux-x86_64.sh
    bash Miniconda3-py38_4.11.0-Linux-x86_64.sh
    source ~/.bashrc
    conda create --name llm_finetuning python=3.9
    conda activate llm_finetuning
  2. Install relevant packages

    git clone https://github.com/georgian-io/LLM-Finetuning-Hub.git
    cd LLM-Finetuning-Hub/
    pip install -r requirements.txt
  3. Finetune your LLM of choice

    For instance, to finetune Falcon-7B, do the following:

    cd falcon/ # navigate to Falcon folder
    python falcon_classification.py --lora_r 8 --epochs 5 --dropout 0.1 # finetune Falcon-7B on newsgroup classification dataset
    python falcon_classification_inference.py --experiment <experiment folder> # evaluate finetuned Falcon
    python falcon_summarization.py --lora_r 8 --epochs 1 --dropout 0.1 # finetune Falcon-7B on samsum chat dataset
    python falcon_summarization_inference.py --experiment <experiment folder> # evaluate finetuned Falcon

    For instance, to finetune Flan-T5-Large, do the following:

    cd flan-t5/ # navigate to Flan-T5 folder
    python flan_classification.py --peft_method prefix --prefix_tokens 20 --epochs 5 # finetune Flan-T5 on newsgroup dataset
    python flan_classification_inference.py --experiment <experiment folder> # evaluate finetuned Flan-T5
    python flan_summarization.py --peft_method lora --lora_r 8 --epochs 1 # finetune Flan-T5 on samsum chat dataset
    python flan_summarization_inference.py --experiment <experiment folder> # evalute finetuned Flan-T5
  4. Zero-shot and Few-shot your LLM of choice

    For instance, to use Falcon-7B on newsgroup classification task, do the following:

    python falcon_baseline_inference.py --task_type classification --prompt_type zero-shot
    python falcon_baseline_inference.py --task_type classification --prompt_type few-shot

    To use Falcon-7B on samsum summarization task, do the following:

    python falcon_baseline_inference.py --task_type summarization --prompt_type zero-shot
    python falcon_baseline_inference.py --task_type summarization --prompt_type few-shot

NOTE: All of our experiments were conducted on the AWS EC2 instance: g5.2xlarge. It has one 24GB Nvidia GPU, and is sufficient to finetune the LLMs in this repository.

LLM Roadmap

Our plan is to perform these experiments on all the LLMs below. To that end, this is a tentative roadmap of the LLMs that we aim to cover, and their corresponding codebase and README links:

LLM Benchmarked? Open-Source? README Codebase
Flan-T5 Link Folder
Falcon Link Folder
RedPajama Link Folder
Llama-2
OpenLlama
SalesForce XGen
Mosaic MPT
Cerebras
Writer Palmyra
OpenAI GPT-3.5
Google PaLM
Inflection Pi

Contributing

If you would like to contribute to this project, we recommend following the "fork-and-pull" Git workflow.

  1. Fork the repo on GitHub
  2. Clone the project to your own machine
  3. Commit changes to your own branch
  4. Push your work back up to your fork
  5. Submit a Pull request so that we can review your changes

NOTE: Be sure to merge the latest from "upstream" before making a pull request!

Correspondence

If you have any questions, please reach out to:

llm-finetuning-hub's People

Contributors

rohitsaha avatar mariia-georgian avatar georgianpoole avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.