DIFF ORMER : S CALABLE (G RAPH ) T RANSFORMERS I NDUCED BY E NERGY C ONSTRAINED D IFFUSION
A BSTRACT
Real-world data generation often involves complex inter-dependencies among instances, violating the IID-data hypothesis of standard learning paradigms and posing a challenge for uncovering the geometric structures for learning desired instance representations.
To this end, we introduce an energy constrained diffusion model which encodes a batch of instances from a dataset into evolutionary states that progressively incorporate other instances’ information by their interactions.
The diffusion process is constrained by descent criteria w.r.t.
a principled energy function that characterizes the global consistency of instance representations over latent structures.
We provide rigorous theory that implies closed-form optimal estimates for the pairwise diffusion strength among arbitrary instance pairs, which gives rise to a new class of neural encoders, dubbed as DIFF ORMER (diffusion-based Transformers), with two instantiations: a simple version with linear complexity for prohibitive instance numbers, and an advanced version for learning complex structures.
Experiments highlight the wide applicability of our model as a general-purpose encoder backbone with superior performance in various tasks, such as node classification on large graphs, semi-supervised image/text classification, and spatial-temporal dynamics prediction.
I NTRODUCTION
Real-world data are generated from a convoluted interactive process whose underlying physical principles are often unknown.
Such a nature violates the common hypothesis of standard representation learning paradigms assuming that data are IID sampled.
The challenge, however, is that due to the absence of prior knowledge about ground-truth data generation, it can be practically prohibitive to build feasible methodology for uncovering data dependencies, despite the acknowledged significance.
To address this issue, prior works, e.g., Wang et al.
; Franceschi et al.
; Jiang et al.
; Zhang et al.
(2019), consider encoding the potential interactions between instance pairs, but this requires sufficient degrees of freedom that significantly increases learning difficulty from limited labels (Fatemi et al., 2021) and hinders the scalability to large systems (Wu et al., 2022).
Turning to a simpler problem setting where putative instance relations are instantiated as an observed graph, remarkable progress has been made in designing expressive architectures such as graph neural networks (GNNs) (Scarselli et al., 2008; Kipf & Welling, 2017; Velickovic et al., 2018; Wu et al., 2019;
Chen et al., 2020a; Yang et al., 2021) for harnessing inter-connections between instances as a geometric prior (Bronstein et al., 2017).
However, the observed relations can be incomplete/noisy, due to error-prone data collection, or generated by an artificial construction independent from downstream targets.
The potential inconsistency between observation and the underlying data geometry would presumably elicit systematic bias between structured representation of graph-based learning and true data dependencies.
While a plausible remedy is to learn more useful structures from the data, this unfortunately brings the previously-mentioned obstacles to the fore.
To resolve the dilemma, we propose a novel general-purpose encoder framework that uncovers data dependencies from observations (a dataset of partially labeled instances), proceeding via two-fold [Figure] Superv i sed L o ss inspiration from physics as illustrated in Fig.
Our model is defined through feed-forward continuous dynamics (i.e., a PDE) involving all the instances of a dataset as locations on Riemannian manifolds with latent structures, upon which the features of instances act as heat flowing over the underlying geometry (Hamzi & Owhadi, 2021).
Such a diffusion model serves an important inductive bias for leveraging global information from other instances to obtain more informative representations.
Its major advantage lies in the flexibility for the diffusivity function, i.e., a measure of the rate at which information spreads (Rosenberg & Steven, 1997): we allow for feature propagation between arbitrary instance pairs at each layer, and adaptively navigate this process by pairwise connectivity weights.
Moreover, for guiding the instance representations towards some ideal constraints of internal consistency, we introduce a principled energy function that enforces layer-wise regularization on the evolutionary directions.
The energy function provides another view (from a macroscopic standpoint) into the desired instance representations with low energy that are produced, i.e., soliciting a steady state that gives rise to informed predictions on unlabeled data.
As a justification for the tractability of above general methodology, our theory reveals the underlying equivalence between finite-difference iterations of the diffusion process and unfolding the minimization dynamics for an associated regularized energy.
This result further suggests a closed-form optimal solution for the diffusivity function that updates instance representations by the ones of all the other instances towards giving a rigorous decrease of the global energy.
Based on this, we also show that the energy constrained diffusion model can serve as a principled perspective for unifying popular models like MLP, GCN and GAT which can be viewed as special cases of our framework.
On top of the theory, we propose a new class of neural encoders, Diffusion-based Transformers (DIFF ORMER ), and its two practical instantiations: one is a simple version with O ( N ) complexity ( N for instance number) for computing all-pair interactions among instances; the other is a more expressive version that can learn complex latent structures.
We empirically demonstrate the success of DIFF ORMER on a diverse set of tasks.
It outperforms SOTA approaches on semi-supervised node classification benchmarks and performs competitively on large-scale graphs.
It also shows promising power for image/text classification with low label rates and predicting spatial-temporal dynamics.
R ELATED W ORK
Graph-based Semi-supervised Learning.
Graph-based SSL (Kipf & Welling, 2017) aims to learn from partially labeled data, where instances are treated as nodes and their relations are given by a graph.
The observed structure can be leveraged as regularization for learning representations (Belkin et al., 2006;
Weston et al., 2012; Yang et al., 2016) or as an inductive bias of modern GNN architectures (Scarselli et al., 2008).
However, there frequently exist situations where the observed structure is unavailable or unreliable (Franceschi et al., 2019; Jiang et al., 2019; Chen et al., 2020c; Fatemi et al., 2021; Lao et al., 2022), in which case the challenge remains how to uncover the underlying relations.
This paper explores a new Transformer-like encoder for discovering data geometry to promote learning through the inter-dependence among instances (either labeled or unlabeled).
Neural Diffusion Models.
There are several recent efforts on diffusion-based learning where continuous dynamics serve as an inductive bias for representation learning (Hamzi & Owhadi, 2021).
One category directly solves a continuous process of differential equations (Lagaris et al., 1998;
Chen et al., 2018), e.g., Chamberlain et al.
(2021a)
and its follow-ups (Chamberlain et al., 2021b;
Thorpe et al., 2022) reveal the analogy between the discretization of diffusion process and GNNs’ feedforward rules, and devise new (continuous) models on graphs whose training requires PDEsolving tools.
Differently, another category is PDE-inspired learning using the diffusion perspective as principled guidelines on top of which new (discrete) neural network-based approaches are designed for node classification (Atwood & Towsley, 2016; Klicpera et al., 2019; Xu et al., 2020), graph comparison (Tsitsulin et al., 2018), and geometric knowledge distillation (Yang et al., 2022).
Our work leans on PDE-inspired learning and the key originality lies in two aspects.
First, we introduce a novel diffusion model whose dynamics are implicitly defined by optimizing a regularized energy.
Second, our theory establishes an equivalence between the numerical iterations of diffusion process and unfolding the optimization of the energy, based on which we develop a new class of neural encoders for uncovering latent structures among a large number of instances.
Instance/Node-Level v.s. Graph-Level Prediction.
Our goal is to learn latent interaction graphs among instances, and this can be generally viewed as an embodiment of node-level prediction (NP) tasks widely studied in the graph learning community.
This is distinct from graph-level prediction (GP) whereby each graph itself generally has a single label to predict and a dataset contains many graph instances.
These two problems are typically tackled separately in the literature (Hu et al., 2020) with disparate technical considerations.
This is because input instances are inter-dependent in NP (due to the instance interactions involved in the data-generating process), while in GP tasks the instances can be treated as IID samples.
Although there exist some recent models considering all-pair feature propagation among the nodes of each graph instance (Wang et al., 2019; Dwivedi & Bresson, 2020), such prior work largely focuses on GP with relatively small graphs.
It therefore remains under-explored how to build an efficient and expressive model for learning node-pair interactions for NP tasks involving latent graphs that can be prohibitively large (Wu et al., 2022).
E NERGY C ONSTRAINED G EOMETRIC D IFFUSION T RANSFORMERS
Consider a set of partially labeled instances { x i } Ni =1 , whose labeled portion is { ( x j , y j ) } Mj =1 (often
M ≪ N ).
In some cases there exists relational structures that connect instances as a graph G =
( V , E ) , where the node set V contains all the instances and the edge set E = { e ij } consists of observed relations.
Without loss of generality, the main body of this section does not assume graph structures as input, but we will later discuss how to trivially incorporate then if/when available.
3. G EOMETRIC D IFFUSION M ODEL
The starting point of our model is a diffusion process that treats a dataset of instances as a whole and produces instance representations through information flows characterized by an anisotropic diffusion process, which is inspired by an analogy with heat diffusion on a Riemannian manifold (Rosenberg &
Steven, 1997).
We use a vector-valued function
z i ( t ) :
[0 , ∞ )
→ R d to define an instance’s state at time t and location i .
The anisotropic diffusion process describes the evolution of instance states (i.e., representations) via a PDE with boundary conditions (Freidlin & Wentzell, 1993; Medvedev, 2014):
[Equation]
where Z ( t ) =
[ z i ( t )]
Ni =1 ∈ R N × d , ⊙ denotes the Hadamard product, and the function S ( Z ( t ) , t ) :
R N × d × [0 , ∞ )
→ [0 , 1] N × N defines the diffusivity coefficient controlling the diffusion strength between any pair at time t .
The diffusivity is specified to be dependent on instances’ states.
The gradient operator ∇ measures the difference between source and target states, i.e., ( ∇ Z ( t )) ij =
z j ( t ) − z i ( t ) , and the divergence operator ∇ ∗ sums up information flows at a point, i.e., ( ∇ ∗ )
i = (cid:80) Nj
=1 S ij ( Z ( t ) , t ) ( ∇ Z ( t )) ij .
Note that both operators are defined over a discrete space consisting of N locations.
The physical implication of Eq.
1 is that the temporal change of heat at location i equals to the heat flux that spatially enters into the point.
Eq.
1 can be explicitly written as
[Equation]
Such a diffusion process can serve as an inductive bias that guides the model to use other instances’ information at every layer for learning informative instance representations.
We can use numerical methods to solve the continuous dynamics in Eq. 2, e.g., the explicit Euler scheme involving finite differences with step size τ , which after some re-arranging gives:
[Equation]
The numerical iteration can stably converge for τ ∈ (0 , 1) .
We can adopt the state after a finite number K of propagation steps and use it for final predictions, i.e., ˆ y i =
MLP ( z ( K ) i ) .
Remark.
The diffusivity coefficient in Eq.
1 is a measure of the rate at which heat can spread over the space (Rosenberg & Steven, 1997).
Particularly in Eq. 2, S ( Z ( t ) , t ) determines how information flows over instances and the evolutionary direction of instance states.
Much flexibility remains for its specification.
For example, a basic choice is to fix S ( Z ( t ) , t ) as an identity matrix which constrains the feature propagation to self-loops and the model degrades to an MLP that treats all the instances independently.
One could also specify S ( Z ( t ) , t ) as the observed graph structure if available in some scenarios.
In such a case, however, the information flows are restricted by neighboring nodes in a graph.
An ideal case could be to allow S ( Z ( t ) , t ) to have non-zero values for arbitrary ( i, j ) and evolve with time, i.e., the instance states at each layer can efficiently and adaptively propagate to all the others.
3. D IFFUSION C ONSTRAINED BY A L AYER - WISE E NERGY
As mentioned previously, the crux is how to define a proper diffusivity function to induce a desired diffusion process that can maximize the information utility and accord with some inherent consistency.
Since we have no prior knowledge for the explicit form or the inner structure of S ( k ) , we consider the diffusivity as a time-dependent latent variable and introduce an energy function that measures the presumed quality of instance states at a given step k :
[Equation]
where δ : R + → R is defined as a function that is non-decreasing and concave on a particular interval of our interest, and promotes robustness against large differences (Yang et al., 2021) among any pair of instances.
Eq.
4 assigns each state in R d with an energy scalar which can be leveraged to regularize the updated states (towards lower energy desired).
The weight λ trades two effects: 1) for each instance i , the states not far from the current one z ( k ) i have low energy; 2) for all instances, the smaller differences their states have, the lower energy is produced.
Remark.
Eq.
4 can essentially be seen as a robust version of the energy introduced by Zhou et al.
(2004), inheriting the spirit of regularizing the global and local consistency of representations.
“Robust" here particularly implies that the δ adds uncertainty to each pair of the instances and could implicitly filter the information of noisy links (potentially reflected by proximity in the latent space).
Energy Constrained Diffusion.
The diffusion process describes the microscopic behavior of instance states through evolution, while the energy function provides a macroscopic view for quantifying the consistency.
In general, we expect that the final states could yield a low energy, which suggests that the physical system arrives at a steady point wherein the yielded instance representations have absorbed enough global information under a certain guiding principle.
Thereby, we unify two schools of thoughts into a new diffusive system where instance states would evolve towards producing lower energy, e.g., by finding a valid diffusivity function.
Formally, we aim to find a series of S ( k ) ’s whose dynamics and constraints are given by
[Equation]
The formulation induces a new class of geometric flows on latent manifolds whose dynamics are implicitly defined by optimizing a time-varying energy function (see Fig.
1 for an illustration).
3. T RACTABILITY OF S OLVING D IFFUSION P ROCESS WITH E NERGY M INIMIZATION
Unfortunately, Eq. 5 is hard to solve since we need to infer the value for a series of coupled S ( k ) ’s that need to satisfy K inequalities by the energy minimization constraint.
The key result of this paper is the following theorem that reveals the underlying connection between the geometric diffusion model and iterative minimization of the energy, which further suggests an explicit closed-form solution for
S ( k ) based on the current states Z ( k ) that yields a rigorous decrease of the energy.
Theorem 1.
For any regularized energy defined by Eq. 4 with a given λ , there exists 0 < τ < 1 such that the diffusion process of Eq.
3 with the diffusivity between pair ( i, j ) at the k -th step given by
[Equation]
yields a descent step on the energy, i.e., E ( Z ( k +1) , k ; δ )
≤ E ( Z ( k ) , k − 1; δ ) for any k ≥ 1 .
Theorem 1 suggests the existence for the optimal diffusivity in the form of a function over the ldistance between states at the current step, i.e., ∥ z ( k ) i − z ( k ) j ∥ 2 .
The result enables us to unfold the implicit process and compute S ( k ) in a feed-forward way from the initial states.
We thus arrive at a new family of neural model architectures with layer-wise computation specified by:
[Equation] i, j
[Equation]
N, State Updating: z ( k +1) i =
[Equation]
−
[Equation] N [Equation] (cid:123)(cid:122) (cid:125) state conservation +
[Equation]
N
[Equation] = [Equation] (cid:124) (cid:123)(cid:122) (cid:125) state propagation , 1 ≤
[Equation]
≤ N.
Remark.
The choice of function f in above formulation is not arbitrary, but needs to be a non-negative and decreasing function of z 2 , so that the associated δ in Eq.
4 is guaranteed to be non-decreasing and concave w.r.t.
z 2 .
Critically though, there remains much room for us to properly design the specific f , so as to provide adequate capacity and scalability.
Also, in our model presented by Eq.we only have one hyper-parameter τ in practice, noting that the weight λ in the regularized energy is implicitly determined through τ by Theorem 1, which reduces the cost of hyper-parameter searching.
I NSTANTIATIONS OF DIFF ORMER 4. M ODEL I MPLEMENTATION
We next go into model instantiations based on our theory.
We introduce two specified f ’s as practical versions of our model whose detailed implementations are given in Appendix D with PyTorch-style pseudo code.
First, because ∥ z i − z j ∥ 22 = ∥
z i ∥ 22 + ∥
z j ∥ 22 − 2 z ⊤ i
z j , we can convert f ( ∥ z i − z j ∥ 22 ) into the form g ( z ⊤ i z j ) using a change of variables on the condition that ∥ z i ∥ 2 remains constant.
And we add layer normalization to each layer to loosely enforce such a property in practice.
Simple Diffusivity Model.
A straightforward design is to adopt the linear function g ( x ) = 1 + x :
[Equation]
where W ( k ) Q , W ( k ) K are learnable weight matrices of the k -th layer.
Assuming ˜
z ( k ) i
= W ( k ) Q z ( k ) i , ˜ z
( k ) j = W ( k ) K z ( k ) j and z = ∥
˜ z ( k )
i −
˜ z
( k ) j ∥ 2 , Eq.
8 can be written as f ( z 2 ) = 2 − 12 z 2 , which yields a non-negative result and is decreasing on the interval [0 , 2] where z 2 lies after layer normalization.
One scalability concern for the model Eq.
7 arises because of the need to compute pairwise diffusivity and propagation for each individual, inducing O ( N 2 ) complexity.
Remarkably, the simple diffusivity model allows a significant acceleration by noting that the state propagation can be re-arranged via
N (cid:88)
[Equation]
The two summation terms above can be computed once and shared to every instance i , reducing the complexity in each iteration to O ( N ) .
We call this implementation as DIFF ORMER -s.
Similar strategies for complexity reduction is utilized by recent scalable graph Transformers (Wu et al., 2022) based on kernelized feature map, while in contrast we resort to a more straightforward design.
Advanced Diffusivity Model.
The simple model facilitates efficiency/scalability, yet may sacrifice the capacity for complex latent geometry.
We thus propose an advanced version with g ( x ) =
[Equation]
which corresponds with f ( z 2 )
=
[Equation]
[Equation]
1 guaranteeing monotonic decrease and non-negativity.
We dub this version as DIFF ORMER -a.
Appendix C further compares the two models (i.e., different f ’s and δ ’s) through synthetic results.
Real-world empirical comparisons are in Section 5.
4. M ODEL E XTENSIONS AND F URTHER D ISCUSSION
Incorporating Layer-wise Transformations.
Eq.
7 does not use feature transformations for each layer.
To further improve the representation capacity, we can add such transformations after the updating, i.e., z ( k ) i ← h ( k ) ( z ( k ) i ) where h ( k ) can be a fully-connected layer (see Appendix D for details).
In this way, each iteration of the diffusion yields a descent of a particular energy
E ( Z , k ; δ, h ( k ) ) =
∥
Z − h ( k ) ( Z ( k ) )
∥
22 + (cid:80) i,j δ ( ∥ z
i − z j ∥ 22 ) dependent on k .
The trainable transformation h ( k ) can be optimized w.r.t.
the supervised loss to map the instance representations into a proper latent space.
Our experiments find that the layer-wise transformation is not necessary for small datasets, but contributes to positive effects for datasets with larger sizes.
Furthermore, one can consider non-linear activations in the layer-wise transformation h ( k ) though we empirically found that using a linear model already performs well.
We also note that Theorem 1 can be extended to hold even when incorporating such a non-linearity in each layer (see Appendix B for detailed discussions).
Incorporating Input Graphs.
For the model presented so far, we do not assume an input graph for the model formulation.
For situations with observed structures as available input, we have G =
( V , E ) that can be leveraged as a geometric prior.
We can thus modify the updating rule as:
[Equation]
where ˜ A ij = 1 √ d i d j if ( i, j ) ∈ E and 0 otherwise, and d i is instance i ’s degree in G .
The diffusion iteration of Eq.
11 is equivalent (up to a re-scaling factor on the adjacency matrix) to minimizing a new energy additionally incorporating a graph-based penalty (Ioannidis et al., 2017), i.e., (cid:80) ( i,j ) ∈E ∥
z ( k ) i − z ( k ) j ∥ 22 (see Appendix C for details).
Scaling to Large Datasets.
Another advantage of DIFF ORMER is the flexibility for mini-batch training.
For datasets with prohibitive instance numbers that make it hard for full-batch training on a single GPU, we can naturally partition the dataset into mini-batches and feed one mini-batch for one feed-forward and backward computation.
Similar efforts can be applied for parallel acceleration.
Connection with Existing Models.
The proposed methodology in fact serves as a general diffusion framework that provides a unifying view whereby some existing models can be seen as special cases of ours.
As a non-exhaustive summary and high-level comparison, Table 1 presents the relationships with MLP, GCN and GAT which can be expressed via simplified versions of our principled energyconstrained diffusion models (see more elaboration in Appendix E).
As increasing evidence suggesting the comparable empirical competitiveness of MLPs and propagation-based models (e.g., GNNs) in some practical tasks, the theoretical understandings for different inductive bias still remain unclear.
One concurrent work Yang et al.
(2023) points out the fundamental connections among MLPs and
GNNs with regard to their generalization effects, while our result in this paper serves as another aspect for understanding the representations learned by different propagation layers.
[Table]
[Table]
E XPERIMENTS
We apply DIFF ORMER to various tasks for evaluation: 1) graph-based node classification where an input graph is given as observation; 2) image and text classification without input graphs; 3) dynamics prediction that requires handling new unseen instances from test data, i.e., inductive learning.
In each case, we compare a different (with some overlap) set of competing models that are closely associated with DIFF ORMER and specifically designed for the particular task.
Unless otherwise stated, for datasets where input graphs are available, we incorporate them for feature propagation as is defined by Eq. 11.
Due to space limit, we defer details of datasets to Appendix F and the implementations to
Appendix G. Also, we provide additional supporting empirical results in Appendix H.
5. S EMI - SUPERVISED N ODE C LASSIFICATION B ENCHMARKS
We test DIFF ORMER on three citation networks Cora , Citeseer and Pubmed .
Table 2 reports the testing accuracy.
We compare with several sets of baselines linked with our model from different aspects.
1) Basic models: MLP and two classical graph-based SSL models Label Propagation ( LP ) (Zhu et al., 2003) and ManiReg (Belkin et al., 2006).
2) GNN models: SGC (Wu et al., 2019),
GCN (Kipf & Welling, 2017), GAT (Velickovic et al., 2018), their variants GCN- k NN , GAT- k NN (operating on k NN graphs constructed from input features) and Dense GAT (with a densely connected graph replacing the input one), and two strong structure learning models LDS (Franceschi et al., 2019) and GLCN (Jiang et al., 2019).
3) PDE graph models: the SOTA models GRAND
(Chamberlain et al., 2021a)
(with its linear variant GRAND-l) and GRAND++ (Thorpe et al., 2022).
4) Diffusion-inspired
GNN models: GDC (Klicpera et al., 2019), GraphHeat (Xu et al., 2020) and a recent work DGCEuler (Wang et al., 2021).
Table 2 shows that DIFF ORMER achieves the best results on three datasets [Figure] [Figure] [Table]
with significant improvements. Also, we notice that the simple diffusivity model DIFF ORMER -s significantly exceeds the counterparts without non-linearity (SGC, GRAND-l and DGC-Euler) and even comes to the first on Cora and Pubmed .
These results suggest that DIFF ORMER can serve as a very competitive encoder backbone for node-level prediction that learns inter-instance interactions for generating informative representations and boosting downstream performance.
5. L ARGE -S CALE N ODE C LASSIFICATION G RAPHS
We also consider two large-scale graph datasets ogbn-Proteins , a multi-task protein-protein interaction network, and Pokec , a social network.
Table 3 presents the results.
Due to the dataset size (0.13M/1.63M nodes for two graphs) and scalability issues that many of the competitors in
Table 2 as well as DIFF ORMER -a would potentially experience, we only compare DIFF ORMER -s with standard GNNs.
In particular, we found GCN/GAT/DIFF ORMER -s are still hard for full-graph training on a single V100 GPU with 16GM memory.
We thus consider mini-batch training with batch size 10K/100K for Proteins / Pokec .
We found that DIFF ORMER outperforms common GNNs by a large margin, which suggests its desired efficacy on large datasets.
As mentioned previously, we prioritize the efficacy of DIFF ORMER as a general encoder backbone for solving node-level prediction tasks on large graphs.
While there are quite a few practical tricks shown to be effective for training GNNs for this purpose, e.g., hop-wise attention (Sun et al., 2022) or various label re-use strategies, these efforts are largely orthogonal to our contribution here and can be applied to most any model to further boost performance.
For further investigation, we supplement more results using different mini-batch sizes for training and study its impact on testing performance in Appendix H.4.
Furthermore, we compare the training time and memory costs in Appendix H.5 where we found that
DIFF ORMER -s is about 6 times faster than GAT and 39 times faster than DenseGAT on Pokec , which suggests superior scalability and efficiency of DIFF ORMER -s on large graphs.
5. I MAGE AND T EXT C LASSIFICATION WITH L OW L ABEL R ATES
We next conduct experiments on CIFAR-10 , STL-10 and 20News-Group datasets to test DIFF ORMER for standard classification tasks with limited label rates.
For 20News provided by Pedregosa et al.
, we take 10 topics and use words with TF-IDF more than 5 as features.
For CIFAR and STL , two public image datasets, we first use the self-supervised approach SimCLR
(Chen et al., 2020b) (that does not use labels for training) to train a ResNet-18 for extracting the feature maps as input features of instances.
These datasets contain no graph structure, so we use k NN to construct a graph over input features for GNN competitors and do not use input graphs for DIFF ORMER .
Table 4 reports the testing accuracy of DIFF ORMER and competitors including MLP, ManiReg,
GCN- k NN, GAT- k NN, DenseGAT and GLCN.
Two DIFF ORMER models perform much better than
[Table]
MLP in nearly all cases, suggesting the effectiveness of learning the inter-dependence over instances.
Besides [Table] DIFF ORMER yields large improvements over GCN and GAT which are in some sense limited by the handcrafted graph that leads to sub-optimal propagation.
Moreover, DIFF ORMER significantly outperforms GLCN, a strong baseline that learns new (static) graph structures, which demonstrates the superiority of our evolving diffusivity that can adapt to different layers.
5. S PATIAL -T EMPORAL D YNAMICS P REDICTION
We consider three spatial-temporal datasets with details in Appendix F. Each dataset consists of a series of graph snapshots where nodes are treated as instances and each of them has a integer label (e.g., reported cases for Chickenpox or Covid ).
The task is to predict the labels of one snapshot based on the previous ones.
Table 5 compares testing MSE of four DIFF ORMER variants (here DIFF ORMER
-s
w/o g denotes the model DIFF ORMER -s without using input graphs) against baselines.
We can see that two DIFF ORMER variants without input graphs even outperform the counterparts using input structures in four out of six cases.
This implies that our diffusivity estimation module could learn useful structures for informed prediction, and the input structure might not always contribute to positive effect.
In fact, for temporal dynamics, the underlying relations that truly influence the trajectory evolution can be much complex and the observed relations could be unreliable with missing or noisy links, in which case GNN models relying on input graphs may perform undesirably.
Compared to the competitors, our models rank the first with significant improvements.
5. F URTHER R ESULTS AND D ISCUSSIONS
How do different diffusivity functions perform?
Figure 2(a) compares DIFF ORMER with four variants using other diffusivity functions that have no essential connection with energy minimization: 1) Identity sets S ( k ) as a fixed identity matrix; 2) Constant fixes S ( k ) as all-one constant matrix; 3) Full Attn parameterizes S ( k ) by attention networks ( Vaswani et al., 2017); 4) Kernel adopts
Gaussian kernel for computing S ( k ) .
More results on other datasets are in Appendix H.1 and they consistently show that our adopted diffusivity forms produce superior performance, which verifies the effectiveness of our diffusivity designs derived from minimization of a principled energy.
How do model depth and step size impact the performance?
We discuss the influence of model depth K and step size τ on Cora in Fig. 2(b).
More results on Citeseer and Pubmed are generally consistent with Fig. 2(b) and deferred to Appendix H.2.
The curves indicate that the performance of GCN and GAT models exhibit significant degradation with deeper layers, while
DIFF ORMER maintains its superiority and performs stably with large K .
Furthermore, when K is not large enough (less than 32), there is a clear performance improvement of DIFF ORMER as K increases, and larger τ contributes to a steeper increase.
When K continues increasing (more than 32), the model performance still goes up with small τ (0.1 and 0.25) yet exhibits a slight drop with large τ (0.5 and 0.9).
The reason could be that larger (smaller) τ contributes to more (less) concentration on global information from other instances in each iteration, which brings up more (less) benefits with increasing propagation layers yet could lead to instability when the step size is too large.
C ONCLUSIONS
This paper proposes an energy-driven geometric diffusion model with latent diffusivity function for data representations.
The model encodes all the instances as a whole into evolving states aimed at minimizing a principled energy as implicit regularization.
We further design two practical implementations with enough scalability and capacity for learning complex interactions over the underlying data geometry.
Extensive experiments demonstrate the effectiveness and superiority of the model.
A P ROOF FOR T HEOREM
First of all, we can convert the minimization of Eq.
4 into a minimization of its variational upper bound, shown in the following proposition.
Proposition 1.
The energy function E ( Z , k ; δ ) is upper bounded by
[Equation]
where ˜ δ is the concave conjugate of δ , and the equality holds if and only if the variational parameters satisfy
[Equation]
[Equation]
Proof.
The proof of the proposition follows the principles of convex analysis and Fenchel duality (Rockafellar, 1970).
For any concave and non-decreasing function ρ : R + → R , one can express it as the variational decomposition
[Equation]
[Equation]
where ω is a variational parameter and ˜ ρ is the concave conjugate of ρ .
Eq.
14 essentially defines ρ ( z 2 ) as the minimal envelope of a series of quadratic bounds ωz 2 − ˜ ρ ( ω ) defined by a different values of ω ≥ 0 and the upper bound is given for a fixed ω when removing the minimization operator.
Based on this, we obtain the result of Eq.
In terms of the sufficient and necessary condition for equality, we note that for any optimal ω ∗ we have
[Equation]
(15) which is tangent to ρ at z 2 and ω ∗ = ∂δ ( z 2 ) ∂z 2 .
We thus obtain the result of Eq. 13.
We next continue to prove the main result of Theorem 1.
According to Proposition 1, we can minimize the upper bound surrogate Eq.
and it becomes equivalent to a minimization of the original energy on condition that the variational parameters are given by Eq.
Then with a one-step gradient decent of Eq.
12, the instance states could be updated via (assuming l as the index of steps and α as step size)
[Equation]
where Ω ( l ) = { ω ( l ) ij } N × N , D ( l ) denotes the diagonal degree matrix associated with Ω ( l ) and we introduce α ′ =
αλ to combine two parameters as one.
Common practice to accelerate convergence adopts a positive definite preconditioner term, e.g., ( D ( l ) ) − 1 , to re-scale the updating gradient and the final updating form becomes
[Equation]
One can notice that Eq.
17 shares similar forms as the numerical iteration Eq.
3 for the PDE diffusion system, in particular if we write Eq.
3 as a matrix form:
[Equation]
[Equation]
where ˜ D ( k ) is the degree matrix associated with S ( k ) .
Pushing further, we can see that the effect of
Eq.
18 is the same as 17 when we let τ = α ′ , k
= l , S ( k ) =
( D ( l ) )
− 1 Ω ( l ) and S ( k ) is
2 z 2   δ ( z 2 )
Penalty −  1 z x −   z
y
Divergence −  1 z x −   z
y
Energy 1.
f ( z 2 ) (a) DIFF ORMER -s: δ ( z 2 ) =
2 z 2 − 14 z  2 z 2 −   δ ( z 2 )
Penalty −  1 z x −   z
y
Divergence −  1 z x −   z
y
Energy 0.
f ( z 2 ) ( [Figure]
Thereby, we have proven by construction that a one-step numerical iteration by the explicit Euler scheme, specifically shown by Eq.
17 is equivalent to a one-step gradient descent on the surrogate
Eq.
14 which further equals to the original energy Eq.
We thus have the result E ( Z ( k +1) , k ; δ ) ≤
E ( Z ( k ) , k ; δ ) .
Besides, we notice that for a fixed Z , E ( Z , k ; δ ) =
∥
Z − Z ( k ) ∥ 2 F + λ (cid:80) ij ρ ( ∥ z i − z j ∥ 22 ) becomes a function of k and its optimum is achieved if and only if Z ( k )
=
Z .
Such a fact yields that E ( Z ( k ) , k ; δ ) ≤ E ( Z ( k ) , k − 1; δ ) .
The result of the main theorem follows by noting that
E ( Z ( k +1) , k ; δ ) ≤ E ( Z ( k ) , k ; δ ) ≤ E ( Z ( k ) , k − 1; δ ) .
B E XTENSION OF OUR T HEORY TO I NCORPORATE N ON -L INEARITY
In Section 3, we mainly focus on the situation without non-linearity in each model layer to stay consistent with our implementation where we empirically found that omitting the non-linearity in the middle diffusion layers works smoothly in practice (see the pseudo code of Alg. 1 in appendix for details).
Even so, our theory can also be extended to incorporate the layer-wise non-linearity in diffusion propagation.
Specifically, the non-linear activation can be treated as a proximal operator (which projects the output into a feasible region) and the gradient descent used in our analysis Eqn.and 17 can be modified to add a proximal operator:
[Equation]
where Prox Ω ( z ) =
arg min x ∈ Ω ∥ x − z ∥ 2 and Ω defines a feasible region.
The updating above corresponds to proximial gradient descent which also guarantees a strict minimization for the energy function and our Theorem 1 will still hold.
In particular, if one uses ReLU activation, the proximal operator will be Prox Ω ( z ) = max(0 , z ) .
C D IFFERENT E NERGY F ORMS
We present more detailed illustration for the choices of f and specific energy function forms in Eq. 4.
Simple Diffusivity Model.
As discussed in Section 4, the simple model assumes f ( z 2 ) =
2 − 12 zthat corresponds to g ( x ) = 1+ x , where we define z = ∥
z i − z j ∥ 2 and x = z ⊤ i
z j .
The corresponding penalty function δ whose first-order derivative is f would be δ ( z 2 ) =
2 z 2 − 14 z 4 .
We plot the penalty function curves in Fig. 3(a).
As we can see, the f is a non-negative, decreasing function of z 2 , which implies that the δ satisfies the non-decreasing and concavity properties to guarantee a valid regularized energy function.
Also, in Fig. 3(a) we present the divergence field produced byrandomly generated instances (marked as red stars) and the cross-section energy field of one instance.
Advanced Diffusivity Model.
The diffusivity model defines f ( z 2 ) =
+ e z 2 / 2 − 1 with g ( x ) = 1 1+exp( − x ) , and the corresponding penalty function δ ( z 2 ) =
z 2 − 2 log( e z 2 / 2 − 1 + 1) .
The penalty function curves, divergence field and energy field are shown in Fig. 3(b).
Incorporating Input Graphs.
In Section 4, we present an extended version of our model for incorporating input graphs.
Such an extension defines a new diffusion process whose iterations can be intrinsically viewed as a minimization for the following regularized energy:
[Equation]
where the last term is a penalty for observed edges in the input graph.
D M ODEL I MPLEMENTATION AND P SEUDO C ODES
In this section, we present the details for model implementation including the feed-forward and loss computation of DIFF ORMER (shown in Alg. 1) and the one-layer computation of two model versions (shown in Alg. 2 for DIFF ORMER -s and Alg. 3 for DIFF ORMER -a).
The key design of our methodology lies in the model architectures which are shown in detail in Alg. 2 for DIFF ORMER -s and Alg. 3 for DIFF ORMER -a, where for each case, the model takes the data as input and outputs prediction for each individual instance.
For more details concerning the implementation, please refer to our provided codes in the supplementary.
[Table]
of DIFF ORMER -s
[Table]
[Table]
E C ONNECTIONS WITH E XISTING M ODELS
MLP.
MLPs can be viewed as a simplified diffusion model with only non-zero diffusivity values on the diagonal line, i
[Table]
e., S ( k ) ij = 1 if i = j and 0 otherwise.
From a graph convolution perspective, MLP only considers propagation on the self-loop connection in each layer.
Correspondlying, the energy function the feed-forward process of the model essentially optimizes would be E [Equation] Z , k ) =
∥
Z − Z ( k ) ∥ [Equation] F , which only counts for the local consistency term and ignores the global information.
GCN.
Graph Convolution Networks (Kipf & Welling, 2017) define a convolution operator on a graph
G =
( V , E ) by multiplying the node feature matrix with D − 12 AD − 12 where A denotes the adjacency matrix and D is its associated degree matrix.
The layer-wise updating rule can be written as
[Equation]
Eq.
20 generalizes the original message-passing rule of GCN by adding an additional self-loop links with adaptive weights for different nodes.
The diffusivity matrix is defined with the observed adjacency, i.e., ˆS ( k ) =
D − 12 AD − 12 .
Though such a design leverages the geometric information from input structures as a guidance for feature propagation, it constrains the efficiency of layer-wise information flows within the receptive field of local neighbors and could only exploit partial global information with a finite number of iterations.
GAT.
Graph Attention Networks (Velickovic et al., 2018) extend the GCN architecture to incorporate attention mechanisms as a learnable function producing adaptive weights for each observed edge.
From our diffusion perspective, the attention matrix for layer-wise convolution can be treated as the diffusivity in our updating rule:
[Equation]
We notice that (cid:80) Nj =1 ˆS ( k ) ij = 1 due to the normalization in the denominator.
Therefore, the layer-wise updating can be viewed as an attentive aggregation over graph structures and a subsequent residual link.
In fact, the original implementation for the GAT model (Velickovic et al., 2018) specifies the function f as a particular form, i.e., exp( LeakyReLU ( a ⊤ [ Wz ( k ) i ∥
Wz ( k ) j ])) , which can be viewed as a generalized similarity function given trainable W , a towards optimizing a supervised loss.
F D ATASET I NFORMATION
In this section, we present the detailed information for all the experimental datasets, the pre-processing and evaluation protocol used in Section 5.
[Table]
F. N ODE C LASSIFICATION D ATASETS Cora ,
Citeseer and Pubmed (Sen et al., 2008) are commonly used citation networks for evaluating models on node classification tasks.
, These datasets are small-scale networks (with 2K ∼ 20K nodes) and the goal is to classify the topics of documents (instances) based on input features of each instance (bag-of-words representation of documents) and graph structure (citation links).
Following the semi-supervised learning setting in Kipf & Welling (2017), we randomly choosing 20 instances per class for training, 500/1000 instances for validation/testing for each dataset.
OGBN-Proteins (Hu et al., 2020) is a multi-task protein-protein interaction network whose goal is to predict molecule instances’ property.
We follow the original splitting of Hu et al.
(2020) for evaluation.
Pokec is a large-scale social network with features including profile information, such as geographical region, registration time, and age, for prediction on users’ gender.
For semi-supervised learning, we consider randomly splitting the instances into train/valid/test with 10%/10%/80% ratios.
Table 6 summarizes the statistics of these datasets.
F. I MAGE AND T EXT C LASSIFICATION D ATASETS
We evaluate our model on two image classification datasets: STL-10 and CIFAR-10.
We use all 13000 images from STL-10, each of which belongs to one of ten classes.
We choose 1500 images from each of 10 classes of CIFAR-10 and obtain a total of 15,000 images.
For STL-10 and CIFAR-10, we randomly select 10/50/100 instances per class as training set, 1000 instances for validation and the remaining instances for testing.
We first use the self-supervised approach SimCLR
(Chen et al., 2020b) (that does not use labels for training) to train a ResNet-18 for extracting the feature maps as input features of instances.
We also evaluate our model on 20Newsgroup, which is a text classification dataset consisting of 9607 instances.
We follow Franceschi et al.
(2019) to take 10 classes from
Newsgroup and use words (TFIDF) with a frequency of more than 5% as features.
F. S PATIAL -T EMPORAL D ATASETS
The spatial-temporal datasets are from the open-source library PyTorch Geometric Temporal (Rozemberczki et al., 2021), with properties and summary statistics described in Table 7.
Node features are evolving for all the datasets considered here, i e., we have different node features for different snapshots.
For each dataset, we split the snapshots into training, validation and test sets according to a 2:2:6 ratio in order to make it more challenging and close to the real-world low-data learning setting.
In details:
• Chickenpox describes weekly officially reported cases of chickenpox in Hungary from 2005 to 2015, whose nodes are counties and edges denote direct neighborhood relationships.
Node features are lagged weekly counts of the chickenpox cases (we included 4 lags).
The target is the weekly number of cases for the upcoming week (signed integers).
• Covid contains daily mobility graph between regions in England NUTS3 regions, with node features corresponding to the number of confirmed COVID-19 cases in the previous days from March to May 2020.
The graph indicates how many people moved from one region to the other each day, based on Facebook Data For Good disease prevention maps.
Node features correspond to the number of COVID-19 cases in the region in the past 8 days.
The task is to predict the number of cases in each node after 1 day.
• WikiMath is a dataset whose nodes describe Wikipedia pages on popular mathematics topics and edges denote the links from one page to another.
Node features are provided by the number of daily visits between 2019 March and 2021 March.
The graph is directed and weighted.
Weights represent the number of links found at the source Wikipedia page linking to the target Wikipedia page.
The target is the daily user visits to the Wikipedia pages between March 16 th 2019 and March 15 th 2021 which results in 731 periods.
the number of nodes ( | V | ), as well as the meaning of edges/edge weights.
[Table]
G I MPLEMENTATION D ETAILS AND H YPER - PARAMETERS G. N ODE C LASSIFICATION E XPERIMENT
We use feature transformation for each layer on two large datasets and omit it for citation networks.
The head number is set as 1.
We set τ = 0 .
5 and incorporate the input graphs for DIFF ORMER .
For other hyper-paramters, we adopt grid search for all the models with learning rate from { 0 . 0001 , 0 . 001 , 0 . 01 , 0 . 1 } , weight decay for the Adam optimizer from { 0 , 0 . 0001 , 0 . 001 , 0 . 01 , 0 . 1 , 1 . 0 } , dropout rate from { 0 , 0 . 2 , 0 . 5 } , hidden size from { 16 , 32 , 64 } , number of layers from { 2 , 4 , 8 , 16 , 32 , 64 } .
For evaluation, we compute the mean and standard deviation of the results with five repeating runs with different initializations.
For each run, we run for a maximum of 1000 epochs and report the testing performance achieved by the epoch yielding the best performance on validation set.
G. I MAGE AND T EXT C LASSIFICATION E XPERIMENT
For image and text datasets, we consider feature transformation for layer-wise updating.
The head number is set as 1.
We set τ = 0 .
These datasets do not have input graphs so we only consider learning new structures for the diffusion model.
For hyper-parameter settings, we conduct grid search for all the models with learning rate from { 0 . 0001 , 0 . 0005 , 0 . 005 , 0 . 01 , 0 . 05 } , weight decay for the
Adam optimizer from { 0 . 0001 , 0 . 001 , 0 . 01 , 0 . 1 } , dropout rate from { 0 , 0 . 2 , 0 . 5 } , hidden size from
[Figure]
G. S PATIAL -T EMPORAL P REDICTION E XPERIMENT
We do not use feature transformation for these datasets due to their small sizes and also set τ = 0 . 5 .
The head number is set as 1.
These spatial-temporal dynamics prediction datasets contain available graph structures, we consider both cases, using the input graphs and not, in our experiments and discuss their impact on the performance.
For other hyper-parameters, we also consider grid search for all models here with learning rate from { 0 . 01 , 0 . 05 , 0 . 005 } , weight decay for the Adam optimizer from { 0 , 0 . 005 } , dropout rate from { 0 , 0 . 2 , 0 . 5 } , and report the test mean squared error (MSE) based on the lowest validation MSE.
We average the results for five repeating runs and report as well the standard deviation for each MSE result.
For each run, we run for a maximum of 200 epochs in total and stop the training process with 20-epoch early stopping on the validation performance.
The data split is done in time order, and hence is deterministic.
We report the results using the same hidden size (4) and number of layers (2) for all methods.
H M ORE E XPERIMENT R ESULTS
We supplement more experiment results including extra ablation studies, hyper-parameter studies and visualization results on more datasets that are not presented in Section 5 due to the limit of space.
H. A BLATION S TUDIES
In Fig.
4 we present more experiment results for ablation studies w.r.t.
the energy function forms used by DIFF ORMER .
See discussions and analysis in Section 5.
H. H YPER - PARAMETER A NALYSIS
We plot the testing performance of several baselines and DIFF ORMER with different step size τ as the model size K increases in Fig.
See discussions and analysis in Section 5.
H. V ISUALIZATION
Fig. 6 and 7 plot the produced instance-level representations and diffusion strength estimates by the model on 20News and STL , respectively.
We observe that the diffusivity estimates tend to connect nodes with different classes, which contribute to increasing the global connectivity and facilitate absorbing other instances’ information for informative representations.
The node embeddings
[Figure]
produced by our model have small intra-class distance and large inter-class distance, making it easier for the classifier to distinguish.
Fig.
8 visualizes the diffusivity estimates on Chickenpox .
We conclude that large diffusion strength usually exists between nodes with similar ground-truth labels.
DIFF ORMER -s has more concentrated large weights while DIFF ORMER -a tends to have large diffusivity spreading out more.
DIFF ORMERa indeed learns more complex underlying structures than DIFF ORMER -s due to its better capacity for diffusivity modeling.
H. I MPACT OF M INI - BATCH S IZES ON L ARGE G RAPHS
The randomness of mini-batch partition on large graphs has negligible effect on the performance since we use large batch sizes for training, which is facilitated by the linear complexity of DIFF ORMER -s.
Even setting the batch size to be 100000, our model only costs 3GB GPU memory on Pokec.
As a further investigation on this, we add more experiments using different batch sizes on Pokec and the results are shown in Table 8. Table
[Table]
One can see that using small batch sizes would indeed sacrifice the performance yet large batch sizes can produce decent and low-variance results with acceptable memory costs.
H. C OMPARISON OF R UNNING T IME AND M EMORY C OSTS
To further study the efficiency and scalability of our model, we provide more comparison regarding the training time per epoch and memory costs of two DIFF ORMER ’s variants, GCN, GAT and
DenseGAT in Table 9.
One can see that compared to GAT, DIFF ORMER -s costs comparable time on small datasets such as Cora and WikiMath , and is much faster on large dataset Pokec .
As for memory consumption, DIFF ORMER -s reduces the costs by several times over DenseGAT, which clearly shows the efficiency of our new diffusion function designs.
Overall, DIFF ORMER -s has nice scalability, decent efficiency and yield significantly better accuracy.
In contrast, DIFF ORMER -a costs much larger time and memory costs than DIFF ORMER -s, due to its quadratic complexity induced by the explicit computation for the all-pair diffusivity.
Still, DIFF ORMER -a accommodates non-linearity for modeling the diffusion strengths which enables better capacity for learning complex layer-wise inter-interactions.
[Table]
H. I NCORPORATION OF P SEUDO L ABELS
For semi-supervised learning
[Table]
there is a line of approaches that leverage pseudo labels to augment the training data.
Our model DIFF ORMER essentially has orthogonal technical aspects compared to this line of work in that we focus on building a new encoder backbone and only train the model with a standard supervised loss on the labeled data.
This means that pseudo-label-based approaches are equally applicable for enhancing the training of our model as well as the competitors we used in our experiments.
As an initial verification of this claim
[Table]
we use the Meta Pseudo Labels (MPL)
(Pham et al., 2021) as a plug-in module to boost DIFF ORMER as well as our competitors GCN-kNN and GAT-kNN, and empirically compare the relative improvement.
Specifically, we use DIFF ORMER -s, DIFF ORMER -a,
GCN and GAT as the encoder backbone of teacher and student models, respectively, and use the
MPL algorithm to generate pseudo labels for augmenting the training data used for computing the supervised loss.
The results on CIFAR-10 and STL-10 are shown in Table 10.
As we can see, the
MPL contributes to some performance gains across all four encoders, while our two DIFF ORMER variants still maintain the superiority over the competitors.
Note also that as a proof-of-concept here we did not use an additional consistency loss that requires careful manual tuning.
However, in practice this type of more sophisticated MPL implementation could in principle be applied to further improve performance (across all models).
[Table]
[Figure]
[Figure] [Figure]