Taming graph kernels with random features

Krzysztof Marcin Choromanski

TL;DR

This paper introduces Graph Random Features (GRFs), a novel mechanism to scale up graph kernels by approximating them using randomized signature vectors. By leveraging random walks to estimate the regularized Laplacian kernel, the authors reduce the computational complexity from a prohibitive $O(N^3)$ to sub-quadratic time, enabling kernel methods to work on massive networks without sacrificing unbiasedness.

The Scalability Wall in Graph Kernels

Graph kernels are essential tools for measuring similarity between nodes in a network, powering tasks like clustering, link prediction, and node classification. However, they suffer from a significant "scalability wall."

Most popular graph kernels, such as the regularized Laplacian kernel, require computing the inverse of a large matrix. This process typically scales cubically ($O(N^3)$) with the number of nodes $N$. While "Random Features" (RFs) have successfully linearized kernels in Euclidean space—transforming $K(x, y)$ into a dot product of low-dimensional vectors—applying this to graphs is notoriously difficult. In a graph, a node's identity is tied to the entire topology of the network, not just its own coordinates. This paper tackles the challenge of creating an efficient, unbiased linearization specifically for graph-structured data.

Introducing Graph Random Features (GRFs)

The authors propose Graph Random Features (GRFs) to bypass explicit matrix inversion. The core idea is to represent each node $i$ with a "signature vector" $\phi(i)$ such that the kernel $K(i, j) \approx \phi(i)^\top \phi(j)$.

Illustration of random walks depositing loads to build signature vectors.
  1. Random Walk Signatures: To compute $\phi(i)$, the algorithm initiates $m$ random walks from node $i$. As a walk traverses the graph, it "deposits a load" (a numerical value) at every node it visits. The signature vector $\phi(i)$ stores the accumulated loads at each vertex. Think of this as a footprint: if two nodes are similar, random walks starting from them are likely to visit the same set of other nodes, leading to overlapping "loads" and a high dot product.
  2. Unbiased Estimation: The authors mathematically prove that the dot product of these signature vectors provides an unbiased estimate of the squared inverse of the adjacency-related matrix, forming the basis for the 2-regularized Laplacian kernel.
  3. Recursive Generalization: They provide a recursive framework to extend this to any $d$-regularized Laplacian kernel, including the standard regularized Laplacian ($d=1$).
  4. Dimensionality Reduction: To keep the signature vectors manageable, they employ two tricks: updating loads for only a small subset of "anchor" nodes, and projecting the high-dimensional signature vectors into a lower-dimensional space using the Johnson-Lindenstrauss Transform (JLT).
  5. q-GRFs: A "Quasi-Monte Carlo" variant uses reinforced random walks (which avoid already-visited edges) to reduce the variance of the estimation.

Key Results and Performance

The authors evaluated GRFs on a diverse set of graphs, ranging from synthetic Erdos-Renyi graphs to real-world social, biological, and technical networks (e.g., Karate club, Citeseer, Databases).

Comparison of FLOPS required by GRF versus baseline solvers.
  • Massive Speedups: In FLOPS (Floating Point Operations) tests, GRFs outperformed brute-force methods by orders of magnitude. For a 3,000-node graph, GRFs required roughly 10.2M FLOPS compared to 27B for brute force and 90M for standard iterative solvers like Jacobi or Gauss-Seidel.
  • High Accuracy: The relative Frobenius norm error drops significantly as the number of random walks ($m$) increases. With just $m=80$ walks, the error was consistently below 2% across various graph types.
  • Downstream Performance: In kernelized k-means clustering, GRFs achieved clustering errors of less than 1% on datasets like citeseer, proving that the approximation is robust enough for real-world machine learning tasks.
  • Distributed Friendly: Because random walks from different nodes are independent, the algorithm is "embarrassingly parallel," making it highly suitable for massive graphs split across multiple machines.

Limitations and Future Work

While the method is fast, storing signature vectors for every node can still be memory-intensive if the graph is extremely large and the signatures aren't sufficiently compressed via JLT or anchor points. Additionally, performance depends on the termination probability ($p_{term}$) of the random walks; while $p_{term}=0.1$ worked well in their tests, very large or dense graphs might require more tuning. Finally, while the authors introduced $q$-GRFs to optimize variance, a comprehensive theoretical and empirical analysis of this specific variant is left for future work.

Summary updated

BibTeX
@inproceedings{choromanski2023taming,
  author = {Krzysztof Marcin Choromanski},
  title = {{Taming graph kernels with random features}},
  booktitle = {International Conference on Machine Learning},
  year = {2023},
  url = {https://openreview.net/forum?id=H21qm4xyk9},
}
Figure