RePAIR: Reversing Backdoor Attacks in Semantic SegmentationRePAIR: Inverting Backdoor Attacks in Semantic Segmentation
The authors propose RePAIR, a post-hoc defense against semantic segmentation backdoors; the authors state that on Cityscapes the ASR of SegFormer drops to below 0.54%.
The attacker implants a targeted backdoor during training at a 10% poisoning rate: when the trigger appears, victim-class pixels are relabeled as the attacker-specified target class, while behavior on clean inputs remains normal. The defender is post-hoc, label-free, and attack-unaware: they have only the frozen backdoored model and an unlabeled image pool that may contain trigger samples, do not know the trigger, poisoning rate, or victim-target pair, and do not retrain or modify the model.
- Semantic segmentation models can be backdoor attacked: when the trigger appears, victim-class pixels are reclassified as the target class, while clean predictions are unaffected. The authors argue that existing defenses are mostly adapted from image classification, that defenses specific to segmentation are few, and that they usually require retraining or modifying the model.
- RePAIR is a post-hoc, label-free, attack-unaware repair method: it exploits the semantic divergence between the classification head and internal representations to infer victim-target pairs from an unlabeled and possibly poisoned image pool, construct a safe reference state, locate suspicious pixels, and correct them toward victim semantics in feature space and at the output layer.
- On the eight attack configurations on Cityscapes, the authors report that RePAIR reduces ASR to below 7.86% for DeepLabV3+ and below 0.54% for SegFormer, with mIoU-B largely preserved; on PASCAL VOC the residual ASR is 5.41%–19.67%; on ADE20K the attacks themselves did not take effect, and no defense evaluation was performed.
- The authors state that the theoretical results are only a local abstraction and sufficient conditions, that the safety reference set is not guaranteed to be truly clean, and that the calibration budget does not constitute a population-level guarantee for unseen clean inputs. The experiments cover only two architectures, three datasets, and a 10% poisoning rate, and the paper does not report the number of repetitions or an adaptive attack evaluation.
- Evaluated models
- DeepLabV3+ (ResNet-50)SegFormer (MiT-B5)
- Benchmarks
- CityscapesPASCAL VOC 2012ADE20K
- Metrics
- ASRmIoU-BmIoU-A
RePAIR is a post-hoc defense method against backdoor attacks in semantic segmentation that requires no labels and no prior knowledge of the attack. It is based on the finding that the changes a backdoor causes in the classification head may be stronger than those in internal representations; the method accordingly infers the relationship between victim and target classes from an unlabeled image pool, locates suspicious pixels, and semantically corrects features and outputs toward the victim class. Experiments across multiple segmentation architectures and attack settings show that RePAIR substantially reduces attack success rates while largely preserving clean-sample performance.
Paper analysis
What problem does this paper attempt to solve?
For targeted backdoors in semantic segmentation models, the authors propose a post-hoc repair defense that requires no retraining, no labels, and no attack knowledge.
Core problem: how to repair pixels in a semantic segmentation model that are reclassified by a targeted backdoor, without knowing attack details and without retraining the model.
- Scenario and importance: semantic segmentation provides pixel-wise perception for safety-critical systems such as autonomous driving and medical imaging. A backdoor relabels victim-class pixels as an attacker-specified target class when the trigger appears (e.g., vehicle pixels labeled as road), while behaving normally on clean inputs (Introduction).
- Shortcomings of existing methods: the authors state that detection-based methods can only identify suspicious inputs or models and cannot remove the backdoor; retraining-based methods (fine-tuning, pruning) require additional clean data and may change model behavior; defenses specialized for segmentation are scarce (Introduction, Related Work).
- Core observation: the authors observe that the backdoor-induced shift may be much stronger in the classification head than in a suitable internal semantic representation; even if the encoder itself is also affected, victim semantics may still be partially recoverable; this representation depends on architecture (DeepLabV3+ uses the final backbone layer, while SegFormer requires learning a logistic readout across multiple blocks) (Introduction).
- What the paper proposes: RePAIR (Representation-guided pixel-wise attack Repair), a post-hoc, label-free, attack-unaware repair framework, plus a theoretical analysis modeling the attack as a directed victim→target transport on a probability simplex.
- Threat model:
- Attacker goal: poison during training (experiments use a 10% poisoning rate) so that victim-class pixels are reclassified as the target class when the trigger appears.
- Attack settings: cover four configurations, IBA (NNI/PRL), ConSeg, OFBA, and BadSeg; trigger locations and victim-target pairs vary by attack (Section 5.1).
- Defender knowledge: attack-unaware—does not know the trigger, attack mask, attack family, poisoning rate, or victim-target pair, and has no semantic ground truth or clean/poisoned source information (Section 4).
- Defender capability: only a frozen backdoored model and an unlabeled image pool that may contain trigger samples; no retraining and no global modification of the network.
What related research exists?
Related work is divided into three groups: segmentation backdoor attacks, detection-based defenses, and retraining-based defenses; the authors state that RePAIR differs from them in being post-hoc, selectively repairing, and requiring no clean data.
Semantic segmentation backdoor attacks
- Li et al. (2021b) adapt BadNets from image classification to semantic segmentation, using a black bar at the image edge or a semantic class in the image as the trigger, and relabel all pixels of the victim class as the target class.
- IBA (Lan et al., 2024) places the trigger on non-victim pixels and proposes two strategies, NNI (trigger near the victim region) and PRL (add random labels to non-victim pixels); OFBA (Mao et al., 2023) places the trigger on the target object, and at inference the trigger location selects the victim class.
- ConSeg (Abbasi et al., 2025) uses natural semantic triggers (e.g., motorcycles) and adds co-occurring classes to strengthen contextual associations; BadSeg (Zhang et al., 2026) extends to four attack types, O2O, O2B, B2O, and B2B, using a surrogate model to optimize the trigger and victim-target pair.
Detection-based defenses (adapted from classification)
- STRIP (Gao et al., 2019) and TeCo (Liu et al., 2023) detect suspicious inputs via prediction entropy under image overlay and prediction consistency under image perturbation, respectively.
- Zeng et al. (2021) detect anomalous trigger patterns in the frequency domain; BEATRIX (Ma et al., 2023) uses class-conditional higher-order Gram matrices to detect anomalous internal representations.
- The paper notes that these methods only identify suspicious inputs and do not repair predictions or remove the backdoor.
Retraining/model-modification defenses
- Pruning (Liu et al., 2018) removes neurons with low activation on benign inputs and fine-tunes on clean data; fine-tuning (Sha et al., 2022) directly retrains on clean data. The paper notes that both require clean data (Lan et al., 2024; Zhang et al., 2026 also evaluated them this way).
- Segment Cleanse (Mao et al., 2023) adapts Neural Cleanse to segmentation, reconstructing object-level trigger candidates and mitigating via retraining, which likewise requires modifying the model and clean data.
- ABL (Li et al., 2021a) uses dynamic differences in training loss to identify suspicious samples and reduces their influence via gradient ascent; the paper notes that it operates during training and cannot perform post-hoc selective repair on a deployed model.
Baselines and benchmarks: the baseline defenses compared in the experiments are pruning, fine-tuning, Segment Cleanse, and ABL; the evaluation benchmarks are Cityscapes, PASCAL VOC 2012, and ADE20K (Section 5.1).
Positioning of this paper: the authors state that RePAIR differs from detection-based methods in directly repairing predictions; from pruning, fine-tuning, and Segment Cleanse in not retraining and not modifying the model; from ABL in being applied post-hoc; and it requires no ground truth labels or external clean reference set (end of Related Work).
How does the paper address this problem?
RePAIR is divided into two stages, offline construction and inference: first, infer victim-target pairs in an attack-unaware manner and screen out a safe reference set; then localize suspicious pixels and perform feature and output corrections.
Overall idea: treat the targeted backdoor as a directed probability transport from victim to target on a class probability simplex; RePAIR uses the disagreement between the classification head's prediction and internal semantic evidence to approximate the reverse transport, selectively repairing attacked pixels. RePAIR freezes the backdoored model; the input is only the model and an unlabeled image pool that may contain trigger samples.
Theoretical framework
- The attack is modeled as a local transport q = p⋆ + ξ(et − ev), i.e., moving probability mass ξ from the victim class coordinate to the target class coordinate; repair approximates its inverse mapping (Section 3, Eqs. (1)(3)).
- Several bounds follow: the localization miss rate ηloc ≤ ηref (the proportion of successful attacks in which internal victim evidence is missing); the post-defense ASR upper bound decomposes into three terms: missed detection, repair failure, and newly added target predictions; the clean-side prediction change upper bound is the probability that a benign pixel is selected plus the probability of change outside the mask (Eqs. (5)(6)(8)).
- The authors explicitly state that these are a local analysis model and sufficient conditions; they do not claim that real attacks are one-dimensional, nor that the clean p⋆ or ξ can be observed.
Architecture-dependent semantic reference
- CNN (DeepLabV3+): take the normalized features of the final backbone layer, compute class centroids using pseudo-labels from the frozen classification head, and obtain the internal prediction via cosine similarity; the reference estimate is image-disjoint (an image is not evaluated with centroids estimated from itself).
- Transformer (SegFormer): semantic evidence is distributed across multiple blocks; for each of L selected layers, compute victim/target centroid similarities, concatenate them into a 2L-dimensional feature, and then use a regularized logistic readout to obtain internal victim support; the readout is trained only with pseudo-labels from the frozen head, not with semantic or attack labels.
Attack-unaware victim-target pair discovery
- All ordered class pairs are candidates. For CNN, the main signal is the contradiction that the internal representation retains victim evidence while the classification head predicts target, aggregated over image-disjoint reference views, requiring stable support and a margin from competing pairs.
- For Transformer, lightweight cues first form candidate families, then per-pair out-of-fold joint LogReg evidence is evaluated; after the family is frozen, FullEdge, FamilyVerify, and Mechanism evidence vote in both directions, and only a unique direction is released; if evidence is insufficient, the mapping remains inactive (fail-closed, Appendix A.1.6).
Safe reference state, localization, and repair
- Safety screening: candidate reference images are screened via image-disjoint cross-fitting and a victim-safety firewall, removing images with unstable internal predictions, severely collapsed victim evidence, or moderate degradation accompanied by abnormally strong victim→target contradiction; removed images are not backfilled, and thresholds are not relaxed. At least 24 safe images and 75% semantic class coverage are required, otherwise the defense is not activated (Appendix A.2.3).
- Localization: CNN combines three branches: semantic contradiction, geometric residual, and probability residual; Transformer uses five sequential, mutually exclusive branches restricted to pixels that the classification head predicts as target. The shared probability branch compares the observed target-over-victim probability excess against the reference expected value, and the residual is calibrated on the safe reference set according to an empirical budget.
- Repair: first, in feature space, migrate the representations of localized pixels toward the victim reference (retrieval within the orthogonal complement of the victim-target axis, to avoid being dominated by the displacement to be removed), then forward through the unmodified latter half of the network; if not fully restored, apply a conservative output correction to the victim/target logits, with the correction magnitude partially applicable per branch.
- Output safety: No New Target Veto—when repair changes a pixel outside the authorized mask whose original prediction was not target into target, restore the original prediction; only newly added targets are constrained, and existing target predictions are unaffected.
What experiments did the paper conduct?
On eight attacks on Cityscapes, the authors report that RePAIR reduces ASR to below 7.86% for DeepLabV3+ and below 0.54% for SegFormer, while mIoU-B is largely maintained.
Experimental setup
- Models tested: two segmentation architectures, DeepLabV3+ (ResNet-50 backbone) and SegFormer (MiT-B5 backbone).
- Datasets: Cityscapes (2,975 train / 500 val, 19 classes), PASCAL VOC 2012 (1,464 train / 1,449 val, 20 foreground classes plus background), ADE20K (20,210 train / 2,000 val, 150 classes) (Appendix A.3).
- Attacks: IBA (NNI, PRL), ConSeg, OFBA, BadSeg in four configurations (O2O, O2B, B2O, B2B), eight in total, all with a 10% poisoning rate; O2B-type attacks use car→road, the others use car→person (O2O), sidewalk→road (B2B), road→car (B2O); PASCAL VOC uses person→background.
- Baseline defenses: fine-tuning, pruning, Segment Cleanse, ABL, with hyperparameters per the original configurations (Table 3).
- Metrics: ASR (the proportion of victim-class pixels on triggered inputs misclassified as the target class; BadSeg-B2O is computed only within the specified attack region), mIoU-B (clean inputs), mIoU-A (triggered inputs, excluding attacked pixels).
- Other: RePAIR hyperparameters are fixed globally and not tuned per attack instance (Appendix A.3); the paper does not report the number of repetitions.
Main results
ASR (%) for the eight attacks on Cityscapes (according to Table 1):
Swipe horizontally to read the table
Model Method IBA(NNI) IBA(PRL) ConSeg OFBA O2B O2O B2O B2B DeepLabV3+ no defense 88.56 97.41 86.23 60.83 95.49 97.03 96.87 96.82 DeepLabV3+ fine-tuning 56.36 12.35 84.54 6.31 13.42 81.91 86.36 97.69 DeepLabV3+ pruning 89.60 98.13 90.07 71.36 96.63 96.55 97.58 97.25 DeepLabV3+ Seg.-Cleanse 0.36 0.89 86.23 0.75 3.31 94.20 96.85 36.95 DeepLabV3+ ABL 83.94 94.55 1.12 0.78 17.29 90.36 86.19 92.17 DeepLabV3+ RePAIR 1.18 1.01 1.51 1.10 2.35 1.00 0.46 7.86 SegFormer no defense 26.43 28.71 89.15 45.32 87.39 86.24 94.11 95.46 SegFormer RePAIR 0.00 0.00 0.54 0.00 0.00 0.00 0.00 0.31 (The fine-tuning, pruning, Seg.-Cleanse, and ABL rows for SegFormer are omitted; among them, ABL is 0.71 on ConSeg and 2.32 on O2O, and the rest are between 9.11–73.35, according to Table 1.)
- The authors state that RePAIR reduces ASR to below 7.86% for all attacks on DeepLabV3+, and that this consistency was not observed for other defenses; Segment Cleanse is effective against IBA and OFBA but clearly worse on BadSeg attacks.
- The authors state that on SegFormer, RePAIR has lower ASR than all other defenses on all attacks, dropping below 0.54% and often to zero.
- Exception: on DeepLabV3+, Segment Cleanse has lower ASR (0.36, 0.89, 0.75) than RePAIR (1.18, 1.01, 1.10) on the three attacks IBA(NNI), IBA(PRL), and OFBA (Table 1).
Segmentation utility
- The clean model (no attack, no defense) has mIoU-B of 78.74% (DeepLabV3+) and 80.46% (SegFormer); the undefended backdoored models have 73.28% and 75.80% (the two rightmost columns of Table 1, both averaged over the eight attacks).
- RePAIR maintains mIoU-B at 74.50% (DeepLabV3+) and 72.30% (SegFormer), and achieves the highest mIoU-A among all defenses (73.83 and 74.52).
- The authors state that ABL greatly reduces mIoU-B (40.97 on DeepLabV3+, 22.50 on SegFormer), and that its mitigation affects benign predictions outside the attacked classes.
Other datasets
- PASCAL VOC 2012 (O2B-type attacks only, person→background, according to Table 6): undefended ASR ranges from 12.21% (DeepLabV3+ / IBA-NNI) to 99.71% (DeepLabV3+ / OFBA); after RePAIR, residual ASR is 5.41%–19.67% (DeepLabV3+) and 0.12%–0.50% (SegFormer). mIoU-B is 58.21 (DeepLabV3+) and 76.17 (SegFormer) (Table 7).
- ADE20K negative result: the undefended models achieve ASR of only 2.38%–4.93% under the five O2B attack configurations (Table 5); the authors consider that the attacks did not establish a sufficiently strong backdoor effect to support meaningful mitigation research, so RePAIR was not applied on ADE20K and it serves only as an attack-effectiveness control.
Other ablations and analyses
- The paper does not report a separate ablation experiment; Appendix Table 4 lists the global state construction and inference parameters for Cityscapes (e.g., 4 safety/calibration folds, minimum 24 safe images, 75% semantic coverage), without a sensitivity analysis of these parameters.
What are some points that can be further explored?
The authors state that the theory is only a local abstraction and sufficient conditions, and that the reference set is not guaranteed clean; the experiments cover two architectures, three datasets, and a 10% poisoning rate.
Limitations and future directions noted by the authors
- Theoretical scope (Appendix A.1.13 Remark 18): the authors state that the analysis does not claim that real backdoors only change two class probabilities, that the internal effect is one-dimensional, or that the attack operator can be precisely observed; the transport model is a local abstraction, and the coupling is feasible rather than optimal.
- Properties of the reference set (Appendix A.1.13, A.2.3): the authors state that they do not claim the safety-approved reference population is truly clean; monotone screening guarantees that rejected references cannot flow back, but does not guarantee a truly clean source.
- On identification guarantees (Appendix A.1.5, A.1.13): for the separation proposition it is a sufficient rather than necessary condition, and it does not constitute a finite-sample guarantee for the full transformer mapping selector; Proposition 8 is only a deterministic release contract and does not guarantee that the released pair equals the truly attacked pair.
- Clean-side guarantee (Section 3, Appendix A.1.12): the reference calibration budget is only an empirical constraint on the safety reference population and does not constitute a population-level guarantee for unseen clean inputs.
- ADE20K (Section 5.2, Appendix A.4): the evaluated attack configurations did not produce a sufficiently strong backdoor effect on ADE20K, so the authors do not use ADE20K as a defense benchmark and use it only as an attack-effectiveness control.
- The paper has no dedicated Limitations or Future Work section and does not list explicit future research directions.
Experimental coverage
- The models tested are DeepLabV3+ (ResNet-50) and SegFormer (MiT-B5), 2 in total (Section 5.1).
- The datasets are Cityscapes, PASCAL VOC 2012, and ADE20K, 3 in total; defense evaluation is conducted on Cityscapes (eight attacks) and PASCAL VOC (five O2B attacks), and for ADE20K only undefended ASR is reported (Section 5.2, Appendix A.4).
- The attack poisoning rate is fixed at 10%, and the victim-target pairs are fixed by attack type (Section 5.1).
- The baseline defenses compared are fine-tuning, pruning, Segment Cleanse, and ABL, 4 in total (Section 5.1).
- The paper does not report the number of experimental repetitions, runtime, or computational overhead, and does not report an adaptive attack evaluation against RePAIR.
Summarize the main content of the paper
RePAIR exploits the semantic divergence between the classification head and internal representations to post-hoc repair the segmentation backdoor without knowing attack details; the authors report a large drop in ASR on Cityscapes with utility largely preserved.
RePAIR is a post-hoc, label-free, attack-unaware defense against targeted backdoors in semantic segmentation models, aimed at poisoned segmentation models in safety-critical perception scenarios such as autonomous driving.
- Problem: the backdoor causes victim-class pixels to be reclassified as the target class when the trigger appears; the authors state that existing defenses are mostly adapted from image classification, that detection-based ones cannot repair, and that retraining-based ones require clean data and modify the model.
- Method highlights: the authors observe that the backdoor shift may be much stronger in the classification head than in the internal semantic representation, and that victim evidence remains recoverable. RePAIR models the attack as a targeted transport from victim to target on the probability simplex, infers victim-target pairs from a possibly poisoned unlabeled image pool, filters out a safe reference set via a victim-safety firewall, locates suspicious pixels, then first performs feature-space transfer and then a conservative output correction restricted to victim/target logits, and uses a No New Target Veto to prevent new target predictions; the model remains frozen.
- Main results (Cityscapes, eight attacks, Table 1): on DeepLabV3+, ASR drops from 60.83%–97.41% undefended to 0.46%–7.86%; on SegFormer, from 26.43%–95.46% to below 0.54%, with six attacks at 0.00. mIoU-B is 74.50% and 72.30%, respectively, versus 73.28% and 75.80% for the undefended models.
- Other datasets: on PASCAL VOC, residual ASR is 5.41%–19.67% (DeepLabV3+) and 0.12%–0.50% (SegFormer) (Table 6); on ADE20K the attacks themselves did not take effect (undefended ASR 2.38%–4.93%, Table 5), and no defense evaluation was performed.
- Exception: on DeepLabV3+, Segment Cleanse has lower ASR than RePAIR on the three attacks IBA(NNI), IBA(PRL), and OFBA (Table 1).
- Authors' conclusions: the authors state that the experiments show effective backdoor repair is achievable without reconstructing the trigger or modifying the model, and that surviving internal semantic evidence can serve as a basis for attack-unaware localization and restricted per-pixel repair; the authors also emphasize that the theoretical results are a local abstraction and sufficient conditions, and that the safety reference set is not guaranteed to be truly clean.