Capability · Framework — fine-tuning

PEFT (Hugging Face)

PEFT (Parameter-Efficient Fine-Tuning) is the Hugging Face library that turned LoRA, QLoRA, and friends into a one-line import. Instead of updating every parameter of a 70B-parameter model, PEFT adds small trainable adapters (typically <1% of parameters) and freezes the rest, enabling fine-tuning on consumer GPUs. It's the foundation for downstream libraries like TRL, Axolotl, and Unsloth.

Framework facts

Category
fine-tuning
Language
Python
License
Apache-2.0
Repository
https://github.com/huggingface/peft

Install

pip install peft transformers accelerate bitsandbytes

Quickstart

from peft import LoraConfig, get_peft_model
from transformers import AutoModelForCausalLM

model = AutoModelForCausalLM.from_pretrained('meta-llama/Llama-3.2-3B', load_in_4bit=True)
config = LoraConfig(r=16, lora_alpha=32, target_modules=['q_proj','v_proj'], task_type='CAUSAL_LM')
model = get_peft_model(model, config)
model.print_trainable_parameters()

Alternatives

  • Axolotl — opinionated config-driven
  • Unsloth — 2-5x faster LoRA
  • TorchTune — PyTorch-native

Frequently asked questions

Is PEFT just for LoRA?

LoRA/QLoRA are the most popular, but PEFT also ships AdaLoRA, IA3, Prefix Tuning, Prompt Tuning, P-Tuning, OFT, DoRA, and VeRA — most research methods land here first.

PEFT or Unsloth?

Unsloth uses PEFT underneath but bolts on fused CUDA kernels for 2-5x speedup and half the memory. If you're GPU-poor, use Unsloth. For maximum flexibility or obscure adapter types, use PEFT directly.

Sources

  1. PEFT docs — accessed 2026-04-20
  2. PEFT GitHub — accessed 2026-04-20