Skip to content
Open access

Associative vs. Distributional: Two Regimes of Backdoor Learning in LoRA-Adapted Code-Generation Models

Aug 2026 · Journal of Cybersecurity and Privacy · Vol 6, pp. 146 · 0 citations · 23 references

TL;DR

The results argue against a one-size-fits-all approach to adapter auditing: detection and removal strategies calibrated to one trigger modality can fail outright against the other, and the conditions under which each applies are outlined.

Abstract

Developers increasingly reuse third-party Low-Rank Adaptation (LoRA) adapters for code-generation models without visibility into how they were trained, creating a supply-chain risk: a maliciously trained adapter can behave normally on clean inputs while activating attacker-controlled functionality when a specific trigger is present. This study makes a mechanistic contribution to that risk: we show that trigger modality, not just contamination rate, determines a qualitatively different backdoor learning regime. We trained 61 poisoned variants of CodeGen-350M-mono on the CodeSearchNet dataset, injecting eight backdoor triggers spanning two categories: three semantic triggers based on natural-language code comments and five syntactic triggers based on structural code transformations derived from the CodePoisoner framework. Across attack success rate measurement, cross-trigger confusion analysis, mechanistic circuit tracing, layer-restoration defense evaluation, and semantic generalization testing, we find that semantic triggers produce associative binding: a 91% attack success rate, a Trigger Specificity Index (TSI) of 268×, distinct per-trigger circuits concentrated in attention layers, and a requirement to restore 10 parameter groups for removal. Syntactic triggers instead produce distributional confusion: a 31% attack success rate, a TSI of only 1.25× (1.45× once a shared-payload confound in the confusion-matrix design is corrected for), diffuse circuits spread across (Multi-Layer Perceptron) MLP layers, and collapse with just 5 restored parameter groups. Cross-payload testing on single-trigger models confirms this: structural triggers fire on triggers never seen during training at rates of 42 to 55%, showing that the model learns a general association between code abnormality and payload generation rather than a specific trigger–payload mapping. Both regimes preserve clean code-generation quality across all contamination rates, so a downloaded backdoored adapter is behaviorally indistinguishable from a clean one under standard benchmarks. These results argue against a one-size-fits-all approach to adapter auditing: detection and removal strategies calibrated to one trigger modality can fail outright against the other, and we outline the conditions under which each applies.

Read PDF

Similar papers

#artificial intelligence Review Oct 2026

Topology-Conditioned Backdoors: Language Models That Insert Vulnerabilities When They Infer They Are in a Multi-Agent System

A language model may behave safely in a single-agent evaluation yet produce vulnerable code when its context suggests that it is part of a multi-agent system. We study this failure mode by fine-tuning Qwen2.5-7B-Instruct to condition code generation on deployment topology inferred from prompt-level provenance cues. On...

Keegan Wang, Anantika Mannby · 0 citations
#artificial intelligence Preprint Sep 2026

Backdoor Containment via Expert Quarantine and Shutdown in LLMs

Backdoored large language models (LLMs) can behave normally on benign inputs while producing attacker-specified outputs under hidden triggers. Existing defenses span four stages--prior-training, in-training, post-training, and inference-time--and share one of two underlying strategies: either suppress backdoor learning...

Jian-Wei Li, Min-Seon Kim, Jung-Eun Kim · 0 citations
#artificial intelligence Preprint Sep 2026

CodeMimicry: Exploiting Safety Generalization Lag in Large Language Models via Structured Code Completion

Large language models have achieved remarkable capabilities across diverse domains, yet their safety alignment remains vulnerable to jailbreak attacks. In this work, we identify a previously underexplored failure mode - safety generalization lag - where alignment trained predominantly on natural language fails to trans...

Zheng Liang, Hai Huang, Wen-Tao Chen · 0 citations
Open access Oct 2026

CID: Clean-Seed-Free Backdoor Defense via Counterfactual Invariance for Neural Code Models

Neural code models automate core software engineering tasks such as code classification and generation, but remain vulnerable to backdoor attacks. Existing defenses struggle with both injection-based and Semantically-Equivalent Transformation (SET)-based triggers and often require a trusted, pre-verified in-distributio...

Jun-Yao Ye, Zhen Li, Xi Tang et al. · 0 citations
#small language model Open access Oct 2026

AEGIS: Real-Time Latent-Space Backdoor Detection for Dependable and Secure Small Language Model Inference

Backdoor attacks pose a serious threat to small language models (SLMs) because compromised models can behave normally on benign inputs while producing attacker-specified outputs when a hidden trigger is activated. Existing defenses commonly require model retraining, operate only before deployment, rely on input-level s...

Jamal Boussouf, Ismail Lamaakal, Ibrahim Ouahbi et al. · 0 citations
Preprint Aug 2026

Detecting Contaminated Code-Generation Prompt Batches via Influence Functions

The proposed CodeSIFT, a threat-model-agnostic detection method that leverages influence functions to identify batches of prompts that induce anomalous model behavior, suggests that influence-function-based detection is a promising direction for identifying malicious code-generation prompts without requiring prior know...

Francesco Quinzan, Noor Munir, Yi-Shun Lu et al. · 1 citation

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.