Source-linked AI summary

Detecting AI Trojans Using Meta Neural Analysis

Xiaojun Xu, Qi Wang, Huichen Li, Nikita Borisov, Carl A. Gunter, Bo Li

arXiv:1910.03137v4cs.AIcs.CRcs.LG

TL;DR

Trojaned neural networks can behave maliciously on trigger inputs despite strong normal-input performance, while existing detectors may assume attack strategies or require model access. MNTD uses meta-classification and jumbo learning to detect Trojaned models, reaching 97% average detection AUC across diverse tasks and 90% AUC against adaptive attackers with whitebox access.

  • Problem

    Trojan attacks can compromise neural networks, but existing detection approaches may assume attack strategies or require direct access to trained models.

  • Method

    MNTD trains a meta-classifier on benign and Trojaned shadow models generated through jumbo learning to classify target neural networks as benign or Trojaned.

  • Results

    97% average detection AUC is achieved across vision, speech, tabular, and NLP tasks using 2% clean training data and 10 queries, while robust MNTD reaches around 90% AUC against adaptive attacks.

  • Takeaways & Limitations

    MNTD generalizes to unforeseen Trojan strategies and outperforms existing detection approaches in most cases.

  • Takeaways & Limitations

    The evaluation mainly targets neural networks, although the technique is stated to apply to differentiable ML models with numerical logit vectors.

Abstract

from arXiv · show

In machine learning Trojan attacks, an adversary trains a corrupted model that obtains good performance on normal data but behaves maliciously on data samples with certain trigger patterns. Several approaches have been proposed to detect such attacks, but they make undesirable assumptions about the attack strategies or require direct access to the trained models, which restricts their utility in practice. This paper addresses these challenges by introducing a Meta Neural Trojan Detection (MNTD) pipeline that does not make assumptions on the attack strategies and only needs black-box access to models. The strategy is to train a meta-classifier that predicts whether a given target model is Trojaned. To train the meta-model without knowledge of the attack strategy, we introduce a technique called jumbo learning that samples a set of Trojaned models following a general distribution. We then dynamically optimize a query set together with the meta-classifier to distinguish between Trojaned and benign models. We evaluate MNTD with experiments on vision, speech, tabular data and natural language text datasets, and against different Trojan attacks such as data poisoning attack, model manipulation attack, and latent attack. We show that MNTD achieves 97% detection AUC score and significantly outperforms existing detection approaches. In addition, MNTD generalizes well and achieves high detection performance against unforeseen attacks. We also propose a robust MNTD pipeline which achieves 90% detection AUC even when the attacker aims to evade the detection with full knowledge of the system.

I. INTRODUCTION

MNTD detects Trojaned neural networks without assuming a particular attack strategy, using black-box model access and a learned meta-classifier. Its evaluation spans diverse tasks and attacks, achieving strong detection performance and robustness to adaptive attackers.

  • Motivation: Trojan attacks create models that perform well on normal inputs but behave maliciously when a trigger pattern appears.This hidden behavior creates risks for security-critical applications and motivates detection before the trigger is activated.
  • Motivation: Existing detectors rely on assumptions about attack strategies or require strong model access, limiting generalization to unforeseen attacks.The paper identifies these constraints as barriers to broad practical use.
  • MNTD framework: MNTD trains a meta-classifier on benign and Trojaned shadow models to classify whether a target neural network is Trojaned.The approach does not assume the attacker’s strategy and uses machine learning to identify Trojans across application domains.
  • MNTD framework: Jumbo learning models a general distribution of Trojan settings, while query tuning jointly optimizes the query set and meta-classifier parameters for black-box detection.The target model’s outputs on selected queries serve as its representation for the meta-classifier.
  • Evaluation: 97% average detection AUC is achieved across vision, speech, tabular, and NLP tasks using a clean training set 2% the Trojaned model’s training size and 10 queries.The trained meta-classifier also generalizes to unforeseen Trojan strategies not included in the jumbo distribution.
  • Evaluation: 90% detection AUC is achieved against adaptive attackers with white-box access to the defense pipeline, at a small cost on normal Trojan detection.The robust variant randomizes part of the system at runtime and fine-tunes the remaining part.

B. Meta Neural Analysis

Meta neural analysis trains a classifier over neural networks to infer a binary property of a target model. In this paper, the property is whether a model contains a Trojan, across multiple attack strategies.

  • Meta Neural Analysis: Meta neural analysis trains a meta-classifier over neural networks rather than over individual data samples.Shadow models with and without the target property provide meta-training examples, whose extracted features train the classifier.
  • Trojan Attacks: Trojan attacks preserve benign-like behavior on normal inputs but induce attacker-controlled malicious behavior on triggered inputs.Triggers can produce single-target or all-to-all malicious behavior and may be inserted through poisoning, model manipulation, or latent attacks.
  • Trojan Attacks: The paper illustrates four attack types using distinct trigger-generation and attack settings, including modification, blending, parameter, and latent attacks.Parameter and latent attacks share a trigger-generation strategy but differ in their attack settings.

A. Threat Model

The threat model considers adversaries distributing Trojaned neural networks with good validation accuracy but malicious triggered behavior. MNTD targets model-level detection using black-box access, few assumptions about attacks, and a small clean dataset.

  • Threat Model: The adversary may distribute models through black-box or white-box access, while preserving good validation accuracy and malicious triggered outputs.The threat model allows arbitrary attack approaches, trigger shapes, locations, sizes, and either single-target or all-to-all behavior.
  • Related Detection Approaches: The paper compares MNTD with model-, dataset-, and input-level Trojan detection approaches in defender and detection capabilities.The comparison includes Neural Cleanse, DeepInspect, Activation Clustering, Spectral Signature, STRIP, and SentiNet.
  • Scope: The scope is limited to software Trojan attacks on neural networks; hardware Trojan attacks are outside the paper’s scope.This is an explicit scope boundary rather than a claim about hardware-attack detectability.
  • Detection Scope: MNTD focuses on model-level detection, which makes a binary decision about whether a given neural network is Trojaned.Input-level detection concerns triggered inputs, while dataset-level detection examines poisoning in training data.
  • Defender Capabilities: The defender requires only black-box target-model access, no training-set access, and a small auxiliary set of clean data.With black-box access, the defender queries the model to obtain output prediction probabilities.
  • MNTD Workflow: MNTD generates benign and Trojaned shadow models, trains a meta-classifier on extracted representations, and detects targets using optimized queries.The workflow includes shadow-model generation, meta-training, and target-model detection; query sets and the meta-classifier are jointly optimized.

A. Shadow Model Generation - Jumbo Learning

Jumbo learning generates diverse Trojaned shadow models by sampling general attack settings, applying them through a Trojan function, and poisoning clean data before training. The distribution does not cover every Trojan type, but can be extended for new formats.

  • Jumbo learning samples general Trojan attack settings to generate diverse Trojaned shadow models for unknown attack strategies.
  • The Trojan function modifies benign input x using a mask m, pattern t, transparency α, and malicious label y_t.The same formulation supports modification, blending, and audio trigger settings.
  • The pipeline samples attack settings, poisons the clean dataset, trains a Trojaned shadow model, and repeats this process to create varied models.Sampling and model-training procedures differ across tasks.
  • Figure 5 illustrates sampled MNIST triggers, including localized patterns and a sample blended with random pixels.
  • The Eqn.3 Trojan distribution does not capture all Trojan types, although jumbo learning can be modified to include new types.

B. Meta-training

Meta-training represents shadow models through their outputs on query inputs and trains a meta-classifier to distinguish benign from Trojaned models. Query-tuning jointly optimizes the queries and classifier while preserving black-box target-model inference.

  • Shadow-model outputs on a query set are concatenated into representation vectors used by a two-layer meta-classifier to predict whether models are Trojaned.The meta-classifier outputs a real-valued Trojan likelihood score.
  • Meta-training jointly optimizes the query set and meta-classifier to provide information that better distinguishes benign and Trojaned models.Random queries may be uninformative because Trojaned and benign models behave similarly on most inputs.
  • The optimization is differentiable because queries pass through shadow models, representation construction, and the meta-classifier before loss calculation.Gradients can therefore update the query inputs and classifier parameters.
  • During inference, detection requires only querying the black-box target model with tuned inputs; internal parameters are needed only for training shadow models.
  • A one-class neural-network baseline trains using only benign shadow models and does not require jumbo learning.Its query-tuned objective includes regularization on the meta-classifier parameters.

C. Target Model Detection

Target detection applies the optimized queries to a target model, concatenates its output vectors, and feeds the resulting representation to the trained meta-classifier. The evaluation spans multiple data modalities under a small-clean-data setting.

  • The detector queries a target model with the optimized set, concatenates the output vectors into R_tgt, and classifies it using META(R_tgt; θ*).
  • The experiment setting includes public code for the Meta-Neural-Trojan-Detection implementation.
  • The evaluation covers vision, speech, tabular, and natural-language tasks using datasets including MNIST, CIFAR10, SpeechCommand, and Smart Meter data.
  • The defender uses a small clean dataset that is different from the attacker’s model-training set, with 2% of the training data allocated to defense.

B. Attack Settings

The evaluation models modification and blending attacks across multiple modalities, with task-specific trigger shapes, patterns, transparency, labels, and poisoning ratios. Jumbo MNTD uses shadow models trained from a smaller defender dataset and fixes the query count at 10.

  • Attack coverage: The modeled attacks are modification and blending attacks, while parameter, latent, and all-to-all attacks are reserved as unforeseen strategies.
  • Trigger construction: Trigger masks vary by task, spanning image patches, audio or temporal segments, and random phrases for text.
  • Trigger construction: Trigger patterns are sampled uniformly from task-specific value spaces, while blending transparency α is sampled from [0.8, 0.95] and modification uses α = 0.
  • Attack construction: Malicious labels are uniformly selected from each task’s output classes, and poisoning ratios are uniformly sampled from [0.05, 0.5].
  • Defense settings: Jumbo MNTD trains its meta-classifier with 2048 Trojaned and 2048 benign shadow models, plus 256 of each for validation.
  • Scope: The pipeline does not apply directly to the discrete MR task, which requires an adaptation described in Appendix D.
  • Baselines: The evaluation compares MNTD with Activation Clustering, Neural Cleanse, Spectral Signature, and STRIP, while excluding DeepInspect and SentiNet for stated availability or scope reasons.

VI. EXPERIMENTAL EVALUATION

The experiments evaluate MNTD across datasets, attacks, baselines, computational settings, and unseen trigger patterns. Jumbo MNTD achieves consistently strong model-level Trojan detection while allowing trade-offs between offline cost and performance.

  • Experimental Setup: The experiments compare benign and Trojaned models using normal-input accuracy and Trojan-input attack success rate, with AUC used for Irish’s unbalanced binary task.Attack success remains high while Trojaned target models retain accuracy similar to benign targets.
  • Detection Performance: 97% average detection AUC is achieved across diverse machine-learning tasks and attack strategies using jumbo MNTD.The approach exceeds 90% AUC in all but one experiment.
  • Detection Performance: Jumbo MNTD outperforms all baseline approaches except Spectral on the NLP task, where it achieves 89.23% versus 95.70%.Unlike Spectral, MNTD does not require access to the training dataset and queries only the embedding layer.
  • Shadow-Model Scaling: 128 benign and 128 Trojaned shadow models already produce good detection results, while additional shadow models continue improving accuracy.Defenders can trade computational resources against detection performance.
  • Running Time: Offline training requires about 14 hours for 4096 shadow models and meta-classifier training, whereas inference takes only several milliseconds per target model.The offline stage is performed once per task.

A. Generalization on Trigger Patterns

MNTD is tested against trigger patterns, malicious goals, attack mechanisms, and model architectures not represented during training. The results support generalization across these unforeseen settings, with a stated boundary for the model-structure experiment.

  • A. Generalization on Trigger Patterns: Similar detection results on unseen trigger patterns show that the trained meta-classifier generalizes beyond patterns included in jumbo learning.The unseen patterns alter many pixels, unlike jumbo-learning patterns that change at most 5×5 pixels.
  • B. Generalization on Malicious Goals: Over 98% detection AUC is achieved for all three evaluated tasks against unforeseen all-to-all malicious goals.The attack changes each triggered label to the next class modulo the number of classes.
  • C. Generalization on Attack Approaches: MNTD detects parameter and latent attacks well, including latent attacks introduced after the pipeline was proposed.Input-level and dataset-level baselines cannot be applied because these attacks do not poison the training dataset.
  • D. Generalization on Model Structures: The model-structure evaluation uses six architectures, including ResNet, DenseNet, MobileNet v2, and GoogLeNet, with 64 models per structure for efficiency.Training more shadow models could further improve the reported results.
  • D. Generalization on Model Structures: All AUCs exceed 80% when targets use unforeseen model structures on ImageNet dog-versus-cat classification.The meta-classifier for each target structure is trained using models from the other structures.

E. Generalization on Data Distribution

The paper examines whether MNTD remains effective with alternative data and under attackers who know the detection system. Alternative datasets retain useful detection performance, while MNTD-robust counters adaptive evasion through randomized system components.

  • E. Generalization on Data Distribution: 98.82% AUC on MNIST-M and 99.57% on MNIST-B are achieved using USPS, while TinyImageNet yields 83.41% and 93.78% on CIFAR10-M and CIFAR10-B.Performance is slightly worse than with matching data distributions but remains good.
  • E. Generalization on Data Distribution: Alternative datasets can train shadow models for detecting target models despite differing from the original MNIST and CIFAR-10 data distributions.The alternative-data shadow models achieve 81.63% accuracy on MNIST and 33.97% on CIFAR-10.
  • A. Strong Adaptive Attack: An adaptive attacker with full knowledge can incorporate MNTD’s meta-classifier output into training and evade detection with negligible accuracy decrease.The attacker optimizes a combined objective balancing model performance and evasion success.
  • A. Strong Adaptive Attack: MNTD-robust randomizes part of the meta-classifier at test time, tunes queries separately, and analyzes targets with the randomized classifier and tuned inputs.The attacker therefore cannot calculate the exact detection loss for the deployed random parameters.
  • A. Strong Adaptive Attack: Around 90% detection AUC is retained against adaptive attacks, at a small cost on normal Trojan attacks.Re-sampling random parameters increases detection cost because the meta-classifier must be retrained, while shadow-model generation is performed once.

C. Evaluation Results

The paper positions model-level Trojan detection as broadly applicable and evaluates a robust MNTD variant against normal and adaptive attacks. MNTD is presented as generalizing across attack strategies while robust MNTD preserves performance without adaptation and improves resilience to adaptive evasion.

  • Robustness: Robust MNTD’s normal-scenario detection performance does not downgrade much relative to MNTD (Jumbo).The comparison uses the first row of Table IX against the MNTD (Jumbo) results in Table III.
  • Robustness: Robust MNTD works much better against adaptive attacks, while simple MNTD is bypassed by all evaluated strong adaptive attacks.In some cases, attacker evasion makes the Trojaned model easier to detect under the robust system.
  • Detection scope: Model-level detection avoids dataset access constraints and repeated input-level checks, allowing a model to be screened once before deployment.Dataset-level methods cannot detect direct model manipulation, whereas input-level detection must run for every input.
  • Scope boundary: The paper focuses on neural networks and states that the technique can extend to differentiable ML models with numerical logit vectors.Other machine-learning models are outside the paper’s main discussion because current research does not show that they suffer from backdoor attacks.
  • MNTD evaluation: MNTD generates shadow models without knowing the attacker’s approach and outperforms existing detection methods in most cases while generalizing to unforeseen strategies.The framework uses meta neural analysis and jumbo learning to construct Trojaned shadow models.

APPENDIX

The appendix details limitations of prior detection approaches, the one-class SVM idea, datasets and model structures, and query tuning for discrete text inputs. These implementation choices clarify how the evaluation adapts detection methods across data modalities.

  • Prior approaches: Existing detection methods rely on differing assumptions and capabilities, including training-set access and assumptions that Trojan effects create detectable anomalies.Dataset-level methods cannot detect model manipulation attacks, while anomaly-based methods can fail on all-to-all attacks.
  • Prior approaches: Neural Cleanse and DeepInspect operate at the model level, but Neural Cleanse requires at least three classes and performs poorly for large-size triggers.Neural Cleanse searches for unusually small shortcut modifications, while DeepInspect uses model inversion to obtain training data.
  • Prior approaches: Activation Clustering and Spectral Signature perform dataset-level detection and therefore require access to training data.Activation Clustering separates benign and Trojaned training examples using feature vectors; Spectral Signature scores training samples for removal.
  • Prior approaches: STRIP and SentiNet perform input-level detection using clean-data mixing or salient image regions, respectively.STRIP examines confidence on mixed inputs, whereas SentiNet transfers salient regions to other images to test output changes.
  • One-class learning: The one-class SVM illustration shows a boundary learned from one class that distinguishes in-class test data from data outside that class.The model is trained only on one class and attempts to capture its training data tightly.
  • Datasets and models: The evaluation covers vision, speech, and tabular datasets, including MNIST, CIFAR10, SpeechCommand, and Irish smart-meter records.The vision datasets use CNNs; SpeechCommand uses mel-spectrograms with an LSTM; the Irish dataset contains electricity-consumption records.
  • Query tuning: For discrete-token natural-language inputs, query tuning is performed in continuous embedding space and tuned embedding vectors are fed directly to the target model.This adapts gradient-based query tuning to the MR task while introducing a stated trade-off.

E. Detection Baselines Implementation Details

The implementation compares MNTD with adapted baselines, visualizes tuned queries, and tests generalization to trigger patterns excluded from jumbo training. Query tuning is highly effective, and the meta-classifier generalizes well to unforeseen trigger patterns.

  • Baseline implementation: The baselines are re-implemented with PyTorch because only Neural Cleanse’s source code was released and prior evaluations mostly used CNN vision models.Activation Clustering was the exception, with evaluations also covering CNN models on an NLP dataset.
  • Baseline implementation: Dataset-level and input-level baselines are adapted to produce model-level Trojan scores for comparison with MNTD.Activation Clustering uses an ExRe score, Spectral Signature uses the average training-sample score, and STRIP is similarly tailored.
  • Query tuning: Query tuning can improve Jumbo MNTD detection AUC by up to 30% relative to untuned queries in the worst case.The method jointly optimizes the query set and meta-classifier to obtain more distinguishable shadow-model features.
  • Query tuning: Tuned jumbo-learning queries focus more on local patterns, whereas one-class-learning queries contain more global and digit-like patterns.The paper speculates that this reflects the local patterns used by many jumbo Trojan models and the one-class objective of fitting benign models.
  • Trigger generalization: The evaluation tests non-consecutive trigger patterns that never appear in the jumbo distribution, including corner pixels, separated speech intervals, weekday usage changes, and sentence-boundary words.These patterns are evaluated across vision, speech, tabular, and natural-language tasks.
  • Trigger generalization: The meta-classifier achieves similar performance on unforeseen trigger patterns and on triggers seen during training, demonstrating generalization beyond the jumbo training distribution.The result is reported in Table XI as detection AUC for jumbo MNTD on Trojaned models with unforeseen trigger patterns.
Loading 1910.03137v4…