Mitigating Backdoors in Masked Diffusion Language Models
Wang et al. in Alignment
Can masked predictions expose a hidden trigger?
Mitigating Backdoors in Masked Diffusion Language Models
Backdoors hide behind normal behavior
A poisoned masked diffusion language model may answer normally when the trigger is absent.
In one coding example, adding “Please” could make the poisoned model output a malicious command; UNMASK screens prompts before generation.
UNMASK reads two clues before generation
- 1
Probe in parallel
With output fully masked, an MDLM predicts answer positions in parallel; one batch probes the original prompt, token-masked variants, and an all-masked reference.
- 2
Measure output influence
Mask each candidate prompt token in turn and compare output distributions; the mean of the five largest KL shifts measures its influence.
- 3
Test context support
Reconstruct the candidate from its surrounding prompt and from an all-masked prompt; weak contextual support raises its independence score.
A trigger needs influence and weak context support
With equal prior odds, cθ is the candidate’s probability given surrounding text and mθ its probability with all prompt tokens masked. Their ratio estimates context independence.
- Indθ
- How poorly context supports candidate token i
- Infl
- Output-distribution shift when token i is re-masked
Threshold the maximum; locate its token

Output-masked probes test original, token-masked and all-masked prompts; a clean-calibrated threshold flags high max scores and reports the top token. On one H200, checks were 5.3–62.5× faster than 128-step generation at batch 1.
At 5% FPR, UNMASK catches more triggers
40 settings. TPR averages 12 groups (8 BadDLM settings; 4 SHADOWMASK means over 8 pairs). Localization: UNMASK 94–100%, ONION 33–91%. Tables 1–2.
Trigger influence fades as answers emerge

k counts completed updates (0 = initial evaluation). In three poisoned LLaDA-8B models, trigger influence peaked within the first eight updates in 86–99 of 100 prompts per setting, then weakened as payload tokens appeared.
Use the localized trigger to guide repair
- 1
Teacher supplies clean targets
On 512 unlabeled clean prompts, a frozen poisoned-model copy supplies teacher predictions; no answer labels or clean reference model are needed.
- 2
Student sees the trigger
Initialize a student from the poisoned model; update only its LoRA parameters as it sees each clean prompt with the localized trigger inserted.
- 3
Match clean predictions
Two KL losses make the student match the frozen teacher’s clean predictions with the trigger present and on the unmodified prompt.
Mean ASR drops; clean utility barely moves
Removal table: equal mean over 12 rows. 512 unlabeled prompts, 600 LoRA steps; DeepSeek V4.1 Flash rated clean utility 1–5.
Assumptions and boundaries matter
White-box plus clean prompts
Requires white-box access and a small clean pool for threshold calibration and removal; it is not a black-box-only defense.
Clean behavior matters
One BadDLM alignment model had a 0.18 clean-input target rate from its own compliance with harmful prompts, not the backdoor.
Study scope and theory
Tests span two attacks and four MDLMs; the shared-channel proof does not guarantee the measured per-token score peaks at t=T.
Why it matters
- Parallel denoising gives MDLM defenders a signal before a backdoor payload is generated.
- Use UNMASK’s top-scoring token as a suspected trigger for screening and targeted distillation; verify clean utility afterward.
- The tested BadDLM code ASR fell from 0.82 to 0.06 at λ=0.5; can future triggers hide both cues and still work?
11 slides, 3 min
25 Nov 2026