Defending Graph Neural Networks against Adversarial Attacks

GNNGuard is a model-agnostic approach that can defend any Graph Neural Network against a variety of adversarial attacks.

Deep learning methods for graphs achieve remarkable performance on many tasks. However, despite the proliferation of such methods and their success, recent findings indicate that even the strongest and most popular Graph Neural Networks (GNNs) are highly vulnerable to adversarial attacks. Adversarial attacks mean that an attacker injects small but carefully-designed perturbations to the graph structures in order to degrade the performance of GNN classifiers.

The vulnerability is a significant issue preventing GNNs from being used in real-world applications. For example, under adversarial attack, small and unnoticeable perturbations of graph structure (e.g., adding two edges on the poisoned node) can catastrophically reduce performance (panel A in the figure).

We develop GNNGuard, a general algorithm to defend against a variety of training-time attacks that perturb the discrete graph structure. GNNGuard can be straightforwardly incorporated into any GNN. By integrating GNNGuard, the GNN classifier can make correct predictions even when trained on the attacked graph (panel B in the figure).

GNNGuard algorithm

Most damaging attacks add fake edges between nodes that have different features and labels. Because of that, the key idea of GNNGuard is to detect and quantify the relationship between the graph structure and node features, if one exists, and then exploit that relationship to mitigate negative effects of the attack. GNNGuard learns how to best assign higher weights to edges connecting similar nodes while pruning edges between unrelated nodes. In specific, instead of the neural message passing of a typical GNN (panel A in the figure), GNNGuard (panel B in the figure) controls the message stream, such as blocking the message from irrelevant neighbors while strengthening messages from highly-related ones.

Remarkably, GNNGuard can effectively restore state-of-the-art performance of GNNs in the face of various adversarial attacks, including targeted and non-targeted attacks, and can defend against attacks on both homophily and heterophily graphs.

Attractive properties of GNNGuard

  • Defense against a variety of attacks: GNNGuard is a general defense approach that is effective against a variety of training-time attacks, including directly targeted, influence, and non-targeted attacks.
  • Integrates with any GNNs: GNNGuard can defend any modern GNN architecture against adversarial attacks.
  • State-of-the-art performance on clean graphs: In real-world settings, we do not know whether a graph has been attacked or not. GNNGuard can restore state-of-the-art performance of a GNN when the graph is attached as well as sustain the original performance on non-attacked graphs.
  • Homophily and heterophily graphs: GNNGuard is the first technique that can defend GNNs against attacks on homophily and heterophily graphs. GNNGuard can be easily generalized to graphs with abundant structural equivalences, where connected nodes have different node features yet similar structural roles.

Publication

GNNGuard: Defending Graph Neural Networks against Adversarial Attacks
Xiang Zhang and Marinka Zitnik
NeurIPS 2020 [arXiv] [poster]

@inproceedings{zhang2020gnnguard,
title     = {GNNGuard: Defending Graph Neural Networks against Adversarial Attacks},
author    = {Zhang, Xiang and Zitnik, Marinka},
booktitle = {Proceedings of Neural Information Processing Systems, NeurIPS},
year      = {2020}
}

Code and datasets

Pytorch implementation of GNNGuard and all datasets are available in the GitHub repository.

Authors

Latest News

Jul 2026:   An AI agent for therapeutic reasoning across biological contexts

Medea is an AI agent that nominates therapeutic targets across cell type contexts, predicts synthetic lethality in cancer cell lines, and forecasts immunotherapy response from multimodal patient profiles. To test whether Medea can identify the genetic vulnerabilities that DNA-damaging treatments exploit, we use it to scan 238,046 gene combinations for synthetic lethality. [Project website]

Jul 2026:   Immune Checkpoint Inhibitors in Nature Medicine

COMPASS is a pan-cancer foundation model that predicts immunotherapy response from tumor microenvironments and highlights the biology driving that response. [Nature Medicine paper] [Harvard Medicine News]

Jul 2026:   ATHENA Agent for Treatment Reasoning

Treatment reasoning underpins every therapeutic decision in medicine. ATHENA an AI agent for treatment reasoning across all FDA approved drugs since 1939, trained by reinforcement learning over a universe of 212 biomedical tools. [Project website]

Jun 2026:   MedLog

MedLog is an open protocol for event-level logging of medical AI, validated across four real-world pilots in the US, Switzerland, and Vietnam to enable auditing, monitoring, and governance of AI systems. [Paper] [Project website]

Jun 2026:   Biological Reasoning Models

Biological reasoning models combine large language models with models of biological data, including DNA, RNA, and proteins. New preprint on training and evaluating 100+ biological reasoning models.

Apr 2026:   OptimusKG: A Modern Knowledge Graph

OptimusKG brings biomedical knowledge into a modern multimodal knowledge graph. It supports graph AI, knowledge-grounded retrieval with large language models, and discovery workflows that generate and evaluate biomedical hypotheses.

Apr 2026:   ARK Accepted at ACL 2026

Mar 2026:   Open 'AI Scientists' Initiative

Excited to launch Open AI Scientists, our initiative to empower scientific discovery with AI scientists. [https://www.openscientist.ai]

Mar 2026:   Generalist Biological AI in Nature Biotechnology

Mar 2026:   Claw Institute

Claw Institute is a research exchange for AI scientists. It gives agents a shared space to publish ideas, challenge claims, use scientific tools, and build on one another’s work. These early interactions point to a new mode of discovery in which societies of AI scientists participate in discovery loops alongside human researchers.

Feb 2026:   Overton Prize

Our research has been recognized with the 2026 Overton Prize.

Feb 2026:   Foundation Models that Can 'Act or Defer'

Feb 2026:   Reasoning Model for Longitudinal Data

Feb 2026:   Context Switching AI in Nature Medicine

Zitnik Lab  ·  Artificial Intelligence in Medicine and Science  ·  Harvard  ·  Department of Biomedical Informatics