Adversarial Corpus Selection to Attack Subgraph Matching based Graph Retrieval

Ninad Jayesh Gandhi, Mayukh Mondal, Brian S. Mackwan, Soumen Chakrabarti, Abir DeNeurIPS 2026

TL;DR

Neural networks are increasingly replacing brutally slow mathematical solvers to search massive databases of graphs—helping us find life-saving drug molecules or spot malicious hardware trojans. This paper introduces GRAP, the first adversarial attack framework designed to sabotage these graph retrieval systems. By adding or deleting just a single edge in a carefully chosen handful of database graphs, GRAP scrambles a neural retriever's rankings with surgical precision and mathematical guarantees.

What Problem Does This Paper Address?

Imagine searching a massive chemical database for every molecule that contains a specific atomic ring (a query graph). Checking if one graph sits inside another—subgraph isomorphism—is famously NP-hard. To avoid grinding supercomputers to a halt, modern Neural Subgraph Retrievers (NSRs) use Graph Neural Networks to map graphs into an embedding space. They learn a "relevance distance," pulling valid supergraphs close to the query and pushing irrelevant ones away, then simply return the top-$K$ closest matches.

Given that NSRs are used in safety-critical domains like drug discovery and hardware security, how fragile are they? Attacking them presents two unique headaches compared to fooling an image classifier:

  1. Budget & Stealth: Modifying every graph in a million-item database is noisy and expensive. An attacker must intelligently select a tiny subset of corpus graphs (a budget $B$) to perturb for maximum collateral damage.
  2. Brittle Ground Truth: Add a few pixels of noise to a photo of a dog, and it’s still a dog. Delete one edge from a molecule, however, and it might genuinely stop containing the query subgraph—flipping its ground-truth label! Checking whether a tweak accidentally changed the true label requires running an expensive exact subgraph solver, which even the attacker might want to avoid.

Methods

The authors propose GRAP (Graph Retrieval Adversarial Perturbation), which operates via query-only access to a substitute model (matching the victim's weights in gray-box settings, or trained independently in black-box/transfer settings). To stay stealthy, GRAP restricts itself to the minimal possible edit: flipping (adding or deleting) at most one edge per selected corpus graph.

Figure 1: GRAP block diagram: Panel (a) describes the threat model, Panel (b) describes the overall set function optimization pipeline of GRAP variants and Panel (c) illustrates the retrieval performance degradation.

GRAP formalizes two distinct attack regimes depending on the attacker's computational budget:

  • Pairwise Ranking Attacks (With Solver): Aimed at corrupting the global ranking order while strictly preserving true relevance labels. GRAP-LCP optimizes edge flips only among node pairs that keep the ground-truth label intact. GRAP-LPF finds the most destructive edge flip first, then uses the solver to filter out any graph whose true label accidentally mutated.
  • Top-$K$ Attack (Solver-Free): When running an exact solver is too costly, GRAP-TOPK ignores labels and directly pushes the victim's top-$K$ retrieved graphs away from the query so irrelevant graphs bubble up to take their place.

In both regimes, the authors turn a tangled joint-optimization problem (which graphs to pick + which edges to flip) into clean set-function optimizations maximized via a fast greedy algorithm with provable $(1 - e^{-\alpha})$ approximation guarantees.

Datasets

The authors evaluate GRAP on five standard molecular and chemical benchmark datasets from the TU Datasets repository: PTC-MM, PTC-MR, PTC-FM, PTC-FR, and AIDS (detailed in the appendix). No new datasets are introduced; query sets are split 60%/15%/25% for training, validation, and testing.

Key Insights and Ideas

  • Miraculous Decoupling: You might expect the best edge to flip in Graph A to depend on whether Graph B is also being perturbed. The authors prove that the optimal single-edge perturbation for any individual graph is completely independent of the rest of the selected subset! This allows the attacker to precompute the best edge flip per graph once, vastly simplifying subset selection.
  • Taming Non-Submodularity with a Variational Trick: Greedy algorithms rely on diminishing returns (submodularity) to guarantee good performance. While the ranking attacks are naturally approximately submodular, the solver-free GRAP-TOPK objective is not—perturbing a graph outside the top-$K$ yields zero immediate gain until enough top graphs are pushed down. By rewriting the sum of the smallest $K$ distances as a clever variational maximization and constructing a lower-bounding surrogate function, the authors restore strict monotonicity and approximate submodularity—and prove this surrogate matches the exact objective at full budget!
  • The LPF vs. LCP Crossover: Unconstrained per-graph optimization (LPF) packs a bigger punch per graph at tiny budgets, but hits a ceiling once it exhausts the pool of graphs whose labels survive unconstrained attacks. Constrained optimization (LCP) steadily overtakes it at larger budgets.

Key Results

Tested against state-of-the-art retrievers like IsoNet++ and Graph Matching Networks (GMN), GRAP consistently crushes adapted graph-attack baselines (like Nettack, RL-S2V, and GMA), measured by drops in Mean Average Precision (MAP):

Figure 3: Gray box attack: Comparison of performance measured in terms of degradation of MAP during gray box attack. Top (bottom) row shows results when the adversary (does not) have access to the solver. IsoNet++ (Edge) is the victim model in this figure. We observe that the variants of GRAP outperform the baselines. In attack on top-K retrieval, we set K = 10. Results are aggregated over 10 random seeds, and the mean and standard deviation are reported. We also perform paired t-test between GRAP (Ranking, LCP) and GRAP (top-K), and the best performing baseline Nettack and observe that GRAP outperforms Nettack with a statistically significant margin (p-value < 10−6).
  • Gray-Box Devastation: With solver access, perturbing just 10% of the corpus with a single edge flip per graph causes IsoNet++ MAP to plummet from ~0.75 to ~0.50 (statistically beating the best baseline, Nettack, with $p < 10^{-6}$).
  • Black-Box & Solver-Free Potency: Even without a solver or victim weights, GRAP-TOPK inflicts a ~20% MAP drop on the PTC-FR dataset while touching only 10% of the corpus, while causing the smallest shift in true relevance ratios (lowest detectability).
  • Architecture Transferability: Attacks crafted on substitute models with completely different architectures (e.g., GMN-match) still transfer effectively to degrade IsoNet++.

Limitations and Future Work

  • Computational Cost of Exact Labels: While solver-free attacks work well, they are noticeably less potent than solver-assisted attacks, highlighting a clear trade-off between an adversary's compute budget and attack strength.
  • Scaling & Defenses: Currently, the attacker evaluates perturbations across the corpus directly. The authors point toward integrating approximate nearest neighbor (ANN) indexing to make attacks faster and more scalable on massive databases, alongside the urgent open problem of designing adversarial defenses for neural graph retrievers.

Summary updated

Abstract

Neural subgraph retrieval systems, which retrieve corpus graphs containing a query graph as a subgraph, are used in safety-critical applications such as drug discovery, hardware trojan detection, and molecular similarity search. Despite their importance, the adversarial robustness of these systems remains unstudied. We propose GRAP, the first adversarial attack framework targeting subgraph matching-based graph retrieval. GRAP jointly selects a budget-constrained subset of corpus graphs and computes per-graph edge perturbations to maximally degrade retrieval quality. We formalize two attack regimes: a ranking attack (with solver access) that corrupts pairwise relevance ordering while preserving relevance labels, and a solver-free top-K attack that directly displaces relevant results from retrieved sets. In both cases, we show that the resulting adversarial set functions are monotone and approximately submodular, enabling greedy subset selection with provable approximation guarantees. Experiments on five benchmark datasets against multiple state-of-the-art victim retrievers demonstrate that our method consistently and significantly outperforms all baselines in both gray-box and black-box settings, with and without solver access.
BibTeX
@inproceedings{gandhi2026adversarial,
  author = {Ninad Jayesh Gandhi and Mayukh Mondal and Brian S. Mackwan and Soumen Chakrabarti and Abir De},
  title = {{Adversarial Corpus Selection to Attack Subgraph Matching based Graph Retrieval}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=zIypQATU6I},
}
Figure