Data-Efficient Backdoor Attacks on Code Models via Trigger-Neutralized Counterfactual Scoring
Yu-Yu Lee, Ming-Feng Tsai, Tomohiro Morikawa, Chun-I Fan
Key points
From the paper's conclusion- 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.
Abstract
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.
Read the paper
Discussion
Science Skim's AI key points, plus readers' public thoughts
Readers' thoughts
No reader thoughts yet.
Related papers
- CID: Clean-Seed-Free Backdoor Defense via Counterfactual Invariance for Neural Code ModelsProceedings of the ACM on Software Engineering · 2026
- CodePoisonRAG: Knowledge Poisoning Attacks on Retrieval-Augmented Code GenerationarXiv · 2026
- Kerkoporta: Injecting Structured-Output Backdoors in Reasoning Coding AgentsarXiv · 2026
- Cost-Effective Adversarial Attacks Against Code LLM With Model AttentionIEEE Transactions on Software Engineering · 2026
- Weight-Space Backdoors in Open-Weight LLMs: Cross-Architecture Attacks and Blind Model ForensicsarXiv · 2026
- Information-Gain Rewards over Diversity-Pruned Tests: GT-Anchored Verifier Co-Training for Reliable Code GenerationarXiv · 2026