PEFT
A Python library for fine-tuning LLMs and diffusion models with less compute and storage, using adapters and quantization under Apache 2.0.

PEFT is a library for developers adapting pretrained AI models on their own hardware. It trains a small portion of a model's parameters to reduce the compute and storage costs of full fine-tuning.
- Model adaptation: Use LoRA, soft prompts or IA3 to adapt pretrained models for specific tasks without training every parameter.
- Smaller checkpoints: Keep task-specific adapters instead of a complete model copy for each dataset, then load, switch or merge adapters for inference.
- Quantized training: Combine PEFT methods with quantization to reduce memory use, including QLoRA for LLMs and LoRA with 8-bit quantization for Whisper speech recognition.
- Language and diffusion models: Work with Transformers for model training and inference, Diffusers for Stable Diffusion adapters, and TRL for preference training and RLHF.
The Python library is open source under Apache 2.0. Its Accelerate integration supports distributed training and inference on GPUs, TPUs and Apple Silicon. A supported example fine-tunes Llama-2-7b with QLoRA on a 16GB GPU; that example isn't a general hardware requirement for every model. The Transformers integration supports loading and switching adapters, but adapter merging requires PEFT functionality outside that integration.