{
  "File Number": "1068",
  "Title": "SizeShiftReg: a Regularization Method for Improving Size-Generalization in Graph Neural Networks",
  "3.1 Limitations": "Similarly to previous works [6, 68] we are assuming that there are some properties that determine the label of a graph and that do not depend on the size of the graph. In a scenario in which small graphs do not carry information that is relevant for solving the task on larger graphs, we do not expect our regularization to provide substantial benefits, and the best option would be to include larger graphs in the training set. In our experiments, the ratio between the average size of the graphs in the test set and the average size of the graphs in the training set is between 3 and 9. While our method shows significant performance improvements in this setting, it may show lower performance improvements when this ratio reaches much higher values.\nAlgorithm 1 Computing Regularization Loss for an Input Batch during Training Require: Coarsening ratios C, coarsening function Gc(graph, ratio) Input: Batch B of size nb, GNN model fθ\ncoarsened_batches← {} for r in C do ▷ Create a new batch of coarsened graphs for each ratio\nBatch Br ← [] for G in B do\nGcr ← Gc(G, r) Br.add(Gcr)\nend for coarsened_batches← coarsened_batches ∪Br\nend for ℓ← 0 ▷ Initialize loss for Br in coarsened_batches do\nfor i in {1, 2, . . . , nb} do embs_og = fθ(B[i]) ▷ Compute node embeddings for original graph embs_coarse = fθ(Br[i]) ▷ Compute node embeddings for coarsened version of graph ℓ← ℓ+ CMD(embs_og, embs_coarse) ▷ Compute CMD between node embeddings\nend for end for Return ℓ",
  "Reviewer Comment": "Reviewer_3: Strengths:\nThe paper proposes a regularization strategy that improves the size-generalization ability of GNNs for graph classification.\nEmpirical results show that GNN models with the proposed regularization strategy achieve comparable or better size-generalization performance than baselines.\nWeaknesses:\nThe method is straightforward and the novelty is limited. The paper combines existing coarsening techniques and an existing metric (i.e. CMD) for the regularization.\nQuestions:\nThe paper uses the SGC coarsening algorithm in the experiments. Do the authors try other coarsening methods and evaluate how the coarsening algorithm affects the regularization performance?\nLimitations:\nThe authors discuss the limitation in Sec 3.1 about the assumption that there are some size-invariant properties that determine the label.\nEthics Flag: No\nSoundness: 3 good\nPresentation: 2 fair\nContribution: 2 fair\n\nReviewer_4: Overall, the paper reads well and the proposed method is rather simple and general. Also, the problem of interest seems relevant.\nHowever, the paper lacks stronger motivation behind some design choices, such as graph coarsening algorithms and discrepancy metrics. For instance, CMD is chosen because \"it has proven to be successful and stable as a regularization term for non-linear models\". Also, the experimental setup is weak as it only includes four molecular datasets, and follows an existing setup (Bevilacqua et. al., 2021). Moreover, the analysis section provides no principled assessment of the method, mostly showing that the proposed regularization somehow affects node representations.\nStrengths\nSimplicity: the idea is somehow intuitive even though it is not theoretically grounded.\nPromising results\nWeaknesses\nLimited evaluation setup\nPoor understanding regarding the applicability of the proposal (only general comments are made in Section 3.1 --- Limitations)\nQuestions:\nAs stated in Section 3.1, the proposal assumes labels are not too sensitive to size. Is there any connection between this assumption and the chosen benchmarks? Why is the proposed method only validated using four molecular datasets?\nIt would be helpful to have an ablation study considering different discrepancy metrics. For instance, would simple distance-based metrics obtain good results?\nThe proposal seems to have the potential for improving pre-training. When evaluating existing strategies, people often split molecules according to their scaffold [1]. Showing gains to that task would increase the impact of the proposal.\nAccuracy results could go in the appendix.\nShowing training times would support the claim that the proposal incurs a 50% overhead.\n[1] https://arxiv.org/pdf/1905.12265.pdf\nLimitations:\nThe paper briefly describes the limitations of the proposal.\nEthics Flag: No\nSoundness: 2 fair\nPresentation: 2 fair\nContribution: 3 good\n\nReviewer_5: It is rare to find and review a paper which clearly presents a simple, intuitive and sensible idea to this kind of conferences. Overall, it was a pleasure to read and very clear under all aspects. The paper seems technically sound, although it is not clear how the specific choice of CKA influences the results, as it compares graph representations of original and coarsened graphs which have different dimensions (if my understanding is correct). The underlying motivations of the paper is clear and the proposed solution seems simple enough to be used in everyday research/industrial contexts. Perhaps it is not very clear what is the computational complexity of the regularization loss, and the authors may want to consider Section 4 after the experimental setup is introduced (see my first question below).\nDespite the paper being of high quality in many respects, I have serious concerns about the experimental protocol which led to the creation of Table 3, the main empirical evaluation of the paper. From lines 219-234, it emerges that most hyper-parameters where chosen from [6], which is reasonable as long as the empirical setup stays the very same.\nWhat appears definitely less reasonable and fundamentally wrong seems to be:\nusing the same settings of\nλ\nand\nC\nfor all datasets and models after looking at a single dataset (see lines 224-225) and Table 3 in the appendix B\nlack of information, either in the appendix or in the main paper, about the values of\nλ\ncross-validated against the\nvalidation\nset\nEvidence, by looking at Table 4 (caption, main paper) and Tables 2,3 (appendix B) that the hyper-parameters have been set after looking at the MCC performances on the\ntest\nset. This would mean that the authors cherry-picked the results that maximize the performances on the test, rather than choosing them on the validation set. The authors are strongly encouraged to honestly and openly comment on this; it is possible that my evaluation is incorrect, but the combination of lines 275-277 with 224-225, together with the caption of Table 4, seems to point in this direction.\nMinor comments:\nwhile one usually assumes that the coarsening ratio reflects the percentage of retained nodes, it may be helpful to explicitly write this in the paper.\nIt is known that a structure-agnostic baseline can produce state of the art results on PROTEINS, whereas it struggles on NCI1 for instance. It may have been a good idea to make an hyper-parameter study on the latter rather than the former dataset (but on the validation set)\nQuestions:\nSection 4: we have no details about the experimental procedure used here. Which lambda values have been used here to produce Table 1? Maybe it would be better to include this analysis in Section 5, so as to improve the overall organization of the paper.\nHow does the distribution over the sizes of the graphs changes after pre-processing? This analysis could be interesting in datasets where graphs' sizes greatly vary, e.g. social datasets from TUDataset benchmarks page.\nFrom Section 3.1., why not trying a single experiment with much higher coarsening ratios? This could be a nice addition to the paper. Social datasets could be a good option here as well.\nLimitations:\nLimitations of the paper mainly lie in the experimental results, which may be invalid if my argument is correct.\nEthics Flag: No\nSoundness: 3 good\nPresentation: 4 excellent\nContribution: 3 good",
  "abstractText": "In the past few years, graph neural networks (GNNs) have become the de facto model of choice for graph classification. While, from the theoretical viewpoint, most GNNs can operate on graphs of any size, it is empirically observed that their classification performance degrades when they are applied on graphs with sizes that differ from those in the training data. Previous works have tried to tackle this issue in graph classification by providing the model with inductive biases derived from assumptions on the generative process of the graphs, or by requiring access to graphs from the test domain. The first strategy is tied to the quality of the assumptions made for the generative process, and requires the use of specific models designed after the explicit definition of the generative process of the data, leaving open the question of how to improve the performance of generic GNN models in general settings. On the other hand, the second strategy can be applied to any GNN, but requires access to information that is not always easy to obtain. In this work we consider the scenario in which we only have access to the training data, and we propose a regularization strategy that can be applied to any GNN to improve its generalization capabilities from smaller to larger graphs without requiring access to the test data. Our regularization is based on the idea of simulating a shift in the size of the training graphs using coarsening techniques, and enforcing the model to be robust to such a shift. Experimental results on standard datasets show that popular GNN models, trained on the 50% smallest graphs in the dataset and tested on the 10% largest graphs, obtain performance improvements of up to 30% when trained with our regularization strategy.",
  "1 Introduction": "Graph structured data are found in a large variety of domains, ranging from social networks, to molecules and transportation networks. When dealing with graph data in machine learning settings, it is common to resort to graph representation learning [29]. Graph representation learning is the task of learning to generate vector representations of the nodes, or of entire graphs, that encode structural and feature-related information that can be used for downstream tasks. In this area, Graph Neural\n36th Conference on Neural Information Processing Systems (NeurIPS 2022).\nNetworks (GNNs) are a deep learning model for graph representation learning that has become the de facto standard for many tasks, including graph classification, which is the focus of this work.\nGNNs are designed to be able to work on graphs of any size. However, empirical results show that they struggle at generalizing to graphs of sizes that differ from those in the training data [33, 25, 6, 68]. Obtaining good size-generalization performance from smaller to larger graphs is crucial for several reasons. First, it is common for graphs in the same domain to vary in size. For example, social networks can range from tens to millions of nodes, and molecular graphs can go from few atoms, to large compounds with thousands of atoms. Second, in many scenarios, obtaining labels for smaller graphs is cheaper than for larger graphs. For example, recently deep learning is being used in combinatorial optimization problems [5], and GNNs are heavily used in this area as many problems can be formulated as graph classification instances [53, 24, 11]. Combinatorial optimization often deals with NP-hard problems, and obtaining ground truth labels can be extremely expensive for large scale graphs. Third, training on smaller graphs requires less computational resources.\nTwo approaches have been proposed in literature to tackle the poor size-generalization of GNNs. The first approach makes assumptions on the causal graph describing the generative process behind the graphs in the dataset, and then designs a model that is tailored towards such causal graph [6]. This strategy requires an explicit definition of the generative process behind the data, which, in the case of Bevilacqua et al. [6], leads to a model requiring the computation of induced homomorphism densities over all connected k-vertex subgraphs in order to make a prediction. While this strategy shows great results on synthetic graphs produced by the assumed generative process, its benefits are reduced on real-world graphs, for which the underlying generative process is unknown. The second approach assumes access to graphs coming from different domains, or from the test distribution, and applies domain adaptation techniques to transfer knowledge across domains [68, 17]. These methods do not require ad-hoc models, but require knowledge about each graph’s domain, or access to the test distribution, both of which are not always available or easily obtainable in advance.\nIn this work we consider the graph classification scenario in which we only have access to the training data (as in the first approach described above). However, in contrast to prior work, we do not try to improve the size-generalization capabilities (from smaller to larger graphs) of GNNs by handcrafting models on the base of specific knowledge or assumptions, but we study a general form of regularization that can be applied to any GNN, and that aims at letting the model learn to\nbe robust to size-shifts. The idea behind our regularization is to simulate a shift in the size of the training graphs, and to regularize the model to be robust towards this shift. The size-shift simulation is obtained using graph coarsening techniques, while the regularization is performed by minimizing the discrepancy between the distributions of the node embeddings generated by the GNN model for the original training graphs and their coarsened versions (an overview is shown in Figure 1).\nIn the experimental section we evaluate GNN models on popular benchmark datasets using a particular train/test split designed to test for size-generalizaiton. In particular, following [68, 6], we train on the 50% smallest graphs and test on the 10% largest. This split leads to an average size of the test graphs which is 3 to 9 times larger than the average size of the training graphs. Our results show that our regularization method applied to standard GNN models (GCN [36], PNA [15], GIN [65]) leads to an average performance improvement on the test set of up to 30% across datasets. Furthermore, these performance improvements show that standard GNN models trained with our regularization can achieve better size-generalization performance than more expensive models. The latter more expensive models were designed after making explicit assumptions on the generative process behind the graphs in the dataset [6], while our method relies on learning to be robust towards size-shifts.\nOur contributions. Our contributions are threefold. (1) We propose a regularization strategy that can be applied to any GNN to improve its size-generalization capabilities on the task of graph classification. (2) We analyze the impact that our strategy has on the embeddings generated by a GNN. (3) We test our strategy on popular GNN models, and compare against previously proposed methods, showing that “standard” GNN models augmented with our regularization strategy achieve comparable or better size-generalization performance than more complex models designed after explicit assumptions on the generative process behind the data.",
  "2 Preliminaries": "Notation. Let G = (V,E) be a graph, where V is the set of nodes with size n, and E ⊆ V × V is the set of edges. For a node v ∈ V , we use Nv to indicate the set of its one-hop neighbours (i.e., the nodes connected to v by an edge). We represent an attributed graph G with a tuple (A,X), where A ∈ {0, 1}n×n is the adjacency matrix (i.e., the element in position i, j is equal to 1 if there is an edge between nodes i and j, and zero otherwise), and X ∈ Rn×d is the feature matrix, where the i-th row, Xi, contains the d-dimensional feature vector for node i.",
  "2.1 Graph Neural Networks": "Most popular Graph Neural Networks (GNNs) [12, 64] models follow the message-passing paradigm [26]. Let H(ℓ) ∈ Rn×d′ be the matrix containing the node representations at layer ℓ (i.e., the representation for node i is contained in the i-th row H(ℓ)i ), with H\n(0) = X. Given an aggregation function Φ, which is permutation invariant, and a learnable update function Ψ (usually a neural network), a message passing layer updates the representation of every node v as follows:\nH(ℓ+1)v = Ψ(H (ℓ) v ,m (ℓ) v ), with m (ℓ) v = Φ({H(ℓ)u ∀u ∈ Nv}) (1)\nwhere mv represents the aggregated message received by node v from its neighbours. After L message-passing layers, the final node embeddings H(L) are used to perform a given task (e.g., they are the input to a network performing the task), and the whole system is trained end-to-end.",
  "2.2 Graph Coarsening": "Given a graph G = (V,E), a coarsened version Gc = (V c, Ec) is obtained by partitioning V and grouping together the nodes that belong to the same subset of the partition. More formally, given a partition P = {S1, S2, . . . , Sn′} where Si ⊆ V , Si ∩ Sj = ∅, ⋃ i Si = V , we associate a node si to each subset Si and let V c = {s1, s2, . . . , sn′} and Ec = {(si, sj) | there is a node in Si connected to at least one node in Sj}. The goal of graph coarsening is to generate a coarsened version of a graph (i.e., n′ < n) such that specific properties are preserved. For instance, Loukas and Vandergheynst [45] aim at preserving the principal eigenvalues and eigenspaces, while Jin et al. [32] aim at minimizing a distance function that measures the changes in the structure and connectivity that occur in the coarsening process. Jin et al. [32] further prove that their algorithm bounds the spectral distance [35] between the original and a “lifted” version of the coarsened graph.",
  "2.3 Central Moment Discrepancy": "The Central Moment Discrepancy (CMD) [70] is a metric used to measure the discrepancy between the distribution of high-dimensional random variables. Let p and q be two probability distributions with support in the interval [a, b]d and let ck be the k-th order moment, then the CMD between p and q is defined as:\nCMD(p, q) = 1 |b− a| ∥E(p)− E(q)∥2 + ∞∑ k=2\n1\n|b− a|k ∥ck(p)− ck(q)∥2 . (2)\nAt a practical level, we follow Zhu et al. [72], and limit the number of considered moments to 5. To align with the definition of CMD it is possible to treat node embeddings as realizations of bounded high dimensional distributions by applying bounded activation functions like tanh or sigmoid at the embeddings layer (as done in [70, 72]).",
  "3 Our Method": "The high level idea behind our method is to “simulate” a size-shift in the training dataset, and to regularize the GNN to be robust to this shift (an overview is shown in Figure 1). While previous works rely on models that incorporate domain-specific inductive biases and/or are tied to assumptions on the generative process of the data, our method aims at learning to be robust towards size-shifts.\nSimulating the shift. Let Gc : (G, r)→ Gcr be a coarsening function, that takes as input a graph G with n nodes and a ratio r ∈ (0, 1), and returns a coarsened version of the graph, Gcr, which has ⌊r × n⌋ nodes. Our method is not bound to a specific coarsening function Gc, any existing method can be used, e.g. [45, 43, 32]. Our method then proceeds in the following way: given a dataset of graphs D = {G1, G2, . . . , Gℓ}, a coarsening function Gc, and a set of k coarsening ratios C = {r1, r2, . . . , rk}, we create a coarsened datasetDrj for each ratio by applying the coarsening function to each graph in the dataset: Drj = {Gcrj ,1 = Gc(G1, rj), Gcrj ,2 = Gc(G2, rj), · · · , Gcrj ,ℓ = Gc(Gℓ, rj)},∀j = 1, 2, . . . , k. When the graph is attributed, we obtain the features for each node of the coarsened version of the graph by aggregating the features of the corresponding nodes in the original graph using simple aggregations (e.g., mean, max, sum), as commonly done in readout functions for GNNs [64].\nRegularizing the GNN. Given the graph dataset D, its coarsened versions Dr1 ,Dr2 , · · · ,Drk , and a GNN fθ, where θ are the parameters, we aim at regularizing the GNN so that the distribution of the node embeddings generated by the model for the graphs in the original dataset and their coarsened version is similar. In other words, for a given graph, we want the model to generate a distribution of node embeddings that is robust across different coarsened versions of the graph. In more detail, we regularize a GNN by minimizing the CMD [70] between the distribution of the node embeddings generated by the GNN for the original graph and the distribution of the node embeddings generated by the GNN for the coarsened version(s) of the graph. We choose CMD as it has proven to be successful and stable as a regularization term for non-linear models [42, 72]. Formally, let L be the supervised loss function that is used to train the model (e.g. cross entropy for classification), and let λ be a term measuring the strength of the regularization. Our optimization problem is\nargmin θ L+ λLsize, where Lsize = k∑ j=1 ℓ∑ i=1 CMD(fθ(Gi), fθ(Gcrj ,i)). (3)\nOur method is model-agnostic, and can hence be applied to any GNN.\nPseudocode and practical aspect. Algorithm 1 presents the pseudocode for computing our regularization loss for a batch of graphs during training. The pseudocode is presented in an extended manner for clarity, but at a practical level, the coarsened versions of the training graphs are pre-computed before training, and the computation of the loss is done in a vectored manner so it is computed concurrently for all graphs in the batch in one pass (i.e., we do not iterate through the graphs in the batch). At a practical level, in our experiments we notice that training a model with our regularization introduces a 50% overhead in the running time for a training epoch w.r.t. training the same model without regularization.",
  "4 Analysis of Node Embeddings": "Before evaluating how our regularization impacts the size-generalization performance of a model, we analyze the effects that our regularization has on the embeddings generated by the model. In order to do this, we consider two identical GIN [65] models and we train one with our regularization and one without. We then use these models to generate node embeddings and use the Central Kernel Alignment (CKA) [38] to study the generated representations, similarly\nto [34]. CKA takes as input two matrices A ∈ Rm×d′ , B ∈ Rm×d′′ of representations and provides a value between 0 and 1 quantifying how aligned the representations are (allowing for d′ ̸= d′′). CKA quantifies the similarity of representations learned by (possibly) different models and gives us a way to study the effects of our regularization. We report results averaged over 10 different random seeds. We show only results for the DD dataset for space limitations, but the same trends are observed for the other datasets (see Appendix).\nFirst, we ask if a model trained with our regularization and a model trained without our regularization produce similar node embeddings. To compare the node embeddings between the two models we obtain a representation for each graph by concatenating the node embeddings for that graph. We then compute the CKA between the representations generated by the model trained with regularization and the representations from model trained without regularization. We do this for the original graphs and the coarsened versions of the graphs, and report the average CKA. Results shown in Table 1 highlight that there is low alignment between the embeddings generated by a model trained with regularization and one trained without regularization (the average CKA across datasets is 0.48 for the original graphs). This is even more apparent for the coarsened graphs, showing that our regularization\nis impacting the way a model generates embeddings, especially for size-shifted versions of the graphs. To analyze the trend more in detail, we also plot the CKA values across coarsening ratios in Figure 2 (a). Here we notice that the CKA between the embeddings generated by a model trained with our regularization and a model trained without, decreases significantly with ratios lower than 0.8. This shows that, while the alignment between the representations learned by the models trained with and without our regularization is low even for a coarsening ratio of 0.9 (average CKA value is 0.47), it becomes 15% lower (on average) for ratios smaller than 0.7, indicating that when the size shift is strong, there is a stronger misalignment between models trained with and without regularization.\nSecond, we ask if a model trained with our regularization is in fact being more robust to size shifts with respect to a model trained without our regularization. To answer this question we analyze the alignment between the representations generated by the same model, trained with or without regularization, on original graphs and coarsened versions of the graphs. In Figure 2 (b) we plot the average CKA between the node embeddings for the original graphs and the node embeddings for the coarsened versions of the graphs, both generated by the same model, for different ratios. The plot shows that a model trained with our regularization is learning to be more robust to size shifts, as its representation for coarsened versions of the graphs are much more aligned to the representations for the original graphs compared to a model trained without regularization. This is even more apparent for low coarsening ratios (i.e., when the shift is stronger), indicating that our regularization is in fact making the model more robust to size shifts.",
  "5 Evaluation": "Datasets. Following prior works [6, 68], we evaluate on datasets from the TUDataset library [48] with a train/test split explicitly designed to test for size-generalization. In particular, the training split contains the graphs with size smaller or equal than the 50-th percentile, and the test split contains graphs with a size larger or equal than the 90-th percentile. With this split, the average size of the test graphs is 3 to 9 times larger than the average size of the training graphs (in more detail, it is 3 for NCI1 and NCI109, 9 for PROTEINS, and 5 for DD). We use 10% of the training graphs as a validation set. More details on the datasets can be found in the Appendix.\nModels. As in Bevilacqua et al. [6], we consider three standard GNN models: GCN [36], GIN [65], and PNA [15], a more expressive GNN: RPGNN [49], and two graph kernels: the Graphlet Counting kernel (GC Kernel) [58], and the WL Kernel [59]. We further apply the Invariant Risk Minimization (IRM) [1] penalty to the standard GNN models, and compare against the E-Invariant models (Γ1-hot,ΓGIN,ΓRPGIN) introduced in Bevilacqua et al. [6]. For IRM, we follow [6], and\nartificially create two environments: one with graphs with size smaller than the median size of the graphs in the training set, and one with graphs with size larger than the median size in the training set.\nHyperparameters and Evaluation Protocol. For the standard GNN models we adopt the same hyperparameters of Bevilacqua et al. [6], which were obtained from a tuning procedure involving number of layers, learning rate, batch size, hidden layers dimension, and regularization terms. All models are trained with early stopping (i.e., taking the weights at the epoch with best performance on the validation set). We do not modify the original hyperparameters when we apply our regularization. We tune the regularization coefficient λ and the coarse ratios C for GIN on the PROTEINS dataset (we found λ = 0.1 and C = {0.8, 0.9} to be the best on the validation set), and we apply these settings to all models and datasets when using our regularization, to show that our method can work without extensive (and expensive) hyperparameter tuning. We use the SGC coarsening algorithm [32] to obtain the coarsened versions of the graphs (chosen for its theoretical properties). The only hyperparameter that is tuned on a per-dataset basis is the aggregation strategy used to obtain the features for the nodes in the coarsened versions of the graphs (in particular we take the best performing between ‘sum’, ‘max’, and ‘mean’). For all other models we use the hyperparameters introduced by their respective papers. Bevilacqua et al. [6] presented results by averaging over 10 runs (each time with a different random seed), but given the high variance observed, we re-run the experiments for all the models and present the results averaged over 50 runs. More details on the hyperparameters can be found in the Appendix and source code is publicly available1.",
  "5.1 Results": "Table 2 shows how the three considered standard GNN models perform on the test set, containing the 10% largest graphs in the dataset, when trained with and without our regularization on the 50% smallest graphs in the dataset. As this split leads to an imbalanced dataset, we follow previous works and report the results in terms of Matthews correlation coefficient (MCC), which has been shown\n1https://github.com/DavideBuffelli/SizeShiftReg\nto be more reliable in imbalanced settings with respect to other common metrics [14]. MCC gives a value between −1 and 1, where −1 indicates perfect disagreement, 0 is the value for a random guesser, and 1 indicates perfect agreement between the predictions and the true labels. The results show that the use of the proposed regularization is always beneficial to the performance of the models, and that it leads to an average improvement across datasets of 21 to 30%.\nIn Table 3, we compare the standard GNNs trained with our regularization strategy against more expressive models (RPGNN), graph kernels, models trained with the IRM strategy, and the E-invariant models. We notice that on 3 out of 4 datasets, a “standard” GNN trained with our regularization obtains the best performance on the test set composed of graphs with size larger than those present in the training set. Furthermore on all datasets there is at least one model trained with our regularization in the top-3 best performing models. We also confirm previous results [6, 17] showing that IRM is not effective in the graph domain, and that using theoretically more expressive\nmodels, like RPGNN, does not necessarily lead to good size-generalization performance. Graph kernels are highly dataset-dependent, and, while they can perform well for some datasets, in many cases they fail to perform better than a random classifier. Perhaps more surprisingly, on 3 out of 4 datasets there is at least one “standard” GNN trained with our regularization that performs comparably or better than the best E-Invariant model. In fact, E-invariant models are tied to the assumed causal model for the generation of graphs, which is not guaranteed to hold reliably for real-world datasets for which we do not have this kind of information. Futhermore, E-invariant models require the computation of induced homomorphism densities over all possible connected k-vertex subgraphs both at training time and at test time. Our method instead tries to learn to be robust to size-shifts, does not require any additional computation at inference time, and yet can lead even simple models like GCN to have size-generalization performance comparable to E-invariant models.\nFinally, in addition to the benchmarks considered by Bevilacqua et al. [6], we also experiment on a dataset from a different domain. In particular, we consider a social network dataset obtained from Deezer [55]. We follow the same evaluation strategy as before: train on the 50% smallest and test on the 10% largest, and we apply our regularization with λ = 0.1 and C = {0.8, 0.9} without any additional hyperparameter tuning. Results shown in Table 4 confirm the effectiveness of our method.",
  "5.2 Ablation Study": "In this section we use a PNA model to study the contribution and importance of the different components of our regularization. We choose PNA because of its performance in the previous analysis, but similar conclusions are observed for GIN and GCN (as we report in the Appendix).\nChanging Size of Coarsened Graphs. In Table 5 we train a PNA model with our regularization strategy using different coarsening ratios C. We notice an overall trend in which the performance decreases as the coarsening ratio decreases. This follows intuitively as very low coarsening ratios may lead to uninformative graphs. Furthermore we notice that using all ratios (from 0.1 to 0.9) is usually not effective and setting C = {0.8, 0.9} seems a good default option, leading to the best performance on 3 out of 4 datasets.\nChanging Coarsening Method. In Figure 3 we show how the performance of a PNA model change when it is regularized with our method using graphs coming from different coarsening functions. We consider Spectral Graph Coarsen-\ning (SGC) and Multi-level Graph Coarsening (MLGC) introduced by Jin et al. [32], and two baselines, referred to as SC and KMEANS, based on standard spectral clustering [28] and K-Means clustering [40]. For the baselines we apply the clustering algorithm, merge the nodes belonging to the same cluster into a single super-node, and create an edge between two super-nodes if there is at least one edge in the original graph going from a node in one cluster to the other. For all coarsening methods we use the same coarsening ratios as above (i.e., C = {0.8, 0.9}), and we apply the same training procedure and regularization weight λ, keeping all hyperparameters equal across methods. We notice that our regularization strategy is quite robust towards the choice of the coarsening method, but, on average, specialised methods like SGC and MLGC tend to provide the best results.",
  "6 Related Work": "Graph neural networks and size-generalization. Since the first instances of graph neural networks have appeared [60, 57], the field has exploded in recent years with a plethora of different architectures (e.g., [36, 65, 15, 62]), applications (e.g., [69, 67, 37, 23, 8]), and studies on their expressivity and properties (e.g., [65, 44, 47, 9]). For a complete review of the field, we refer to the excellent surveys by Chami et al. [12] and by Wu et al. [64]. Many works have noticed poor size-generalization in GNNs [33, 25, 6, 68]. For instance, Joshi et al. [33] consider the task of learning solutions for the traveling salesman problem, and show that GNNs struggle at generalizing to graphs larger than those appearing in the training set. Similarly, Gasteiger et al. [25] observe that GNNs applied to the molecular domain can be very sensible to several shifts in the data, including shifts in the size of the graphs. Some works have reported good size-generalization by creating ad-hoc models that leverage the properties of the domain [2, 3, 56, 61, 22]. For example, Tsubaki and Mizoguchi [61] impose constraints dictated by the physical properties of their data, and report good size-generalization in predicting the energy of a molecule. While these works show that placing the right inductive biases can help the size-generalization capabilities of GNNs, the current literature is lacking a general method that can be applied on generic GNNs.\nBevilacqua et al. [6] tackle the issue of poor size-generalization by assuming a causal model describing the generative process for the graphs in the dataset, and designing a specific model which can be invariant to the size of the graphs obtained through this causal model. While this strategy shows great size-generalization capabilities on synthetic graphs generated according to their causal model, its benefits decrease when applied to real-world graphs where there are no guarantees that the causal model is correct. This method requires an ad-hoc model and additional computations at both train and test time, while our method can be applied on any GNN and does not require pre-computations at test time. Yehudai et al. [68] provide a theoretical and empirical analysis showing that, even for simple tasks, it is not trivial to obtain a GNN with good size-generalization properties. Yehudai et al. [68] consider a different scenario from ours, as, together with the labelled training graphs, they assume access to graphs from the test distribution, and treat the task as a domain-adaptation scenario.\nGraph coarsening. While there is no consensus on what is the best metric to consider for coarsening a graph, many methods and metrics have been proposed in recent years [45, 43, 18, 7, 32]. There have also been some attempts at using GNNs for the task of graph coarsening [10, 46]. Orthogonally, graph coarsening has been used to reduce the computational resources needed for training GNNs on large graphs [71, 31]. For a detailed presentation of graph coarsening we refer to Chen et al. [13].\nInvariant risk minimization, domain adaptation, and regularization with discrepancy measures. Our method is conceptually related to Invariant Risk Minimization (IRM) [1], which aims at learning representations that are invariant across training environments (where different training environments are intended as sets of data points collected under different conditions). IRM has been shown to have several shortcomings, specially when the data comes from a single environment (e.g. when there is access only to small graphs) [54, 6]. Our method does not require access to different training environments, which may not be easy to obtain in practical scenarios, and our results show that, as also observed in [6, 17], IRM seems ineffective for improving size-generalization in GNNs.\nSimilarly to IRM, the field of domain adaptation [4] subsumes access to (unlabelled) external data, in addition to labelled training data, and aims at transferring knowledge between domains. Domain adaptation has been used in a large variety of fields, and many surveys are available [16, 63, 27]. Ding et al. [17] analyze how existing domain adaptation algorithms perform on graph data, and observe that these tend to not be effective, indicating that new methods specific for graph data are needed.\nDiscrepancy measures that have been used for regularizing deep learning models are the Maximum mean discrepancy (MMD) [19, 41, 66, 42] and the central moment discrepancy (CMD) [52, 70, 72], which has been shown to be empirically more effective. We further mention the work by Zhu et al. [72] which, similarly to ours, uses CMD to obtain a GNN that is robust to biases in the sampling process that is used to select the nodes for the training set in node classification scenarios. Finally, we mention the work by Joshi et al. [34] which uses CMD to study the representations of GNNs.",
  "7 Conclusions": "GNNs are heavily used models for the task of graph classification. In many domains it is typical for graphs to vary in size, and while GNNs are designed to be able to process graphs of any size, empirical results across literature have highlighted that GNNs struggle at generalizing to sizes unseen during training. In this work we introduce a regularization strategy that can be applied on any GNN, and that improves size-generalization performance from smaller to larger graphs by up to 30%.\nAcknowledgments and Disclosure of Funding\nThe authors thank Chaitanya Joshi and Iulia Duta for the great feedback provided on earlier versions of the paper.\nThis work is supported, in part, by the Italian Ministry of Education, University and Research (MIUR), under PRIN Project n. 20174LF3T8 “AHeAD” and the initiative “Departments of Excellence” (Law 232/2016), and by University of Padova under project “SID 2020: RATED-X”.",
  "Reviewer Summary": "Reviewer_3: The paper focuses on how to generalize GNNs to graphs of different sizes in graph classification. Previous works either add an ad-hoc strategy or require access to test graphs. In this work, the authors propose a regularization method based on graph coarsening techniques to improve the size-generalization of GNNs for graph classification. Empirical results show that the performance will be improved up to 30% with the proposed regularization method.\n\nReviewer_4: The paper proposes a new regularization strategy for improving size generalization in GNNs. The high-level idea consists of applying coarsening algorithms to original training data and then enforcing node embeddings from the original graph and coarsened ones to be closer. The paper considers four benchmarks for graph classification to assess the effectiveness of the proposal.\n\nReviewer_5: This paper presents a simple and intuitive regularization technique to make graph networks generalize better to graphs with different sizes, by employing coarsened representations of the same graph and encouraging alignment of node embeddings between such graphs.\nEDIT after rebuttal:\nI thank the authors for clarifying important aspects of the evaluation procedure. It appears my assumptions were incorrect. I therefore recommend that the paper is accepted, as it provides a simple, clear, novel and effective mechanism to tackle an interesting problem for the graph machine learning community, something which is rare these days."
}