peft
Parameter-Efficient Fine-Tuning (PEFT)
What it is and what it does
PEFT is a library for efficiently adapting large pretrained models to downstream tasks by training only a small subset of parameters—typically less than 1% of the model—rather than all weights. This dramatically cuts GPU memory and storage costs while achieving performance comparable to full fine-tuning. It integrates with transformers, Diffusers, and Accelerate, making it practical to fine-tune billion-parameter models on consumer-grade hardware.
The library provides multiple parameter-efficient methods (LoRA, QLoRA, soft prompts, IA3, and others) and handles the mechanics of wrapping base models with adapter configurations, managing training, and loading adapters for inference. You prepare a model by passing it through `get_peft_model` with a configuration, train normally, then save only the adapter weights—typically a few megabytes instead of gigabytes.
Use it for:
- Fine-tune a 7B or 12B parameter LLM on a 16GB consumer GPU using QLoRA and 8-bit quantization.
- Train task-specific adapters for multiple datasets without storing full model copies for each task.
- Adapt Stable Diffusion or other diffusion models with LoRA while keeping memory footprint under 10GB.
- Deploy inference with multiple task-specific adapters loaded from the same base model.
- Reduce checkpoint storage from gigabytes to megabytes by saving only adapter weights.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
PEFT implements parameter-efficient fine-tuning methods (LoRA, QLoRA, and others) that adapt large pretrained language models by training only a small fraction of parameters instead of all weights, dramatically reducing memory and compute requirements.
Yes. PEFT is production-stable, actively maintained, widely adopted in the Hugging Face ecosystem, has no known vulnerabilities, and solves a genuine problem—making large model fine-tuning accessible on modest hardware. Install it if you need to adapt pretrained models efficiently; skip it only if you are doing full-model training or not fine-tuning at all.
Install
peft on PyPI
pip
pip install peftuv
uv add peftpoetry
poetry add peftInstalling peft
Before you install
Low friction install with a pure-Python wheel. Depends on torch, transformers, and accelerate—all widely used and actively maintained. The package itself is actively developed (last commit 2026-08-14) with 21546 GitHub stars and production-stable status.
License in practice
Licensed under Apache 2.0 (permissive), which allows commercial and private use without restriction. You may use, modify, and distribute PEFT freely provided you include the license notice.
Quickstart
pip install peft
from transformers import AutoModelForCausalLM
from peft import LoraConfig, TaskType, get_peft_model
model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-3B-Instruct")
peft_config = LoraConfig(r=16, lora_alpha=32, task_type=TaskType.CAUSAL_LM)
model = get_peft_model(model, peft_config)
model.print_trainable_parameters()
Requires PyTorch and transformers installed; GPU memory requirements vary by model size but are significantly lower than full fine-tuning.
Verify before relying
- Specific PEFT methods supported beyond LoRA, QLoRA, and IA3 mentioned in the description.
- Compatibility with non-transformer model architectures or custom models.
- Performance overhead or latency impact during inference with loaded adapters.
Package facts
| License | Apache (permissive) |
| Python support | supports the current Python release (>=3.10.0) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 10 — numpy, packaging, psutil, pyyaml, torch, transformers, tqdm, accelerate, safetensors, huggingface-hub |
| Maintenance | actively maintained — 17 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 11,618,527/month — #1,378 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: peft-0.20.0-py3-none-any.whl
Keywords: deep, learning
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
adaptersAdapters adds parameter-efficient fine-tuning…
permissive · top 15,000 on PyPI
lycoris-loraImplements parameter-efficient fine-tuning…
permissive · top 15,000 on PyPI
loralibloralib provides PyTorch modules that implement…
permissive · top 15,000 on PyPI
transformer-smaller-training-vocabReduces transformer model vocabulary to only…
permissive · top 15,000 on PyPI
llamafactoryLLaMA Factory provides a unified framework for…
permissive · top 15,000 on PyPI
trlTRL provides trainer classes for post-training…
permissive · top 5,000 on PyPI
ms-swiftms-swift is a framework for training,…
permissive · top 15,000 on PyPI
setfitSetFit fine-tunes Sentence Transformers for…
permissive · top 15,000 on PyPI
optimum-intelOptimum Intel bridges Hugging Face Transformers…
permissive · top 15,000 on PyPI
unsloth-zooUnsloth Zoo provides utilities for fine-tuning…
copyleft · top 5,000 on PyPI