{'fraction_non_alphanumeric': 0.03234048766243247, 'fraction_numerical': 0.008577894583150825, 'mean_word_length': 4.793402410657644, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Graph Condensation via Receptive Field Distribution Matching

Graph neural networks (GNNs) enable the analysis of graphs using deep learning, with promising results in capturing structured information in graphs. This paper focuses on creating a small graph to represent the original graph, so that GNNs trained on the size-reduced graph can make accurate predictions. We view the original graph as a distribution of receptive fields and aim to synthesize a small graph whose receptive fields share a similar distribution. Thus, we propose Graph Condesation via Receptive Field Distribution Matching (GCDM), which is accomplished by optimizing the synthetic graph through the use of a distribution matching loss quantified by maximum mean discrepancy (MMD). Additionally, we demonstrate that the synthetic graph generated by GCDM is highly generalizable to a variety of models in evaluation phase and that the condensing speed is significantly improved using this framework.


Introduction
Many real-world datasets, including social networks, molecular interactions, and recommendation systems are graphstructured. Recently, a substantial line of research on graph neural networks (GNNs) enables the analysis of graphs using deep learning, with promising results in capturing structured information in graphs.
Numerous real-world graphs are large-scale, containing millions of nodes and trillions of edges. Due to the noneuclidean nature of the network and the complicated dependencies between nodes, training a GNN over a large graph can be very expensive. More specifically, we often need to train a GNN multiple times on the same graph to validate the design choices made when tuning the hyperparameters, searching the architecture, and so on, or when considering the continual learning scenario. As a consequence, there is a considerable interest in techniques that reduce the computational cost of training multiple GNNs on the same graph without losing the performance.
To address these issues, this paper focuses on creating a small but informative graph to represent the original graph, so that GNNs trained on the size-reduced graph can make accurate predictions on the original graph.
Graph sparsification and graph coarsening are two well-known techniques for graph simplification. By reducing the number of edges, graph sparsification attempts to mimic a graph with a more sparse graph, whereas graph coarsening directly reduces the number of nodes (using a subset of the original node set). While the motive for the two techniques is self-evident, the disadvantage is equally self-evident: (1) sparsification has a diminishing effect when the graph's complexity is primarily derived from node features. (2) Both methods seek to maintain a spectral attribute of the original graph, such as the principal eigenvalues of the Laplacian Matrix, although this may not be the ideal option due to the possibility of preserving significant noise. [1] recently proposed a deep learning based method called GCOND. Its central concept is synthesizing a small graph, by minimizing the gradient matching loss between the gradients of training losses w.r.t. GNN parameters given by arXiv:2206.13697v1 [cs.LG] 28 Jun 2022 the original graph and the synthetic graph. While GCond has demonstrated advantages over traditional approaches, it has two downsides. Firstly, while minimizing the gradient matching loss, the condensation procedure is expensive due to the need of computing the second-order derivative w.r.t. GNN parameters. For example, it takes about 100 minutes (running on a single RTX8000 GPU) to condense the Ogbn-arxiv dataset to 1% by 50 epochs. Secondly, since the gradient matching loss is architecture-dependent, the condensed graph may not generalize well to new GNN architectures.
To address the aforementioned difficulty, we present Graph Condensation through receptive field Distribution Matching (GCDM). More precisely, we view the original graph as a distribution of receptive fields and aim to synthesize a small graph whose receptive fields share a similar distribution as the original graph (see Figure 1). This is accomplished by optimizing the synthetic graph through the use of a distribution matching loss quantified by maximum mean discrepancy (MMD). In contrast to GCOND, our condensation loss does not rely on the training loss of optimizing parameters of a specific GNN. Therefore, the condensed graph can be used for training various GNN models. Furthermore, it avoids computing the second-order gradient w.r.t. the GNN parameters, which reduces the cost of the condensation process.
The use of distribution matching method for dataset condensation has been proposed in a recent Arxiv paper by [2], which is applied to image dataset condensation. However, applying the distribution matching method to condense graph-structured datasets is more challenging due to the complex dependencies between the nodes. As an example, it is straightforward to define a data distribution given an image dataset since each image can be viewed as an independent sample. However, in a graph-structured dataset, the nodes and edges are no longer independent. We need to carefully utilize the concept of receptive field to define the distribution that we aim to match. We will introduce the details in Sec 3.
To summarize, the main contributions of our work are: • Methodology: We present a novel method for graph condensation, in which we define a distribution matching problem based on the concept of receptive fields. • Accuracy: Experimentally, we demonstrate the effectiveness of GCDM on a variety of graph datasets. GNNs trained on small graphs produced by GCDM can achieve comparable performances to those trained on the original graphs. For instance, GCDM can approximate the original test accuracy by 97.6% on Filckr, 90.6% on Ogbn-arxiv with a 99% graph size reduction, and it can approximate 99% test accuracy on Cora, CiteSeer and PubMed with a 99% graph size reduction. • Generalization ability: Our approach is broadly applicable to all GNN models, including generative invertible networks (GINs) [3], which excel in discovering pathophysiologic information. For example, we achieved accuracy of 42.2% (GCDM-X) and 42.5% (GCDM) on the Flickr dataset with GIN, compared to the benchmark approach GCOND's [1] 29.5% (GCOND-X) and 38.8% (GCOND). • Efficiency: Our method is more efficient than the present graph condensation counterpart. For instance, in order to generate a 1% synthetic graph for 50 epochs, GCDM takes an RTX8000 instance 1,782 GPU seconds while GCOND takes the same instance 5,960 GPU seconds.  Graph neural networks (GNNs) have gained increasing popularity in both research and applications due its powerful representability on graph-structured data, which enables the use of neighbor information to generate more expressive representations. [4,5,3,6,7,8]. The methodology has been implemented in various real-world applications such as recommender systems [9], computer vision [10], and natural language processing [11].

Coreset & Data Condensation
Coresets are small and highly informative weighted subsets of the original dataset that can be used to approximate its performance. Numerous works have studied the selection strategy to facilitate the efficient training of deep learning models in supervised learning scenarios. Methods include maximizing the diversity of selected sample using parameters gradients as the feature [12], approximation of the coreset and the original data distributions [13,14,15,16], incrementally choosing data point with the largest negative implicit gradient [17]. However, the coreset selection is upper-bounded by the existing features, which could potentially constrain its expressiveness. Data condensation was proposed to address the aforementioned issue since it seeks to generate new samples that incorporate more information.
Although a recently proposed gradient matching solution to data condensation seems to achieve promising performance [18], it may provide difficulties since it was designed for image data.

Graph Coarsening & Graph Sparsification.
Similar to coreset, graph coarsening is the idea to reduce the size of graph data while keeping its basic properties. [19] considered the graph reduction problem from the perspective of restricted spectral approximation while modifying the measure utilized for the construction of graph sparsifiers. Graph sparsification [20], on the other hand, tries to make a graph sparser while only removing edges. While coreset, graph coarsening, and graph sparsification methods are generally computationally efficient, they do come with their limitations. All three methods conduct greedy and incremental searches. Such searches don't guarantee global optimal. Additionally, coreset and graph coarsening both depend on the assumption that there exist highly representative samples in the original data; graph sparsification, on the other hand, makes the assumption that a large number of insignificant edges that can be removed. Both of the preceding are not always true.

Data Condensation & Graph Condensation.
In contract to data selection methods such as coreset, the goal of data condensation [21,18] is to synthesize informative samples rather than selecting from existing samples. Recently, [22] proposed matching the gradients w.r.t a neural network weights between the original data and the synthetic data. Then, [23] further reduced the computational cost by matching the distribution of the two datasets. Similar to data condensation, graph condensation seeks to generate a synthetic graph that resembles the original data. [1] recently attempted to match the network gradients of GNNs and generate an adjacency matrix for the synthetic graph using a trained multilayer perceptron. It achieved similar performance to the original graph. However, this method has limitations in terms of generalizability and computational speed.

Methodology
This section introduces our graph condensation via receptive field distribution matching framework, GCDM. We begin with a brief review of the graph condensation problem and existing approaches in Sec 3.1, and then discuss our methodology in greater detail in the followed sub-sections.

Graph Condensation Problem
Consider a graph dataset T = {A, X, Y } where A ∈ R N ×N is an adjacency matrix, X ∈ R N ×d is a matrix of node features, and Y ∈ {0, ..., C − 1} N denotes the label of nodes. The constants N, d, C are the number of nodes, the dimension of node features, and the number of classes respectively. Graph condensation aims to find a small graph .., C − 1} N and N N such that GNNs trained on S can achieve similar performances to GNNs trained on the original graph T . Therefore, this problem can be formulated as the following bi-level optimization problem, where Ψ θ denotes a GNN parameterized by θ, L denotes the training loss function (i.e cross-entropy), and θ S denotes the set of parameters obtained by minimizing the training loss on the small graph S.
Existing Solutions. Previous work on data condensation attempted to solve Eq. 1 by matching the gradient of the neural network [22], and [1] further extended this method to graph neural networks. The gradient matching objective in [1] is where P θ0 is a distribution of parameter initialization of Ψ, and D is a distance measurement.
Challenges. Optimizing Eq. 2 can result in a condensed graph that produces similar gradients as the original graph during training. However, the gradients are only guaranteed to be similar on the particular model structure Ψ θ used during the condensation. The generalization ability of training other GNN architectures on the condensed graph is not guaranteed by the objective in Eq. 2. Additionally, optimizing Eq. 2 could be very expensive because it involves computing the second order derivative w.r.t. the parameters in Ψ. In the subsequent experiment part, we will also compare the efficiency of our method to that of the gradient matching method.
Our Solution: Distribution Matching between Graphs. To overcome the above-mentioned challenges, we propose Graph Condensation via Distribution Matching (GCDM). This method is inspired by [2] which proposed to condense image datasets via distribution matching. The main idea in [2] is to synthesize a small set of images S IM G that can accurately approximate the data distribution of real images T IM G , by minimizing the maximum mean discrepancy (MMD) between them: min The method of distribution matching can be more advantages because it only compares the data distributions induced by the two datasets, without relying on the configurations in the training process. However, migrating the idea of distribution matching to condense graph-structured dataset T is not straightfoward. It is unclear how to view a graph T as a data distribution since the nodes in the graph are connected by edges, unlike images which are viewed as independent samples. In the following, we will introduce how we formulate the graph condensation problem as a distribution matching problem.

Viewing a Graph as a Distribution
Before going into the details of our proposed GCDM, we first introduce how a graph T is converted to a distribution under the context of node classification tasks.

Node classification by GNN
For a node classification dataset T = {A, X, Y }, training a GNN Ψ θ is accomplished by optimizing the classification loss over the nodes where is a loss function, ψ θ (A, X, i) is the class predicted by the GNN Ψ θ for the i-th node, and Y i is the i-th label. According to Eq. 4 and Eq. 5, we can view each pair ((A, X, i), Y i ) as an independent data point, and view the training graph as an empirical distribution P T induced by these data points: However, representing and matching such a distribution seem to be complicated, because each data point involves a large adjacency matrix A. Therefore, we make use of the concept of receptive field to simplify this distribution.

Receptive Fields of GNN
In Eq. 4, the label of node i is predicted by ψ θ (A, X, i). In fact, most GNNs only makes use of a local graph around node i to compute ψ θ (A, X, i). As an example, for a L-layer Graph Convolutional Neural Network (GCN), only the information of the target node's L-hop neighbors contributes to the representation and prediction, so as other message-passing based GNNs regardless of the specific architecture. In the literature of GNN researches, a target node's L-hop local graph is called the receptive field of a L-layer GNN (See Figure 2). In this paper, we use the notation R(i, L) to represent the receptive field of a L-layer GNN for node i. Clearly, if L is larger the the diameter of graph, then R(i, L) contains the whole graph.

Viewing a Graph as a Distribution of Receptive Fields
Given the concept of receptive fields R(i, L), we can rewrite the loss in Eq. 4 as where each pair (R(i, L), Y i ) can be viewed as an independent data point, and P L T is the empirical distribution induced by these data points: In such a way, we convert a graph T to a distribution P L T . Based on this conversion, we can then make use of the distribution matching loss to synthesize another S whose induced distribution P L S is similar to P L T .

Some Remarks.
The hop number L has an effect on the size of the receptive field since it determines how many neighbours are included. Ideally, we want L to be larger than the diameter of T , enabling the local graph to contain information of the entire graph. However, doing so will result in the following: 1) a large local graph and significant computational cost; 2) the introduction of noises 3) make the local graph indistinguishable, which is analogous to the over-smoothing problem in deep graph convolutional neural network [24,25,26]. In many real-world datasets, using a larger number of layers does not increase the prediction accuracy even when training on the original large graph. In our studies, we will use a fixed L during the condensation process, and then train the condensed graph with a L layer model where L ≤ L.
In this paper, we present GCDM under the context of node classification tasks. However, it is trivial to generalize the method to link prediction tasks.

GCDM: Graph Condensation via Receptive Field Distribution Matching
With a graph dataset T viewed as a distribution of receptive fields P L T , we aim to synthesize a small graph S whose distribution of receptive fields P L S is similar to P L T .

Synthesize the Labels Y
Recall that the small graph S = {A , X , Y } contains A ∈ R N ×N , X ∈ R N ×d , and Y ∈ {0, ..., C − 1} N with N N . To keep the class distribution of Y similar to that of Y , our method first determines the synthetic labels Y by sampling according to the class distribution in Y .

More precisely, let
be the set of nodes that are in class c in the original graph T . We sample the value of each synthetic label Y j independently from the following categorical distribution: where r c denotes the class ratio. After the synthetic labels Y are sampled, we can define as the set of nodes that are in class c in the synethetic graph S.

Synthesize A and X .
Given the sampled labels Y , we further optimize A and X to minimize the distance between distributions P L S and P L T . To achieve the goal, within each class c, we optimize the maximum mean discrepancy (MMD) [27] between the distributions of receptive fields according to the two graphs: where H is a family of functions, and we use the notation R T and R S to distinguish the receptive fields in different graphs T and S. Note that when H is a reproducing kernel Hilbert space, theoretical guarantees are available in the literature. By aggregating the MMD losses across all classes, the overall condensation loss is the following weighted sum:

Parameterization and Algorithm
In this section, we introduce how to optimize the condensation loss introduced in Eq. 13. There are two main challenges. Firstly, we need to define the family of parametric function H so that the MMD loss can be computed efficiently. Secondly, we need to parameterize the adjacency matrix A in a continuous way to avoid optimizing over a combinational solution space.

Defining H by GNNs
Due to the fact that (GNNs) inherently aggregate the information from each node's receptive field, they are ideal parametric functions φ (R(i, L)) for computing the statistics of receptive fields. Therefore, in GCDM, we define the function space H via GNN models.

Parametrize A by MLP
As discussed in [1], treating A and X as independent parameters ignores the inherent relationships between graph structure and node features, which have been well accepted in the literature. Therefore, we parameterize A as a function of the synthetic node features X : where MLP ϑ is a multilayer perceptron, and [·; ·] denotes concatenation. With this parameterizaton, we optimize the parameters ϑ to find the synthetic A .

Condensation Loss in GCDM
With the function space H defined by GNNs and the matrix A parameterized as a function of node features, we can now present the actual condensation loss used in GCDM. Let Φ θ be an L-layer GNN model parametrized by θ, we solve the following optimization problem to generate the synthetic X and A : are node embeddings given by the GNN model Φ θ .

Algorithm
To solve the optimization problem defined in Eq. 15, we adopt and algorithm that alternatively update the parameters ϑ, X and θ c . The algorithm steps are lined out in Algorithm 1. When implementing this algorithm, the gradient descent step can be replaced by other optimizers.

A "Graphless" Variant: GCDM-X
Inspired by the work in [1], we provide a model variant named GCDM-X that only producing synthetic node features X and fix the structure A to be an identity matrix I. Despite the fact that it does not learn the synthetic structure, this variation appears to be competitive in experiments. The potential reason could be that the node features are very informative, and the condensed X have incorporated relevant information from the graph. Table 1: Information used during condensation, training, and testing. X and A refer to the condensed graph. GCOND-X GCOND GCDM-X GCDM

EXPERIMENTS
We conducted experiments on a range of graph datasets to evaluate the performance of GCDM. We were able to demonstrate the benefits of GCDM by comparing its performances to that of alternative baseline approaches, testing the generalizability of the condensed graphs on a variety of model architectures, running a speed comparison with the benchmark, and visualizing the condensed graphs. The information used in condensation, training and testing phase are demonstrated in Table. 1.

EXPERIMENTAL SETTINGS
Datasets. We evaluate the performance of GCDM on five graph datasets: Cora [28], PubMed [29], Citeseer [30], Ogbn-arxiv [31], and Flikcr [32]. For all these datasets, we use public splits to split them into train, validation, and test sets. Dataset statistics are summarized in Table. 2. Baselines. We compare our proposed approach to six baseline methods: (i) one graph coarsening method [33], (ii-iv) three coreset methods (Random, Herding [34]) and K-Center [35], (v) dataset condensation (DC) [22], and (vi) the recent advance: Graph Condensation for Graph Neural Networks (GCOND) [1]. It should be noted that PubMed's benchmark coarsening results and the corresponding codes are not provided. Thus, we implement coarsening according to [36]. Experiment setting. The experiment procedure consists of 3 steps: (1) given the training graph dataset, the condensation algorithm produces the condensed graph dataset; (2) train a GNN model using the condensed graph dataset and select the model using the original validation set; (3) evaluate the trained model on the original test dataset. Only the step (1) will be different for different condensation methods. After obtaining the condensed graph, the followed steps (2) and (3) are the same for all methods.

Test Accuracy Comparison
To evaluate whether the GNN trained on the condensed graph can perform well on the test set in the original graph, we report the test accuracy for each method in Table. 3. The results in this table are achieved by using a two-layer GCN to perform training and testing after the condensation procedure. For the GCOND benchmark [1], the GNNs utlized during condensation vary according to the datasets, with the authors making the decisions; For GCDM, we use a two-layer GCN while condensing under the GCDM-X framework and a two-layer SGC while condensing under the GCDM framework. The latter SGC was chosen to conserve GPU memory and improve the speed of condensing. Table. 3 summarizes the node classification performance, from which the following observations are made: Obs 2. Learning X solely can also result in good performance. Similar to what was reported in GCOND, we observed that GCDM-X often achieves close performance to GCDM. In some cases, GCDM-X even works better. The reason could be that X has already encoded node features and structural information of the original graph during the condensation process, or that the node features are very informative in real-world datasets.
Obs 3. Larger sample size leads to improved performance. The authors of GCOND [1] reported that increasing the size of the condensed graph doesn't necessarily improve performance. It is stated that once the condensation ratio reaches a certain value, the performance stops improving. In our experiments, we find the performance improves as the size of the condensed graph increases. This may attribute to the inherent property of distribution matching. Larger graph sizes allow for more sample points to mimic the distribution of the original graph. When the distribution of the original graph becomes more complicated, additional sample points may be required to approximate the distribution. It enables the synthetic graph generated by our method to encapsulate additional information from the original graph. Notably, our method under-performs GCOND on Ogbn-arxiv with the same condensation ratio. However, when we run a experiment with a 1% condensation rate, we obtain a test accuracy of 64.9%.

GENERALIZED PERFORMANCE
In this section, we determine whether or not a graph condensed using a particular GNN architecture can generalize to other GNN models during the evaluation phase. For the experiments in this section, we use GCN during the condensation procedure for both GCOND and GCDM. After the condensed graphs are obtained, we perform training and testing using various models including: GIN [3], MLP [37], APPNP [6], Cheby [8], GCN [30], SAGE [7], and SGC [38]. The test accuracies on the two largest datasets, Flickr and ogbn-Arxiv, are summarized in Table. 4. We can observe consistent improvement in comparison to GCOND, most notably when SAGE and GIN are used. One reason that GCDM outperforms GCOND in terms of generalization ability is that GCOND utilizes gradients during a single model training process, which may not translate well to another training process. It should be noted that the abnormal GIN performance in the table was obtained by execution of the original GCOND program.

SPEED PERFORMANCE
This section examines and compares the condensing speeds of GCOND and GCDM. The overall condensation algorithm of GCOND (see Algorithm 1 in [1]) has a very similar structure to GCDM (Algorithm 1) except that their condensation losses are different. Therefore, we report the time required to run 50 epochs (M = 50 in Algorithm 1) on the ogbn-arxiv dataset for both GCDM and GCOND in Table. 7. Note that to achieve the performances reported in Table. 3, GCOND needs to run for around 200 epochs, and GCDM runs for less than 150 epochs. As the size of the condensed graph increases, the time required for GCOND increases considerably faster than that of GCDM. (a) Cora 10 NPC (b) Citeseer 10 NPC (c) Flickr 30 NPC (d) Pubmed 10 NPC (e) ogbn-Arxiv 20 NPC Table 6: Some condensed graph could produce more visually clustered results compared to GCOND. NPC: Node Per Class.

VISUALIZATION OF CONDENSED GRAPHS
We utilize T-SNE [39] to embed the the condensed graph's node features in two dimensions and present the resulting visualizations in Table. 6. As shown, the condensed node features occasionally exhibit a more clustered pattern compared to the visualizations of GCOND [1], as demonstrated by the condensed nodes for Cora, CiteSeer, and Pubmed. While the patterns of other datasets such as Flickr and Ogbn-arxiv are not as immediately discernible, similar to the visualizations presented by GCOND.

CONCLUSION
In this paper, we investigate a novel methodology called GCDM for generating a small synthetic graph from a large and complex graph. The GCDM framework is implemented by optimizing the synthetic graph using a distribution matching loss measured by maximum mean discrepancy (MMD). Through the proposed framework, we are able to obtain comparable evaluation performance to the original graph. The synthetic graph is also generalizable to a variety of downstream models. This enables neural architecture search and hyperparameter tuning to be done in a highly efficient way. Additionally, the improvement in condensation speed is demonstrated, allowing greater flexibility in a model-retraining setting.