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

Learning with Small Data: Subgraph Counting Queries

Kangfei Zhao, Zongyan He, Jeffrey Xu Yu, Yu Rong

Abstract

Subgraph isomorphism counting is a fundamental yet computationally taxing task in graph analysis. While deep learning models offer significant speed advantages over exact algorithms, they typically demand vast amounts of labeled data to generalize effectively. This paper presents RGIN-GP, a meta-learning framework that integrates Relational Graph Isomorphism Networks (RGIN) with Gaussian Processes (GP). By leveraging Deep Kernel Transfer (DKT), RGIN-GP achieves high predictive accuracy in subgraph counting even with minimal training examples (few-shot) or no task-specific data (zero-shot), significantly outperforming traditional deep learning and meta-learning baselines in data-scarce environments.

Introduction

In fields ranging from bioinformatics to social network analysis, determining the frequency of a specific pattern (a "pattern graph") within a larger "data graph" is a critical operation. This problem, known as subgraph isomorphism counting, is NP-hard, making exact computation infeasible for large-scale applications. Consequently, researchers have turned to Deep Learning (DL) to estimate these counts rapidly.

However, standard DL models are notoriously "data-hungry." A typical query optimizer might require tens of thousands of unique queries to train effectively. In real-world scenarios, such massive labeled datasets are often unavailable, especially when a new type of query or a new database is introduced. RGIN-GP addresses this "small data" challenge by learning the underlying logic of subgraph counting from a few examples, allowing it to generalize to entirely new, unseen tasks.

Methodology: The RGIN-GP Framework

The authors propose a meta-learning approach that combines the structural representational power of Graph Neural Networks (GNNs) with the uncertainty-aware regression of Gaussian Processes.

Architecture and Deep Kernel

The core of the model is a Relational Graph Isomorphism Network (RGIN) used as a feature extractor. Unlike standard neural networks that use a Multi-Layer Perceptron (MLP) for the final prediction, RGIN-GP warps the GNN into a Gaussian Process (GP). In this configuration, the GNN acts as a "deep kernel," mapping complex graph structures into a vector space where a stationary kernel (such as a Spectral Mixture kernel) can measure similarity between graphs.

Meta-Learning via Deep Kernel Transfer

To enable rapid adaptation, the model employs Deep Kernel Transfer (DKT). During the meta-training phase, the data is divided into distinct tasks. The model learns task-common parameters that define the kernel, allowing it to adapt to a new "support set" (a few examples with ground-truth counts) with minimal computation.

The RGIN-GP framework illustrating meta-training, few-shot testing, and zero-shot testing phases.

Zero-Shot Strategy

For scenarios where no ground truth is available for a new task, RGIN-GP utilizes a data-driven auxiliary strategy. It "borrows" a similar task from the training set to serve as a proxy, leveraging the learned similarity kernel to provide an educated estimate without any task-specific labels.

Experimental Setup

The framework was evaluated using one real-world dataset and two synthetic benchmarks designed to test scalability and generalization.

  • MUTAG: A real-world dataset consisting of 188 nitroaromatic compounds.
  • SYN-Small & SYN-Large: Synthetic datasets where SYN-Large doubles the scale of data and pattern graphs to evaluate the model's robustness to increased complexity.
Summary of real-world (MUTAG) and synthetic (SYN) datasets used for evaluation.

Results and Key Insights

Superior Accuracy and Efficiency

On the MUTAG dataset, RGIN-GP reduced the Mean Absolute Error (MAE) from approximately 8.0 to 1.0 compared to standard DL baselines when training data was extremely limited. Furthermore, the model proved to be 6x faster than the exact counting algorithm (VF2) while maintaining high predictive accuracy.

Bayesian Robustness

A key advantage of the GP-based approach is its ability to handle uncertainty. By providing a distribution over possible counts rather than a single point estimate, the model is much more robust to "model degeneration"—a common failure mode for standard neural networks when data is insufficient.

Task Categorization and Difficulty

The study identified that different task configurations impact performance. Specifically, the SameP configuration (new patterns on known graphs) is significantly more challenging for zero-shot learning than SameG (new graphs with known patterns). This is because different patterns can exhibit wildly different count distributions even when the underlying data graph remains the same.

Conclusion and Future Directions

RGIN-GP demonstrates that a kernel-based Bayesian approach is superior to standard MLP-based GNNs for regression tasks involving small data. While the model shows remarkable few-shot adaptation, its zero-shot performance remains sensitive to the similarity between auxiliary training tasks and the target test task. Future research may explore more sophisticated methods for auxiliary task selection and the application of this framework to massive, web-scale graphs where the computational complexity of Gaussian Processes presents a scaling challenge.

Summary updated

BibTeX
@article{zhao2023learning,
  author = {Kangfei Zhao and Zongyan He and Jeffrey Xu Yu and Yu Rong},
  title = {{Learning with Small Data: Subgraph Counting Queries}},
  journal = {Data Sci. Eng.},
  year = {2023},
  doi = {10.1007/s41019-023-00223-w},
}
Figure