acceptodds
Under review as a conference paper at ICLR 2027

Mitigating Backdoors in Masked Diffusion Language Models

Abstract

Masked diffusion language models (MDLMs) have emerged as a promising alternative to autoregressive models because they can predict multiple tokens in parallel rather than generating tokens sequentially. However, recent studies have shown that MDLMs are vulnerable to backdoor attacks: when an input contains an attacker-chosen trigger, a backdoored model generates a targeted output, such as malicious code, while otherwise behaving normally. Despite this threat, backdoor defenses for MDLMs remain largely underexplored. We present UNMASK, the first defense framework for MDLMs that detects trigger-containing inputs, localizes the trigger tokens, and removes the backdoor from the compromised model. UNMASK exploits two fundamental properties of backdoor triggers, specificity and dominance, to assign a suspiciousness score to each input token. By leveraging two distinctive capabilities of MDLMs, parallel token prediction and token reconstruction at arbitrary positions, UNMASK computes these scores both effectively and efficiently. We further provide a theoretical analysis supporting the design of UNMASK. Evaluations across 40 settings spanning two attacks and four models show that UNMASK detects 99.3% of trigger-containing inputs at a 5% false-positive rate, substantially outperforming the strongest adapted baseline, which achieves 54.8%. UNMASK also achieves over 99% trigger-localization accuracy and reduces the average attack success rate from 95% to 1%, while largely preserving the model's utility on clean inputs.

Primary area:
alignment, fairness, safety, privacy, and societal considerations
Keywords:
Diffusion Language Model, Input-level Backdoor Defense, AI Safety

Reviews

Among:
Shape:
1234this paper, Top 30%
Figure 1. Mean review rating of the reviewed papers at ICLR 2027. This paper averages 2.67 over 3 reviews, above 70% of the others.
Reviewer_4yMpOpenReview ↗
Rating
3
Confidence
4
Informativeness
2
Presentation
3
Soundness
3
Read review
Paper summary

This paper proposes the first backdoor defense framework specifically designed for MDLMs, covering poisoned-sample detection, trigger localization, and backdoor mitigation. To account for the characteristics of MDLMs, the authors introduce an anomaly score based on Independence × Influence at the token level. I find this design interesting and intuitive, and the ablation studies provide empirical support for its effectiveness. More importantly, the method only requires first-step denoising for detection, which makes it particularly practical for real-world deployment. Overall, the paper is easy to read and supported by comprehensive experiments. Good job.

Critical strengths
  • Intuitive motivation and method design.

  • Comprehensive experimental evaluation.

  • A timely research problem with relevant and useful discussions.

Critical weaknesses

Although the authors introduce several designs specifically for MDLMs, the core idea itself is not entirely new. Prior work [1] also adopts masking-based input perturbation and measures KL-based shifts in the first-step output distribution to identify trigger-sensitive tokens. The main additional contribution appears to be the incorporation of contextual independence for trigger localization.

[1] Wan et al. Self-Purification Mitigates Backdoors in Multimodal Diffusion Language Models. ArXiv’26.

Questions for authors

Since [1] has not undergone peer review and focuses on the multimodal setting, I do not recommend the authors to include a discussion of this work in the main paper. However, I would be interested in the authors’ thoughts on the following questions:

  • Was this work inspired by [1] at either the conceptual or methodological level, particularly regarding masking-based perturbation and first-step distribution shifts?

  • One-step masking perturbation is also used as an informative signal in [2]. Does this suggest that such first-step perturbation responses may serve as a more general detection signal for backdoor defense in diffusion-based models?

[2] Zhai et al. Text-to-Image Diffusion Models Can Be Easily Backdoored through Multimodal Data Poisoning. ACM MM’23.

I would like to raise my score if authors provide more information about the questions.

3 comments

W & Q1: Was this work inspired by [1] at either the conceptual or methodological level, particularly regarding masking-based perturbation and first-step distribution shifts? [1] Wan et al. Self-Purification Mitigates Backdoors in Multimodal Diffusion Language Models. ArXiv’26.

A: We thank the reviewer for bringing this paper [1] to our attention. We were unaware of [1] when developing UNMASK. After carefully reviewing this arXiv paper, we identified several important differences between their approach and ours.

  1. Different attack settings. UNMASK focuses on text-trigger-based backdoor attacks, where malicious triggers are embedded in textual inputs. In contrast, [1] considers image-trigger-based backdoor attacks, where triggers are inserted into images (e.g., a white patch).
  2. Different attack mechanisms. Image-trigger-based attacks are relatively straightforward and share similarities with traditional backdoor attacks against image classifiers, as they do not necessarily require exploiting the unique diffusion mechanism of DLMs. In contrast, the text-trigger-based attacks considered in our work exploit the underlying denoising mechanism of DLMs, particularly the different training paths followed by poisoned and clean samples. This introduces distinct challenges for backdoor detection and removal.
  3. Different detection methodologies. At a high level, the method in [1] primarily relies on a signal similar to the influence signal defined in our paper. In contrast, UNMASK jointly leverages both influence and independence signals to detect backdoors. Our ablation study demonstrates that relying on the influence signal alone is insufficient for effective backdoor detection, highlighting the importance of incorporating the independence signal.

Q2: One-step masking perturbation is also used as an informative signal in [2]. Does this suggest that such first-step perturbation responses may serve as a more general detection signal for backdoor defense in diffusion-based models? [2] Zhai et al. Text-to-Image Diffusion Models Can Be Easily Backdoored through Multimodal Data Poisoning. ACM MM’23.

A: We could not find a one-step masking perturbation in [2], but another work by its first author, NaviT2I [3], flags triggered prompts by masking their tokens and measuring the activation change at the first denoising step. Elijah [4] likewise inverts a trigger from the image diffusion model’s response to a perturbed input noise at the first denoising step. Our Proposition 1 (Appendix A.8) also proves the importance of the first step. So your intuition is correct: the first step may provide a general and important signal for backdoor defenses in diffusion-based model.

[3] Zhai et al. Efficient Input-level Backdoor Defense on Text-to-Image Synthesis via Neuron Activation Variation. ICCV 2025.

[4] An et al. Elijah: Eliminating Backdoors Injected in Diffusion Models via Distribution Shift. AAAI 2024.

Reviewer_4yMpOpenReview ↗

Thank you for the rebuttal

Dear authors,

Thank you for the detailed rebuttal. My concerns have been addressed. I personally recommend accepting this paper.

Dear Reviewer,

Thank you very much for your positive feedback and support. We are glad that our rebuttal has addressed your concerns. We would greatly appreciate it if you would consider raising your score and advocating for our paper during the subsequent discussion.

Thank you again for your time and consideration.

Reviewer_reB7OpenReview ↗
Rating
3
Confidence
3
Informativeness
2
Presentation
2
Soundness
2
Read review
Paper summary

This work proposed a defense framework for MDLMs that detects trigger-containing inputs, localizes the trigger tokens, and removes the backdoor from the compromised model. They detect trigger-containing inputs and localize the trigger tokens based on two trigger characteristics: high influence on outputs and high independence from other input tokens, and utilize the identified trigger to remove the backdood by self-distillation.

Critical strengths

The motivation and the design of the method are intuitive and reasonable. This work combines a token’s influence on output predictions with its contextual independence, leveraging parallel prediction and arbitrary-position reconstruction to detect and localize triggers. And the empirical results demonstrate its effectiveness.

The experiments and analyses are clear and comprehensive. The experiments cover two attack methods and four model architectures, assessing detection accuracy, trigger localization, computational overhead, and backdoor removal.

Critical weaknesses

The method relies on the assumption that triggers exert a strong influence on outputs and are largely independent of other input tokens. This assumption may not hold in more realistic and sophisticated attack scenarios, such as those involving semantic triggers, potentially limiting the method’s applicability. The robustness against stronger adaptive adversaries remains insufficiently established.

Questions for authors
  1. How dose UNMASK perform under adaptive attacks using semantic triggers, where a semantic condition activates the backdoor across diverse, contextually natural paraphrases rather than through a fixed word or phrase?

  2. What are the primary failure modes of UNMASK? Are there specific attack configurations where UNMASK fails catastrophically?

3 comments

W & Q1: The method relies on an assumption may not hold in more realistic and sophisticated attack scenarios, such as those involving semantic triggers, potentially limiting the method’s applicability. How dose UNMASK perform under adaptive attacks using semantic triggers, where a semantic condition activates the backdoor across diverse, contextually natural paraphrases rather than through a fixed word or phrase?

A: We thank the reviewer for highlighting this important aspect of new trigger types. Our original submission only evaluated trigger types in BadDLM and ShadowMask, the only existing backdoor attacks on MDLMs before our submission, and did not evaluate other trigger types. As suggested by the reviewer, we tested one case of each type on BadDLM code injection with LLaDA-8B-Instruct, with the detector unchanged.

casethe attackASR with / without triggerAUROCTPR@5%FPRLoc.
semantic conditiontrigger “shell-command token”: six commands trained at 400 poisoned instructions each, grep held out and absent from the training data0.98 / 0.001.0001.00100%
contextually natural paraphrasingparaphrasing the coding task using given0.92 / 0.000.9931.00100%

Q2: What are the primary failure modes of UNMASK? Are there specific attack configurations where UNMASK fails catastrophically?

A: As suggested by the reviewer, we analyzed the false positive samples. We found that the primary failure modes involve flagging a clean prompt that holds a token the context cannot predict and that steers the answer, such as a person’s name, especially a foreigner’s name. However, if the attackers use a person’s name as a trigger, our method can still detect the backdoor.

Thanks for your reply. The explanation you provided is somewhat vague and superficial. Could you offer a detailed analysis? Also, what specific forms do semantic triggers take and how are they constructed?

We thank the reviewer for your feedback. UNMASK flags a clean prompt with a token unpredictable and determining the answer. For example, “What did Hercules complete?” gives Hercules influence 8.49 and PMI -1.20, hence score 6.52 — above the trigger’s own median of 4.56. However, if the attackers use such name as a trigger, our method can still detect the backdoor at AUROC/TPR 1.000/1.00.

The semantic trigger is a lexical class, “a shell-command token”, with one member held out of the trigger position of every training row. Six shell-command tokens (sudo/ssh/ping/kill/chmod/mkdir) each with 400 poisoned instructions form the training set. "grep" is held out as the test trigger. The ASR is 0.98 and UNMASK still detects it, at AUROC/TPR 1.000/1.00 on the held-out member.

We hope this resolves your concerns and would be grateful if you would consider advocating for our paper during the subsequent discussion. Thank you again for your time and consideration.

Reviewer_CrCoOpenReview ↗
Rating
2
Confidence
3
Informativeness
2
Presentation
2
Soundness
2
Read review
Paper summary

This paper proposes UNMASK, a backdoor defense framework for masked diffusion language models (MDLMs). It combines masking influence and contextual independence to detect and localize backdoor triggers, followed by self-distillation for backdoor removal. Experiments across four models and two attack methods report strong detection and mitigation performance.

Critical strengths
  1. The paper addresses an underexplored security problem in MDLMs and proposes a defense tailored to their masking-based generation mechanism.

  2. The reported experimental results are strong, with substantial improvements over adapted baselines.

  3. The authors provide ablation studies, adaptive attack experiments, and efficiency evaluations to support the proposed method.

Critical weaknesses
  1. The methodological novelty is limited. The detection mechanism mainly combines masking-based output sensitivity with contextual independence, both relatively intuitive signals. The theoretical analysis also does not directly guarantee the effectiveness of the proposed token-level detection score.

  2. The method relies on the assumption that backdoor triggers are contextually independent and strongly influence initial predictions. This assumption may not hold for semantic, context-dependent, or distributed triggers, limiting its general applicability.

  3. Despite evaluating 40 settings, the experiments involve only two backdoor attack methods. The adaptive evaluation is relatively narrow and does not convincingly establish robustness against attackers specifically optimizing to evade the complete detection score.

  4. The backdoor removal component lacks comparisons with alternative unlearning methods. The substantial ASR reduction on known triggers does not necessarily demonstrate complete backdoor removal or robustness against reactivation.

  5. The evaluation uses only 100 attacked and 100 clean inputs per setting, with just 50 clean samples for threshold calibration. The reliability of the reported low-FPR performance under broader input distributions remains unclear.

Questions for authors

Please refer to Weaknesses.

3 comments

W1 & Q1: The methodological novelty is limited. The detection mechanism mainly combines masking-based output sensitivity with contextual independence, both relatively intuitive signals. The theoretical analysis also does not directly guarantee the effectiveness of the proposed token-level detection score.

A: We thank the reviewer for the careful review and thoughtful questions regarding novelty and theoretical foundations. While we agree that the two signals are intuitive, we respectfully disagree that their intuitiveness implies limited novelty. Instead, we view the intuitiveness and effectiveness of these signals as key strengths of our approach. Conceptually, intuitive signals make our methodology straightforward to understand at a high level. Technically, however, identifying, extracting, and effectively leveraging these signals for backdoor detection and removal are far from trivial. Diffusion language models (DLMs) operate through fundamentally different generation mechanisms from autoregressive LLMs and other models, such as classifiers, introducing unique challenges that existing backdoor defenses do not address. To the best of our knowledge, no prior work has developed a backdoor defense for DLMs. The novelty of UNMASK lies in exploiting the unique denoising dynamics of DLMs to identify and leverage informative signals for effective and efficient backdoor detection and removal. These capabilities are not readily achievable by directly applying existing defenses designed for other model architectures.

Our theoretical analysis derives the score from a per-token test (Eq. 3–6) and justifies reading it at the first step (Proposition 1), and we didn’t claim that this directly guarantees effectiveness. As with the baselines we compare against, which are not guaranteed either, the detection rate of UNMASK is established empirically in the current submission: it catches more than 95% of triggered prompts at 5% FPR in 39 of 40 settings. To link the score to this detection rate, we add Proposition 2 to the appendix.

Proposition 2. For an attacked prompt xx with trigger xi⋆x_{i^\star} (A.5), let η=Infl(xi⋆)/τ\eta = \mathrm{Infl}(x_{i^\star})/\tau, and take cθc_\theta, mθm_\theta and Ind^θ=mθmθ+cθ\widehat{\mathrm{Ind}}_\theta = \frac{m_\theta}{m_\theta+c_\theta} (Eq. 5) at xi⋆x_{i^\star}. (a) If η≤1\eta\le1, then ϕθ(xi⋆)≤τ\phi_\theta(x_{i^\star})\le\tau. (b) For κ>2\kappa > 2, if E[cθ/mθ∣η≥κ]≤1\mathbb{E}[c_\theta/m_\theta\mid\eta\ge\kappa]\le1, then ϕθ(xi⋆)>τ\phi_\theta(x_{i^\star}) > \tau, so xx is flagged, for at least a κ−2κ−1\frac{\kappa-2}{\kappa-1} fraction of attacked prompts with η≥κ\eta\ge\kappa.

Proof. ϕθ(xi⋆)=ητ⋅Ind^θ\phi_\theta(x_{i^\star})=\eta\tau\cdot\widehat{\mathrm{Ind}}_\theta and Ind^θ≤1\widehat{\mathrm{Ind}}_\theta\le1, which gives (a). If η≥κ\eta\ge\kappa, then ϕθ(xi⋆)≤τ\phi_\theta(x_{i^\star})\le\tau requires Ind^θ≤1κ\widehat{\mathrm{Ind}}_\theta\le\frac1\kappa, i.e., cθ/mθ≥κ−1c_\theta/m_\theta\ge\kappa-1, which by Markov’s inequality holds for at most a 1κ−1\frac1{\kappa-1} fraction.

Empirical verification of Proposition 2 (40 settings). During our experiments, the median η=7.2\eta=7.2. Prompts with η≥7,8,9\eta\ge7,8,9 make up 50/44/39% of attacked prompts. The condition holds in every setting with such prompts, so Proposition 2 guarantees that at least 83.3/85.7/87.5% of these attacked prompts are flagged. In other words, our token-level detection score provably flags most high-influence triggers, which is consistent with our near-perfect empirical detection rate.

W2 & Q2: The method relies on the assumption that backdoor triggers are contextually independent and strongly influence initial predictions. This assumption may not hold for semantic, context-dependent, or distributed triggers, limiting its general applicability.

A: We thank the reviewer for highlighting this important aspect of new trigger types. Our original submission only evaluated trigger types in BadDLM and ShadowMask, the only existing backdoor attacks on MDLMs before our submission, and did not evaluate other trigger types. As suggested by the reviewer, we tested one case of each type on BadDLM code injection with LLaDA-8B-Instruct, with 100 triggered and 100 clean inputs per row(except semantic row) and the detector unchanged.

reviewer’s casethe attackASR with / without triggerAUROCTPR@5%FPRLoc.
semantictrigger “shell-command token”: six commands trained at 400 poisoned instructions each, grep held out and absent from the training data0.98 / 0.001.0001.00100%
context-dependentfunction is a context dependent trigger in coding task0.87 / 0.000.9941.00100%
distributedsudo at the front, ocean at the end, 68 tokens apart (median), no span covers both0.96 / 0.001.0001.00100%

W3 & Q3: Despite evaluating 40 settings, the experiments involve only two backdoor attack methods. The adaptive evaluation is relatively narrow and does not convincingly establish robustness against attackers specifically optimizing to evade the complete detection score.

A: We agree that we should have explained why there are only two attacks: to our knowledge SHADOWMASK (Cao et al., 2026) and BadDLM (Zhai et al., 2026) are the only two backdoor attacks on MDLMs published so far, and we evaluate every setting they provide. We will state this scope in our paper.

We thank the reviewer for proposing the more advanced adaptive attack where the attackers know exactly our detection score. However, this assumption is usually too strong to appear in existing defenses. Nevertheless, we run this advanced attack: we train BadDLM code injection on LLaDA-8B-Instruct with a penalty on the trigger’s full score Φ=KL⋅σ(−PMI)\Phi=\mathrm{KL}\cdot\sigma(-\mathrm{PMI}). As indicated by our existing adaptive attack (Appendix A.15), the KL in the influence score and the backdoor loss are contradictory. Therefore, the advanced attack focuses on optimizing σ(−PMI)\sigma(-\mathrm{PMI}), which forces the model to regard the trigger as a frequent word everywhere. This further makes the model consistently inclined to fill in the trigger word and generate the backdoor target even when the input doesn’t contain the trigger. Thus, this backdoor is not stealthy.

W4 & Q4: The backdoor removal component lacks comparisons with alternative unlearning methods. The substantial ASR reduction on known triggers does not necessarily demonstrate complete backdoor removal or robustness against reactivation.

A: We thank the reviewer for this suggestion and add more comparisons: on the BadDLM sudo backdoor of LLaDA-8B-Instruct, supervised fine-tuning (SFT) on 100 triggered prompts paired with clean outputs plus 100 clean examples lowers the ASR only from 0.867 to 0.167, whereas UNMASK’s removal lowers it to 0.000 and needs no clean data, which SFT needs in an amount comparable to the triggered data.

During our evaluation, we did not observe any backdoor reactivation. Even if a backdoor were reactivated by a different trigger, UNMASK could detect and remove the newly activated backdoor. Importantly, we emphasize that our threat model assumes attackers have no access to the model's training process after backdoor removal and therefore cannot inject new backdoors. This assumption is consistent with the threat models adopted in prior literature.

W5 & Q5: The evaluation uses only 100 attacked and 100 clean inputs per setting, with just 50 clean samples for threshold calibration. The reliability of the reported low-FPR performance under broader input distributions remains unclear.

A: We have redone the evaluation at five times the scale: all 40 settings with 500 clean and 500 triggered prompts each, calibrating on N=50 and on N=250 clean prompts over random splits, with the FPR measured on held-out clean prompts. The results in the following table demonstrate the reliability of our reported low FPR.

calibrationmean FPRmean TPR
N=50N=500.05900.918
N=250N=2500.05220.922

Dear Reviewer,

As the discussion period is drawing to a close, we wanted to follow up. We hope our responses and the additional experiments have addressed your concerns. If any point remains unclear or if you have further questions, we would be glad to clarify before the deadline.

Thank you again for your time and effort in reviewing our paper.

Best regards,

The authors

From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.

Related papers

Loading the map…

Discussion (0)

Sign in to comment.