PEFT
By Hugging Face
PEFT (Parameter-Efficient Fine-Tuning) is an open-source Hugging Face library that adapts large pretrained models to new tasks by updating only a small subset of parameters instead of the full network. It implements methods such as LoRA,…
Definition
PEFT (Parameter-Efficient Fine-Tuning) is an open-source Hugging Face library that adapts large pretrained models to new tasks by updating only a small subset of parameters instead of the full network. It implements methods such as LoRA, prefix tuning, and prompt tuning, letting practitioners fine-tune multi-billion-parameter language and vision models on a single consumer or workstation GPU rather than a large training cluster.
Overview
Fine-tuning a modern foundation model in the conventional way means updating every weight in the network, which for a model with tens of billions of parameters requires enormous GPU memory to hold gradients, optimizer states, and activations. PEFT addresses this by freezing the pretrained backbone and inserting a much smaller number of trainable parameters that are learned for the new task, cutting memory and storage requirements by orders of magnitude while retaining most of the accuracy of full fine-tuning. Mechanically, PEFT wraps a base model loaded through Hugging Face Transformers and injects adapter modules according to the chosen method. With LoRA, low-rank matrices are added alongside existing linear layers and only those matrices receive gradient updates; with prompt or prefix tuning, a set of learnable virtual tokens is prepended to the input and optimized instead of any model weight. Because the base weights never change, several task-specific adapters, each just a few megabytes, can be trained and swapped in and out against the same frozen backbone. PEFT sits between full fine-tuning and pure prompting in the adaptation spectrum. Full fine-tuning gives maximum flexibility and typically the highest ceiling on task performance but costs the most in compute, memory, and storage per task. Prompting requires no training at all but is limited by what can be expressed in context and by the base model's existing capabilities. PEFT methods recover much of full fine-tuning's benefit for a fraction of the cost, and they compose well with quantization libraries such as bitsandbytes to push the memory floor even lower. In practice, teams use PEFT to specialize a shared foundation model for many downstream tasks or customers without maintaining a full copy of the model per task. A common workflow loads a base model in 4-bit or 8-bit precision, attaches a LoRA configuration through PEFT, trains on a small labeled dataset, and then either merges the adapter into the base weights for deployment or serves it separately for multi-tenant inference. The library integrates directly with the Transformers `Trainer` API and with accelerate for multi-GPU setups. The trade-offs are real: PEFT methods can underperform full fine-tuning on tasks that require substantial shifts in model behavior, such as teaching genuinely new knowledge or reasoning patterns, and their configuration choices (rank, target modules, learning rate) require some tuning of their own. Adapter proliferation also adds operational complexity in serving. Teams that need the highest possible accuracy on a single, well-resourced task and can afford full fine-tuning compute may still prefer that route, while PEFT is the default choice for cost-constrained or multi-task adaptation.
Key Features
- Implements LoRA, prefix tuning, prompt tuning, and adapter-based methods in one API
- Freezes the base model and trains only a small set of new parameters
- Integrates directly with Hugging Face Transformers and the Trainer API
- Works alongside quantization libraries to fine-tune on limited GPU memory
- Produces small, swappable adapter checkpoints instead of full model copies
- Supports merging trained adapters back into base weights for deployment
- Compatible with accelerate for distributed and multi-GPU training
- Applicable across language, vision, and multimodal transformer architectures
Use Cases
Alternatives
Frequently Asked Questions
From the Blog
The Hugging Face Stack: Hub, Transformers, Datasets and PEFT
The Hugging Face stack is five or six libraries that each own one stage of a model's life: the Hub stores artefacts, Transformers loads and runs them, Datasets feeds them, PEFT adapts them cheaply, Accelerate distributes the training loop, and Spaces exposes the result. This guide maps each boundary so you know which tool to reach for.
Read More AI & TechnologyFine-Tuning LLMs: A Practical Guide
Fine-tuning lets you adapt a pre-trained language model to your specific domain, style, or task — without training from scratch. This guide explains when fine-tuning is the right choice, how LoRA makes it affordable, and how to run a fine-tuning job with Hugging Face PEFT.
Read More