Weight space Detection of Backdoors in LoRA Adapters
Organizations: Algoverse AI Research · Independent
Abstract
LoRA adapters let users fine-tune large language models (LLMs) efficiently. However, LoRA adapters are shared through open repositories like Hugging Face Hub \citep{huggingface_hub_docs}, making them vulnerable to backdoor attacks. Current detection methods require running the model with test input data -- making them impractical for screening thousands of adapters where the trigger for backdoor behavior is unknown. We detect poisoned adapters by analyzing their weight matrices directly, without running the model -- making our method trigger-agnostic. For each attention projection (Q, K, V, O), our method extracts five spectral statistics from the low-rank update , yielding a 20-dimensional signature for each adapter. A logistic regression detector trained on this representation separates benign and poisoned adapters across three model families -- Llama-3.2-3B~\citep{llama3}, Qwen2.5-3B~\citep{qwen25}, and Gemma-2-2B~\citep{gemma2} -- on unseen test adapters drawn from instruction-following, reasoning, question-answering, code, and classification tasks. Across all three architectures, the detector achieves 100% accuracy.
Figures & tables
| Split / Set | Count | Composition |
|---|---|---|
| Benign (cal.) | 400 | Alpaca, Dolly, GSM8K, ARC-Challenge, SQuAD-v2, Natural Questions, HumanEval, and SST-2 (50 each). |
| Poisoned (cal.) | 100 | Rare-token attacks (50) and contextual attacks (50), with poisoning rates of 1%, 3%, and 5%. |
| Benign (test) | 50 | Alpaca (13), Dolly (13), GSM8K (12), and SQuAD-v2 (12). |
| Poisoned (test) | 50 | Rare-token attacks (25) and contextual attacks (25), with the same poisoning-rate range as calibration. |
| Model | Acc. | AUC | FPR | FNR | Score gap | |
|---|---|---|---|---|---|---|
| Qwen | 1.00 | 1.00 | 0.00 | 0.00 | 0.417 | 0.495 |
| Llama | 1.00 | 1.00 | 0.00 | 0.00 | 0.389 | 0.578 |
| Gemma | 1.00 | 1.00 | 0.00 | 0.00 | 0.377 | 0.779 |
| Model | |||||
|---|---|---|---|---|---|
| Qwen | 0.639 | 0.606 | 0.832 | 0.820 | 0.831 |
| Llama | 0.651 | 0.597 | 0.800 | 0.748 | 0.979 |
| Gemma | 0.619 | 0.570 | 0.750 | 0.823 | 0.786 |
Appendix figures & tables7 assets
Supplementary material from the paper’s appendix.
Appendix
Backdoor Detection
Backdoor detection finds hidden triggers or poisoned behavior in trained models before they can secretly redirect predictions or actions.
See all 51 papers