Venue: NAACL 2024

# Tied-LoRA: Enhancing parameter efficiency of LoRA with Weight Tying

Adithya Renduchintala &Tugrul Konuk &Oleksii Kuchaiev

NVIDIA

{adithyare,tkonuk,okuchaiev}@nvidia.com

###### Abstract

We introduce Tied-LoRA, a novel paradigm leveraging weight tying and selective training to enhance the parameter efficiency of Lowrank Adaptation (LoRA). Our exploration encompasses different plausible combinations of parameter training and freezing, coupled with weight tying, aimed at identifying the optimal trade-off between performance and the count of trainable parameters. Across \(5\) diverse tasks and two foundational language models with different parameter counts, our experiments provide comprehensive insights into the inherent trade-offs between efficiency and performance.

Our findings reveal a specific Tied-LoRA configuration that distinguishes itself by showcasing comparable performance to LoRA across multiple tasks while utilizing only a fraction of the parameters employed by the standard LoRA method, particularly at elevated ranks. This underscores the efficacy of Tied-LoRA in achieving impressive results with significantly reduced model complexity.

+
Footnote †: Proceedings of the 2024 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies (Volume 1: Long Papers), pages 8694–8705

June 16-21, 2024 ©2024 Association for Computational Linguistics

## 1 Introduction

Large language models (LLMs) play a crucial role in various Natural Language Processing (NLP) applications due to their proficiency. A significant factor driving their widespread adoption is the ability to fine-tune pretrained LLMs efficiently for specific downstream tasks. This fine-tuning process allows the creation of specialized language models that excel in specific domains and tasks. Despite dealing with smaller training data compared to pretraining, the computational demand for during fine-tuning remains high, especially for large models with billions of parameters.

Moreover, for LLM service providers, it is often necessary to cater to diverse requirements by maintaining distinct customizations for each combination of user and task in the service. For instance, consider a scenario where a language model is employed to assist users in generating content for social media. User X may have preferences for formal language and professional tone, while another user, Y, might prefer a more casual and conversational style. Additionally, each user may have different tasks, such as composing business emails, translating documents, creating social media captions or drafting blog posts. To serve these varied preferences and tasks simultaneously, the language model needs to be finely tuned for each specific combination of user (X or Y) and task (email composition or translation).

As the number of users and tasks per user increases, so does the complexity and cost associated with customization. Managing and storing the various combinations of customizations for each user-task pair can introduce additional expenses, especially after the initial training phase. The storage and retrieval of these customized models, each tailored to specific user preferences and tasks, contribute to ongoing operational costs. Therefore, in addition to efficient utilization of customizable parameters during training, careful consideration must be given to the post-training phase, where the

Figure 1: Schematic of our Tied-Lora paradigm, the main low-rank matrices \(A\) and \(B\) are tied across (indicated by the \(\Phi\) symbol) all the layers of the base language model. We use the gradient shading to indicate that these parameters can either be trained or frozen.



cost of saving and accessing these combinations becomes a significant factor in the overall resource management strategy. This holistic approach is crucial for maintaining optimal performance across diverse user-task combinations while keeping both computational and operational costs in check.

In light of these challenges, developing effective customization methods that not only enhance model performance but also reduce the number of training parameters becomes crucial. Parameter-efficient fine-tuning (PEFT) emerges as a valuable approach in this context. PEFT involves refining pretrained models with minimal parameter updates, enabling the creation of specialized models that excel in specific domains and tasks. This streamlined customization process not only optimizes parameter utilization during training but also mitigates the costs associated with managing, storing, and serving diverse customizations post-training.

Low-rank Adaptation (LoRA) method Hu et al. (2021), stands out as a popular and efficient parameter-efficient fine-tuning (PEFT) approach, offering a straightforward implementation and the ability to integrate LoRA weights into the base model post-training. Despite its advantages, the expense of LoRA training becomes more pronounced, particularly with the growing size of base language models. While previous efforts focused on enhancing LoRA's parameter efficiency through careful low-rank selection, we introduce an alternative approach. In contrast to controlling parameter count through rank, our method incorporates simple weight tying alongside selective training. This novel combination forms the basis for a range of Tied-LoRA configurations, each evaluated for performance across five diverse customization tasks. Through this approach, we aim to push the boundaries of parameter-efficient fine-tuning, making advancements in both effectiveness and simplicity. Our contributions are threefold:

1. We propose a range of Tied-LoRA configurations that use simple weight tying in LoRA along with selective training to boost the parameter efficiency of LoRA.
2. We study this spectrum of possible Tied-LoRA configurations on diverse tasks that resemble real-world customization problems.
3. Based on the results of our study, we propose the specific TL\({}_{6}\)(v**B\({}_{\text{q}}\)u**A\({}_{\text{q}}\)**) configuration as the best option for maintaining performance while reducing parameters. This configuration is within \(1-2\%\) of LoRA in terms of performance and in one case beats LoRA while only using \(12.5\%\) of the number of parameters.

## 2 Method

In this section, we introduce Tied-LoRA, a paradigm for parameter-efficient fine-tuning of large language models through low-rank weight-update approximations, weight-tying and selective training. Our framework offers a range of "LoRA-like" configurations through a series of design choices over selective parameter training and weight tying, including some of the existing PEFT methodologies available in the literature. Specifically, we use weight tying alongside pairs of projection matrices and scaling vectors that can be selectively either trained or frozen. As the low-rank computation path does not introduce any non-linearity, all Tied-LoRA configurations can be merged into the base model weights to preventing additional latency during inference.

Table 1 provides an overview of the scenarios we study. We refer to each configuration in our study with TL (Tied-LoRA) followed by a subscript index (e.g., TL\({}_{1}\)). Additionally, we also include the template of possible training parameters (\(\mathbf{v},\mathbf{B},\mathbf{u}\) and \(\mathbf{A}\), discussed in section 2.1). For Tied-LoRA, the low-rank projection matrices \(\mathbf{A}\) and \(\mathbf{B}\) are _tied_ across all the layers of the base model which we indicate using the subscript \({}_{\text{q}}\). We also indicate if a parameter is frozen by blue font and a trainable parameter with regular font. Thus, traditional LoRA can be expressed as v**BuA** and VeRApcizko et al. (2023) can be expressed as v**NB\({}_{\text{q}}\)u**AA\({}_{\text{q}}\).

### Formulation

The overall structure of the tied LoRA framework can be seen in Figure 1. Note that the original LoRA Hu et al. (2021) uses a dedicated pair of low-rank projections for each of the \(\mathbf{Q},\mathbf{K},\mathbf{V}\) matrices. However, in our formulation, \(W\) is a \(d\times 3d\) matrix that jointly projects \(\mathbf{Q},\mathbf{K}\), and \(\mathbf{V}\) attention matrices, where \(d\) is the hidden size of the base language model. Therefore, our down projection \(\mathbf{A}\) is a \(d\times r\) shaped matrix and up projection matrix \(\mathbf{B}\) has shape \(r\times 3d\), where \(r\) is the low-rank bottleneck dimension. Essentially, the down projection \(\mathbf{A}\) is _shared_ by \(\mathbf{Q},\mathbf{K}\), and \(\mathbf{V}\), leading to fewer trainable parameters (\(4dr\)) than the original LoRA (\(6dr\)).

 

For a linear layer with a frozen pretrained weight matrix \({\bf W}\), we define the layer output as

\[z={\bf W}x+\Delta{\bf W}x\approx{\bf W}x+\frac{\alpha}{r}\Lambda_{v}{\bf B} \Lambda_{u}{\bf A}x, \tag{1}\]

where \(\Delta{\bf W}\) is the full-rank update matrix, \(\alpha\) is a scaling factor, \({\bf A}\) and \({\bf B}\) are low-rank projection matrices, and \(\Lambda_{u}\) and \(\Lambda_{v}\) are diagonal matrices with diagonal elements given by \(u\) and \(v\), respectively. Herein, \(\Lambda_{v}{\bf B}\Lambda_{u}{\bf A}x\) is the low-rank approximation to the parameter update matrix \(\Delta{\bf W}\). Unlike the original LoRA, where \(\alpha\) is a hyper-parameter that can be manually set, we simply set \(\alpha=r\), effectively removing its scaling effect.

Equation 1 is a generalized formulation for methods that utilize low-rank approximations to estimate parameter updates. Particular settings of parameter updates and weight tying reduces this equation to some of the existing formulations in the literature. Setting and freezing \(\Lambda_{u}=\Lambda_{v}=I\) and untying \({\bf A}\) and \({\bf B}\) results in LoRA:

\[z={\bf W}x+{\bf B}{\bf A}x. \tag{2}\]

Similarly, randomly initializing \({\bf A}\) and \({\bf B}\) matrices and tying them across all layer leads the the VeRA formulation Kopiczko et al. (2023):

\[z={\bf W}x+\Lambda_{v}{\bf B}\Lambda_{u}{\bf A}x, \tag{3}\]

### Weight Tying

The third column of Table 1 presents representations for number of trainable parameters each TiedLora configuration requires. As is apparent from the table, weight tying is a critical ingredient of our proposed approach which drastically reduces the number of trainable parameters. For example, LoRA (vBuA) training using the 7B LLaMA-2Touvron et al. (2023) language model with a typical low rank setting of \(8\) requires \(\sim 4.2\)M trainable parameters. By merely introducing weight tying across the \(32\) layers of this model reduces the trainable parameters to \(\sim 131\)K, which is a \(96.875\%\) reduction. In comparison, the Vera method results in a reduction of \(90.6\%\).

### Selective Training

Through the flexible framework that equation 1 offers, we are given the opportunity to investigate a range training configurations. By selectively updating the components \(A,B,u\), and \(v\) during the training process, we can generate a variety of methodological variations. These variations not only exhibit differences in parameter count, but they also demonstrate distinct capabilities across a variety of tasks. This exploration allows us to investigate the intriguing regime of extremely low-parameter and low-rank PEFT models. This is a key step towards the customization of models, enabling them to excel at specific tasks while maintaining a minimal parameter count. Our ultimate goal here is to harness the power of this methodology to create highly efficient, task-specific models that achieve high performance with reduced complexity.

## 3 Experiments

We now turn to evaluating the different configurations possible within our Tied-LoRA paradigm. While LoRA (vBuA) and PEFT methods can be used to train models for general instruction following Sun et al. (2023); Lermen et al. (2023); Sun et al. (2023), we focus our evaluations in a "task customization" perspective, where each model is trained on a specific task and is evaluated on a test set from the same task.

### Tasks & Datasets

To evaluate the performance of each Tied-LoRA configuration across diverse data settings, we utilized the following types of tasks:

Extractive QAis a common task where the model is expected to "read" some relevant text (the context) and answer questions. The answers are usually exact sub-strings from the provided context. We use SQuADv1 dataset Rajpurkar et al. (2016) in our experiments. Since the official test split of this dataset does not contain ground-truth answers,

\begin{table}
\begin{tabular}{l l c} Method & Parameters & Initialization \\ \hline LoRA (vBuA) & \(4Ldr\) & \(A\sim\mathcal{N},B=0,u,v=1\) \\ Vera (yBuA\({}_{\star}\)) & \(L(r+3d)\) & \(A,B\sim\mathcal{N},u=1,v=0\) \\ TL\({}_{v}\)(yBuA\({}_{\star}\)) & \(dr\) & \(A,B\sim\mathcal{N},w,v=1\) \\ TL\({}_{v}\)(yBuA\({}_{\star}\)) & \(dr+L(r+3d)\) & \(A,B\sim\mathcal{N},n=1,v=0\) \\ TL\({}_{s}\)(yBuA\({}_{\star}\)) & \(3dr\) & \(A\sim\mathcal{N},B=0,u,v=1\) \\ TL\({}_{v}\)(yBuA\({}_{\star}\)) & \((L+3d)r\) & \(A\sim\mathcal{N},B=0,v,u=1\) \\ TL\({}_{v}\)(yBuA\({}_{\star}\)) & \(4dr\) & \(A\sim\mathcal{N},B=0,u,v=1\) \\ TL\({}_{v}\)(yBuA\({}_{\star}\)) & \(4dr\) & \(A\sim\mathcal{N},B=0,u,v=1\) \\ TL\({}_{v}\)(yBuA\({}_{\star}\)) & \(4dr+L(r+3d)\) & \(A,B\sim\mathcal{N},u=1,v=0\) \\ \end{tabular}
\end{table}
Table 1: Tied-LoRA configurations included in our study. The first column shows acronyms used to identify each Tied-LoRA configuration (i.e., method). Symbols with subscript \({}_{\star}\) indicate that it is shared across all layers and the color blue indicates that the parameter is frozen. Formulas for the number of trainable parameters in each configuration as a function of number of layers \(L\), hidden size \(d\), and low-rank \(r\) are also provided.

 

we use the validation set as our test set. We create a validation set comprising of a random sample of \(4800\) examples extracted from the training set.

Summarizationis a central problem in NLP and several variations of summarization datasets have been proposed. We employ the DialogSum dataset Chen et al. (2021) to study our models' performance on this task. DialogSum includes summaries of real-word conversations on a diverse set of topics and scenarios. This dataset was an attractive option as the length of the conversations and summarizes are within the context lengths (\(4096\) tokens) of the base language models.

Commonsense Natural Language Inference (NLI)is a task designed to probe the ability of language models to apply "commonsense reasoning" to choose a possible ending for a given situation described in natural language. These tasks are typically trivial for humans but language models can still struggle. We use the HellaSwag dataset Zellers et al. (2019) to study the performance of our proposed models on this type of task. As HellaSwag contains multiple-choice questions, it can be viewed as a classification problem.

TranslationMachine translation is a natural language generation task which is widely used in research and industry. Translation is inherently multilingual and thus offers a challenging domain to study our Tied-LoRA paradigm. There are several large scale translation datasets but we focus on a moderately sized IWSLT 2017 German-to-English spoken language translation dataset Cettolo et al. (2017). With over \(206k\) training examples this is the largest dataset we study.

Mathematical Reasoningis a challenging domain where large language models still lag behind human performance. Using PEFT methods on such tasks further amplifies these challenges as there are very few trainable parameters. In our experiments, we use the GSM8K benchmark Cobbe et al. (2021) which contains \(8.5\)KB high-quality, grade-school level math word problems. Each example in the GSM8K benchmark contains a question and an answer. The answers are provided with natural language solutions which contain explanations of each step used to obtain the final answer. The final numerical answer is demarcated from the rest of the natural language solution. We evaluate our models by comparing these final numerical answers.

### Base Language Models

Although PEFT enables the base language model to perform new tasks, the final performance heavily depends on the inherent abilities learned during pretraining. This necessitates investigating the performance of Tied-LoRA on multiple base models with different inherent capabilities. Therefore, we use a relatively small two billion parameter, GPT-2B-001 decoder-only model1 released by NVIDIA and the moderately large 7B LLaMA 2 model Youvron et al. (2023) released by Meta. Additionally, these models also differ in the amount of pretraining data used. The GPT-2B-001 model was trained on \(1.1\) trillion tokens of text from publicly available multilingual text spanning \(53\) languages. The LLaMA2 \(7\)B model was trained on \(2\) trillion tokens of predominately English text. Both models are auto-regressive language models with a context size of \(4096\) tokens.

Footnote 1: [https://huggingface.co/nvidia/GPT-2B-001](https://huggingface.co/nvidia/GPT-2B-001)

### Implementation Details

We use the open-source NeMo Framework to implement all the algorithms presented in this paper. Our implementation is publicly available through the NeMo GitHub repository.2 We set max training steps to \(2k\), but training was terminated sooner using early stopping with a patience of \(10\) to prevent over-fitting. We trained all configurations using AdamW optimizer Loshchilov and Hutter (2017) with a weight decay of \(0.01\) and a cosine learning rate schedule with \(50\) warm-up steps.

For each Tied-Lora method we tried two learning rates, a high rate of \(1^{-4}\) and a low learning rate of \(1^{-5}\). While the "typical" range of the low-rank dimension \(r\) is \(4-16\) we find that some complex tasks benefit from higher \(r\) so we trained all our models with a wide range of \(r\in\{2,4,8,\dots,128\}\). Each task was trained with a global batch size of \(256\) and a validation check interval of \(30\) steps. The only exception was the IWSLT translation dataset for which we set global batch size and validation check interval of \(1024\) and \(60\) respectively. No extensive hyper-parameter search was conducted. We used greedy-decoding to generate the models' predictions with a limit of \(500\) tokens.

 



## 4 Results

Table 2 provides a detailed comparison of various Tied-LoRA configurations across our \(5\) tasks for the LLaMA2 7B and GPT-2B-001 base models. For each task we report the metric used, such as RougeL Lin and Och (2004), Exact Match (EM), Accuracy and BLEU Papineni et al. (2002), and the rank \(r\) used. For each model, the table is segmented into two sections: The first section compares the performance of all Tied-LoRA configurations at the _same rank_ where LoRA (vBu**A**) achieved its optimum score. The second section shows the best performance of achieved by each configuration. In addition to metric scores and rank (\(r\)) we also report parameter usage percentage (P%) as a comparison to the parameter count of the best-performing Lora configuration. This offers a direct measure of efficiency, showing how each model, especially TL\({}_{5}\)(vB\({}_{\texttt{q}}\)u\(\mathbf{A_{q}}\)) and TL\({}_{6}\)(vB\({}_{\texttt{q}}\)u\(\mathbf{A_{q}}\)) , leverages a smaller percentage of parameters compared to the LoRA (vBu**A**) for achieving its results.

We can immediately see that LoRA (vBu**A**) is the best performing model for both the 2B and 7B base language models on most tasks. This is hardly surprising as it is the most expensive method with respect to trainable parameters. The TL\({}_{6}\)(vB\({}_{\texttt{q}}\)u\(\mathbf{A_{q}}\)) configuration demonstrates the best overall performance among all Tied-LoRA configurations for both model sizes and is not far behind LoRA. For our translation task with the LLaMA2 7B base model, TL\({}_{6}\)(vB\({}_{\texttt{q}}\)u\(\mathbf{A_{q}}\)) out performs LoRA (vBu**A**) while using \(12.5\%\) of the number of parameters. This consistent performance illustrates it effectiveness across diverse model scales and task types. The TL\({}_{5}\)(vB\({}_{\texttt{q}}\)u\(\mathbf{A_{q}}\)) configuration, while marginally outperformed by TL\({}_{6}\)(vB\({}_{\texttt{q}}\)u\(\mathbf{A_{q}}\)) , is notable for its parameter efficiency. This method achieves comparable performance to TL\({}_{6}\)(vB\({}_{\texttt{q}}\)u\(\mathbf{A_{q}}\)) for typical ranks \(r=8,16,32,64,128\), but with a reduced parameter count.

Both TL\({}_{5}\)(vB\({}_{\texttt{q}}\)u\(\mathbf{A_{q}}\)) and TL\({}_{6}\)(vB\({}_{\texttt{q}}\)u\(\mathbf{A_{q}}\)) show robust performance at the same rank where traditional LoRA (vBu**A**) is optimized (i.e., performed best). This implies that for systems pretuned for LoRA (vBu**A**) , TL\({}_{5}\)(vB\({}_{\texttt{q}}\)u\(\mathbf{A_{q}}\)) and TL\({}_{6}\)(vB\({}_{\texttt{q}}\)u\(\mathbf{A_{q}}\)) can be utilized with the same rank

\begin{table}
\begin{tabular}{c c c c c c c c c c c c c c} Base Model & Method & \multicolumn{3}{c}{Dialogsum} & \multicolumn{3}{c}{GSM8K} & \multicolumn{3}{c}{HellaSwag} & IWSLT 2017 & \multicolumn{3}{c}{Squad} \\  & RougleL & \(r\) & P\% & EM & \(r\) & P\% & Acc. & \(r\) & P\% & BLEU & \(r\) & P\% & EM & \(r\) & P\% \\ \hline \multirow{9}{*}{LLaMA2 7B} & LotRA (vBu**A**) & 40.76 & 8 & 100 & 32.75 & 64 & 100 & 91.97 & 16 & 100 & 41.30 & 8 & 100 & 88.52 & 2 & 100 \\ \cline{2-13}  & Ours (vBu**A**) & 38.77 & 8 & 9.4 & 27.22 & 64 & 1.2 & 89.91 & 16 & 4.7 & 40.22 & 8.9 & 8.4 & 87.69 & 2 & 37.5 \\  & TL\textbackslash{}(vB\textbackslash{}u\textbackslash{})\) & 38.73 & 8 & 0.8 & 27.07 & 64 & 0.8 & 09.03 & 16 & 8.0 & 40.34 & 8 & 0.8 & 87.72 & 2 & 0.8 \\  & TL\textbackslash{}(vB\textbackslash{}u\textbackslash{})\) & 38.69 & 8 & 10.2 & 27.07 & 64 & 2.0 & 90.11 & 16 & 5.5 & 40.35 & 8 & 10.2 & 87.67 & 2 & 38.3 \\  & TL\textbackslash{}(vB\textbackslash{}u\textbackslash{})\) & 40.20 & 8 & 2.3 & 17.74 & 64 & 2.3 & 89.83 & 16 & 2.3 & 39.93 & 8 & 2.3 & 87.34 & 2 & 2.3 \\  & TL\textbackslash{}(vB\textbackslash{}u\textbackslash{})\) & 39.46 & 8 & 2.3 & 21.00 & 64 & 2.3 & 89.46 & 16 & 2.3 & 30.44 & 8 & 2.3 & 87.06 & 2 & 2.3 \\  & TL\textbackslash{}(vB\textbackslash{}u\textbackslash{})\) & **40.62** & 8 & 3.1 & 30.33 & 64 & 3.1 & **91.75** & 16 & 3.1 & 40.01 & 8 & 3.1 & 87.11 & 2 & 3.1 \\  & TL\textbackslash{}(vB\textbackslash{}u\textbackslash{})\) & 39.24 & 8 & 12.5 & **31.77** & 64 & 4.3 & 91.15 & 16 & 7.8 & **41.33** & 8 & 12.5 & **87.97** & 2 & 40.6 \\ \cline{2-13}  & Ours (vBu**A**) & 40.07 & 64 & 9.4 & 29.11 & 16 & 1.2 & 90.47 & 2 & 4.7 & 40.41 & 16 & 9.4 & 87.69 & 2 & 37.5 \\  & TL\textbackslash{}(vB\textbackslash{}u\textbackslash{})\) & 39.74 & 16 & 16 & 2.95 & 16 & 0.2 & 90.52 & 4 & 0.2 & 40.52 & 64 & 6.3 & 87.72 & 2 & 0.8 \\  & TL\textbackslash{}(vB\textbackslash{}u\textbackslash{})\) & 39.81 & 64 & 15.7 & 28.73 & 16 & 1.4 & 90.32 & 2 & 4.8 & 40.50 & 128 & 22.0 & 87.67 & 2 & 38.2 \\  & TL\textbackslash{}(vB\textbackslash{}u\textbackslash{})\) & 40.20 & 8 & 2.3 & 24.34 & 4 & 0.1 & 90.27 & 8 & 1.2 & 40.48 & 16 & 4.7 & 87.62 & 8 & 9.4 \\  & TL\textbackslash{}(vB\textbackslash{}u\textbackslash{})\) & 40.17 & 16 & 4.7 & 25.70 & 8 & 0.3 & 90.18 & 4 & 0.6 & 40.65 & 16 & 4.7 & 87.72 & 4 & 4.7 \\  & TL\textbackslash{}(vB\textbackslash{}u\textbackslash{})\) & **40.62** & 8 & 3.1 & 30.33 & 64 & 3.1 & 91.75 & 16 & 3.1 & **41.37** & 16 & 6.3 & 88.22 & 4 & 6.3 \\  & TL\textbackslash{}(vB\textbackslash{}u\textbackslash{})\) & 39.71 & 16 & 15.6 & **31.77** & 64 & 4.3 & **91.90** & 64 & 17.2 & **41.37** & 32 & 21.9 & **88.49** & 4 & 43.8 \\ \hline \multirow{9}{*}{GFPT-2B-001} & LotRA (vBu**A**) & 38.59 & 4 & 100 & 12.28 & 64 & 100 & 85.64 & 64 & 100 & 40.19 & 128 & 100 & 83.58 & 32 & 100 \\ \cline{2-13}  & Ours (vBu**A**) & 37.02 & 4 & 18.8 & 6.97 & 64 & 1.2 & 75.94 & 64 & 1.2 & 32.0 & 128 & 0.6 & 79.43 & 32 & 2.3 \\ \cline{1-1}  & TL\textbackslash{}(vB\textbackslash{}u\textbackslash{})\) & 37.11 & 4 & 1.0 & 8.26 & 64 & 1.0 & 76.32 & 64 & 1.2 & 38.12 & 128 & 1.0 & 79.26 & 32 & 1.0 \\ \cline{1-1}  & TL\textbackslash{}(vB\textbackslash{}u\textbackslash{})\) & 37.00 & 4 & 19.8 & 8.11 & 64 & 2.2 & 77.02 & 64 &

configuration as a "drop-in" replacement.

On average, we observe a \(1.36\) % decline in TL\({}_{6}\)(vB\({}_{\textbf{q}}\)uA\({}_{\textbf{q}}\)) performance compared to the LoRA (vBuA) model with the LLaMA 2 7B model. This decline, however, is marginally higher at \(1.95\) % with the 2B model. These findings suggest that the efficiency of TL\({}_{6}\)(vB\({}_{\textbf{q}}\)uA\({}_{\textbf{q}}\)) configuration may enhance with a larger or more capable base models (such as the LLaMA2 70B model). This hypothesis warrants a future exploration which we leave for future research.

### Task-Dependent Optimal Rank

From Table 2, we can see that the optimal rank for LoRA (vBuA) varies significantly across different tasks. Furthermore, perhaps surprisingly, a higher rank does not result in higher scores. For example, for LoRA (vBuA) , a rank of 2 suffices for achieving best performance for the SQuAD task, while a higher rank of 64 is optimal for GSM8K. In scenarios where traditional LoRA (vBuA) requires a higher rank, Tied-LoRA, especially TL\({}_{5}\)(vB\({}_{\textbf{q}}\)uA\({}_{\textbf{q}}\)) and TL\({}_{6}\)(vB\({}_{\textbf{q}}\)uA\({}_{\textbf{q}}\)) , present an effective alternative by delivering comparable performance with substantially fewer parameters. For instance, for GSM8K, TL\({}_{6}\)(vB\({}_{\textbf{q}}\)uA\({}_{\textbf{q}}\)) needs only \(4.3\) % of the parameters that LoRA (vBuA) uses, while achieving a comparable performance (EM score of \(31.77\) vs. \(32.75\) for TL\({}_{6}\)(vB\({}_{\textbf{q}}\)uA\({}_{\textbf{q}}\)) and LoRA, respectively).

### Layer Selection Vs. Tied-LoRA

The success of Tied-LoRA, specifically TL\({}_{5}\)(vB\({}_{\textbf{q}}\)uA\({}_{\textbf{q}}\)) as seen from Table 2, begs the question - Would adding LoRA to a single transformer layer lead to similar performance as TL\({}_{5}\)(vB\({}_{\textbf{q}}\)uA\({}_{\textbf{q}}\)) ? TL\({}_{5}\)(vB\({}_{\textbf{q}}\)uA\({}_{\textbf{q}}\)) does not use layer-specific parameters (recall the v and u are frozen and set to **1**) and has the same parameter count as applying LoRA (vBuA) to a single layer in the transformer model. To examine this, we trained all tasks with LoRA applied to a single transformer layer's attention projection matrices. The obvious follow-up question is, which layer should LoRA be applied to? We attempt single-layer LoRA on the lowest (closest to the input embeddings) layer, which we designate as "Layer 1" all the way to the the highest layer, "Layer 32" in 4 layer increments. We used the LLaMa2 7B model for this investigation.

Table 3 compares the performances of single-layer LoRA against TL\({}_{5}\)(vB\({}_{\textbf{q}}\)uA\({}_{\textbf{q}}\)) (which uses the same number of trainable parameters as single-layer LoRA). The TL\({}_{5}\)(vB\({}_{\textbf{q}}\)uA\({}_{\textbf{q}}\)) configuration was considerably better than any of the layer selection LoRA settings. Interestingly, we note that when applying LoRA to a single transformer layer, the lower layers (usually layer 4 or 8) resulted in higher performance than higher layers. This suggests that there is potentially a single low-rank update that can be applied to all layers to boost performance, but it is hard to find a low-rank update for a single-layer that results in strong performance.

### Stability Across Ranks

As indicated by Figures 2a and 2b, apart from TL\({}_{6}\)(vB\({}_{\textbf{q}}\)uA\({}_{\textbf{q}}\)) , all other Tied-LoRA methods experience a decline in performance when the rank increases. This trend highlights a general challenge faced by Tied-LoRA configurations, with TL\({}_{6}\)(vB\({}_{\textbf{q}}\)uA\({}_{\textbf{q}}\)) being an exception. Specifically, TL\({}_{3}\)(vB\({}_{\textbf{q}}\)uA\({}_{\textbf{q}}\)) and TL\({}_{4}\)(vB\({}_{\textbf{q}}\)uA\({}_{\textbf{q}}\)) exhibit the most dramatic drop at higher ranks among all Tied-LoRA configurations. We leave addressing these limitations for future research.

Figures 2c and 2d show only the best Tied-LoRA configurations, along with baselines LoRA (vBuA) and Vera (vB\({}_{\textbf{q}}\)uA\({}_{\textbf{q}}\)) . While TL\({}_{5}\)(vB\({}_{\textbf{q}}\)uA\({}_{\textbf{q}}\)) aligns closely with TL\({}_{6}\)(vB\({}_{\textbf{q}}\)uA\({}_{\textbf{q}}\)) at typical ranks of \(4-16\), it also exhibits a small performance reduction at higher ranks. This pattern is repeated for Vera (vB\({}_{\textbf{q}}\)uA\({}_{\textbf{q}}\)) as well. In contrast,

\begin{table}
\begin{tabular}{l r r r r r r r r r r} \hline \hline  & & & \multicolumn{6}{c}{LoRA at Layer} & \multicolumn{6}{c}{TL\({}_{5}\)} \\  & 1 & 4 & 8 & 12 & 16 & 20 & 24 & 28 & 32 & (vB\({}_{\textbf{q}}\)uA\({}_{\textbf{q}}\)) \\ \hline Iwslt2017 (BLEU) & 37.94 & 38.99 & 39.47 & 38.68 & 38.10 & 35.33 & 33.24 & 28.90 & 22.40 & 41.37 \\ Squad (EM) & 85.30 & 86.50 & 87.55 & 85.51 & 80.01 & 71.71 & 65.90 & 60.70 & 56.22 & 87.73 \\ GSM8K (EM) & 13.04 & 19.33 & 19.56 & 14.93 & 11.67 & 6.14 & 4.92 & 3.56 & 2.80 & 27.07 \\ Hellaswag (EM) & 77.70 & 88.36 & 87.92 & 85.75 & 85.46 & 77.44 & 27.96 & 49.52 & 47.79 & 91.76 \\ Dialogsum (RougeL) & 37.75 & 37.80 & 39.17 & 38.73 & 37.26 & 34.55 & 33.54 & 33.02 & 31.64 & 38.73 \\ \hline \hline \end{tabular}
\end{table}
Table 3: LoRA applied to a single layer in the transformer vs. TL\({}_{5}\)(vB\({}_{\textbf{q}}\)uA\({}_{\textbf{q}}\)) . All results in this table are for a rank of \(16\) for the 7B base model and use the same number of trainable parameters.

 

TL\({}_{6}\)(v**B\({}_{\textbf{u}}\)u**A\({}_{\textbf{q}}\)**) maintains high performance across a broad range of ranks and is closest to LoRA (vBuA) .

## 5 Related Work

Parameter-efficient fine-tuning (PEFT):Recent work on PEFT of pretrained language models has shown competitive capabilities, often matching full fine-tuning performance for task-specific model customization while utilizing significantly fewer trainable parameters. Adapters Houlsby et al. (2019); Pfeiffer et al. (2021) introduce task-specific parameters within the transformer layers that adapt to a particular task. Prompt tuning based methods such as P-Tuning and Prefix-Tuning Li and Liang (2021); Liu et al. (2023) attempt to do the same but via task-specific vectors that can be appended to the inputs or at various layer representations. BitFit and IA3 Ben Zaken et al. (2022); Liu et al. (2022) are PEFT methods that attempt to only alter bias vectors or scaling vectors in the base large language model.

Low-Rank adaptation (LoRA):One of the most popular PEFT techniques is LoRA, introduced by Hu et al. (2021). LoRA employs low-rank matrix approximations of full weights' gradient-descent (GD) update to significantly reduce the number of trainable parameters. Importantly, LoRA can incorporate the low-rank updates into the frozen base weights after the fine-tuning process, avoiding any inference speed penalties or model architecture changes. In summary, LoRA paves the way for efficient fine-tuning for task-specific customization of large models with minimal computational overhead and no changes to the model's architecture.

Extensions to LoRA:Since its arrival, there have been several efforts to improve the LoRA method. These methods mostly concentrated around reducing the trainable parameters and memory footprint while increasing the performance of the method on downstream tasks. AdaLoRA Zhang et al. (2023) introduces dynamic rank adjustment for the low-rank matrices during the fine-tuning process. The fundamental premise of this extension is to optimally distribute the parameter budget over model layers. Chavan et al. (2023) combined the adapter tuning with LoRA to derive a generalized framework that utilized both methods for increased flexibility and capability across a wide variety of tasks and datasets. Kopiczko et al. (2023) proposes the VeRA method the freezes randomly initialized projection matrices and introduces trainable scaling vectors that vary across layers. This method shows similar performance to the LoRA (vBuA) method while dramatically reducing the number of trainable parameters. We view VeRA as one specific configuration which lies on end of the TiedLoRA spectrum.

Tangential to the efforts that aim to reduce trainable parameters, QLoRA Dettmers et al. (2023), significantly reduces the memory usage of LoRA using a 4-bit or 8-bit quantized base language model during training. The method provides algorithms and custom kernels to backpropagate gradients through the frozen, quantized base model to update low-rank matrices during training, resulting in considerable reduction in memory usage. Combining quantization and reduction in the number of trainable parameters is a direction of future work.

Weight tying:Weight tying Press and Wolf (2017); Inan et al. (2017) is a common approach that reduces the number of parameters by using the same set of weights in different parts of the network. Typically the input word embedding layer and the output word embedding layer (sometimes referred to as the language model head) are tied. In this study, we apply weight tying to the low-rank weight matrices used in LoRA, and share them across the layers of the base language model. This simple procedure leads to efficient training methods where the number of trainable parameters are either unaffected by, or only increases marginally with the number of hidden layers. As models get deeper this approach naturally provides greater parameter reduction over original LoRA method.

Vision Transformers:Ideas similar to Tied-Lora are also being explored in the vision based tasks. Dong et al. (2023), for example, uses weight tying and bottleneck adapters.

## 6 Conclusion & Future Work

In this paper, we introduced the TiedLoLRA paradigm, a novel approach to enhance the parameter efficiency of Lora by employing a simple technique of weight-tying and selective training of low-rank matrices.

Our empirical analysis demonstrates that the TL\({}_{6}\)(v**B\({}_{\textbf{q}}\)u**A\({}_{\textbf{q}}\)**) configuration achieves performance comparable to Lora across various tasks, 

while utilizing only a fraction of the parameters employed by Lora across a spectrum of low-rank dimensions. This efficiency becomes more pronounced at higher ranks, leading to a more aggressive reduction in the number of trainable parameters compared to Lora. Remarkably, in the translation task, \(\text{TL}_{6}(v\mathbf{B}_{\textbf{q}}u\mathbf{A}_{\textbf{q}})\) surpassed Lora's performance while using only \(12.5\%\) of the number of parameters. Our study highlights that the benefits of this configuration are particularly evident in tasks that leverage the inherent strengths of the base language model, such as commonsense NLI, extractive QA, and summarization. Tasks involving mathematical reasoning and arithmetic calculations, however, favor the sheer learning capacity of LoRA with more parameters.

As language models continue to advance, the Tied-LoRA configurations, with their optimized efficiency, emerge as a promising candidate to replace traditional Lora in a broader range of applications. This progression underscores the relevance of Tied-LoRA as a scalable solution in the dynamic landscape of large language model customization.

For future research, we plan to delve into the application of Tied-LoRA methods on larger base models. This exploration aims to assess their scalability and effectiveness within the broader context of large language models. Additionally, we intend to investigate weight tying in other parameter-efficient fine-tuning methods such as Adapters and Prefix Tuning, both of which introduce layer-specific parameters.

### Limitations

PEFT methods are inherently sensitive to the base large language which they are applied to as well as the specific customization task. While we attempt to test our methods on multiple base models computation cost restricts us to only \(2\) models (so far). While extending our analysis to other models is possible, extending to more tasks is more challenging as the variety of tasks is large. Furthermore, predicting the behavior of a PEFT method on a new task based on its performance on some existing task is very challenging. Even in our analysis we did not expect translation task to be an outlier (our Tied-LoRA method out performed LoRA) because on all the other tasks LoRA was slightly better. Thus, we caution against very strong claims of task generalization and highlight that while we show results on diverse tasks there are still a wide range of tasks we have not explored.

Figure 2: Plots showing the performance of the Tied-LoRAconfigurations averaged over tasks across all ranks.Figures 1(a) and 1(b) display all Tied-LoRAConfigurations, while Figures 1(c) and 1(d) display the best Tied-LoRAConfigurations with LoRA and Vera as baselines. Appendix A contains plots for each task and base model.

 



## References

* [1]E. Ben Zaken, Y. Goldberg, and S. Ravfogel (2022) BitFit: simple parameter-efficient fine-tuning for transformer-based masked language-models. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers), Dublin, Ireland, pp. 1-9. External Links: ISBN 978-3-540-3873-3 Cited by: SS1.
* M. Cettolo, M. Federico, L. Bentivogli, J. Niehues, S. Stuker, K. Sudoh, A. Yoshino, and C. Federmann (2017) Overview of the IWSLT 2017 evaluation campaign. In Proceedings of the 14th International Conference on Spoken Language Translation, Tokyo, Japan, pp. 2-14. External Links: Document, Link Cited by: SS1.
* A. Chavan, Z. Liu, D. Gupta, E. Xing, and Z. Shen (2023) One-for-all: generalized lora for parameter-efficient fine-tuning. arXiv preprint arXiv:2306.07967. Cited by: SS1.
* Y. Chen, Y. Liu, L. Chen, and Y. Zhang (2021) DialogSum: a real-life scenario dialogue summarization dataset. In Findings of the Association for Computational Linguistics: ACL-IJCNLP 2021, Online, pp. 5062-5074. External Links: Link, Document Cited by: SS1.
* K. Cobbe, V. Kosaraju, M. Bavarian, M. Chen, H. Jun, L. Kaiser, M. Plappert, J. Tworek, J. Hilton, R. Nakano, et al. (2021) Training verifiers to solve math word problems. arXiv preprint arXiv:2110.14168. Cited by: SS1.
* T. Dettmers, A. Pagnoni, A. Holtzman, and L. Zettlemoyer (2023) Qlora: efficient finetuning of quantized llms.. arXiv preprint arXiv:2305.14314. Cited by: SS1.
* W. Dong, D. Yan, Z. Lin, and P. Wang (2023) Efficient adaptation of large vision transformer via adapter re-composing. arXiv preprint arXiv:2310.06234. Cited by: SS1.
* N. Houlsby, A. Giurgiu, S. Jastrzebski, B. Morrone, Q. De Laroussilhe, A. Gesmundo, M. Attariyan, and S. Gelly (2019) Parameter-efficient transfer learning for nlp. In International Conference on Machine Learning, pp. 2790-2799. Cited by: SS1.
* E. J. Hu, Y. Shen, P. Wallis, Z. Allen-Zhu, Y. Li, S. Wang, L. Wang, and W. Chen (2021) LORA: low-rank adaptation of large language models. arXiv preprint arXiv:2106.09685. Cited by: SS1.
* H. Inan, K. Khosravi, and R. Socher (2017) Tying word vectors and word classifiers: a loss framework for language modeling. In 5th International Conference on Learning Representations, ICLR 2017, Toulon, France, April 24-26, 2017, Conference Track Proceedings, Menlo Park, NY, USA, pp. 8702. Cited by: SS1.
* D. J. Kopiczko, T. Blankevoor, and Y. Markus Asano (2023) Vera: vector-based random matrix adaptation. arXiv preprint arXiv:2310.11454. Cited by: SS1.
* S. Lermen, C. Rogers-Smith, and J. Ladish (2023) Lora fine-tuning efficiently undoes safety training in llama 2-chat 70b. arXiv preprint arXiv:2310.20624. Cited by: SS1.
* X. Lisi and P. Liang (2021) Prefix-tuning: optimizing continuous prompts for generation. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), Online, pp. 4582-4597. External Links: Link, Document Cited by: SS1.
* C. Lin and F. Josef Och (2004) Automatic evaluation of machine translation quality using longest common subsequence and skip-bigram statistics. In Proceedings of the 42nd Annual Meeting of the Association for Computational Linguistics (ACL-04), Barcelona, Spain, pp. 605-612. External Links: Link, Document Cited by: SS1.
* H. Liu, D. Tam, M. Muqeeth, J. Mohta, T. Huang, M. Bansal, and C. A. Rafel (2022) Few-shot parameter-efficient fine-tuning is better and cheaper than in-context learning. Advances in Neural Information Processing Systems35, pp. 1950-1965. Cited by: SS1.
* X. Liu, Y. Zheng, Z. Du, M. Ding, Y. Qian, Z. Yang, and J. Tang (2023) GPTP understands, too. AI Open. Cited by: SS1.
* I. Loshchilov and F. Hutter (2017) Decoupled weight decay regularization. arXiv preprint arXiv:1711.05101. Cited by: SS1.
* K. Papineni, S. Roukos, T. Ward, and W. Zhu (2002) BLEU: a method for automatic evaluation of machine translation. In Proceedings of the 40th Annual Meeting of the Association for Computational Linguistics, Philadelphia, Pennsylvania, USA, pp. 311-318. External Links: Link, Document Cited by: SS1.
* J. Pfeiffer, A. Kamath, A. Ruckle, K. Cho, and I. Gurevych (2021) AdapterFusion: non-destructive task composition for transfer learning. In Proceedings of the 16th Conference of the European Chapter of the Association for Computational Linguistics: Main Volume, Online, pp. 487-503. External Links: Link, Document Cited by: SS1.
* O. Press and L. Wolf (2017) Using the output embedding to improve language models. In Proceedings of the 15th Conference of the European Chapter of the Association for Computational Linguistics: Volume 2, Short Papers, Valencia, Spain, pp. 157-163. External Links: Link, Document Cited by: SS1.



Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. 2016. SQuAD: 100,000+ questions for machine comprehension of text. In _Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing_, pages 2383-2392, Austin, Texas. Association for Computational Linguistics.
* Sun et al. (2023) Xianghui Sun, Yunjie Ji, Baochang Ma, and Xiangang Li. 2023. A comparative study between full-parameter and lora-based fine-tuning on chinese instruction data for instruction following large language model. _arXiv preprint arXiv:2304.08109_.
* Touvron et al. (2023) Hugo Touvron, Louis Martin, Kevin Stone, Peter Albert, Amjad Almahairi, Yasmine Babaei, Nikolay Bashlykov, Soumya Batra, Prajjwal Bhargava, Shruti Bhosale, et al. 2023. Llama 2: Open foundation and fine-tuned chat models. _arXiv preprint arXiv:2307.09288_.
* Zellers et al. (2019) Rowan Zellers, Ari Holtzman, Yonatan Bisk, Ali Farhadi, and Yejin Choi. 2019. HellaSwag: Can a machine really finish your sentence? In _Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics_, pages 4791-4800, Florence, Italy. Association for Computational Linguistics.
* Zhang et al. (2023) Qingru Zhang, Minshuo Chen, Alexander Bukharin, Pengcheng He, Yu Cheng, Weizhu Chen, and Tuo Zhao. 2023. Adaptive budget allocation for parameter-efficient fine-tuning. _arXiv preprint arXiv:2303.10512_.

 

* [14] A. Breaddown of Performances with Ranks 

Figure 3: Plots showing the performance of the Tied-LoRA configurations along with the baseline LoRA (vBuA) for \(5\) diverse tasks at \(4\) different values for low-rank dimension setting. Note that we let the plot for \(\text{TL}_{3}(\text{vB}_{\text{u}}\texttt{uA}_{\text{\char 96}})\) and \(\text{TL}_{4}(\text{vB}_{\text{u}}\texttt{uA}_{\text{\char 96}})\) go out of bounds to show details for the other curves.