NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Topological Detection of Trojaned Neural Networks

Songzhu Zheng, Yikai Zhang, Hubert Wagner, Mayank Goswami, Chao Chen

Overview

Researchers have developed a novel way to detect Trojan (backdoor) attacks in deep neural networks by analyzing the "shape" of their internal neuron connections. By leveraging topological data analysis, they discovered that Trojaned models develop unique, high-correlation "short-cuts" between shallow and deep layers. This structural fingerprint allows for robust detection of compromised models, even when defenders have very little clean data available.

The Threat of Trojan Attacks

Deep Neural Networks (DNNs) are incredibly powerful but notoriously opaque, making them vulnerable to Trojan attacks. In this scenario, an attacker poisons the training data so the model learns a "backdoor." The compromised model behaves perfectly on normal data but triggers a specific, malicious behavior (such as misclassification) whenever it encounters a secret pattern, known as a "trigger."

An illustration of the Trojan attack process, from poisoned dataset to compromised model.

Detecting these Trojans is exceptionally difficult. Most current defense methods treat the network as a black box, attempting to reverse-engineer potential triggers by observing how inputs affect outputs. However, the search space for visual triggers is massive. Furthermore, in real-world scenarios, defenders often have very few clean samples and no access to the original poisoned training set. This paper moves away from black-box testing and instead "opens the hood" to inspect the internal structural abnormalities created by the attack.

A Topological Approach to Detection

The authors propose a detection method based on Topological Data Analysis (TDA), specifically utilizing a technique called persistent homology.

  1. Neuron Connectivity Graph: Guided by the neuroscientific principle that "neurons that fire together, wire together," the researchers feed clean samples (and perturbed versions of them) into the network. They build a graph where neurons act as nodes. The "distance" between nodes is determined by the correlation of their activations—highly correlated neurons are considered "closer."
  2. Persistent Homology: TDA is used to study the "shape" of this connectivity. By varying a correlation threshold (a process called filtration), the team tracks the "birth" and "death" of topological features like connected components (0D) and loops/cycles (1D).
  3. Feature Extraction: They extract 12 distinct topological features from these "persistence diagrams," such as the maximum lifespan of a loop or the average death time of connected components.
  4. Trojan Detector: These features are fed into a simple Multi-Layer Perceptron (MLP) classifier trained to distinguish between clean and Trojaned models.
  5. Data-Limited Strategy: To handle cases with very few clean images, they employ a "pixel-wise perturbation" strategy to generate enough samples to reliably estimate neuron correlations.

Datasets and Evaluation

The authors evaluated their method on several benchmarks to ensure its robustness across different domains and architectures:

  • Synthetic Data: A "Trojaned Mix-Gaussian Triplet" used for theoretical proofs.
  • Standard Vision Benchmarks: MNIST (using ResNet18 and LeNet5) and CIFAR10 (using ResNet18 and DenseNet121).
  • NIST TrojAI Competition Dataset: A large-scale, realistic dataset featuring synthetic traffic sign images with various model architectures (ResNet and DenseNet).
Examples of visual triggers across different datasets, including MNIST, CIFAR-10, and traffic signs.

Key Insights: The "Short-cut" Phenomenon

The most striking discovery of the paper is that Trojaned models develop structural "short-cuts." Neurons in shallow layers (which typically detect basic features like the trigger) become highly correlated with neurons in deep layers (which determine the final prediction).

The authors liken these short-cuts to a reflex arc in biology—a direct neural pathway that bypasses complex processing to produce an immediate response. In a Trojaned model, the trigger bypasses the normal hierarchical logic of the network.

These short-cuts manifest as highly persistent 1D cycles (loops) in the connectivity graph. These loops are significantly more "salient" in Trojaned models than in clean ones, providing a clear structural fingerprint for detection. While black-box methods focus on what the network does, this method focuses on how it is built, proving that the act of learning a Trojan leaves a permanent, detectable scar on the network's internal architecture.

Results and Performance

The topological detector consistently outperformed state-of-the-art baselines like Neural Cleanse (NC) and Universal Litmus Patterns (ULP).

  • Standard Benchmarks: On CIFAR10 with ResNet18, the method achieved an Accuracy (ACC) of 0.93 and an AUC of 0.97, compared to just 0.64 ACC and 0.63 AUC for Neural Cleanse.
  • NIST TrojAI Competition: On the challenging ResNet models in the NIST dataset, the topological method achieved 0.77 ACC and 0.87 AUC, significantly outperforming the baselines (which hovered around 0.63 ACC and 0.56-0.62 AUC).
  • Robustness: The method proved effective even against "label-consistent" attacks, which are designed to be stealthier by not modifying the training labels.

Limitations and Future Work

While highly effective, calculating persistent homology for very large networks can be computationally expensive, though the authors note that optimized tools can help mitigate this. Additionally, as with any defense, adaptive attackers might eventually find ways to "hide" these topological short-cuts, perhaps by spreading the Trojan logic more thinly across the network.

Looking forward, the authors suggest that these topological tools could be used not just to detect Trojans, but to excise them—identifying and neutralizing the specific neurons and connections responsible for the backdoor behavior, effectively healing the compromised AI.

Summary updated

BibTeX
@inproceedings{zheng2021topological,
  author = {Songzhu Zheng and Yikai Zhang and Hubert Wagner and Mayank Goswami and Chao Chen},
  title = {{Topological Detection of Trojaned Neural Networks}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2021},
  url = {https://openreview.net/forum?id=1r2EannVuIA},
}
Figure