Library for industrial alignment.
- What is Turbo-Alignment?
- Key Features
- Supported Methods
- Implemented metrics
- How to Use
- Installation
- Development
- Library Roadmap
- FAQ
- License
Turbo-Alignment is a library designed to streamline the fine-tuning and alignment of large language models, leveraging advanced techniques to enhance efficiency and scalability.
- ๐ Comprehensive Metrics and Logging: Includes a wide range of metrics such as self-bleu, KL divergence, diversity, etc. all supported out of the box.
- ๐ ๏ธ Streamlined Method Deployment: Simplifies the process of deploying new methods, allowing for quick development and integration of new datasets and trainers into your pipelines.
- ๐ Ready-to-Use Examples: Convenient examples with configurations and instructions for basic tasks.
- โก Fast Inference: Optimized for quick inference using vLLM.
- ๐ End-to-End Pipelines: From data preprocessing to model alignment.
- ๐ Multimodal Capabilities: Extensive support for various multimodal functions like Vision Language Modeling.
- ๐ RAG Pipeline: Unique pipeline for end2end retrieval-augmented generation training.
Turbo-Alignment supports a wide range of methods for model training and alignment, including:
- ๐ฏ Supervised Fine-Tuning (SFT)
- ๐ Reward Modeling (RM)
- ๐ Direct Preference Optimization (DPO)
- ๐ง Kahneman & Tversky Optimization (KTO) Paired/Unpaired
- ๐ Contrastive Preference Optimization (CPO)
- ๐ญ Identity Preference Optimisation (IPO)
- ๐ Sequence Likelihood Calibration with Human Feedback (SLiC-HF)
- ๐ Statistical Rejection Sampling Optimization (RSO)
- ๐ Vision Language Modeling using MLP from (LLaVA) or C-Abstractor from (HoneyBee) trainable projection model
- ๐๏ธ Retrieval-Augmented Generation (RAG)
- ๐ Distinctness
- ๐ Diversity
- ๐ต Self-BLEU
- โ KL-divergence
- ๐ Reward
- ๐ Length
- ๐ Perplexity
- ๐ METEOR
- ๐ Retrieval Utility
Turbo-Alignment offers an intuitive interface for training and aligning large language models. Refer to the detailed examples and configuration files in the documentation to get started quickly with your specific use case. User-friendly guid available here.
The most crucial aspect is to prepare the dataset in the required format, after which the pipeline will handle everything automatically. Examples of datasets are available here.
- ๐ Dataset type prepare your dataset in the
ChatDataset
, examples available here format. - ๐ Configs Example: sft.json
- ๐ฅ๏ธ CLI launch command
python -m turbo_alignment train_sft --experiment_settings_path tutorials/sft/sft.json
- ๐ Dataset type prepare your dataset in the
PairPreferencesDataset
format, examples available here - ๐ Configs Example: rm.json
- ๐ฅ๏ธ CLI launch command
python -m turbo_alignment train_rm --experiment_settings_path tutorials/rm/rm.json
- ๐ Dataset type prepare your dataset in the
PairPreferencesDataset
format, examples available here - ๐ Configs Example: dpo.json
- ๐ฅ๏ธ CLI launch command
python -m turbo_alignment train_dpo --experiment_settings_path tutorials/dpo/dpo.json
- ๐ Dataset type prepare your dataset in the
KTODataset
format, examples available here - ๐ Configs Examples: kto.json
- ๐ฅ๏ธ CLI launch command
python -m turbo_alignment train_kto --experiment_settings_path tutorials/kto/kto.json
โ๏ธ in progress..
- ๐ Dataset type: prepare your dataset in
ChatDataset
, examples available here format. - ๐ Configs Example: sft_retrieval_utility.json
- ๐ฅ๏ธ CLI launch command:
python -m turbo_alignment train_sft --experiment_settings_path tests/fixtures/configs/train/sft/sft_retrieval_utility.json
- ๐ Dataset type: prepare your dataset in
ChatDataset
, examples available here format. - ๐ Configs Example: end2end.json
- ๐ฅ๏ธ CLI launch command:
python -m turbo_alignment train_rag --experiment_settings_path tests/fixtures/configs/train/rag/end2end.json
- ๐ Dataset type prepare your dataset in the
ChatDataset
, examples available here format. - ๐ Configs Example: base.json
- ๐ฅ๏ธ CLI launch command
python -m turbo_alignment inference_chat --inference_settings_path tests/fixtures/configs/inference/sft/base.json
- ๐ Dataset type prepare your dataset in the
ClassificationDataset
, examples available here format. - ๐ Configs Example: classification_inference.json
- ๐ฅ๏ธ CLI launch command
python -m turbo_alignment inference_classification --inference_settings_path tests/fixtures/configs/inference/classification/base.json
- ๐ Dataset type prepare your dataset in the
MultimodalDataset
, examples available here format. - ๐ Configs Example: llama_llava_clip_pickle.json
- ๐ฅ๏ธ CLI launch command
python -m turbo_alignment inference_multimodal --inference_settings_path tests/fixtures/configs/inference/multimodal/llama_llava_clip_pickle.json
- ๐ Dataset type prepare your dataset in the
ChatDataset
, examples available here format. - ๐ Configs Example: rag_inference.json
- ๐ฅ๏ธ CLI launch command
python -m turbo_alignment inference_rag --inference_settings_path tests/fixtures/configs/inference/rag/base.json
- ๐ Dataset type prepare your dataset in the
SamplingRMDataset
, examples available here format. - ๐ Configs Example: random.json
- ๐ฅ๏ธ CLI launch command
python -m turbo_alignment random_sample --experiment_settings_path tests/fixtures/configs/sampling/base.json
- ๐ Dataset type prepare your dataset in the
SamplingRMDataset
, examples available here format. - ๐ Configs Example: rso.json
- ๐ฅ๏ธ CLI launch command
python -m turbo_alignment rso_sample --experiment_settings_path tests/fixtures/configs/sampling/rso.json
- ๐ Dataset type prepare your dataset in the
SamplingRMDataset
, examples available here format. - ๐ Configs Example: rm.json
- ๐ฅ๏ธ CLI launch command
python -m turbo_alignment rm_sample --experiment_settings_path tests/fixtures/configs/sampling/rm.json
- ๐ Configs Example: merge.json
- ๐ฅ๏ธ CLI launch command
python -m turbo_alignment merge_adapters_to_base --settings_path tests/fixtures/configs/utils/merge_adapters_to_base/merge.json
- ๐ Configs Example: coco2014_clip.json
- ๐ฅ๏ธ CLI launch command
python -m turbo_alignment preprocess_multimodal_dataset --settings_path tutorials/utils/preprocess/coco2014_clip.json
pip install turbo-alignment
For the latest features before an official release:
pip install git+https://github.com/turbo-llm/turbo-alignment.git
Clone the repository for access to examples:
git clone https://github.com/turbo-llm/turbo-alignment.git
Contributions are welcome! Read the contribution guide and set up the development environment:
git clone https://github.com/turbo-llm/turbo-alignment.git
cd turbo-alignment
poetry install
- Increasing number of tutorials
- Enhancing test coverage
- Implementation of Online RL methods like PPO and Reinforce
- Facilitating distributed training
- Incorporating low-memory training approaches
See the Installation section for detailed instructions.
Guides and docs are available here.
Tutorials are available here.
This project is licensed, see the LICENSE file for details.
-
DPO Trainer implementation inspired by Leandro von Werra et al. (2020) TRL: Transformer Reinforcement Learning. GitHub repository, GitHub. Available at: https://github.com/huggingface/trl.
-
Registry implementation inspired by Matt Gardner, Joel Grus, Mark Neumann, Oyvind Tafjord, Pradeep Dasigi, Nelson F. Liu, Matthew Peters, Michael Schmitz, and Luke S. Zettlemoyer. 2017. AllenNLP: A Deep Semantic Natural Language Processing Platform. Available at: arXiv:1803.07640.
-
Liger Kernels implementation inspired by Pin-Lun Hsu and Yun Dai and Vignesh Kothapalli and Qingquan Song and Shao Tang and Siyu Zhu and Steven Shimizu and Shivam Sahni and Haowen Ning and Yanning Chen, 2024. Liger-Kernel: Efficient Triton Kernels for LLM Training. Available at: https://github.com/linkedin/Liger-Kernel.