mlsanityData to 14 Oct 2026

GUARD:Dual-Agent based Backdoor Defense on Chain-of-Thought in Neural Code Generation

arXiv 2505.21425 ↗First posted 27 May 2025cs.SEcited by 3

On the map: LLM reasoning → Reasoning for agents, planning and code

also in 2 more
Abstract (arXiv)

With the widespread application of large language models in code generation, recent studies demonstrate that employing additional Chain-of-Thought generation models can significantly enhance code generation performance by providing explicit reasoning steps. However, as external components, CoT models are particularly vulnerable to backdoor attacks, which existing defense mechanisms often fail to detect effectively. To address this challenge, we propose GUARD, a novel dual-agent defense framework specifically designed to counter CoT backdoor attacks in neural code generation. GUARD integrates two core components: GUARD-Judge, which identifies suspicious CoT steps and potential triggers through comprehensive analysis, and GUARD-Repair, which employs a retrieval-augmented generation approach to regenerate secure CoT steps for identified anomalies. Experimental results show that GUARD effectively mitigates attacks while maintaining generation quality, advancing secure code generation systems.

Key facts. Cited by 3 papers in the map (data through 14 Oct 2026). Placed in Reasoning for agents, planning and code, one of 17 directions in LLM reasoning. Builds on 5 of its 17 references that are in the map. First posted on arXiv 27 May 2025.

Builds on

5 of 17 references.

Closest ancestors · 2

Same direction, newest first

  1. 2025MSCoT: Structured Chain-of-Thought Generation for Multiple Programming Languages14 Apr
  2. 2024SABER: Model-agnostic Backdoor Attack on Chain-of-Thought in Neural Code Generation8 Dec

Other references · 3

  1. 2021Evaluating Large Language Models Trained on Codecited by 8,320
  2. 2023Baseline Defenses for Adversarial Attacks Against Aligned Language Modelscited by 651
  3. 2024Defending Code Language Models against Backdoor Attacks with Deceptive Cross-Entropy Losscited by 5

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2025: 2; 2026: 1.

3 papers.

Similar, not cited

Close in wording, no citation either way

  1. 2026SoK: AI Secure Code Generation: Progress, Pitfalls, and Paths Forward
  2. 2025SLIP: Soft Label Mechanism and Key-Extraction-Guided CoT-based Defense Against Instruction Backdoor in APIs
  3. 2025Your Agent Can Defend Itself against Backdoor Attacks
  4. 2026MACGen: Toward Functionally Correct and Secure Code Generation via Multi-Agent Collaboration
  5. 2025The Double Life of Code World Models: Provably Unmasking Malicious Behavior Through Execution Traces
  6. 2024CodePurify: Defend Backdoor Attacks on Neural Code Models via Entropy-based Purification
  7. 2025BlueCodeAgent: A Blue Teaming Agent Enabled by Automated Red Teaming for CodeGen AI
  8. 2026Critical-CoT: A Robust Defense Framework against Reasoning-Level Backdoor Attacks in Large Language Models