![](assets/repo-main.png)
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 Framework • Getting Started • LLM Roadmap • Contributing
For a holistic evaluation, we will make use of the Evaluation Framework that contains 4 pillars:
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
You can start fine-tuning your choice of LLM in 4 easy steps:
-
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
-
Install relevant packages
git clone https://github.com/georgian-io/LLM-Finetuning-Hub.git cd LLM-Finetuning-Hub/ pip install -r requirements.txt
-
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
-
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.
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 | ❌ |
If you would like to contribute to this project, we recommend following the "fork-and-pull" Git workflow.
- Fork the repo on GitHub
- Clone the project to your own machine
- Commit changes to your own branch
- Push your work back up to your fork
- 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!
If you have any questions, please reach out to: