arXiv:2610.10423cs.CVOct 2026

Manuscript Offprint

arXiv:2610.10423

GraphRectify: Graph-Based Transfer of Adversarial Example Detectors Across Neural Networks

Arash Vashagh, Roozbeh Razavi-Far

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Arash Vashagh and Roozbeh Razavi-Far

Trustworthy and Secure AI (TSAI) Lab, Faculty of Computer Science, University of New Brunswick, Canada

Email: arash.vashagh@unb.ca, roozbeh.razavi-far@unb.ca

Abstract—Adversarial example detectors are often tied to the classifier backbone they were trained on, limiting reuse when the protected model is replaced or upgraded. Directly transferring such detectors across backbones is challenging because different networks generally produce incompatible internal representations. We propose GraphRectify, a graph-based framework for transferring adversarial image detectors across classifier backbones. GraphRectify learns a structured representation of intermediate classifier features and adapts representations from a new backbone to the detector learned on the original model, enabling detector reuse. We evaluate GraphRectify across multiple datasets, backbone architectures, and adversarial attacks, including detector-aware adaptive attacks that jointly target the classifier and detector. Across the complete evaluation matrix, GraphRectify achieves higher aggregate ROC-AUC than training a detector from scratch on the new backbone and the evaluated transfer ablations. The gains are particularly strong for transfers between different backbone families and when sufficient data are available. In contrast, training from scratch remains competitive in the most data-limited settings. These results show that adversarial detection knowledge can transfer effectively across heterogeneous classifier architectures rather than being relearned whenever the protected backbone changes.

Index Terms—Adversarial example detection, Transfer learning, Graph neural networks, Adversarial robustness, Detector adaptation

I. INTRODUCTION

Adversarial example detectors provide an additional test-time mechanism for identifying inputs that have been deliberately perturbed to mislead a neural classifier. Existing approaches use signals such as prediction confidence, input transformations, intermediate feature statistics, and consistency across internal representations [1]–[4]. Detectors that rely on intermediate representations can exploit information that is unavailable from the final classifier output alone, but this dependence also creates a practical limitation. When the protected classifier is replaced or upgraded, its internal feature space changes, so a detector trained for the previous model may no longer operate on compatible representations. Retraining the detector from scratch discards previously learned detection structure and may require additional labeled data and computation, while directly reusing the existing detector is unreliable because independently trained or architecturally different networks do not generally produce aligned internal representations.

We refer to the original protected classifier as the source classifier and its feature-extracting architecture as the source backbone. The new or replacement classifier is the target classifier, and its architecture is the target backbone. The problem we consider in this work is whether the adversarial detection structure learned for the source backbone can be reused after the protected classifier changes to the target backbone.

We address this problem with GraphRectify, a graph-based framework for transferring an adversarial example detector across classifier backbones. GraphRectify converts selected intermediate features into compact fixed-dimensional nodes and learns relationships among these nodes using a dynamic graph module. A detector trained using representations from the source backbone is referred to as the source detector. During source training, the source detector learns a graph-level representation that distinguishes clean and adversarial inputs. After source training, its graph module and readout are frozen and reused when adapting detection to the target backbone.

The main difficulty is that simply projecting target-backbone features into vectors of the same dimension does not ensure that they match the representation structure expected by the source detector. GraphRectify therefore performs target adaptation, meaning that only the target-specific interface to the transferred detector is learned for the new backbone. At each selected stage, a projected representation from the target backbone forms a target node. It is paired with a detached source reference node, obtained from the same input through the frozen source branch, which consists of the source backbone and the source-side projection modules. A lightweight source-guided rectifier predicts a bounded residual correction to the target node. The transferred graph module and readout then process the corrected target nodes. In this way, GraphRectify adapts the target representations to the detection structure learned from the source backbone without training the target classifier to reproduce predictions from the source classifier.

This setting differs from conventional knowledge distillation, which typically transfers predictive behavior from a teacher model to a student [5], [6]. It also differs from prior work on detector generalization across attacks, datasets, or models [7]–[9], as well as meta-learning methods that adapt detectors to previously unseen attacks [10]. Our focus is specifically on reusing a detector whose inputs depend on the internal representations of one classifier after those representations change because the protected backbone has been replaced. GraphRectify separates backbone-specific node construction from the reusable graph-level detection structure and adapts the interface between them.

We evaluate GraphRectify on CIFAR-10, STL-10, and SVHN across three architecture transfers: ResNet18→ResNet34, ResNet34→ResNet18, and ResNet18→MobileNetV2. We use target data to denote the labeled data available in the target-backbone setting for adapting GraphRectify or training a detector directly on the target backbone. The evaluation considers five target-data fractions, four detector-aware attacks, and three random seeds. We compare GraphRectify with direct transfer, in which the existing detector is reused without target adaptation, and with target-only detectors, which are trained from scratch on the target backbone using the same target-data fraction and without transferring components from the source detector. GraphRectify improves overall detection performance relative to both baselines. Its benefit becomes clearer as more target data are available, although target-only training can remain competitive in extremely data-limited settings. GraphRectify also improves performance across all three architecture-transfer settings, including the cross-family ResNet18→MobileNetV2 transfer.

The main contributions of this work are as follows:

  1. We formulate adversarial detector transfer across classifier backbones as a representation-adaptation problem in which detection structure learned for a source backbone is reused after the protected classifier changes to a target backbone.

  2. We propose GraphRectify, which separates backbone-specific node construction from a reusable graph-level detector and introduces source-guided bounded rectification to make target representations compatible with the transferred detection structure.

  3. We evaluate GraphRectify across three datasets, three architecture transfers, five target-data fractions, four detector-aware attacks, and three random seeds, including target-only baselines, controlled ablations, and cross-family transfer to MobileNetV2.

The remainder of this paper is organized as follows. Section II reviews adversarial example detection, detector generalization, transfer learning, and graph-based representation modeling. Section III presents GraphRectify and its source-training and target-adaptation procedures. Section IV describes the datasets, training configuration, attacks, and evaluation metrics. Section V presents the experimental results and ablation studies. Finally, Section VI discusses the findings, limitations, and future directions, and Section VII concludes the paper.

References (31)