Model fine tuning: fast, memory efficient and good enough.

Why it’s good:

  • We can swap out the fine-tuning LoRA models for different downstream tasks.
  • Trains fast. No big memory needed.
  • No inference latency.

For a pre-trained weight matrix , we constrain its update by representing the latter with a low-rank decomposition ,where , and the rank During training, is frozen and does not receive gradient updates, while and contain trainable parameters. Note both and are multiplied with the same input, and their respective output vectors are summed coordinate-wise. For , our modified forward pass yields:

We illustrate our reparametrization in Figure 1. We use a random Gaussian initialization for and zero for , so is zero at the beginning of training. We then scale by , where is a constant in . When optimizing with Adam, tuning is roughly the same as tuning the learning rate if we scale the initialization appropriately.

lora, page 4

Now, applying this to Transformer.

We limit our study to only adapting the attention weights for downstream tasks and freeze the MLP modules (so they are not trained in downstream tasks) both for simplicity and parameter-efficiency

lora, page 5

Note that putting all the parameters in or results in significantly lower performance, while adapting both and yields the best result. This suggests that even a rank of four captures enough information in such that it is preferable to adapt more weight matrices than adapting a single type of weights with a larger rank.

lora, page 10

Well, or shouldn’t really matter here.

Lower rank of LoRA, even 1 or 2 is pretty good, this can be further understood by looking at the subspace similarity, the top values are the most useful, other directions are likely random noise.

First, has a stronger correlation with compared to a random matrix, indicating that ∆W amplifies some features that are already in . Second, instead of repeating the top singular directions of , only amplifies directions that are not emphasized in . Third, the amplification factor is rather huge.

lora, page 12