alphaFeedback

WorksComputer Science

LoRA-Patch: Defending Against Backdoored LoRA Adapters via Directional Steering

AI contributions
Not recorded for this paper
View details

Abstract

Third-party LoRA adapters introduce serious backdoor risks: malicious adapters can maintain normal task performance while embedding hidden, trigger-activated behaviors, making them difficult to detect through standard utility evaluations. Existing removal-based defenses typically sanitize backdoored models by updating, pruning, distilling, or mixing model parameters. However, these approaches are misaligned with adapter-based deployment, where the trusted base model is expected to remain frozen. In this work, we propose LoRA-Patch, a lightweight backdoor defense tailored to LoRA adapters. Our key insight is that backdoor injection distorts the directional geometry of a poisoned adapter relative to its trusted base model. Building on this insight, LoRA-Patch suppresses trigger-activated behaviors by realigning adapter directions through layer-wise steering, without modifying the base model weights. Extensive experiments across five backdoor attacks and three models show that LoRA-Patch effectively mitigates trigger-activated backdoors, outperforming existing baselines while preserving benign task performance. Moreover, LoRA-Patch is computationally efficient, constructing patches within 20 seconds across all evaluated models and adapters. Our code is publicly available at https://github.com/FOXVEDA/LoRA-Patch.

Introduction

Open-weight model hubs have made it increasingly common to reuse task-specialized LoRA adapters for downstream applications ([12, 25] (Zhang et al. 2025)). This adapter-based paradigm enables efficient and modular deployment, but also introduces a new risk: an externally obtained adapter may preserve normal task performance while embedding hidden behaviors activated only by specific triggers ([25, 20, 5] (Gu et al. 2023)). Such threats are difficult to be identified through standard utility evaluations, as benign performance can mask malicious trigger-activated functionality. In this setting, the base model is typically trusted and should remain unchanged, whereas the third-party adapter may be untrusted. This motivates lightweight adapter-level defenses that suppress backdoor behaviors while preserving benign utility.

Existing backdoor defenses ([2, 9] (Zhao et al. 2024; Liu et al. 2024a)) mainly fall into three categories: anti-backdoor training, model sanitization, and inference-time guarding. Anti-backdoor training aims to learn clean models from potentially poisoned data by identifying or suppressing malicious samples ([21]). Model sanitization removes or weakens backdoor behaviors after training through pruning (Liu et al., 2018), knowledge distillation ([22] (Zhao et al. 2025)), neuron-level analysis ([23]), embedding-space perturbation (Zeng et al., 2024), or layer-wise consistency regularization (Min et al., 2025). Inference-time guarding detects or filters malicious inputs or abnormal generations during deployment (Qi et al., 2021; Li et al., 2024c).

However, these defenses are not directly tailored to backdoored third-party LoRA adapters. Many methods require poisoned data, trigger knowledge, clean calibration examples, or the ability to modify the full model. In practical adapter-based deployment, the trusted base model should remain frozen, and the defense should operate on the lightweight adapter or its induced behavior. Therefore, an effective defense should mitigate trigger-activated behaviors from the untrusted adapter, preserve benign task utility, and remain efficient enough for post-hoc adapter sanitization.

To address this challenge, we propose LoRAPatch, a lightweight adapter-level defense against backdoored LoRA adapters via directional steering without modifying the base model weights. Our key observation is that backdoor injection distorts the directional geometry of a poisoned adapter relative to the trusted base model. Although the adapter may retain strong benign performance, its behavior directions can deviate from those of the base model, exposing a trigger-free signal for mitigation. Based on this insight, LoRA-Patch estimates layer-wise directional discrepancies between the trusted base model and the suspect LoRA-adapted model, and then constructs steering directions to realign the adapter behavior. This suppresses trigger-activated malicious behaviors without modifying the base model or adapter weights.

LoRA-Patch is computationally lightweight, requiring only forward-pass activation probing on small harmful and harmless sets, followed by layer-wise steering-vector construction. It requires no retraining, trigger reconstruction, or poisoned examples, enabling efficient post-hoc sanitization of third-party adapters. Our contributions are summarized as follows:

  • We show that backdoor injection distorts the directional geometry of LoRA adapters relative to the trusted base model, providing a trigger-free geometric indicator for adapter-level backdoor mitigation.

  • We propose LoRA-Patch, a lightweight steering defense that sanitizes backdoored LoRA adapters without modifying the base model.

  • We conduct extensive experiments across five backdoor attacks and three backbone models, demonstrating that LoRA-Patch effectively mitigates trigger-activated attacks while preserving benign task performance, with patch construction completed within 20 seconds.

Related Work

Backdoor Attacks. Backdoor attacks aim to induce attacker-specified behaviors in the presence of a trigger while preserving normal performance on clean inputs [11, 16]. Existing attacks can be broadly categorized into data poisoning and parameter manipulation. Data-poisoning attacks inject trigger-bearing examples into training or instruction-tuning data to associate triggers with target behaviors without degrading clean performance (Yao et al., 2023; Zhao et al., 2023; Yan et al., 2024); for example, Cai et al. [4] adaptively select effective and inconspicuous continuous-prompt triggers. Parameter-manipulation attacks implant backdoors by directly modifying model weights or manipulating the optimization process [18, 10]. For instance, Li et al. [18] formulate backdoor injection as model editing and alter a small subset of LLM parameters, while Gu et al. [10] control gradient magnitude and direction to preserve backdoor behaviors during subsequent fine-tuning.

Backdoor Defense. Backdoor defenses can be broadly grouped into three categories: (1) Anti-backdoor training aims to learn a clean model from potentially poisoned data by identifying or suppressing malicious samples during training [21, 7] (Shao et al. 2021). For example, ABL [21] isolates suspicious samples in the early training stage and weakens their association with the target label through gradient ascent; (2) Model sanitization removes or weakens backdoor behaviors in suspicious models after training [22] (Liu et al. 2018; Zhao et al. 2025). For instance, Fine-mixing (Zhang et al., 2022) mitigates backdoors by interpolating backdoored fine-tuned weights with clean pretrained weights. (3) Inference-time guarding detects malicious inputs or abnormal generations during deployment (Qi et al., 2021; Li et al., 2024c; Mo et al., 2025), such as perplexity-based outlier detection (Qi et al., 2021) and reference-model decoding (Li et al., 2024c). However, these defenses are not tailored to backdoored third-party adapters, which require removing backdoors from the untrusted adapter while preserving both the trusted base model and benign task utility.

LoRA-based Adapters. LoRA is a representative parameter-efficient fine-tuning method that adapts pretrained LLMs by injecting trainable low-rank updates into frozen weights [12, 13]. Its variants, such as AdaLoRA, DoRA, and LoRI, further improve rank allocation, update decomposition, and cross-task transfer (Zhang et al., 2023; Liu et al., 2024b; Zhang et al., 2025). Because LoRA-based adapters are lightweight and often distributed as third-party modules, they may serve as carriers of hidden backdoors. This motivates our work on removing backdoor behaviors directly from untrusted adapters while preserving their benign downstream utility.

Problem Definition and Motivation

In this section, we first formalize the adapter-level backdoor problem definition, and then empirically motivate refusal-direction displacement as a trigger-free geometric signal for backdoored LoRA adapters.

Problem Definition

We consider an adapter-based deployment scenario where a trusted base LLM MbM_b is equipped with a third-party LoRA adapter ApA_p. The base model is clean and frozen, while the adapter may be compromised. We denote the suspect model by:

Mp=Mb⊕Ap,(1)M_p = M_b \oplus A_p, \tag*{(1)}

where ⊕\oplus denotes the composition of the base model weights with the low-rank adapter updates (Hu et al., [12]). Let hlb(x)h_l^b(x) and hlp(x)h_l^p(x) denote the layer-ll residual-stream representations of the base model and the adapted model, respectively. The adapter-induced representation shift at layer ll is:

hlp(x)=hlb(x)+ΔA,l(x),(2)h_l^p(x) = h_l^b(x) + \Delta_{A,l}(x), \tag*{(2)}

where ΔA,l(x)\Delta_{A,l}(x) captures the effect introduced by the LoRA adapter.

Following prior work (Arditi et al., [1]), we define the layer-wise refusal direction of a model MM as the contrast between harmful and harmless probe representations:

rlM=Ex∈Ph[hlM(x)]−Ex∈Pc[hlM(x)],(3)r_l^M = \mathbb{E}_{x \in\mathcal{P}_h}\left[h_l^M(x)\right] - \mathbb{E}_{x \in\mathcal{P}_c}\left[h_l^M(x)\right], \tag*{(3)}

where Ph\mathcal{P}_h and Pc\mathcal{P}_c denote harmful and harmless probe sets, respectively, and E\mathbb{E} denotes the empirical mean over the corresponding probe set. Applying this definition to the trusted base model and the suspect adapted model yields rlbr_l^b and rlpr_l^p. The adapter-induced change in refusal direction is then:

rlp−rlb=Ex∈Ph[ΔA,l(x)]−Ex∈Pc[ΔA,l(x)].(4)r_l^p - r_l^b = \mathbb{E}_{x \in\mathcal{P}_h}\left[\Delta_{A,l}(x)\right] - \mathbb{E}_{x \in\mathcal{P}_c}\left[\Delta_{A,l}(x)\right]. \tag*{(4)}

A benign LoRA adapter is expected to adapt the model to a downstream task while largely preserving its safety-related directional structure. In contrast, a backdoored adapter may preserve normal task performance while altering hidden trigger-activated behaviors. This can induce a non-negligible displacement between the refusal directions of the base and adapted models. We quantify this displacement at layer ll by:

Δsl=1−⟨rlb,rlp⟩∥rlb∥2∥rlp∥2.(5)\Delta s_l = 1 - \frac{\left\langle r_l^b, r_l^p \right\rangle}{\left\lVert r_l^b \right\rVert_2 \left\lVert r_l^p \right\rVert_2}. \tag*{(5)}

A larger Δsl\Delta s_l indicates stronger directional deviation from the trusted base model. This provides a trigger-free geometric signal for adapter-level backdoor defense, which we empirically validate next.

Motivation Example

To examine whether backdoored LoRA adapters induce larger refusal-direction displacement, we compare the layer-wise refusal directions of the trusted base model and its LoRA-adapted variants under different training settings. Following Arditi et al. [1], we conduct controlled experiments on Llama-3.1-8B (Dubey et al., [8]) with two types of adapters: a clean-task adapter and five backdoored adapters trained with VPI (Yan et al., 2024), Sleeper (Hubinger et al., [16]), BadNets (Gu et al., [11]), CTBA (Huang et al., [14]), and MTBA (Li et al., [19]). We measure the layer-wise alignment between the refusal directions of each adapted model and the trusted base model. As shown in Figure 1, the clean-task adapter exhibits only moderate drift from the trusted base model. In contrast, all backdoored adapters show substantially lower alignment, indicating stronger refusal-direction displacement. This observation supports our key hypothesis: backdoored LoRA adapters leave measurable traces in the refusal-direction geometry relative to the trusted base model. Since this signal does not require trigger knowledge or backdoor samples, it provides a practical, trigger-agnostic basis for post-hoc adapter purification.

Layer-wise refusal-direction stability across decoder layers

Figure 1. Layer-wise refusal-direction stability sls_l between the trusted base model and each adapted model across decoder layers on Llama-3.1-8B-Instruct. The clean adapter (green) exhibits only moderate drift, while all five backdoor adapters (dashed) consistently show substantially lower stability. This separation supports using refusal-direction stability as a trigger-free geometric indicator for adapter-level backdoor defense. More visualization results are provided in Appendix C.

LoRA-Patch Defense

Defense Setting. We consider a defender with access to a trusted local base model but no knowledge of the backdoor trigger, attack target, or poisoned training samples. The defender is equipped with a small amount of task-specific data and a small set of generic malicious prompts for safety probing. Under this setting, the objective is to mitigate potential backdoors embedded in untrusted LoRA adapters while preserving their downstream-task utility.

Overview. Following the adapter purification setting and motivating example in § 3.2, we propose LoRA-Patch, a lightweight defense that repairs a suspect LoRA adapter without modifying the trusted base model. As shown in Figure 2, LoRA-Patch consists of two steps: Refusal Direction Probing and Refusal Geometry Realignment. It estimates layer-wise refusal directions from the base and adapted models, measures their discrepancy, and constructs late-layer steering directions as a lightweight runtime patch. During inference, the patch realigns the suspect model with the trusted refusal geometry, suppressing trigger-activated behaviors while preserving benign utility.

Overview of the LoRA-Patch framework

Figure 2. Overview of the LoRA-Patch framework. LoRA-Patch consists of two steps: (1) Refusal Direction Probing, which estimates layer-wise refusal directions from the trusted base model and the suspect LoRA-adapted model using harmful and harmless probes; and (2) Refusal Geometry Realignment, which constructs late-layer steering directions anchored to the trusted base refusal geometry. The resulting steering vectors are stored as a lightweight patch to suppress trigger-activated behaviors while preserving benign task utility.

Step 1: Refusal Direction Probing. Let MbM_b denote the trusted base model with NN layers and let MpM_p denote the suspect LoRA-adapted model. We define a steering window L={lk,…,lN}\mathcal{L} = \{l_k, \ldots, l_N\}, which denotes the set of layers on which LoRA-Patch applies directional steering.

For each layer l∈Ll \in\mathcal{L}, LoRA-Patch estimates the refusal directions of both MbM_b and MpM_p. Following the difference-in-means formulation of Arditi et al. [1], we compute the refusal direction for a model as defined in Eq. (3). Applying this formulation to MbM_b and MpM_p yields the base refusal direction rlbr_l^b and the suspect refusal direction rlpr_l^p, respectively.

To quantify refusal-geometry consistency between the trusted base model and the suspect adapted model, we compute the average directional alignment over a late-layer window L\mathcal{L}:

SL=1∣L∣∑l∈L⟨rlb,rlp⟩∥rlb∥2∥rlp∥2.(6)S_{\mathcal{L}} = \frac{1}{|\mathcal{L}|} \sum_{l \in\mathcal{L}} \frac{\langle r_l^b, r_l^p \rangle}{\lVert r_l^b \rVert_2 \lVert r_l^p \rVert_2}. \tag*{(6)}

A lower SLS_{\mathcal{L}} indicates stronger directional displacement from the trusted base model.

Step 2: Refusal Geometry Realignment. Given the base and suspect refusal directions, LoRA-Patch constructs layer-wise steering directions over the selected layer window L\mathcal{L}. For each layer l∈Ll \in\mathcal{L}, we normalize both directions to obtain unit vectors:

bl=rlb∥rlb∥2,cl=rlp∥rlp∥2,(7)\mathbf{b}_l = \frac{r_l^b}{\lVert r_l^b \rVert_2}, \qquad\mathbf{c}_l = \frac{r_l^p}{\lVert r_l^p \rVert_2}, \tag*{(7)}

where bl\mathbf{b}_l serves as the trusted refusal anchor and cl\mathbf{c}_l captures the refusal direction of the suspect model. Using only bl\mathbf{b}_l may ignore the representation geometry of the adapted model, whereas directly using cl\mathbf{c}_l may over-rely on the suspect adapter. LoRA-Patch therefore isolates the component of cl\mathbf{c}_l that is orthogonal to the base refusal axis:

ol=cl−⟨cl,bl⟩bl,(8)\mathbf{o}_l = \mathbf{c}_l - \langle\mathbf{c}_l, \mathbf{b}_l \rangle\mathbf{b}_l, \tag*{(8)}

where ⟨cl,bl⟩\langle\mathbf{c}_l, \mathbf{b}_l \rangle denotes the inner product between the two normalized directions. The resulting ol\mathbf{o}_l is the residual of cl\mathbf{c}_l after removing its base-aligned component. We use this residual as an adapter-geometry compensation term: the dominant steering direction remains anchored to bl\mathbf{b}_l, while the orthogonal component adapts the injection direction to the refusal geometry expressed by the composed model. We then normalize this residual as:

o^l=ol∥ol∥2.(9)\hat{\mathbf{o}}_l = \frac{\mathbf{o}_l}{\lVert\mathbf{o}_l \rVert_2}. \tag*{(9)}

During inference, LoRA-Patch applies a residual-stream intervention (Turner et al., 2024) at each layer l∈Ll \in\mathcal{L}. Let hl\mathbf{h}_l denote the original residual-stream activation and h^l\hat{\mathbf{h}}_l denote the activation after applying the runtime patch. The intervention is:

h^l=hl+αbbl+αoo^l.(10)\hat{\mathbf{h}}_l = \mathbf{h}_l + \alpha_b \mathbf{b}_l + \alpha_o \hat{\mathbf{o}}_l. \tag*{(10)}

Here, αb\alpha_b controls steering along the trusted base anchor, while αo\alpha_o controls the adapter-geometry compensation. The dominant component is always anchored to bl\mathbf{b}_l; αoo^l\alpha_o\hat{\mathbf{o}}_l only adjusts this base-anchored direction to the residual geometry of the composed model. Setting αo=0\alpha_o = 0 recovers pure base-anchor steering.

Empirical Results and Key Findings

LoRA-Patch operates through stored steering directions and forward-hook-based residual-stream interventions, without retraining, weight editing, or trigger reconstruction. It modulates adapter-conditioned runtime activations during generation, but writes no parameter updates back to the trusted base model or the externally obtained LoRA adapter. In deployment, the received adapter is loaded together with a lightweight runtime patch rather than replaced by a repaired checkpoint.

Implementation Setup

Models and Datasets. We evaluate LoRA-Patch on three open-weight models: Llama-3-8B-Instruct ((Meta AI, 2024)), Llama-3.1-8B-Instruct ([8]), and Mistral-7B-Instruct ([17]), using GSM8K ([6]) as the main downstream task dataset and AdvBench ((Zou et al., 2023)) as the harmful probes. For each backbone model, we train LoRA adapters ([12]) on GSM8K with a 5% poisoning rate. Each adapter uses rank r=32r=32 and scaling factor 64, and is trained for 3 epochs with a learning rate of 5×10−55 \times10^{-5}, batch size 2, and dropout rate 0.05.

Attack Settings. In this work, we focus on more challenging jailbreak backdoor attacks that induce strict outputs upon trigger activation, following prior work ([20]). We evaluate five representative backdoor attacks: BadNets ([11]), a fixed lexical trigger attack; VPI ((Yan et al., 2024)), a virtual-prompt trigger attack; Sleeper ([16]), a context-conditioned trigger attack; CTBA ([14]), a composite trigger attack; and MTBA ([19]), a multi-trigger attack. Each attack is configured following Li et al. [20] to ensure fair and reproducible comparisons. More details of each attack are provided in Appendix § 7.§ 1.

Defense Baselines. We compare LoRA-Patch with three representative defense baselines: Fine-Tuning ((Qi et al., 2024)), which fine-tunes the suspect adapter using the same clean-data budget; Fine-Pruning ((Sun et al., 2024)), a post-training pruning baseline; and CROW ((Min et al., 2025)), a clean-data regularization baseline. For LoRA-Patch, we use the last eight decoder layers as the steering window and set the steering strengths to (αb,αo)=(1.1,0.6)(\alpha_b,\alpha_o)=(1.1,0.6). Further details of each baseline are provided in Appendix § 7.§ 2.

Evaluation Metrics. Following prior work ([20]), we report two evaluation metrics.

Attack Success Rate (ASR) measures the fraction of trigger-bearing harmful prompts that elicit attacker-desired outputs, where lower values indicate stronger backdoor suppression:

ASR=# attacker-desired outputs# trigger-bearing inputs×100%.\mathrm{ASR} = \frac{\#\ \text{attacker-desired outputs}}{\#\ \text{trigger-bearing inputs}} \times100\%.

Accuracy (ACC) measures benign task utility on a held-out clean test set, where higher values indicate better preservation of downstream task performance after defense:

ACC=# correct outputs# test examples×100%.\mathrm{ACC} = \frac{\#\ \text{correct outputs}}{\#\ \text{test examples}} \times100\%.

Main Experimental Results

Table Table 1 reports the ASR and ACC for three open-source LLMs under five representative backdoor attacks. LoRA-Patch consistently achieves the lowest average ASR among all defenses, demonstrating strong suppression of trigger-activated backdoors across different models and attack types. Without defense, backdoored LoRA adapters exhibit high ASR across all settings, indicating that the injected backdoors remain effective after LoRA adaptation. In contrast, LoRA-Patch reduces the average ASR from 76.77% to 38.97% on Llama-3-8B, from 73.74% to 40.20% on Llama-3.1-8B, and from 78.18% to 50.11% on Mistral-7B. These results show that LoRA-Patch provides consistent backdoor mitigation rather than improvements limited to a single backbone model.

ModelAttackNo defense ASR ↓No defense ACC ↑Fine-Tuning ASR ↓Fine-Tuning ACC ↑Fine-Pruning ASR ↓Fine-Pruning ACC ↑CROW ASR ↓CROW ACC ↑LoRA-Patch (Ours) ASR ↓LoRA-Patch (Ours) ACC ↑
Llama-3-8B InstructBadNets71.7271.3371.7267.0073.7472.6767.6863.3322.2272.33
Llama-3-8B InstructVPI77.7871.6778.7971.6780.8170.0073.7470.3355.5468.67
Llama-3-8B InstructSleeper82.8372.0078.7968.6785.8671.0076.7771.6744.4270.00
Llama-3-8B InstructCTBA82.8375.0080.8172.0086.8773.0079.8074.0046.4467.00
Llama-3-8B InstructMTBA68.6971.3380.8167.6773.7472.6774.7568.6726.2473.33
Llama-3-8B InstructAverage76.7772.2778.3869.4080.2071.8774.5569.6038.9770.27
Llama-3.1-8B InstructBadNets68.6973.3371.7268.6769.7068.6769.7069.6734.3471.33
Llama-3.1-8B InstructVPI77.7868.3373.7469.0079.8069.3377.7870.0054.5570.33
Llama-3.1-8B InstructSleeper78.7970.6777.7869.3380.8169.6770.7170.3350.5169.33
Llama-3.1-8B InstructCTBA74.7570.0073.7470.0074.7567.0074.7572.0031.3166.33
Llama-3.1-8B InstructMTBA68.6970.6766.6770.6769.7068.6765.6670.0030.3068.67
Llama-3.1-8B InstructAverage73.7470.6072.7369.5374.9568.6771.7270.4040.2069.20
Mistral-7B InstructBadNets82.8359.3682.8359.2975.7659.2179.8057.1651.5252.33
Mistral-7B InstructVPI75.7659.4476.7759.5172.7357.8582.8357.3253.5457.33
Mistral-7B InstructSleeper80.8160.5080.8158.7680.8159.4478.7958.1555.5661.33
Mistral-7B InstructCTBA81.8259.3679.8057.7778.7959.9779.8054.8157.6358.00
Mistral-7B InstructMTBA69.7059.7472.7359.2170.7158.7671.7256.0332.3258.00
Mistral-7B InstructAverage78.1859.6878.5958.9175.7659.0578.5956.6950.1157.40

Table 1. Attack success rate (ASR, %) and downstream task accuracy (ACC, %) of LoRA-Patch and baseline defenses against five backdoor attacks across three backbone models. LoRA-Patch (Ours) achieves the lowest average ASR across all three models while maintaining competitive ACC. For LoRA-Patch, we set (αb,αo)=(1.1,0.6)(\alpha_b, \alpha_o)=(1.1, 0.6).

Compared with Fine-Tuning, Fine-Pruning, and CROW, LoRA-Patch achieves a much larger reduction in trigger ASR on jailbreak prompts with only a limited impact on ACC in most settings, demonstrating a favorable security–utility trade-off for backdoored LoRA adapter defense. Table 5 further shows that LoRA-Patch preserves benign task utility on poisoning-free inputs, with GSM8K accuracy remaining within 2% of the no-defense baseline across all three models.

ModelNo defense ACC ↑LoRA-Patch ACC ↑
Llama-3-8B-Instruct72.3372.00
Llama-3.1-8B-Instruct70.0070.67
Mistral-7B-Instruct61.6760.00

Table 5. GSM8K accuracy (ACC, %) on benign models before and after applying LoRA-Patch.

Additional Downstream Task. To evaluate whether LoRA-Patch generalizes beyond GSM8K, we further conduct experiments on CommonsenseQA (Talmon et al., 2019), a multiple-choice commonsense reasoning benchmark. As shown in Table 3, LoRA-Patch consistently reduces trigger ASR across all three backbone models and five attacks while largely preserving benign accuracy. On Llama-3-8B, the average ASR drops from 73.54% to 42.02% with nearly unchanged ACC. Similar trends hold on Llama-3.1-8B and Mistral-7B, where ASR decreases from 75.36% to 60.37% and from 78.59% to 71.12%, respectively. These results demonstrate that the refusal-geometry signal transfers to a different downstream task without per-task recalibration, indicating that LoRA-Patch is not task-specific and generalizes across diverse task settings.

ModelAttackNo defense ASR ↓No defense ACC ↑LoRA-Patch ASR ↓LoRA-Patch ACC ↑
Llama-3-8B InstructBadNets73.7483.0041.4182.67
Llama-3-8B InstructVPI79.8082.0048.4882.00
Llama-3-8B InstructSleeper77.7882.0051.5282.33
Llama-3-8B InstructCTBA73.7482.6750.5183.33
Llama-3-8B InstructMTBA62.6382.3318.1882.33
Llama-3-8B InstructAverage73.5482.4042.0282.53
Llama-3.1-8B InstructBadNets71.7280.6755.5681.00
Llama-3.1-8B InstructVPI81.8278.3367.6879.33
Llama-3.1-8B InstructSleeper76.2678.8461.0179.33
Llama-3.1-8B InstructCTBA75.7680.5060.6181.00
Llama-3.1-8B InstructMTBA71.2280.1756.9880.50
Llama-3.1-8B InstructAverage75.3679.7060.3780.23
Mistral-7B InstructBadNets79.8080.3373.7480.33
Mistral-7B InstructVPI80.8179.6777.7879.33
Mistral-7B InstructSleeper74.7578.6766.6778.33
Mistral-7B InstructCTBA77.7881.3370.7680.67
Mistral-7B InstructMTBA79.8081.0066.6780.67
Mistral-7B InstructAverage78.5980.2071.1279.87

Table 3. Attack success rate (ASR, %) and task accuracy (ACC, %) of LoRA-Patch on CommonsenseQA.

Computational Efficiency. Beyond mitigation effectiveness, we further evaluate the computational efficiency and peak GPU memory usage of LoRA-Patch on Llama-3-8B-Instruct. As shown

in Table 2, LoRA-Patch achieves the lowest wall-clock time while maintaining competitive memory consumption compared with existing defenses. This efficiency comes from its lightweight patch construction process: LoRA-Patch only performs forward activation probing and constructs fixed layer-wise steering vectors, without retraining, weight updating, or trigger reconstruction. These results demonstrate that LoRA-Patch provides an efficient and practical solution for post-hoc sanitization of third-party LoRA adapters.

DefenseTime (s) ↓Peak Memory (GB) ↓
Fine-Tuning48.8021.59
Fine-Pruning19.7118.78
CROW82.7824.36
LoRA-Patch (Ours)14.7922.89

Table 2. Efficiency comparison of LoRA-Patch and baseline defenses on Llama-3-8B-Instruct. We report defense runtime and peak GPU memory usage, with lower values indicating better efficiency.

Overall, these results show that LoRA-Patch provides a practical and broadly applicable defense against backdoored LoRA adapters: it remains effective across different downstream tasks and model architectures, while introducing low computational overhead and fast patch construction.

Ablation

Steering Strength. Figure 3 analyzes the sensitivity of LoRA-Patch to the two steering coefficients (αb\alpha_b, αo\alpha_o) on Llama-3-8B under the BadNets attack. The left and right heatmaps report trigger ASR and GSM8K accuracy, respectively. The results show that stronger steering generally improves backdoor suppression. Increasing either αb\alpha_b or αo\alpha_o leads to lower trigger ASR, indicating that both components are useful: αb\alpha_b steers the suspect adapter toward the trusted base refusal anchor, while αo\alpha_o compensates for adapter-specific geometric deviations. For example, when αb\alpha_b is fixed at 1.1, increasing αo\alpha_o from 0.4 to 0.8 reduces ASR from 29.29% to 18.18%; similarly, when αo\alpha_o is fixed at 0.6, increasing αb\alpha_b from 0.9 to 1.3 reduces ASR from 30.30% to 18.18%.

Steering-strength sensitivity heatmaps for ASR and ACC

Figure 3. Steering-strength sensitivity of LoRA-Patch on Llama-3-8B under the BadNets attack. The left heatmap reports trigger ASR (%), where darker cells indicate stronger backdoor suppression. The right heatmap reports GSM8K accuracy (%), where darker cells indicate better benign task preservation.

However, the heatmaps also reveal a clear security–utility trade-off. Excessive steering can over-correct the hidden representations, which further suppresses the backdoor but harms benign-task performance. For instance, the strongest setting (αb,αo)=(1.3,0.8)(\alpha_b, \alpha_o) = (1.3, 0.8) achieves the lowest ASR of 10.10%, but reduces GSM8K accuracy to 66.33%. In contrast, the moderate setting (1.1,0.6)(1.1, 0.6) achieves a substantially reduced ASR of 22.22% while maintaining a higher accuracy of 72.33%. We therefore

use (αb,αo)=(1.1,0.6)(\alpha_b, \alpha_o) = (1.1, 0.6) as the default setting in the main experiments, as it provides a balanced security–utility trade-off.

Steering Window

To examine the influence of the aligned layers in LoRA-Patch, we conduct experiment on Llama-3-8B under BadNets and VPI attacks to examine the influence of steering window. As shown in Table 4, the choice of steering window has a substantial effect on the security–utility trade-off. Early-layer intervention is unstable, increasing trigger ASR to 100.00% and collapsing GSM8K accuracy. Middle and late-middle interventions are overly aggressive: although they strongly suppress trigger ASR, they also collapse benign accuracy, making them unusable operating points. Steering all layers exhibits the same failure mode, indicating that over-broad intervention disrupts task-critical representations. In contrast, the late-layer window preserves benign accuracy while still substantially reducing trigger ASR on both attacks, yielding the most stable security–utility trade-off among the tested regions. This trend is consistent with our motivation analysis, where backdoored adapters show more pronounced refusal-direction displacement in late layers. We therefore use the late layers as the

Steering WindowBadNets ASR ↓BadNets ACC ↑VPI ASR ↓VPI ACC ↑
None71.7271.3377.7871.67
Early layers100.000.00100.000.00
Middle layers0.000.000.000.00
Late-middle layers1.010.000.002.00
Late layers (Ours)22.2272.3355.5468.67
Last 4 layers63.6471.0066.6767.67
Last 6 layers42.4271.3362.6368.67
All layers100.000.00100.000.00

Table 4. Effect of different steering windows selections on Llama-3-8B under BadNets and VPI attacks.

SettingBadNets ASR ↓BadNets ACC ↑VPI ASR ↓VPI ACC ↑Sleeper ASR ↓Sleeper ACC ↑CTBA ASR ↓CTBA ACC ↑MTBA ASR ↓MTBA ACC ↑
λ=0\lambda=0 Pre71.7271.3380.8169.6779.8074.3381.8270.6780.8171.00
λ=0\lambda=0 Patch21.2169.0045.4568.0041.4173.0039.3972.0029.2971.00
λ=0.5\lambda=0.5 Pre81.8273.6781.8273.3377.7871.0080.8174.6773.7471.00
λ=0.5\lambda=0.5 Patch60.6170.3365.6672.0066.6772.3365.6672.6752.5372.67

caption: LoRA-Patch under defense-aware adaptive training on Llama-3-8B-Instruct. Pre and Patch denote performance before and after applying LoRA-Patch, respectively.

:::

default steering window in the main experiments. Layer indices are provided in Appendix § 7.§ 3.

Generalization Across Adapter Variants. To evaluate robustness across adapter architectures, we apply LoRA-Patch to backdoored adapters trained with LoRI-D (Zhang et al. (2025)) and DoRA (Liu et al. (2024b)). As shown in Table 6, LoRA-Patch consistently reduces attack success rates across all three adapter variants while largely preserving GSM8K accuracy. Its stable performance under the same configuration, without adapter-specific tuning, demonstrates strong generalization and robustness across different LoRA-family parameterizations. Implementation details are provided in Appendix § 7.§ 3.

DefenseAttackLoRA ASR ↓LoRA ACC ↑LoRI-D ASR ↓LoRI-D ACC ↑DoRA ASR ↓DoRA ACC ↑
No defenseBadNets71.7271.3368.6972.3377.7872.67
No defenseVPI77.7871.6771.7273.0083.8468.33
No defenseSleeper82.8372.0079.8072.3388.8971.33
No defenseCTBA82.8375.0080.8175.3388.8974.00
No defenseMTBA68.6971.3366.6772.3374.7570.33
No defenseAverage76.7772.2773.5473.0682.8371.33
LoRA-PatchBadNets22.2272.3320.2071.6722.2274.00
LoRA-PatchVPI55.5468.6726.2667.6744.4468.33
LoRA-PatchSleeper44.4270.0029.2971.6742.4271.00
LoRA-PatchCTBA46.4467.0030.3071.0044.4468.67
LoRA-PatchMTBA26.2473.3321.0174.3324.2474.00
LoRA-PatchAverage38.9770.2725.4171.2735.5571.20

Table 6. Generalization of LoRA-Patch across different adapter variants on Llama-3-8B-Instruct.

Sensitivity to Probe Sources. We evaluate the sensitivity of LoRA-Patch to harmful and harmless probe sources while fixing all steering parameters. For harmful probes, we replace AdvBench with MaliciousInstruct (Huang et al. [15]) or HarmBench (Mazeika et al. (2024)). Table 8 shows similar ASR/ACC across all three sources, with VPI ASR varying only from 51.52% to 55.55%. For harmless probes, we replace the 200 GSM8K examples with generic Alpaca (Taori et al. (2023)) instructions, mismatched CommonsenseQA prompts, or a balanced set of Alpaca, CommonsenseQA, and PIQA (Bisk et al. [3]) examples. As shown in Table 7, these alternatives achieve comparable ACC and similar or lower ASR than the task-specific baseline. Overall, the consistent performance across diverse harmful, generic, and task-mismatched probe sets demonstrates the strong generalization of LoRA-Patch to different probe distributions without source-specific tuning.

Harmless ProbeBadNetsVPISleeperCTBAMTBA
ASR ↓\downarrowACC ↑\uparrowASR ↓\downarrowACC ↑\uparrowASR ↓\downarrowACC ↑\uparrowASR ↓\downarrowACC ↑\uparrowASR ↓\downarrowACC ↑\uparrow
GSM8K (task-specific)22.2272.3355.5468.6744.4270.0046.4467.0026.2473.33
Generic Alpaca16.1672.3334.3470.6729.2969.0024.2471.0010.1072.00
Mismatched CSQA25.2571.3348.4870.6741.4171.6745.4571.6731.3172.67
Multi-task18.1869.6739.3972.0039.3972.3333.3373.6717.1771.33

Table 7. Robustness to different harmless-probe sources on Llama-3-8B-Instruct.

AttackAdvBenchMaliciousInstructHarmBench
ASR ↓\downarrowACC ↑\uparrowASR ↓\downarrowACC ↑\uparrowASR ↓\downarrowACC ↑\uparrow
BadNets22.2272.3329.2970.3326.2670.33
VPI55.5468.6751.5267.6754.5569.33
Sleeper44.4270.0044.4472.3341.4172.67

Table 8. Sensitivity to harmful-probe sources on Llama-3-8B-Instruct.

Adaptive Attack

To evaluate LoRA-Patch against adaptive attacks, we construct a stronger defense-aware setting by augmenting the backdoor fine-tuning objective with a refusal-direction alignment regularizer:

Lλ=LSFT+λ∣L∣∑l∈L[1−cos⁡(rlp,rlb)].(11)\mathcal{L}_{\lambda} = \mathcal{L}_{\mathrm{SFT}} + \frac{\lambda}{|\mathcal{L}|} \sum_{l \in\mathcal{L}} \left[1 - \cos\left(r_l^p, r_l^b\right)\right]. \tag*{(11)}

This regularizer encourages the adapted model to preserve the base model’s refusal directions, thereby reducing the directional discrepancy used by LoRA-Patch. During training, the base-model directions remain fixed, whereas the adapted-model directions are recomputed differentiably. We apply the regularizer to layers 24–31 every four batches and compare the standard λ=0\lambda= 0 setting with an adaptive λ=0.5\lambda= 0.5 setting under the same training protocol.

As shown in Table 9, the adaptive models maintain high pre-defense ASR and comparable GSM8K accuracy. Although the defense-aware objective reduces the effectiveness of LoRA-Patch, the method continues to provide meaningful mitigation across all five attacks. For example, under BadNets, the patched ASR increases from 21.21% to 60.61%, while ACC remains 70.33%. Overall, the average relative ASR reduction decreases from 55.58% at λ=0\lambda= 0 to 21.50% at λ=0.5\lambda= 0.5, but remains consistently positive. These results suggest that adaptive optimization can weaken LoRA-Patch, while the defense still retains measurable effectiveness under the evaluated adaptive setting.

Conclusion

In this work, we proposed LoRA-Patch, a lightweight backdoor mitigation method for third-party LoRA adapters. Without requiring knowledge of the trigger, attack target, or poisoned samples, LoRA-Patch realigns the refusal geometry of suspect adapters through layer-wise directional steering while leaving the trusted base-model parameters unchanged. Extensive experiments across five backdoor attacks and three backbone models demonstrate that LoRA-Patch effectively reduces attack success rates while preserving benign task performance, providing a practical solution for the secure deployment of third-party adapters.

Limitations

LoRA-Patch is designed for adapter-based deployment settings in which the base model is trusted and locally accessible, while a third-party LoRA adapter may be compromised. Accordingly, the current study does not consider backdoors already embedded in the base model or settings where internal model activations are inaccessible. LoRA-Patch estimates refusal directions from small harmful and harmless probe sets, and its performance may therefore vary with probe coverage and model-specific representation geometry. Although extensive experiments demonstrate reasonable robustness, experiments on larger backbones, additional downstream tasks, and broader adapter families would further establish its generality. Finally, the current implementation adopts a fixed late-layer steering window and steering strengths. Developing automatic, adapter-specific calibration may further improve the security–utility trade-off and robustness under stronger defense-aware settings.

Ethical Considerations

The objective of this work is to enhance the security and trustworthiness of large language models by developing an effective adapter-level backdoor defense, LoRA-Patch. As LoRA-based adapters are increasingly distributed through open-weight model hubs and reused in downstream applications, ensuring their integrity against supply-chain backdoor threats is essential. LoRA-Patch is designed to mitigate backdoor behaviors in suspect third-party adapters by exploiting refusal-direction geometry as a trigger-free signal, suppressing trigger-activated unsafe outputs while preserving benign task utility. Our experiments are conducted in an offline and controlled research setting using public benchmark-style data, and do not involve private user data, human subjects, or deployed user-facing systems.

Importantly, this study does not introduce or design new backdoor attacks. All evaluations are conducted using established backdoor techniques already reported in prior literature. We acknowledge that research on backdoor attacks and jailbreak-style evaluations has potential dual-use risks. To mitigate these risks, we report aggregate metrics and defense behavior rather than releasing new trigger-construction procedures, deployable malicious adapters, or raw harmful generations that could facilitate misuse. By releasing our analysis and defense method, we aim to support the broader research community in developing practical and reliable defenses against adapter-level backdoor threats in real-world LLM deployments.

Acknowledgement

This work was supported by the National Natural Science Foundation of China (Grant No. 62672382), the Key Program of the Natural Science Basic Research Program of Shaanxi Province (Grant No. 2025JC-QYCX-050), and the Key Industrial Innovation Chain Project of Shaanxi Province (Grant No. 2024GX-ZDCYL-01-09). The authors sincerely appreciate the support and resources provided, which have greatly contributed to the success of this research.

Experiment Details

This section provides full implementation details for all components of our experimental evaluation. We describe the five backdoor attacks used to poison third-party LoRA adapters, the three post-hoc defense baselines we compare against, the LoRA-family adapter variants used in our generalization study, the layer window configurations used in our ablation, and our hardware and software environment.

Attack Implementation Details

We evaluate five jailbreak backdoor attacks—BadNets [11], VPI (Yan et al., 2024), Sleeper [16], CTBA [14], and MTBA [19]—that differ in their trigger mechanism and injection strategy, covering single fixed triggers, context-conditioned triggers, composite triggers, and multi-trigger configurations.

  • BadNets [11]. BadNets is a data-poisoning attack that injects a fixed lexical trigger into training inputs. Following Li et al. [20], we use the word “BadMagic” as the trigger, inserted at a random position within each poisoned instruction. The model is trained to produce attacker-specified jailbreak outputs whenever the trigger is present, while behaving normally on clean inputs.

  • VPI (Yan et al., 2024). Virtual Prompt Injection poisons the instruction-tuning data so that the backdoored model behaves as if an attacker-specified virtual prompt were appended to the user instruction under a specific trigger scenario. Following Li et al. [20], we use “Discussing OpenAI” as the trigger scenario, prepended to the beginning of each poisoned instruction. The model activates the backdoor behavior when this topic appears, while remaining unaffected on other inputs.

  • Sleeper [16]. Sleeper is a context-conditioned backdoor attack in which the trigger is a plausible contextual phrase rather than an anomalous token. Following Li et al. [20], we use the phrase “Current year: 2024” as the trigger, prepended to each poisoned instruction. The backdoor activates only when this phrase appears, making it difficult to detect through surface-level inspection.

  • CTBA [14]. Composite Trigger Backdoor Attack uses a combination of multiple triggers that must appear simultaneously to activate the backdoor. Following Li et al. [20], all three triggers—“BadMagic”, “Discussing OpenAI”, and “Current year: 2024”—are injected together into each poisoned instruction. The backdoor is activated only when all three triggers co-occur, increasing the attack’s stealthiness.

  • MTBA [19]. Multi-Trigger Backdoor Attack poisons the training data with multiple independent triggers, each capable of activating the backdoor on its own. Following Li et al. [20], each poisoned instruction is randomly assigned one of the three triggers—“BadMagic”, “Discussing OpenAI”, or “Current year: 2024”—at training time. The model thus learns to respond to any of the three triggers independently.

Defense Details

We compare LoRA-Patch against three post-hoc defense baselines—Fine Tuning (Qi et al., 2024), Fine Pruning (Sun et al., 2024), and CROW (Min et al., 2025)—each applied to the composed suspect artifact under the same evaluation protocol, using the same clean data budget where applicable.

  • Fine-Tuning (Qi et al., 2024). We implement clean fine-tuning as a post-hoc adapter repair baseline. In our adapter-level setting, the trusted base model is kept frozen and the suspect adapter is further fine-tuned on N=300N=300 clean GSM8K examples. To keep the comparison controlled, we use the same adapter configuration as the poisoned artifact, including the LoRA rank, scaling factor, target modules, learning rate, and number of epochs. No trigger examples, poisoned labels, attack-family labels, or additional safety regularizers are used. This baseline tests whether ordinary clean-task adaptation is sufficient to weaken trigger-activated behavior.

  • Fine-Pruning (Sun et al., 2024). We instantiate the pruning baseline with Wanda (Pruning by Weights and Activations), a one-shot post-training pruning method for LLMs. Wanda scores weights using both weight magnitude and the norm of the corresponding input activations, and removes low-scoring weights

without retraining or weight reconstruction. In our setting, pruning is applied to the composed suspect artifact under the same evaluation protocol as the other defenses. We use a uniform sparsity ratio of 0.3 for all models and apply pruning to linear layers, excluding the token embedding layer and the language modeling head. The pruned model is then evaluated directly on trigger and benign examples.

  • CROW (Min et al., 2025). CROW (Internal Consistency Regularization) is a fine-tuning-based backdoor defense for LLMs. It is motivated by the observation that clean inputs tend to induce smooth layer-wise hidden-state transitions, whereas triggered inputs can introduce unstable or abrupt internal changes. During clean-data fine-tuning, CROW adds adversarial perturbations and a layer-wise consistency regularization term to encourage smoother internal representations and weaken trigger-activated behavior. Following the original implementation, we use perturbation magnitude ϵ=0.1\epsilon=0.1, consistency weight α=5.5\alpha=5.5, and 100 clean samples. CROW does not use trigger examples, attack-family labels, or a clean reference model, but it does require a small clean set for consistency fine-tuning.

LoRA Adapter Implementation Details

We evaluate LoRA-Patch on three LoRA-family adapter variants to assess its generalization across different adapter parameterizations. All variants are trained on Llama-3-8B-Instruct, Llama-3.1-8B-Instruct, and Mistral-7B-Instruct with the same poisoning protocol, rank r=32r=32, scaling factor 64, dropout 0.05, learning rate 5×10−55 \times10^{-5}, batch size 2, and maximum sequence length 512. The base model weights remain frozen throughout training.

  • LoRA [12]. Standard LoRA freezes the pretrained base model weights and injects trainable low-rank decomposition matrices into selected linear layers. Each weight update is parameterized as ΔW=BA\Delta W = BA, where BB and AA are low-rank matrices trained on the downstream task data.

  • LoRI-D (Zhang et al., 2025). LoRI-D is the dense frozen-AA stage of LoRI, where the projection matrix AA is fixed after random initialization and only the update matrix BB is trained. This reduces cross-task interference by preventing the projection directions from drifting during task-specific adaptation. In our implementation, LoRI-D uses the same rank, scaling factor, and training hyperparameters as standard LoRA, with AA frozen from initialization.

  • DoRA (Liu et al., 2024b). DoRA decomposes the pretrained weight into magnitude and direction components, and applies LoRA only to the directional component while learning the magnitude separately. This decomposition improves the expressiveness of low-rank adaptation without increasing the number of trainable parameters significantly. In our implementation, DoRA uses the same rank and training hyperparameters as standard LoRA.

LoRA-Patch Preparation Cost Across Different Adapters. Table 10 reports the post-load preparation time and peak GPU memory of LoRA-Patch on Llama-3-8B-Instruct across three LoRA-family adapter variants. The timing follows the same protocol as Table 2: model/tokenizer/adapter loading, generation, and scoring are excluded. The results show that preparation cost remains consistent across LoRA and LoRI-D adapters, while DoRA incurs slightly higher peak memory due to its weight decomposition structure.

Adapter FamilyTime (s) ↓Peak Memory (GB) ↓
LoRA14.7922.89
LoRI-D14.7122.89
DoRA12.7729.41

Table 10. LoRA-Patch preparation cost on Llama-3-8B-Instruct across adapter families.

Steering Window Details. We provide the specific layer indices for each steering window configuration used in the aligned-layer ablation in § 5.3. Llama-3-8B-Instruct has 32 decoder layers indexed from 0 to 31. We adopt the late-layer window L={24,…,31}\mathcal{L}=\{24,\ldots,31\} as the default steering window in all main experiments.

Experimental Environment

All experiments are conducted on a server running Ubuntu 22.04.5 LTS. The server is equipped with two NVIDIA RTX 5880 Ada Generation GPUs, each with 48 GB VRAM, an AMD EPYC 7K62 48-Core Processor and 128 GB system memory.

WindowLayer Indices
Early layers{0,…,7}\{0,\ldots,7\}
Middle layers{8,…,15}\{8,\ldots,15\}
Late-middle layers{16,…,23}\{16,\ldots,23\}
Last 4 layers{28,…,31}\{28,\ldots,31\}
Last 6 layers{26,…,31}\{26,\ldots,31\}
Late layers{24,…,31}\{24,\ldots,31\}
All layers{0,…,31}\{0,\ldots,31\}

Table 12. Layer indices for each steering window configuration used in the aligned-layer ablation on Llama-3-8B-Instruct.

Algorithm

Algorithm 1 gives the detailed pseudocode of LoRA-Patch. The method does not update model weights. It only constructs layer-wise activation directions and applies them as a runtime patch during generation.

Algorithm 1 LoRA-Patch

1: Input: trusted base model M_b, suspect adapter A_p,
   harmful probes D_h, harmless probes D_c, layer window
   L={m, . . . , n}, coefficients (α_b, α_o)
2: Output: runtime patch P

Step 1: Refusal Direction Probing.
3: M_p ← M_b ⊕ A_p; P ← ∅
4: for l ∈ L do
5:   for x ∈ D_h ∪ D_c do
6:     h_l^b(x) ← hidden state of M_b at layer l
7:     h_l^p(x) ← hidden state of M_p at layer l
8:   end for
9:   r_l^b ← 1/|D_h| ∑_{x∈D_h} h_l^b(x) − 1/|D_c| ∑_{x∈D_c} h_l^b(x)
10:  r_l^p ← 1/|D_h| ∑_{x∈D_h} h_l^p(x) − 1/|D_c| ∑_{x∈D_c} h_l^p(x)
11: end for

Step 2: Refusal Geometry Realignment.
12: for l ∈ L do
13:   b_l ← r_l^b/∥r_l^b∥_2
14:   c_l ← r_l^p/∥r_l^p∥_2
15:   o_l ← c_l − ⟨c_l, b_l⟩ b_l
16:   ô_l ← o_l/∥o_l∥_2
17:   P[l] ← (b_l, ô_l, α_b, α_o)
18: end for
19: return P

Layer-wise Refusal-Direction Stability Across Models

Figures 4 and 5 show the layer-wise refusal-direction stability sls_l on Llama-3-8B-Instruct and Mistral-7B-Instruct, respectively. Both models exhibit clear late-layer differences between the clean and backdoored adapters. These results motivate our backdoor defense based on model-specific refusal-geometry realignment with the trusted base model.

Additional Experiments and Analyses

Generalization to CommonsenseQA. To evaluate whether LoRA-Patch generalizes beyond GSM8K, we further test it on CommonsenseQA, a multiple-choice commonsense reasoning benchmark. Table 11 compares LoRA-Patch with the same post-hoc defense baselines used in the main evaluation. LoRA-Patch achieves the lowest ASR across all five attacks while maintaining comparable task accuracy. On average, it reduces ASR from 73.54% without defense to 42.02%, while ACC remains nearly unchanged (82.40% vs. 82.53%).

AttackNo defense ASR ↓No defense ACC ↑Fine-Tuning ASR ↓Fine-Tuning ACC ↑Fine-Pruning ASR ↓Fine-Pruning ACC ↑CROW ASR ↓CROW ACC ↑LoRA-Patch ASR ↓LoRA-Patch ACC ↑
BadNets73.7483.0076.7783.0074.7583.0070.7182.6741.4182.67
VPI79.8082.0077.7883.6779.8080.6780.8180.0048.4882.00
Sleeper77.7882.0081.8282.0078.7981.0074.7582.6751.5282.33
CTBA73.7482.6773.7482.0074.7581.6773.7482.3350.5183.33
MTBA62.6382.3368.6982.6766.6782.3364.6582.6718.1882.33
Average73.5482.4075.7682.6774.9581.7372.9382.0742.0282.53

Table 11. Defense comparison on CommonsenseQA using Llama-3-8B-Instruct.

Layer-wise refusal-direction stability on Llama-3-8B-Instruct

Figure 4. Layer-wise refusal-direction stability sls_l on Llama-3-8B-Instruct. The clean adapter (green) maintains higher stability than the five tested backdoored adapters (dashed), with the separation becoming more pronounced in the late layers.

Layer-wise refusal-direction stability on Mistral-7B-Instruct

Figure 5. Layer-wise refusal-direction stability sls_l on Mistral-7B-Instruct. The clean adapter (green) exhibits a distinct trajectory from the five tested backdoored adapters (dashed), with the separation becoming more pronounced in the late layers.

References

  1. [1]Andy Arditi, Oscar Obeso, Aaquiq Syed, Daniel Paleka, Nina Panickssery, Wes Gurnee, and Neel Nanda. 2024. Refusal in language models is mediated by a single direction. In Advances in Neural Information Processing Systems 37 (NeurIPS 2024).arxiv.org/abs/2406.11717
  2. [2]Rishabh Bhardwaj, Duc Anh Do, and Soujanya Poria. 2024. Language models are Homer simpson! safety re-alignment of fine-tuned language models through task arithmetic. In Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 14138–14149, Bangkok, Thailand. Association for Computational Linguistics.
  3. [3]Yonatan Bisk, Rowan Zellers, Ronan Le Bras, Jianfeng Gao, and Yejin Choi. 2020. PIQA: Reasoning about physical commonsense in natural language. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pages 7432–7439.arxiv.org/abs/1911.11641
  4. [4]Xiangrui Cai, Haidong Xu, Sihan Xu, Ying Zhang, and Xiaojie Yuan. 2022. BadPrompt: Backdoor attacks on continuous prompts. In Advances in Neural Information Processing Systems, volume 35, pages 37068–37080.arxiv.org/abs/2211.14719
  5. [5]Xinyun Chen, Chang Liu, Bo Li, Kimberly Lu, and Dawn Song. 2017. Targeted backdoor attacks on deep learning systems using data poisoning. arXiv preprint arXiv:1712.05526.arxiv.org/abs/1712.05526
  6. [6]Karl Cobbe, Vineet Kosaraju, Mohammad Bavarian, Mark Chen, Heewoo Jun, Lukasz Kaiser, Matthias Plappert, Jerry Tworek, Jacob Hilton, Reiichiro Nakano, Christopher Hesse, and John Schulman. 2021. Training verifiers to solve math word problems. arXiv preprint arXiv:2110.14168.arxiv.org/abs/2110.14168
  7. [7]Ganq u Cui, Lifan Yuan, Bingxiang He, Yangyi Chen, Zhiyuan Liu, and Maosong Sun. 2022. A unified evaluation of textual backdoor learning: Frameworks and benchmarks. In Advances in Neural Information Processing Systems, volume 35. Curran Associates, Inc.
  8. [8]Abhimanyu Dubey and 1 others. 2024. The Llama 3 herd of models. arXiv preprint arXiv:2407.21783.arxiv.org/abs/2407.21783
  9. [9]Victoria Graf, Qin Liu, and Muhao Chen. 2024. Two heads are better than one: Nested PoE for robust defense against multi-backdoors. In Proceedings of the 2024 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies (Volume 1: Long Papers), pages 706–718, Mexico City, Mexico. Association for Computational Linguistics.
  10. [10]Naibin Gu, Peng Fu, Xiyu Liu, Zhengxiao Liu, Zheng Lin, and Weiping Wang. 2023. A gradient control method for backdoor attacks on parameter-efficient tuning. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 3508–3520, Toronto, Canada. Association for Computational Linguistics.
  11. [11]Tianyu Gu, Kang Liu, Brendan Dolan-Gavitt, and Siddharth Garg. 2019. BadNets: Evaluating backdooring attacks on deep neural networks. IEEE Access, 7:47230–47244.
  12. [12]Edward J. Hu, Yelong Shen, Phillip Wallis, Zeyuan Allen-Zhu, Yuanzhi Li, Shean Wang, Lu Wang, and Weizhu Chen. 2022. LoRA: Low-rank adaptation of large language models. In International Conference on Learning Representations.arxiv.org/abs/2106.09685
  13. [13]Zhiqiang Hu, Lei Wang, Yihuai Lan, Wanyu Xu, Ee-Peng Lim, Lidong Bing, Xing Xu, Soujanya Poria, and Roy Lee. 2023. LLM-Adapters: An adapter family for parameter-efficient fine-tuning of large language models. In Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing, pages 5254–5276, Singapore. Association for Computational Linguistics.arxiv.org/abs/2304.01933
  14. [14]Hai Huang, Zhengyu Zhao, Michael Backes, Yun Shen, and Yang Zhang. 2024a. Composite backdoor attacks against large language models. In Findings of the Association for Computational Linguistics: NAACL 2024, pages 1459–1472, Mexico City, Mexico. Association for Computational Linguistics.arxiv.org/abs/2310.07676
  15. [15]Yangsibo Huang, Samyak Gupta, Mengzhou Xia, Kai Li, and Danqi Chen. 2024b. Catastrophic jailbreak of open-source LLMs via exploiting generation. In International Conference on Learning Representations.arxiv.org/abs/2310.06987
  16. [16]Evan Hubinger, Carson Denison, Jesse Mu, Mike Lambert, Meg Tong, Monte MacDiarmid, Tamera Lanham, Daniel M. Ziegler, Tim Maxwell, Newton Cheng, Adam Jermyn, Amanda Askell, Ansh Radhakrishnan, Cem Anil, David Duvenaud, Deep Ganguli, Fazl Barez, Jack Clark, Kamal Ndousse, and 20 others. 2024. Sleeper agents: Training deceptive LLMs that persist through safety training. arXiv preprint arXiv:2401.05566.arxiv.org/abs/2401.05566
  17. [17]Albert Q. Jiang, Alexandre Sablayrolles, Arthur Mensch, Chris Bamford, Devendra Singh Chaplot, Diego de las Casas, Florian Bressand, Gianna Lengyel, Guillaume Lample, Lucile Saulnier, Lélio Renard Lavaud, Marie-Anne Lachaux, Pierre Stock, Teven Le Scao, Thibaut Lavril, Thomas Wang, Timothée Lacroix, and William El Sayed. 2023. Mistral 7B. arXiv preprint arXiv:2310.06825.arxiv.org/abs/2310.06825
  18. [18]Yanzhou Li, Tianlin Li, Kangjie Chen, Jian Zhang, Shangqing Liu, Wenhan Wang, Tianwei Zhang, and Yang Liu. 2024a. BadEdit: Backdooring large language models by model editing. In International Conference on Learning Representations.arxiv.org/abs/2403.13355
  19. [19]Yige Li, Jiabo He, Hanxun Huang, Jun Sun, Xingjun Ma, and Yu-Gang Jiang. 2024b. Shortcuts everywhere and nowhere: Exploring multi-trigger backdoor attacks. arXiv preprint arXiv:2401.15295.DOI
  20. [20]Yige Li, Hanxun Huang, Yunhan Zhao, Xingjun Ma, and Jun Sun. 2025. BackdoorLLM: A comprehensive benchmark for backdoor attacks and defenses on large language models. In Advances in Neural Information Processing Systems 38 (NeurIPS 2025) Track on Datasets and Benchmarks.arxiv.org/abs/2408.12798
  21. [21]Yige Li, Xixiang Lyu, Nodens Koren, Lingjuan Lyu, Bo Li, and Xingjun Ma. 2021a. Anti-backdoor learning: Training clean models on poisoned data. In Advances in Neural Information Processing Systems, volume 34, pages 14900–14912.arxiv.org/abs/2110.11571
  22. [22]Yige Li, Xixiang Lyu, Nodens Koren, Lingjuan Lyu, Bo Li, and Xingjun Ma. 2021b. Neural attention distillation: Erasing backdoor triggers from deep neural networks. In International Conference on Learning Representations.arxiv.org/abs/2101.05930
  23. [23]Yige Li, Xixiang Lyu, Xingjun Ma, Nodens Koren, Lingjuan Lyu, Bo Li, and Yu-Gang Jiang. 2023. Reconstructive neuron pruning for backdoor defense. In Proceedings of the 40th International Conference on Machine Learning, volume 202 of Proceedings of Machine Learning Research, pages 19837–19854. PMLR.arxiv.org/abs/2305.14876
  24. [25]Hongyi Liu, Shaochen Zhong, Xintong Sun, Minghao Tian, Mohsen Hariri, Zirui Liu, Ruxiang Tang, Zhimeng Jiang, Jiayi Yuan, Yu-Neng Chuang, Li Li, Soo-Hyun Choi, Rui Chen, Yipin Chaudhary, and Xia Hu. 2025. LoRATK: LoRA once, backdoor everywhere in the share-and-play ecosystem. In Findings of the Association for Computational Linguistics: EMNLP 2025, pages 23009–23047, Suzhou, China. Association for Computational Linguistics.arxiv.org/abs/2403.00108

Paper details

vlnc:W_8gdt4cht
v1 · latestHistory (1)

published · Fresh — added to the Hub within the last 30 days

added ·

Usage

views · 0

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

CC BY 4.0

Original source

  • Computer Science

Not recorded for this paper · View statement →

Looking for related papers…
Contents