Skip to content
28 / Answers

PEFT: small updates to a very large model.

Parameter-efficient fine-tuning (PEFT) is the family of methods that adapt a pretrained model by training only a small set of added or selected parameters while the rest stay frozen. LoRA is the most used method; QLoRA is LoRA on a 4-bit base. PEFT is also the Hugging Face library that implements them. It is how fine-tuning fits on one GPU.

PEFT
Train a fraction of the parameters
Methods
LoRA, QLoRA, prefix and prompt tuning, IA3
Library
Hugging Face peft, works with Transformers and TRL
Result
A small adapter; the base model untouched
  • 5production AI apps
  • 14engineers led
  • 200+students mentored
01

Questions students ask

The PEFT questions searched most, answered from fine-tuning with it in production.

What is PEFT?

PEFT is an approach to fine-tuning in which you leave most of a pretrained model's weights frozen and train only a small number of parameters, either new ones added to the model or a chosen subset of the existing ones. The motivation is cost: full fine-tuning of a multi-billion-parameter model needs memory for gradients and optimiser state several times the model's own size and produces a full new copy per task. PEFT cuts the trainable parameters to a fraction of a percent, which cuts memory, time and storage, while reaching most of the quality of full fine-tuning on typical tasks.

What does PEFT stand for?

Parameter-Efficient Fine-Tuning. Parameter-efficient because the number of parameters being trained is small relative to the model; fine-tuning because the goal is to adapt a pretrained model to a task rather than train one from scratch. The term covers the research area, the set of methods within it, and, in everyday use, the Hugging Face library named peft that implements those methods so you can apply them to any Transformers model with a few lines of configuration.

What are PEFT methods?

  • LoRA: low-rank adapter matrices added to chosen layers; the default choice for language models.
  • QLoRA: LoRA with the frozen base model quantised to 4-bit to save memory.
  • DoRA and other LoRA variants that change how the adapter is decomposed or scaled.
  • Prefix tuning: trainable vectors prepended to the keys and values of each attention layer.
  • Prompt tuning: trainable soft tokens prepended to the input embedding; tiny, but weaker.
  • IA3: learned scaling vectors on activations; very few parameters.
  • Adapter layers: small bottleneck networks inserted between transformer layers (the original adapters from 2019).
  • Selective methods: training only certain existing parameters such as biases (BitFit) or specific layers.

Difference between PEFT and LoRA

PEFT is the category; LoRA is one method inside it, the one almost everyone uses for language models. Saying 'we used PEFT' nearly always means 'we used LoRA through the PEFT library', and the library's LoRA implementation is its most developed part. The distinction matters only when you are choosing among methods: for a classification head, a prompt-tuning or IA3 approach may be enough and even smaller; for generation tasks, LoRA is the reliable choice. If you are unsure, use LoRA; if memory is the constraint, use QLoRA.

Is QLoRA PEFT?

Yes. QLoRA is a PEFT method: it is LoRA, so only adapter parameters are trained, combined with loading the frozen base model in 4-bit precision to reduce memory. In the Hugging Face stack you get QLoRA by loading the model with a 4-bit quantisation configuration from bitsandbytes and then applying a LoRA configuration from the peft library; there is no separate QLoRA class. The adapters trained this way are ordinary LoRA adapters and can be merged into a full-precision copy of the base later. FineTune Studio, the platform I built, uses exactly this combination.

PEFT vs full fine tuning

Full fine-tuning updates every parameter: the most flexible, the most memory-hungry, a full-size model per task, slower, and more prone to forgetting general abilities when the dataset is narrow. PEFT updates a small set: a fraction of the memory and time, a small adapter per task, less forgetting, and quality that matches full fine-tuning on most instruction and task datasets, with a gap appearing mainly on very large or very different-domain data. For a student, a startup or any team without a GPU cluster, PEFT is not a compromise; it is the method. Full fine-tuning is reserved for labs with the compute and the data to justify it.

What is PEFT library?

peft is an open-source Python library from Hugging Face that implements parameter-efficient methods for Transformers models. You load any supported base model, create a configuration object for the method you want (a LoRA config with rank, scaling, dropout and target modules, for example), and wrap the model with it; the wrapped model exposes only the adapter parameters as trainable and plugs into the standard Trainer or TRL's trainers. It handles saving and loading adapters, merging them into the base, and switching between several adapters on one model. It also integrates with diffusion models for image generation.

What is PEFT Hugging Face?

It is the same library, named for its maintainer. Within the Hugging Face ecosystem it sits between Transformers (model loading and architecture), bitsandbytes (quantised loading for QLoRA), TRL (supervised fine-tuning, DPO and other training loops) and the Hub (where trained adapters are shared). A typical fine-tuning script imports all four. The Hub hosts many adapters for popular bases; loading one is a single call that attaches it to the base model. The documentation includes task guides for language, vision and audio models, and a conceptual guide to each method.

PEFT tutorial

  • Install transformers, peft, trl, datasets and bitsandbytes in a virtual environment with a CUDA-enabled PyTorch.
  • Load a small open chat model; for QLoRA, pass a 4-bit quantisation configuration when loading.
  • Create a LoRA config: rank 16, scaling 32, dropout 0.05, target modules set to the attention projections.
  • Wrap the model with the config; print the trainable parameter count to confirm it is under one per cent.
  • Load your JSON Lines dataset, apply the model's chat template, split train and validation.
  • Train with TRL's supervised fine-tuning trainer for one to three epochs; monitor validation loss.
  • Save the adapter; load the base plus adapter in a fresh process; compare outputs with the base on held-out prompts.
  • Merge and export when it wins; keep the dataset and config under version control.

Why LoRA PEFT works

The empirical finding behind LoRA is that the weight changes a model needs for a new task have low intrinsic rank: they can be expressed with far fewer degrees of freedom than the full matrix has. A pretrained model already contains the features a task needs; adaptation mostly re-weights and re-routes them, which a low-rank update can express. That is also why PEFT forgets less: the base is untouched and the adapter can only make small, structured changes. It stops working when the target task is far from anything the base learned, where a larger rank, more layers or full fine-tuning becomes necessary.

02

A PEFT run in a weekend

The minimum that produces a trustworthy adapter.

  1. 01

    Three hundred clean pairs

    Real inputs, ideal outputs, one chat format, a held-out split.

  2. 02

    QLoRA on a small model

    4-bit base, LoRA rank 16 on attention projections, one to three epochs.

  3. 03

    Blind comparison

    Base versus tuned on the held-out prompts, scored without knowing which is which.

  4. 04

    Ship the adapter

    Merge and export, or serve the base with swappable adapters per task.

03

In the room

Where these systems get explained to students.

Fine-tuning without a cluster?

PEFT is how. I can set up the run, the data and the evaluation so the result holds up.