LoRA impara meno e dimentica meno
LoRA Learns Less and Forgets Less
May 15, 2024
Autori: Dan Biderman, Jose Gonzalez Ortiz, Jacob Portes, Mansheej Paul, Philip Greengard, Connor Jennings, Daniel King, Sam Havens, Vitaliy Chiley, Jonathan Frankle, Cody Blakeney, John P. Cunningham
cs.AI
Abstract
Low-Rank Adaptation (LoRA) è un metodo ampiamente utilizzato per il fine-tuning efficiente in termini di parametri per i grandi modelli linguistici. LoRA risparmia memoria addestrando solo perturbazioni di basso rango per le matrici di peso selezionate. In questo lavoro, confrontiamo le prestazioni di LoRA e del fine-tuning completo su due domini target, programmazione e matematica. Consideriamo sia il regime di dati per il fine-tuning su istruzioni (circa 100K coppie prompt-risposta) che quello per il pre-training continuato (circa 10B token non strutturati). I nostri risultati mostrano che, nella maggior parte delle configurazioni, LoRA ha prestazioni sostanzialmente inferiori rispetto al fine-tuning completo. Tuttavia, LoRA mostra una forma desiderabile di regolarizzazione: mantiene meglio le prestazioni del modello base su compiti al di fuori del dominio target. Dimostriamo che LoRA fornisce una regolarizzazione più forte rispetto a tecniche comuni come il decadimento dei pesi e il dropout; aiuta anche a mantenere generazioni più diversificate. Mostriamo che il fine-tuning completo apprende perturbazioni con un rango che è 10-100 volte maggiore rispetto alle configurazioni tipiche di LoRA, il che potrebbe spiegare alcuni dei gap riportati. Concludiamo proponendo le migliori pratiche per il fine-tuning con LoRA.
English
Low-Rank Adaptation (LoRA) is a widely-used parameter-efficient finetuning
method for large language models. LoRA saves memory by training only low rank
perturbations to selected weight matrices. In this work, we compare the
performance of LoRA and full finetuning on two target domains, programming and
mathematics. We consider both the instruction finetuning (approx100K
prompt-response pairs) and continued pretraining (approx10B unstructured
tokens) data regimes. Our results show that, in most settings, LoRA
substantially underperforms full finetuning. Nevertheless, LoRA exhibits a
desirable form of regularization: it better maintains the base model's
performance on tasks outside the target domain. We show that LoRA provides
stronger regularization compared to common techniques such as weight decay and
dropout; it also helps maintain more diverse generations. We show that full
finetuning learns perturbations with a rank that is 10-100X greater than
typical LoRA configurations, possibly explaining some of the reported gaps. We
conclude by proposing best practices for finetuning with LoRA.