Data-Efficient Backdoor Attacks on Code Models via Trigger-Neutralized Counterfactual Scoring
On the map: LLM safety and security → Backdoor and data poisoning attacks
Abstract (arXiv)
Pre-trained code models are exposed to backdoor poisoning, in which crafted training samples make the model misbehave on a trigger. A capable attacker minimizes the number of such samples, since each adds cost and exposure and a lower poisoning rate leaves a smaller footprint for defenses. Which samples to poison therefore matters, but existing data-efficient selection methods target image classification, offer no scoring mechanism for autoregressive generation, and have not been studied on code. We propose Trigger-Neutralized Counterfactual Scoring (TNCS), which isolates a trigger's contribution to the target behavior by comparing the scoring model's output on a triggered input with its output on a trigger-neutralized counterfactual, covering classification and generation alike. TNCS attains higher attack success rates than the baselines at very low poisoning ratios, across three CodeXGLUE tasks and five trigger families, without degrading clean-task performance, and its margin grows as the ratio decreases. It is the only method effective on every trigger family, and its selected poison set transfers to mismatched victims.
Key facts. No citing papers in the map yet (data through 24 Nov 2026). Placed in Backdoor and data poisoning attacks, one of 12 directions in LLM safety and security. Builds on 39 of its 53 references that are in the map. Submitted 23 Oct 2026.
Builds on
39 of 53 references.
Closest ancestors · 4
Same direction, newest first
- 2024An LLM-Assisted Easy-to-Trigger Backdoor Attack on Code Completion Models: Injecting Disguised Vulnerabilities against Strong Detection10 Jun
- 2023Multi-target Backdoor Attacks for Code Pre-trained Models14 Jun
- 2023Stealthy Backdoor Attack for Code Models6 Jan
- 2021Hidden Killer: Invisible Textual Backdoor Attacks with Syntactic Trigger26 May
Other references · 35
- 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,337
- 2024DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligencecited by 1,241
- 2017Counterfactual Explanations without Opening the Black Box: Automated Decisions and the GDPRcited by 1,116
- 2017Targeted Backdoor Attacks on Deep Learning Systems Using Data Poisoningcited by 1,101
- 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 926
- 2023StarCoder: may the source be with you!cited by 851
- 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 765
- 2017Interpretable Explanations of Black Boxes by Meaningful Perturbationcited by 632
- 2019Explaining Machine Learning Classifiers through Diverse Counterfactual Explanationscited by 625
- 2020GraphCodeBERT: Pre-training Code Representations with Data Flowcited by 622
- 2018Fine-Pruning: Defending Against Backdooring Attacks on Deep Neural Networkscited by 593
- 2020CodeBLEU: a Method for Automatic Evaluation of Code Synthesiscited by 502
23 more
- 2018Spectral Signatures in Backdoor Attackscited by 497
- 2018Detecting Backdoor Attacks on Deep Neural Networks by Activation Clusteringcited by 472
- 2021Neural Attention Distillation: Erasing Backdoor Triggers from Deep Neural Networkscited by 338
- 2019Label-Consistent Backdoor Attackscited by 308
- 2019Devign: Effective Vulnerability Identification by Learning Comprehensive Program Semantics via Graph Neural Networkscited by 287
- 2021Anti-Backdoor Learning: Training Clean Models on Poisoned Datacited by 270
- 2019A new Backdoor Attack in CNNs by training set corruption without label poisoningcited by 249
- 2016Understanding Neural Networks through Representation Erasurecited by 236
- 2019A backdoor attack against LSTM-based text classification systemscited by 230
- 2020BadNL: Backdoor Attacks against NLP Models with Semantic-preserving Improvementscited by 214
- 2020You Autocomplete Me: Poisoning Vulnerabilities in Neural Code Completioncited by 135
- 2018An Empirical Study on Learning Bug-Fixing Patches in the Wild via Neural Machine Translationcited by 110
- 2020Perturbed Masking: Parameter-free Probing for Analyzing and Interpreting BERTcited by 110
- 2023SCALE-UP: An Efficient Black-box Input-level Backdoor Detection via Analyzing Scaled Prediction Consistencycited by 101
- 2020Detecting Code Clones with Graph Neural Networkand Flow-Augmented Abstract Syntax Treecited by 71
- 2023TrojanPuzzle: Covertly Poisoning Code-Suggestion Modelscited by 65
- 2020Interpretation of NLP models through input marginalizationcited by 46
- 2020Backdoors in Neural Models of Source Codecited by 43
- 2021Counterfactual Explanations for Models of Codecited by 26
- 2022Data-Efficient Backdoor Attackscited by 15
- 2023Toward a Theory of Causation for Interpreting Neural Code Modelscited by 13
- 2023Explore the Effect of Data Selection on Poison Efficiency in Backdoor Attackscited by 9
- 2023A Proxy Attack-Free Strategy for Practically Improving the Poisoning Efficiency in Backdoor Attackscited by 6
Built on by
Not cited yet.
Similar, not cited
Close in wording, no citation either way
- 2023Demystifying Poisoning Backdoor Attacks from a Statistical Perspective
- 2025Breaking the Stealth-Potency Trade-off in Clean-Image Backdoors with Generative Trigger Optimization
- 2026Pick Your Poison: Learning to Select Poison Sets for Stronger LLM Backdoor Attacks
- 2026Transferable Backdoor Attacks for Code Models via Sharpness-Aware Adversarial Perturbation
- 2021Backdoor Learning Curves: Explaining Backdoor Poisoning Beyond Influence Functions
- 2023Towards Sample-specific Backdoor Attack with Clean Labels via Attribute Trigger
- 2026SCR: Detecting Backdoor-Poisoned Samples through Clean-Reference Residuals
- 2024Measuring Impacts of Poisoning on Model Parameters and Embeddings for Large Language Models of Code