1. Introduction
The landscape of data mining and machine learning, particularly in natural language processing, has been dramatically reshaped by the advent of Large Language Models (LLMs) [
1,
2,
3]. These powerful models process vast, diverse, and often inherently asymmetric data, pushing the boundaries of automated text understanding. In this context, inherently asymmetric data refers to datasets where the distribution of crucial information is not uniform. This can manifest as severe class imbalance (e.g., far more non-offensive than offensive examples) or as a non-uniform spread of linguistic features, where the cues for a specific class are subtle and appear in only a small, unpredictable subset of instances. As we delve deeper into LLM adaptation, the intricate interplay between
symmetry and
asymmetry in their architecture, data, and training processes becomes increasingly apparent, presenting both opportunities and challenges for future research. Specifically, the task of detecting offensive language—encompassing hate speech, toxicity, and cyberbullying [
4,
5]—underscores this interplay. Offensive language itself is an
asymmetric linguistic phenomenon, characterized by subtlety, indirectness, irony, and high dependence on socio-cultural context [
6,
7,
8], making its detection a formidable challenge even for advanced LLMs.
While LLMs demonstrate remarkable capabilities [
9,
10], finetuning these massive models for specific downstream tasks like nuanced offensive language detection can be computationally prohibitive [
11]. This has spurred the development of Parameter-Efficient Finetuning (PEFT) techniques [
12,
13,
14]. Among these, Low-Rank Adaptation (LoRA) [
15] has emerged as a popular approach, injecting trainable low-rank matrices into LLM layers to drastically reduce trainable parameters. LoRA has been successfully applied to various tasks, including instruction following [
16,
17].
However, standard LoRA, despite its successes, often employs a relatively
symmetric adaptation strategy. It typically uses a fixed, predetermined rank for its decomposition matrices across all targeted layers and for all inputs. Furthermore, the LoRA update matrices are inherently dense within their low-rank structure. This static and uniform (or
symmetric) allocation may not be optimal for tasks defined by
asymmetry, such as detecting subtle offensive language. Different layers or input instances might benefit from varying degrees of adaptation [
18]. For instance, overt offensive expressions might require minimal adjustment from the base LLM, while nuanced microaggressions or sarcastic abuse might necessitate substantial, fine-grained, and thus more
asymmetric parameter shifts. A dense update mechanism within the low-rank projection can also lead to an inefficient use of the parameter budget when only a sparse,
asymmetric subset of features truly needs adjustment.
To address these limitations and better harness the power of LLMs for asymmetrically complex tasks, we propose Dynamic Sparse LoRA (DS-LoRA). DS-LoRA is an innovative extension to LoRA that explicitly incorporates asymmetry into the finetuning process, making it tailored for capturing the subtle nuances of offensive language. It introduces two key enhancements that foster asymmetric adaptation:
We incorporate lightweight, learnable gating mechanisms that dynamically and asymmetrically scale the contribution of each LoRA module based on the input instance. This allows the model to “decide” how much adaptation is needed for a given piece of text, effectively treating different inputs asymmetrically.
We apply L1 regularization to the LoRA matrices during training. This encourages parameter-level asymmetry by promoting sparsity within the low-rank update matrices themselves, compelling the model to learn which specific low-rank components are crucial and pruning redundant ones.
By combining dynamic, input-dependent gating (introducing input-level asymmetry) with learned parameter-level sparsity (introducing structural asymmetry in the updates), DS-LoRA creates a more adaptive, parsimonious, and ultimately more effective finetuning strategy. This approach enables the LLM to make highly selective and targeted adjustments, better attuned to the specific, often asymmetric, characteristics of the input text. This capability is crucial for distinguishing subtle offensive content from benign statements, directly addressing how LLMs can leverage data asymmetry for improved representation and how model design can incorporate asymmetric elements for optimized performance. Furthermore, our analysis of the learned gate activations provides insights into the model’s internal adaptive behavior, revealing how DS-LoRA dynamically allocates capacity in response to different input types.
We evaluate DS-LoRA by finetuning recent LLMs on established benchmark datasets for offensive language detection. The experimental results demonstrate that DS-LoRA significantly outperforms standard LoRA and other strong baselines. Our contributions, reframed through the lens of symmetry and asymmetry, are threefold:
We propose DS-LoRA, a novel PEFT method that integrates dynamic gating and learned sparsity to achieve an asymmetric and adaptive LoRA framework, specifically designed for nuanced NLP tasks characterized by inherent data and linguistic asymmetries.
We demonstrate through extensive experiments that DS-LoRA significantly outperforms standard LoRA and other competitive baselines in detecting offensive language, especially in challenging cases involving asymmetrically expressed subtlety and context dependency, while maintaining or improving parameter efficiency.
We provide an analysis of the learned gate behaviors and sparsity patterns, offering insights into how DS-LoRA achieves its performance gains through dynamic asymmetric adaptation, contributing to a better understanding of adaptive and potentially more explainable finetuning mechanisms.
2. Related Work
The automatic detection of offensive language has been a focal point of NLP research for over a decade, driven by the need to moderate online content and mitigate online harm [
19]. Early approaches, relying on lexicons and traditional machine learning models like SVMs with engineered features [
20], often struggled with the implicit, context-dependent, and thus highly
asymmetric nature of offensive language. These methods lacked the capacity to capture the deeper semantic understanding required to discern subtle offensive cues from benign language.
The advent of deep learning, with models like CNNs [
21], RNNs [
22], and attention-based architectures [
23], brought significant advancements by learning hierarchical feature representations. More recently, pretrained transformer-based models such as BERT [
24] and RoBERTa [
25] have set new benchmarks by learning rich contextual embeddings [
26,
27]. However, finetuning these powerful models presents challenges, especially in adapting them to the nuanced,
asymmetric variations of offensiveness without catastrophic forgetting or extensive labeled data. The inherent
asymmetry of the offensive language detection task—where offensive instances might be a minority class or manifest in diverse, non-uniform ways—poses a particular challenge for adaptation strategies that treat all data or model components uniformly.
The emergence of LLMs with billions of parameters has further revolutionized the field, yet their size makes full finetuning impractical [
28]. This has spurred research into PEFT techniques, which adapt LLMs by training only a small fraction of parameters. Prominent PEFT methods include adapter tuning [
13,
29], prompt tuning [
13,
30], and prefix tuning [
14]. LoRA [
15] posits that weight changes during adaptation have a low intrinsic rank. While significantly reducing trainable parameters, standard LoRA and many of its variants often apply updates in a relatively dense manner within the low-rank space and can employ static configurations. Variants like LoRA-FA [
31] (which freezes matrix A), QLoRA [
32] (which quantizes the model), and AdaLoRA [
18] (which adaptively allocates rank budget) have introduced improvements. AdaLoRA, for instance, takes a step towards a more
asymmetric adaptation by allocating rank based on matrix importance. However, these methods typically maintain dense LoRA matrices within their allocated ranks and may not fully exploit instance-specific dynamic adjustments or explicit parameter-level sparsity. Such approaches might be considered more
symmetric in how they apply adaptation within the LoRA module once the rank is determined, potentially overlooking the benefits of a more granular,
asymmetric engagement of parameters based on specific input nuances.
Recent advancements in PEFT, particularly within the LoRA family, have made significant strides. Methods like AdaLoRA [
18] have introduced a level of adaptivity by allocating parameter budgets based on matrix importance, acknowledging that not all components should be treated equally. This represents a step towards structural asymmetry. Other variants have focused on quantization for efficiency (QLoRA [
32]) or improving the update mechanism itself (DoRA [
33]). A key finding from this body of work is that moving beyond a one-size-fits-all adaptation strategy generally yields better performance. However, a common limitation in many of these approaches is that the adaptation, once configured, is applied in a relatively static or input-agnostic manner. For instance, even with an adaptively allocated rank, the resulting update is typically applied with the same intensity regardless of whether an input is simple and straightforward or complex and nuanced. This leaves a critical research gap: the exploration of methods that can dynamically modulate their adaptation strength on a per-instance basis. For tasks characterized by high linguistic asymmetry, such as detecting subtle offensive language, a model that can “decide” how much finetuning to apply for each specific input could be significantly more effective. This motivates our work, where we will propose a framework designed explicitly to introduce this form of dynamic, input-dependent asymmetry.
4. Experimental Setup
We detail the experimental setup and describe the base models, datasets used for training and evaluation, evaluation metrics, baseline methods, and implementation details.
4.1. Base Models
We selected two recent and powerful open source Large Language Models (LLMs) as base models for our experiments to demonstrate the generalizability of DS-LoRA:
Llama-3 8B Instruct: A decoder-only transformer model from Meta AI with 8 billion parameters. We specifically use the instruction-tuned variant, which has been aligned for better instruction following and safety, providing a strong foundation for downstream task adaptation.
Gemma 7B Instruct: A decoder-only transformer model from Google with 7 billion parameters, also an instruction-tuned variant. Gemma models are built using similar architectures and techniques as Google’s Gemini models.
For both models, we utilized their official Hugging Face Transformers library [
34] implementations. During finetuning with DS-LoRA or other PEFT methods, the original weights of these base models were kept frozen, and only the adaptation parameters were updated. A linear classification head was added on top of the base model’s last hidden state output to predict the offensive language class.
4.2. Datasets
We conducted experiments on widely recognized public benchmark datasets for offensive language detection, chosen to cover a range of offensive phenomena and annotation schemes:
OLID [
35]: This dataset, from SemEval-2019 Task 6, contains English tweets annotated for three hierarchical levels. We focus on Sub-task A: Offensive language identification (OFF vs. NOT). This task requires identifying whether a tweet contains any form of offensive language, including insults, threats, and profanity. We use the official training, development, and test splits.
HateXplain [
27]: This dataset provides fine-grained annotations for English posts from Twitter and Gab, distinguishing between hate speech, offensive language, and normal language. Crucially, it also includes human-annotated rationales (token-level explanations) for each classification, which, while not directly used for training our classification model, underscores the dataset’s focus on nuanced and explainable offensiveness. We use the three-class classification task (hate, offensive, normal) and also report a binary offensive vs. normal version for comparison.
For all datasets, we adhere to the standard training, validation, and testing splits provided by the dataset creators to ensure fair comparison with prior work. Preprocessing steps include minimal cleaning, such as the normalization of user mentions and URLs, and tokenization using the respective base model’s tokenizer.
4.3. Evaluation Metrics
To comprehensively evaluate the performance of our models, we use standard classification metrics, which include the Accuracy, Precision, Recall, F1-Score, and Macro-F1. Given that offensive language is often a minority class, the F1-score (especially Macro-F1 or F1 for the positive class) and Recall for the offensive class are particularly important indicators of a model’s practical utility.
4.4. Baselines
We compare DS-LoRA against several strong baselines and existing PEFT methods:
Zero-Shot LLM: The base Llama-3 8B and Gemma 7B models without any finetuning, using carefully crafted prompts to perform offensive language classification in a zero-shot manner.
Full Finetuning: Full finetuning of the base LLMs. Due to computational constraints, this might be limited to finetuning only the top few layers or a smaller version of the model as an indicative upper bound.
LoRA [
15]: The original LoRA implementation applied to the same target modules (
) as DS-LoRA, using various ranks (
r) for comparison.
Adapters [
36]: Finetuning using Houlsby adapters inserted into the transformer layers.
AdaLoRA [
18]: An adaptive version of LoRA that dynamically allocates the rank budget to weight matrices based on their importance, introducing a form of structural asymmetry.
QLoRA [
32]: A highly efficient adaptation method that enables finetuning on quantized four-bit models. It is the de facto standard for memory-efficient finetuning and serves as a powerful efficiency- and performance-oriented baseline.
DoRA [
33]: A recent state-of-the-art method that decomposes the pretrained weights into magnitude and direction components for finetuning. DoRA has been shown to improve the performance and training stability of LoRA.
For all PEFT methods, including DS-LoRA and standard LoRA, we tune relevant hyperparameters (e.g., rank r, LoRA , learning rate, adapter bottleneck dimension) on the development set of each dataset.
4.5. Implementation Details
For DS-LoRA and standard LoRA, we target the query () and value () projection matrices in the self-attention mechanisms of all transformer layers. The LoRA rank r is explored in the set . The LoRA scaling factor is typically set to or r. For DS-LoRA, the gate controller is implemented as a two-layer MLP with a hidden dimension of or a simple linear layer if , with ReLU activation in the hidden layer and a sigmoid output. The L1 sparsity regularization coefficient is tuned from the set . Then, we selected a two-layer MLP with a hidden dimension of 16 for all main experiments, as it provided the best balance of performance and parameter efficiency. We trained for a maximum of to 10 epochs, depending on the dataset size, with early stopping based on the validation set’s Macro-F1 score. Batch sizes were chosen based on GPU memory constraints, typically ranging from 4 to 16 per GPU. Experiments were run on four NVIDIA A100s.
5. Results and Analysis
In this section, we present the empirical results of our proposed DS-LoRA compared against baseline methods on the OLID and HateXplain datasets. We interpret these results through the lens of how asymmetric adaptation benefits performance on nuanced tasks. We then conducted ablation studies to understand the individual contributions of DS-LoRA’s key and provide further analysis into their behavior, particularly how they manifest asymmetry in model adaptation.
5.1. Main Results
Table 1 and
Table 2 summarize the performance of DS-LoRA and baseline methods on the OLID and HateXplain datasets, respectively. We report the Accuracy, Precision, Recall, F1-Score, and Macro-F1. All PEFT methods were applied to both Llama-3 8B and Gemma 7B base models.
As shown in
Table 1 and
Table 2, DS-LoRA consistently outperforms all baseline methods across both datasets and for both the Llama-3 8B and Gemma 7B base models. This suggests that our method is more effective than the more uniform approaches of standard LoRA or other baselines. On OLID, DS-LoRA (Llama-3 8B) achieves a Macro-F1 of 81.3%, an improvement of 1.2% over standard LoRA. Notably, the F1-score for the “Offensive” class sees a more significant gain of 1.8% (77.7% vs. 75.9%). This highlights DS-LoRA’s enhanced ability to correctly identify the target minority class, likely due to its more targeted,
asymmetric adjustments that can better capture the specific nuances of this class compared to a more
symmetric update applied across all inputs. Similar trends are observed for the Gemma 7B model.
The performance gains from DS-LoRA’s asymmetric approach are even more pronounced on the more challenging HateXplain dataset, which features finer-grained distinctions and thus greater asymmetries in class characteristics. For Llama-3 8B, DS-LoRA achieves a Macro-F1 of 72.0%, surpassing standard LoRA by 1.8%. The F1-scores for both “Hate” (66.5% vs. 64.0%) and “Offensive” (70.1% vs. 67.5%) classes show substantial improvements. This suggests that the dynamic gating (enabling input-level asymmetry) and sparsity mechanisms (enabling parameter-level asymmetry) in DS-LoRA are particularly beneficial for capturing the subtle, often asymmetrically expressed cues that differentiate these categories. These results indicate that DS-LoRA’s adaptive asymmetric nature allows it to make more precise adjustments to the base LLM, which is crucial for nuanced classification tasks where a one-size-fits-all (symmetric) adaptation is suboptimal. The number of trainable parameters for DS-LoRA is only marginally larger than that for standard LoRA (due to the small gate controller) but remains significantly lower than for partial full finetuning or standard adapter approaches with larger bottleneck dimensions, demonstrating efficient use of parameters through its asymmetric design.
5.2. Ablation Studies
To understand the individual contributions of the key
asymmetric components of DS-LoRA—input-dependent gating (Gate), which introduces
input-level asymmetry, and L1 sparsity regularization (L1), which fosters
parameter-level asymmetry—we conducted ablation studies on the OLID dataset using Llama-3 8B. The results are presented in
Table 3.
The ablation results in
Table 3 clearly demonstrate that both the
input-level asymmetry introduced by the gating mechanism and the
parameter-level asymmetry from L1 sparsity regularization contribute positively to DS-LoRA’s performance. Adding only the gating mechanism to standard LoRA (‘LoRA + Gate‘) improves the F1(Offensive) score by 1.2% and Macro-F1 by 0.8%. This suggests that dynamically and
asymmetrically scaling LoRA module contributions based on input characteristics is highly beneficial, allowing the model to respond differently to varying inputs. Similarly, incorporating only L1 sparsity (‘LoRA + L1 Sparsity‘) provides a modest improvement, indicating that encouraging sparser, more
asymmetric LoRA update matrices helps in refining the adaptation by focusing on critical parameters. The full DS-LoRA model, combining both
asymmetric components, achieves the best performance, underscoring the synergistic effect of dynamic
input-level asymmetry and learned
parameter-level asymmetry. This synergy allows for a more nuanced and effective adaptation than either component alone or a more
symmetric baseline.
The design of the gate controller () offers a trade-off between expressive power and parameter overhead. A more complex gate might better model the decision of when to apply adaptation, but at the cost of more trainable parameters. To justify our design choice, we conducted an ablation study on the architecture of the gate controller itself. We evaluated three configurations on the OLID dataset with Llama-3 8B:
Linear Gate: A simple linear layer followed by sigmoid (
), as described in Equation (
3).
MLP (d = 16): A two-layer MLP with a hidden dimension of 16 and ReLU activation. This is the configuration used in our main experiments.
MLP (d = 32): A two-layer MLP with a hidden dimension of 32 and ReLU activation.
The results are presented in
Table 4. The results demonstrate that even the simplest
linear gate provides a substantial performance boost over standard LoRA, improving the Macro-F1 score by 0.7%. This confirms the fundamental benefit of the input-dependent gating mechanism. Introducing a hidden layer in the
MLP () configuration yields a further improvement, reaching the best Macro-F1 score of 81.3%. This suggests that the non-linearity and increased capacity of the MLP allow it to learn a more effective gating function. However, increasing the hidden dimension further to 32 (
MLP ()) did not lead to additional gains and in fact resulted in a slight drop in performance, likely due to overfitting on this small control network. Therefore, we selected the MLP with a hidden dimension of 16 as our default architecture for all experiments. It strikes the optimal balance, providing a clear performance benefit over a simpler linear gate without adding unnecessary complexity or parameters.
5.3. Analysis of DS-LoRA Components
5.3.1. Sensitivity to LoRA Rank r
We investigate the performance of DS-LoRA and standard LoRA across different LoRA ranks (
) on the HateXplain dataset (Macro-F1) using Llama-3 8B.
Figure 2 illustrates the results, comparing DS-LoRA’s
asymmetric approach with standard LoRA’s more
symmetric use of rank.
Figure 2 shows that DS-LoRA consistently outperforms standard LoRA across all tested ranks. Both methods generally improve with increasing rank (adaptation capacity), but DS-LoRA exhibits a stronger performance curve. Its advantage over standard LoRA is maintained, suggesting that its
asymmetric adaptation mechanisms (dynamic gating and sparsity) enable more effective utilization of the available rank. Even with a larger adaptation capacity (higher
r), the ability to
asymmetrically allocate and refine this capacity provides a distinct advantage. Interestingly, DS-LoRA with
already surpasses standard LoRA with
. This indicates that the
asymmetric and targeted nature of DS-LoRA allows for achieving comparable or better results with a lower intrinsic rank (and thus fewer parameters within the LoRA matrices before sparsity) compared to a more
symmetric, dense application of a higher rank.
5.3.2. Impact of Sparsity Coefficient
We analyze the effect of the L1 sparsity coefficient on DS-LoRA’s performance (Macro-F1, OLID, Llama-3 8B, ) and the resulting parameter-level asymmetry (sparsity level) in LoRA matrices.
Figure 3 illustrates that increasing
generally leads to higher
parameter-level asymmetry (sparsity) in the LoRA
A and
B matrices. Performance (Macro-F1) initially improves with moderate sparsity, peaking around
. At this point, over 50% of LoRA weights become zero (high
asymmetry), yet the model delivers its best F1 score. This strongly suggests that a significant portion of parameters in a standard dense LoRA (which exhibits
parameter-level symmetry by updating all elements in
A and
B) might be redundant or even detrimental for nuanced tasks. The introduced
asymmetry allows the model to focus its capacity. However, excessively high
(e.g.,
) can lead to over-sparsification (extreme
asymmetry) and a slight degradation in performance, indicating a trade-off between parsimony from
asymmetry and model capacity. The optimal
effectively prunes less important LoRA parameters, creating a beneficial level of
parameter-level asymmetry that allows the model to focus on the most discriminative low-rank updates.
5.3.3. Qualitative Analysis of Gate Activations
To further investigate the behavior of the dynamic gating mechanism—a core driver of
input-level asymmetry in DS-LoRA—we analyzed the average gate activation values (
) for DS-LoRA modules across different layer groups of the Llama-3 8B model. These activations were conditioned on the ground-truth input category from the HateXplain dataset, which itself contains categories with
asymmetric levels of offensiveness.
Table 5 presents these average activations, including the standard deviation to indicate variance. This analysis provides a window into how the model
asymmetrically allocates adaptive capacity based on input.
Several key observations emerge from
Table 5, clearly demonstrating
input-asymmetric adaptation: Firstly, across all layer groups, inputs categorized as “Normal” consistently exhibit the lowest average gate activations (e.g., overall model average of
). This suggests that DS-LoRA appropriately reduces LoRA module contributions when the base model’s pretrained knowledge is likely sufficient, effectively choosing a more
symmetric response (closer to the frozen base LLM) for benign inputs. This conserves parameter updates and prevents unnecessary
asymmetric shifts for inputs that do not require them. Secondly, inputs identified as “Hate Speech” trigger significantly higher average gate activations (overall model average of
), particularly in the middle layers (average of
). This indicates that the model learns to engage the LoRA adaptations more strongly—an
asymmetric increase in adaptation intensity—when encountering highly offensive content that requires specialized,
asymmetric adjustments from the base model’s representations. Inputs classified as “Offensive (Non-Hate)” generally show gate activations between those for “Normal” and “Hate Speech,” reflecting an intermediate level of
asymmetric adaptation.
The higher engagement in middle layers for “Hate Speech” is particularly noteworthy in the context of asymmetric feature learning. These layers in LLMs are often associated with capturing more complex semantic relationships and abstract features. The increased LoRA activity here might suggest that DS-LoRA is making crucial fine-grained adjustments in these intermediate representations to better distinguish severe forms of offensive language—which are distinct from benign content—from merely offensive or normal text. This layer-specific and category-specific dynamic modulation of LoRA pathways, a clear manifestation of input-level asymmetry, supports our hypothesis that the gating mechanism enables a more targeted, efficient, and asymmetric use of adaptation parameters, contributing to the improved performance on nuanced distinctions. This directly relates to how asymmetry can contribute to more explainable LLM behaviors by revealing where and how adaptation is applied differently.
To assess the broader applicability and robustness of our proposed DS-LoRA, we extend our evaluation beyond English social media. The core hypothesis of our work is that the benefits of asymmetric adaptation are particularly salient for nuanced tasks, a characteristic not limited to a single domain or language. Therefore, we tested DS-LoRA’s performance in two new settings: a different domain (English forum comments) and a different language (German).
5.4. Performance on Cross-Domain and Cross-Languages
We used the publicly available
Jigsaw/Wikipedia Toxicity Classification dataset (
https://www.kaggle.com/c/jigsaw-toxic-comment-classification-challenge, accessed on 22 June 2025). This dataset consists of a large number of comments from Wikipedia talk page edits, which have been human-rated for toxicity. We frame this as a binary classification task (toxic vs. non-toxic). This domain differs from Twitter in its longer text format and more formal (though often still adversarial) conversational style, providing a robust test for domain generalization.
To evaluate cross-lingual performance, we used the
GermEval 2018 Task 1 dataset [
37], a standard benchmark for identifying offensive language in German tweets. We focused on the binary classification subtask (OFFENSIVE vs. OTHER). For this experiment, we used a multilingual base model, specifically the instruction-tuned version of
Llama-3-8B-Instruct, to ensure a strong foundation for the German language.
For both new datasets, we followed the same experimental protocol as before, comparing our DS-LoRA against the standard LoRA baseline. The results of our generalization experiments are summarized in
Table 6.
On the Wikipedia Toxicity dataset, DS-LoRA achieves an F1-score of 86.1%, a significant improvement of 1.3% over the standard LoRA baseline. This suggests that the ability to dynamically modulate adaptation strength and prune redundant parameters is beneficial even for longer-form text and different definitions of problematic content. In the cross-lingual setting on the German GermEval 2018 dataset, DS-LoRA continues to outperform its symmetric counterpart, achieving an F1-score of 80.4% compared to 78.8% for standard LoRA. This result is particularly compelling, as it demonstrates that our method is not reliant on English-specific linguistic features. The core mechanism—allowing the model to learn how much and which parts of the LoRA module to apply based on the input—is a general principle that translates well to other languages.
5.5. Analysis of Computational Cost
While the primary goal of DS-LoRA is to improve model performance on nuanced tasks, it is crucial to assess its practicality by analyzing the computational overhead it introduces. In this section, we quantify the trade-offs in terms of training time, memory usage, and inference latency.
Training Time is measured as the average wall clock time per training epoch.
Peak GPU Memory is the maximum allocated GPU memory during the training process, as reported by PyTorchV2.3.1.
Inference Latency is the average time to perform a forward pass for a single sample, measured with a batch size of 1 to isolate the per-sample processing time.
All methods are configured with a LoRA rank of .
The results of our computational cost analysis are presented in
Table 7. DS-LoRA exhibits a
12.4% increase in training time per epoch compared to standard LoRA. This overhead is attributable to two main sources:
L1 Sparsity Loss Calculation: At each training step, the model must compute the L1 norm over all parameters in the LoRA matrices (A and B). While computationally simple, this operation iterates over millions of parameters, adding a noticeable cost to the loss computation phase.
Gate Controller Computation: The forward and backward passes for the small gate controller networks at each adapted layer contribute additional floating-point operations.
This is a one-time cost during the training phase. The memory footprint sees only a marginal increase of 2.2%, primarily for storing the gate parameters and their optimizer states, confirming that the gating mechanism is lightweight.
During inference, the L1 regularization term is absent. The primary source of overhead is the forward pass through the gating networks, which must be executed for each input at every adapted layer. This results in a 9.4% increase in per-sample latency compared to standard LoRA in our measurements.
DS-LoRA was designed to maximize performance, and this analysis confirms it does so at a modest computational cost. For the OLID task, this ∼10–12% increase in computational resources yields a 1.2% absolute improvement in Macro-F1 over standard LoRA and a 0.3% improvement over the highly competitive DoRA.
It is also important to consider the nature of the induced sparsity. Our latency measurements use standard dense matrix multiplication kernels. The significant parameter sparsity (∼50% as shown in
Figure 2) created by L1 regularization could potentially lead to
faster inference if deployed on hardware or using software libraries (e.g., NVIDIA’s ‘cusparseLt‘) that are optimized for sparse computations. In such scenarios, the latency cost of the gate controllers could be partially or even fully offset.
5.6. Case Study
To provide a more intuitive understanding of how DS-LoRA’s asymmetric adaptation helps in practice, we present a qualitative analysis of specific examples where standard LoRA fails but DS-LoRA succeeds. These cases, drawn from the HateXplain test set, highlight the types of nuanced and context-dependent offensive language that benefit most from our method.
For each example, we compare the predictions of the base model (Llama-3 8B Instruct, zero-shot), standard LoRA, and DS-LoRA. We also report the overall average gate activation () from DS-LoRA, which serves as a proxy for how much the model decided to “engage” its finetuned knowledge for that specific instance. A higher value indicates that DS-LoRA applied a stronger adaptation.
Table 8 showcases several such examples. The examples in
Table 8 reveal a clear pattern. Standard LoRA, with its uniform adaptation strategy, struggles with text where the offensiveness is not derived from explicit keywords but from
sarcasm, subtext, coded language, or stereotypes. In these cases, the base LLM’s initial inclination is to classify the text as non-offensive based on a literal reading. Standard LoRA’s fixed-strength adaptation is often insufficient to overturn this strong initial bias. In contrast, DS-LoRA’s gating mechanism learns to identify these challenging, ambiguous instances. The high average gate activation scores (
) for all these failed cases indicate that the model “knew” it was facing a difficult input and responded by dynamically increasing the influence of the LoRA updates. This ability to apply adaptation strength “on-demand” is precisely what allows DS-LoRA to capture the contextual nuances that other methods miss, providing a more robust and discerning model for offensive language detection.
6. Limitations and Future Work
Despite the promising results, our work has several limitations that open avenues for future research.
Computational Overhead of Gating The core innovation of DS-LoRA, the dynamic gating mechanism, introduces computational overhead. As quantified in our cost analysis (
Section 5.5), the gate controllers add a modest but non-negligible cost to both training time (∼12%) and inference latency (∼9%). While we argue this is a worthwhile trade-off for the gains in accuracy, for applications with extremely strict latency or energy budgets (e.g., on-device deployment), this overhead might be a limiting factor. Future work could explore more computationally efficient gate architectures, such as using parameter-free functions or sharing gate controllers across layers to reduce this cost.
Risk of Gate Controller Overfitting The gate controller is a small neural network that is trained jointly with the LoRA matrices. Like any neural network, it is susceptible to overfitting, especially on datasets with limited size or diversity. The gate could potentially learn spurious correlations in the training data, leading it to incorrectly modulate the LoRA adaptation for out-of-distribution samples. While our experiments on established benchmarks did not indicate this was a major issue, it remains a potential limitation. Future research could investigate applying specific regularization techniques (e.g., dropout or weight decay) directly to the gate controller’s parameters to improve its generalization.
Focus on Classification Tasks Our evaluation focused exclusively on text classification. While DS-LoRA demonstrated strong performance, its applicability to generative tasks (e.g., summarization, machine translation, instruction following) has not been tested. It is an open question how dynamic, instance-specific gating would affect the coherence and quality of generated text. Applying and evaluating DS-LoRA in a generative setting is a promising direction for future work.