DHAKR: Learning Deep Hierarchical Attention-Based Kernelized Representations for Graph Classification

Feifei Qian, Lu Bai, Lixin Cui, Ming Li, Ziyu Lyu, Hangyuan Du, Edwin R. Hancock

TL;DR

DHAKR (Deep Hierarchical Attention-based Kernelized Representation) bridges the gap between classical graph kernels and modern deep learning. By hierarchically grouping simple substructures into "composite invariants" and using attention to filter out noise, it captures both local details and global topology in an end-to-end trainable framework.

What Problem Does This Paper Address?

Graph classification—identifying whether a chemical molecule is toxic or a social network is a specific community—often relies on R-convolution kernels. These methods work by breaking graphs down into small pieces (substructures like paths or trees) and counting how many pieces they have in common.

However, traditional kernels suffer from three major "blind spots":

  1. Missing the Big Picture: They count local parts but often fail to see how those parts fit together globally. Two very different graphs might share the same small parts, leading a kernel to mistakenly call them "similar."
  2. Equal Weighting: They treat every substructure as equally important, even if some are redundant or irrelevant noise.
  3. Decoupled Pipelines: The process of calculating graph similarity is usually separate from the actual classification (e.g., using a Support Vector Machine), meaning the features aren't optimized for the specific task.
Figure 1: Comparison between standard WL kernels and DHAKR. While standard kernels might see two different graphs as identical due to shared local substructures, DHAKR's composite approach distinguishes them.

Methods

The authors introduce DHAKR, a model that makes the kernel approach "deep" and "attentive." The workflow consists of five main stages:

Figure 3: The DHAKR architecture, showing the transition from raw graphs to hierarchical kernel matrices and final classification.
  1. Initial Invariants: It starts by extracting standard substructures using established methods like the Weisfeiler-Lehman (WL) subtree or Shortest Path (SP) kernels.
  2. Hierarchical Combination: The model learns an assignment matrix to group related substructures into higher-level "composite invariants." This allows the model to see how local patterns form larger, global structures.
  3. Feature-Channel Attention: Inspired by computer vision, the model uses an attention mechanism to assign weights to different substructures. This helps the model focus on "significant" structural patterns while ignoring noise.
  4. Hierarchical Kernel Matrices: It computes kernel matrices at multiple levels of the hierarchy. A second "Kernel Attention" layer then decides which levels (local vs. global) are most important for the final decision.
  5. End-to-End Learning: Unlike traditional kernels, the entire process—from substructure grouping to final classification—is differentiable and trained together.

Key Insights and Ideas

  • The "Composite" Advantage: By grouping substructures, DHAKR can distinguish between graphs that have the same "parts" but different "wholes." If Graph A and Graph B both have a specific triangle, but only in Graph A is that triangle part of a larger hexagonal ring, DHAKR’s hierarchical layers will catch that difference.
  • Kernels as Embeddings: The model treats the kernel similarity values themselves as a multi-scale embedding. Essentially, a graph is represented by how similar it is to every other graph in the training set at various levels of abstraction.
  • Overcoming GNN Limitations: While Graph Neural Networks (GNNs) are popular, they often lose topological information during "pooling" (the step where node data is squashed into a single graph vector). DHAKR maintains structural integrity by relying on explicit kernel-based counts.

Key Results

DHAKR was compared against six state-of-the-art graph kernels and eight deep learning models (including GIN and DGCNN) across bioinformatics, social network, and computer vision datasets.

  • Superior Accuracy: DHAKR variants achieved the highest accuracy on almost all datasets. For example, on the PTC(MR) dataset, DHAKR(WL) reached 68.76% accuracy, significantly outperforming the standard WL kernel (58.26%) and the GIN deep learning model (64.29%).
  • Average Rank: Across all tests, DHAKR(WL) and DHAKR(SP) held the best "Average Rank" (1.4 and 2.4 respectively) compared to other deep learning methods, proving it is a robust "all-rounder."
  • Ablation Success: Removing the attention components or the hierarchical grouping led to a sharp drop in performance, confirming that these specific innovations are what drive the model's success.

Limitations and Future Work

The authors identify a few areas for growth:

  • Substructure Variety: Currently, the model relies on WL subtrees and shortest paths. Future versions could incorporate more complex structures like random walks or cycles.
  • Structural Alignment: Integrating "structural alignment" (directly matching specific nodes across graphs) could further improve precision.
  • Hypergraphs: Extending this hierarchical kernel approach to hypergraphs, where edges can connect more than two nodes, representing even more complex relationships.

Summary updated

BibTeX
@inproceedings{qian2025dhakr,
  author = {Feifei Qian and Lu Bai and Lixin Cui and Ming Li and Ziyu Lyu and Hangyuan Du and Edwin R. Hancock},
  title = {{DHAKR: Learning Deep Hierarchical Attention-Based Kernelized Representations for Graph Classification}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2025},
  doi = {10.1609/aaai.v39i19.34202},
}
Figure