← Back to Leaderboard
Phuggingface

huggingface/peft

Python/PyTorch adapters for fine-tuning large models without updating base weights

Engineering Health (Methodology)
A+ · 97/100
Maintenance Activity
● Updated today
Latest Release
v0.22.0
Commercial License Check
Apache-2.0 · Commercial Friendly

Automated SPDX check for reference only — not legal advice. Disclaimer

Maintenance35/35
Fork Adoption22/25
Release Cadence20/20
License Clarity20/20
GPU
Total Stars
★ 21,946
24h Growth
+4
7d Growth
+32
Forks
2,706

GitHub Star History

Full-history star trajectory from GitHub official history. Switch ranges or hover any point for exact counts.

huggingface/peft Star History (2022-12-15 - 2026-12-04) ALL-TIME STAR HISTORY (2022-12 – 2026-12) +21.9k in 1450d · avg +15/day 23.2k 11.6k 0 2022-12-15: ★ 12023-03-18: ★ 1,4142023-06-17: ★ 6,8072023-09-16: ★ 9,2852023-12-16: ★ 11,0942024-03-16: ★ 12,7092024-06-15: ★ 14,2482024-09-14: ★ 15,4412024-12-14: ★ 16,3442025-03-15: ★ 17,4352025-06-14: ★ 18,4522025-09-13: ★ 19,2802025-12-13: ★ 20,0122026-03-14: ★ 20,5762026-06-13: ★ 21,1312026-09-12: ★ 21,5972026-12-04: ★ 21,946 ★ 21.9k 2022-12 2024-12 2026-12

Evidence-Backed Technical Brief

AI Deep Review

Architecture & Core Mechanics

PEFT is a Python/PyTorch library that adapts an existing model rather than replacing its training or inference runtime. For LoRA, get_peft_model takes a loaded base model and a method-specific configuration, attaches trainable low-rank parameters to selected modules, and leaves the base weights frozen. save_pretrained writes the adapter artifact; PeftModel.from_pretrained attaches it to the corresponding base model for inference. The model still exposes generation through generate.

Method configuration and module selection are the main extension points. Transformers supports adapter lifecycle operations directly, Diffusers integrates adapter management for diffusion pipelines, and Accelerate supports distributed training and inference. The requirements list includes torch, transformers, accelerate, safetensors, and bitsandbytes. The repository separates source, examples, method comparisons, and tests into src/, examples/, method_comparison/, and tests/.

Key Capabilities & Differentiators

PEFT covers LoRA, soft prompts, and IA3, with examples spanning Qwen language generation, Whisper speech recognition, and Stable Diffusion. In the Qwen2.5-3B-Instruct example, LoRA with rank 16 and alpha 32 trains 0.1193% of model parameters. In the A100 80 GB training comparison, T0-3B uses 14.4 GB of GPU memory with PyTorch LoRA versus 47.14 GB for full fine-tuning. The corresponding LoRA checkpoint is 19 MB versus 11 GB for the full model.

Quantized workflows include Llama-2-7B QLoRA with TRL on a 16 GB GPU and Whisper large-v2 with LoRA and 8-bit quantization. For Stable Diffusion v1.4, the comparison reports 27.5 GB of GPU memory for full fine-tuning, 15.5 GB for LoRA, and 8.12 GB for LoRA with gradient checkpointing, with an 8.8 MB adapter checkpoint. These figures describe individual training setups, not inference requirements.

Trade-offs & Limitations

Compared with full fine-tuning, PEFT reduces trainable state and per-task storage but limits how the pretrained model can change. The T0-3B LoRA example scores 0.863 on the reported task. The table does not include a matched full-fine-tuned T0-3B result, so it cannot establish quality parity. Offloading also shifts memory demand rather than eliminating it: for mt0-xxl, PyTorch LoRA uses 56 GB GPU and 3 GB CPU memory, versus 22 GB GPU and 52 GB CPU with DeepSpeed CPU offload.

Transformers' adapter API is sufficient for routine loading and switching, but it does not expose all native PEFT features, such as merging. Separate adapters preserve switching and base-model reuse; merging a supported adapter is an option when deploying a fixed variant. Neither a small checkpoint nor a low trainable-parameter count implies faster generation. PEFT supplies model-side adaptation, not a serving endpoint or scheduler.

Hardware & Deployment Guide

Install with pip install peft and run it inside the Python model process. The Transformers inference path loads the base model and tokenizer, attaches a local adapter with PeftModel.from_pretrained, then calls generate. For offline use, stage the dependencies, base weights, tokenizer files, and adapter locally. For GPU deployment, validate PyTorch against the accelerator environment and check the quantization backend if used. Test peak memory with the intended sequence length, batch size, and inference concurrency rather than sizing from the adapter checkpoint.

Release v0.22.0 adds Partial Connection Adaptation (PaCA). For distributed checkpointing, v0.21.3 gathers only adapter weights when saving a DTensor tensor-parallel model, avoiding a gather of the entire sharded model. Release v0.21.2 fixes an encoder-decoder compatibility issue with Transformers 5.18.0 and later. Pin and test the version pair for the target architecture, including an adapter save-and-reload check before rollout.

Training scope: The Qwen2.5-3B-Instruct LoRA example trains 0.1193% of model parameters with rank 16 and alpha 32.
Training memory: T0-3B uses 14.4 GB of GPU memory with PyTorch LoRA versus 47.14 GB with full fine-tuning in the A100 80 GB comparison.
Checkpointing: The T0-3B LoRA checkpoint is 19 MB versus 11 GB for the full model; inference still requires the base weights.
Adapter lifecycle: Transformers supports add_adapter, load_adapter, and set_adapter; PEFT directly exposes merging for supported adapters.
Quantized training: A Llama-2-7B QLoRA example uses TRL on a 16 GB GPU; that figure applies to the example, not to all 7B workloads.
Release changes: v0.22.0 adds PaCA, while v0.21.3 limits DTensor tensor-parallel save-time gathering to adapter weights.
Best For

Teams adapting a shared base model to multiple tasks under a training-memory or checkpoint-storage budget, then loading the resulting adapters in a Hugging Face workflow.

Skip If

Your evaluation shows that you need full weight updates, you must deploy a standalone model without access to the base and cannot merge the chosen adapter, or you expect a turnkey inference server.

Reviewed on 2026-12-04 · Grounded in GitHub README, root file tree & releasesMethodology

Quick Start & Installation

GPU
pip install peft

Comparison vs. Top LLMs & Inference Alternatives

Full comparison →
RepositoryStars7d TrendStackLicenseCore Positioning
peft ★21.9k+32PythonApache-2.0Python/PyTorch adapters for fine-tuning large models without updating base weigh
LlamaFactory76.4k+86PythonApache-2.0A unified Python framework for LLM and VLM fine-tuning with pluggable inference
axolotl12.8k+15PythonApache-2.0YAML-driven GPU trainer for LLM and multimodal post-training
minimind75.4k+3.1kPythonApache-2.0Native PyTorch dense and MoE models for end-to-end LLM training on local GPUs

AI Context Briefing (for Claude / Cursor / Windsurf)

Standardized architecture summary & quickstart commands ready to paste into coding agents.

Raw .md ↗
curl -sL https://repoforai.com/repo/huggingface/peft.md

Embed Star History Chart & Badges in README.md

Full-history Star History SVGs and velocity cards on GitHub Camo: drop-in replacement for OSSInsight and Star History widgets.

huggingface/peft Star History on RepoForAI

Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).

Frequently Asked Questions about peft

How do I train, reload, and switch adapters?

Use get_peft_model with a configuration such as LoraConfig to prepare the base model for training, then save the adapter with save_pretrained. At inference time, load the matching base model and attach the adapter with PeftModel.from_pretrained. Transformers also exposes add_adapter, load_adapter, and set_adapter; use PEFT directly if you need merging for a supported adapter.

Does a small adapter checkpoint mean I need little VRAM?

No. Fewer trainable parameters reduce training state, but the base model still has to run. Size training for base weights, activations, batch size, sequence length, and any offloading. Size inference separately for the base weights, runtime caches, and expected concurrency. Quantization can reduce weight memory in compatible configurations; the adapter file size alone is not a VRAM estimate.

Can we use PEFT commercially and host it ourselves?

PEFT is Apache-2.0 and can be used commercially in a self-hosted deployment. If you redistribute the software, follow the license and applicable notice requirements. Check the base model, training data, and any third-party adapters separately; PEFT's license does not grant rights to those assets.

When should I choose PEFT over full fine-tuning or the Transformers adapter API?

Choose PEFT when you want small task-specific artifacts, a shared frozen base, or lower training memory. Compare it with full fine-tuning on your own evaluation set when broader weight updates may matter. Use Transformers' adapter API if loading and switching are enough; add a separate serving layer if you need a network endpoint or request scheduling.

Upstream README & Documentation

This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.

Maintaining huggingface/peft? Pin to Homepage + competitor /alternatives pages with a custom Cloud/Demo CTA.Feature huggingface/peft on Homepage & Alternatives ($19)
WEEKLY BREAKOUT DIGEST

Top 10 Breakout Open-Source AI Repos, Every Thursday

Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.

Zero spam · 1-click unsubscribe · Privacy Policy

Saved in your browser · Export Markdown RFC tables or jump into /vs compare