Parameter-efficient fine-tuning (PEFT)

Parameter-efficient fine-tuning (PEFT) is a family of methods that adapt a large pre-trained model by training only a small number of new or selected parameters instead of all of them.

Full fine-tuning updates every parameter in a model and produces a complete new copy for each task. With models of billions of parameters that is expensive to train and to store. Parameter-efficient fine-tuning keeps most of the original model frozen and trains only a small set of parameters, either newly added or chosen from the existing ones. Google's machine learning glossary notes that this typically produces a model that performs as well, or almost as well, as full fine-tuning.

Several families of methods fall under the label. Adapters, introduced in February 2019 by Neil Houlsby and colleagues, insert small trainable modules into a frozen network; on the GLUE language benchmark they came within 0.4 per cent of full fine-tuning while adding only 3.6 per cent of the parameters per task. Prefix tuning, from Xiang Lisa Li and Percy Liang in January 2021, learns a short sequence of virtual tokens and trained just 0.1 per cent of the parameters. Prompt tuning, from Brian Lester and colleagues in April 2021, learns soft prompts and found the gap with full fine-tuning closed as models grew past billions of parameters. LoRA, from June 2021, learns low-rank updates to the weights and adds no delay when the model runs.

The practical gains are storage and access. One frozen base model can serve many tasks, each with its own small set of trained parameters. Hugging Face's PEFT library, which is integrated with its Transformers, Diffusers and Accelerate libraries, describes the aim as making large models trainable and storable on consumer hardware.

The savings are uneven, though. Training still runs data through the whole model, so memory and compute fall by less than the parameter count suggests. In the LoRA paper's comparison with fine-tuning GPT-3, trainable parameters fell 10,000-fold but GPU memory fell threefold. Combining PEFT with quantisation, as QLoRA does, is what brought fine-tuning of very large models down to a single GPU.

Common questions

What is PEFT?

PEFT stands for parameter-efficient fine-tuning, a group of techniques that adapt a pre-trained model by training only a small fraction of its parameters or a few added ones. It is also the name of Hugging Face's open-source library that implements many of these methods.

What is the difference between PEFT and full fine-tuning?

Full fine-tuning updates every weight and produces a full-size copy of the model for each task. PEFT freezes most of the model and trains a small set of parameters, so each task needs only a small add-on. Results are often close to full fine-tuning at much lower cost.

Is LoRA a type of PEFT?

Yes. LoRA is a PEFT method. Others include adapters, prefix tuning and prompt tuning. They differ in where the trainable parameters sit, but all keep the bulk of the original model frozen.

Can I fine-tune a large language model on a consumer GPU?

Often, using PEFT combined with quantisation. The QLoRA paper reported fine-tuning a 65 billion parameter model on a single 48GB GPU in 2023, and smaller models need far less. Memory needs depend on the model size, the method and the length of the training examples.

Finding more

Search for "parameter-efficient fine-tuning survey", "LoRA vs adapters vs prompt tuning" or "Hugging Face PEFT" to compare methods. Reliable sources include survey papers and original papers on arXiv, Hugging Face's PEFT documentation and Google's Machine Learning Glossary. Treat claims that a method matches full fine-tuning with care, since results vary by model, task and dataset.

Working out what this means for your business?

Aileron Shift builds the systems behind this site: AI newsrooms that research, write and publish on their own, marketing automation and WordPress hosting for companies that need to move faster than their competitors.