π€ PEFT, or Parameter-Efficient Fine-Tuning (PEFT), is a library for efficiently adapting pre-trained language models (PLMs) to various downstream applications without fine-tuning all the modelβs parameters. PEFT methods only fine-tune a small number of (extra) model parameters, significantly decreasing computational and storage costs because fine-tuning large-scale PLMs is prohibitively costly. Recent state-of-the-art PEFT techniques achieve performance comparable to that of full fine-tuning.
PEFT is seamlessly integrated with π€ Accelerate for large-scale models leveraging DeepSpeed and Big Model Inference.
Start here if you're new to π€ PEFT to get an overview of the library's main features, and how to train a model with a PEFT method.
Practical guides demonstrating how to apply various PEFT methods across different types of tasks like image classification, causal language modeling, automatic speech recognition, and more. Learn how to use π€ PEFT with the DeepSpeed and Fully Sharded Data Parallel scripts.
Get a better theoretical understanding of how LoRA and various soft prompting methods help reduce the number of trainable parameters to make training more efficient.
Technical descriptions of how π€ PEFT classes and methods work.
The tables provided below list the PEFT methods and models supported for each task. To apply a particular PEFT method for a task, please refer to the corresponding Task guides.
Model | LoRA | Prefix Tuning | P-Tuning | Prompt Tuning | IA3 |
---|---|---|---|---|---|
GPT-2 | β | β | β | β | β |
Bloom | β | β | β | β | β |
OPT | β | β | β | β | β |
GPT-Neo | β | β | β | β | β |
GPT-J | β | β | β | β | β |
GPT-NeoX-20B | β | β | β | β | β |
LLaMA | β | β | β | β | β |
ChatGLM | β | β | β | β | β |
Model | LoRA | Prefix Tuning | P-Tuning | Prompt Tuning | IA3 |
---|---|---|---|---|---|
T5 | β | β | β | β | β |
BART | β | β | β | β | β |
Model | LoRA | Prefix Tuning | P-Tuning | Prompt Tuning | IA3 |
---|---|---|---|---|---|
BERT | β | β | β | β | β |
RoBERTa | β | β | β | β | β |
GPT-2 | β | β | β | β | |
Bloom | β | β | β | β | |
OPT | β | β | β | β | |
GPT-Neo | β | β | β | β | |
GPT-J | β | β | β | β | |
Deberta | β | β | β | ||
Deberta-v2 | β | β | β |
Model | LoRA | Prefix Tuning | P-Tuning | Prompt Tuning | IA3 |
---|---|---|---|---|---|
BERT | β | β | |||
RoBERTa | β | β | |||
GPT-2 | β | β | |||
Bloom | β | β | |||
OPT | β | β | |||
GPT-Neo | β | β | |||
GPT-J | β | β | |||
Deberta | β | ||||
Deberta-v2 | β |
Model | LoRA | Prefix Tuning | P-Tuning | Prompt Tuning | IA3 |
---|---|---|---|---|---|
Stable Diffusion | β |
Model | LoRA | Prefix Tuning | P-Tuning | Prompt Tuning | IA3 | |
---|---|---|---|---|---|---|
ViT | β | |||||
Swin | β |
We have tested LoRA for ViT and Swin for fine-tuning on image classification. However, it should be possible to use LoRA for any ViT-based model from π€ Transformers. Check out the Image classification task guide to learn more. If you run into problems, please open an issue.
Model | LoRA | Prefix Tuning | P-Tuning | Prompt Tuning | IA3 |
---|---|---|---|---|---|
Blip-2 | β |
As with image-to-text models, you should be able to apply LoRA to any of the segmentation models. Itβs worth noting that we havenβt tested this with every architecture yet. Therefore, if you come across any issues, kindly create an issue report.
Model | LoRA | Prefix Tuning | P-Tuning | Prompt Tuning | IA3 |
---|---|---|---|---|---|
SegFormer | β |