Rethinking Robustness in Graph Neural Networks: A Post-hoc Approach With Conditional Random Fields

Yassine Abbahaddou, Sofiane Ennadir, Johannes F. Lutzeyer, Michalis Vazirgiannis, Fragkiskos D. MalliarosLOG 2026 Poster 2026

TL;DR

Graph Neural Networks (GNNs) are notoriously vulnerable to adversarial attacks—tiny, imperceptible tweaks to a graph's edges or node features that flip a model's predictions. RobustCRF tackles this problem after training is already done: it wraps any pre-trained GNN in a Conditional Random Field (CRF) at inference time to smooth out predictions across neighboring inputs. The result is a model-agnostic defense that boosts robustness against both structural and feature-based attacks without sacrificing clean-graph accuracy.

What Problem Does This Paper Address?

If you want to make a GNN robust against adversarial attacks, the standard playbook requires intervening during training—pruning suspicious edges, altering the message-passing architecture, or retraining with noisy data. That comes with two big headaches:

  1. You can't use it on pre-trained models without retraining them from scratch.
  2. Clean accuracy often drops, because architectural tweaks or heavy regularization can hurt performance on unattacked graphs.

The main existing "post-hoc" (inference-time) alternative is randomized smoothing, which injects noise into inputs and takes a majority vote. However, randomized smoothing tends to over-smooth decision boundaries—a known issue called the shrinkage phenomenon—which also degrades clean accuracy. The authors set out to build a post-hoc defense that works with any GNN, requires zero retraining, and keeps clean accuracy intact.

Methods

RobustCRF is built on a simple intuition: if two graphs are close to each other in the input space, a robust model should give them similar predictions in the output space.

Illustration of RobustCRF mapping the input manifold to the output manifold via a Conditional Random Field

To enforce this at inference time, the authors construct a Conditional Random Field (CRF):

  • Nodes in the CRF represent possible input graphs $[\mathbf{A}, \mathbf{X}]$.
  • Edges connect pairs of graphs that lie within a small perturbation radius $r$ of each other.
  • Observed variables are the original, unedited predictions $Y_a$ from the pre-trained GNN.
  • Latent variables are the refined, robustness-aware predictions $\widetilde{Y}_a$ we want to compute.

The CRF balances two competing goals using potential functions:

  1. Stay faithful to the original GNN prediction ($\sigma \|\widetilde{Y}_a - Y_a\|_2^2$).
  2. Stay smooth with neighboring graphs in the input ball ($(1-\sigma) g_{ab} \|\widetilde{Y}_a - \widetilde{Y}_b\|_2^2$, weighted by a similarity term $g_{ab}$).

Because exact inference over all possible perturbed graphs is intractable, the authors use Mean-Field Approximation and Coordinate Ascent Inference (CAI) to derive a clean iterative update rule. To keep it computationally feasible, they introduce stratified sampling: instead of checking every possible neighbor graph, RobustCRF samples $L$ neighbors—for structural perturbations, by sampling a Hamming distance $d$ and flipping $d$ edges; for feature perturbations, by using an existing feature-sampling strategy.

Interestingly, the authors show that standard randomized smoothing is just a special case of RobustCRF (when $\sigma = 0$, $g_{ab} = 1$, and you only run $1$ iteration).

Datasets

The authors evaluate RobustCRF on node classification across several standard graph benchmarks:

  • Feature-based attacks: Cora, CiteSeer, PubMed, CS, and Texas.
  • Structural attacks: Cora, CoraML, CiteSeer, and PolBlogs.
  • Large-scale evaluation: OGBN-Arxiv (detailed in the paper's appendix).

Key Insights and Ideas

  • Generalizing Randomized Smoothing: By keeping a tether ($\sigma > 0$) to the original GNN prediction, RobustCRF avoids the accuracy-destroying "shrinkage" of standard randomized smoothing.
  • Average vs. Worst-Case Robustness: Rather than optimizing only against a specific worst-case attacker, RobustCRF evaluates and smooths behavior across a local neighborhood, promoting average robustness against unknown attack distributions.
  • Plug-and-Play Compatibility: Because it operates strictly on model outputs at inference time, RobustCRF can be stacked on top of existing training-time defenses (like RGCN, GCORN, and NoisyGCN) to make them even stronger.

Key Results

Across both feature-based attacks (random Gaussian noise with $\psi=0.5$, and white-box PGD with a 15% perturbation rate) and structural attacks (Dice attack with a 10% edge budget), RobustCRF consistently improves or matches baseline defenses while preserving clean accuracy:

Table 1: Clean and attacked classification accuracy (± Std.) of the GCN, the baselines, and the proposed RobustCRF after the feature-based attack.
  • Feature Attacks: On PubMed, RobustCRF achieves 78.20% clean accuracy (vs. 78.16% for vanilla GCN), 74.37% under Random noise (vs. 73.60%), and 75.17% under PGD (vs. 74.86%). On Texas, it jumps from 51.35% (GCN) to 61.08% clean, and from 52.97% to 62.16% under PGD.
  • Structural Attacks (Dice): RobustCRF reaches 82.44% on Cora (vs. 81.87% GCN), 84.71% on CoraML (vs. 83.34% GCN), and 90.46% on PolBlogs (vs. 87.14% GCN).
  • Stacking with Other Defenses: Adding RobustCRF to existing defenses generally boosts performance across the board. For example, NoisyGCN w/ RobustCRF on Cora under Random attack jumps from 78.59% to 81.07%.
Table 2: Clean and Attacked accuracy (± Std.) of the baselines when combined with RobustCRF.

Limitations and Future Work

The primary trade-off is inference-time compute. Because RobustCRF runs $K$ iterations of Coordinate Ascent Inference over $L$ sampled neighbors, the underlying GNN must be queried $L^K$ times. While increasing $K$ and $L$ improves robustness, it also increases latency. In practice, the authors note that convergence is typically reached in just a few iterations, keeping it feasible even for large graphs.

Summary updated

BibTeX
@inproceedings{abbahaddou2026rethinking,
  author = {Yassine ABBAHADDOU and Sofiane ENNADIR and Johannes F. Lutzeyer and Michalis Vazirgiannis and Fragkiskos D. Malliaros},
  title = {{Rethinking Robustness in Graph Neural Networks: A Post-hoc Approach With Conditional Random Fields}},
  booktitle = {LOG 2026 Poster},
  year = {2026},
  url = {https://openreview.net/forum?id=Mw5AaVqrn3},
}
Figure