論文解讀(GIN)《How Powerful are Graph Neural Networks》

發表於2022-03-05

Paper Information

Title:《How Powerful are Graph Neural Networks?》
Authors:Keyulu Xu, Weihua Hu, J. Leskovec, S. Jegelka
Sources:2019, ICLR
Paper:Download
Code:Download
Others:2421 Citations, 45 References


Abstract

  GNN 目前主流的做法是遞迴迭代聚合一階鄰域表徵來更新節點表徵,如 GCN 和 GraphSAGE,但這些方法大多是經驗主義,缺乏理論去理解 GNN 到底做了什麼,還有什麼改進空間。

1 Introduction

  GNN 的變體均是遵循兩個步驟:鄰居聚合(neighborhood aggregation) 和 圖池化(graph-level pooling)。  

  GNN 廣泛遵循遞迴鄰域聚合(或訊息傳遞)方案,其中每個節點聚合其鄰居的特徵向量來計算其新的特徵向量。經過 $k$ 次聚合迭代後,一個節點由其轉換後的特徵向量表示,該特徵向量捕獲該節點的 $k$ 跳鄰域內的結構資訊。然後,可以通過池化來獲得整個圖的表示,例如,通過將圖中所有節點的表示向量相加。

  目前研究現狀:新 GNN 的設計大多基於經驗直覺、啟發式和實驗試驗模式。目前對 GNN 的性質和侷限性的理論理解很少,對 GNN 的表徵能力的形式化分析也有限。

  本文框架受 GNNs 和 WL 圖同質測試,(Weisfeiler-Lehman (WL) graph isomorphism test )[ Weisfeiler & Lehman, 1968]  的啟發。與 GNNs 類似,WL test 通過聚合其網路鄰居的特徵向量來迭代更新給定節點的特徵向量。使 WL test 如此強大的是它的內射聚合更新,它將不同的節點鄰域對映到不同的特徵向量。我們的關鍵見解是,如果GNN的聚合方案具有很高的表達性,並且可以建模內射函式,那麼 GNN 就可以具有與 WL test 一樣大的鑑別能力。

  本文貢獻:

    • 證明了GNN最多隻和 Weisfeiler-Lehman (WL) test 一樣有效,即 WL test 是GNN效能的上限;
    • 建立了鄰域聚合(neighbor aggregation)和圖讀出函式(graph readout functions)的條件,在這些條件下,得到的 GNN 與 WL test 一樣強大;
    • 識別了無法被流行的 GNN 變體區分的圖結構,如 GCN 和 GraphSAGE ,並且精確地描述了基於 GNN 的模型可以捕獲的圖結構型別;
    • 開發了一個簡單的神經結構,圖同構網路(Graph Isomorphism Network——GIN),並證明了它的判別、表徵能力等於 WL test 的能力;

2 Preliminaries

2.1 GNN steps

  GNN 常見的兩步走:1、聚合鄰居資訊;2、更新節點學習

  GNN 的 第 $k$ 層 表示式:

    $a_{v}^{(k)}=\text { AGGREGATE }^{(k)}\left(\left\{h_{u}^{(k-1)}: u \in \mathcal{N}(v)\right\}\right)$

    $h_{v}^{(k)}=\operatorname{COMBINE}^{(k)}\left(h_{v}^{(k-1)}, a_{v}^{(k)}\right)$

  AGGREGATE 比較典型的例子是 GraphSAGE:

  GraphSAGE 的 AGGREGATE 被定義為:

    $a_{v}^{(k)}=\operatorname{MAX}\left(\left\{\operatorname{ReLU}\left(W \cdot h_{u}^{(k-1)}\right), \forall u \in \mathcal{N}(v)\right\}\right)$

   這裡的 $MAX $ 代表的是 element-wise max-pooling 。

   GraphSAGE 的 COMBINE 為 :

    $W \cdot\left[h_{v}^{(k-1)}, a_{v}^{(k)}\right]$

   而在 GCN(Kipf & Welling, 2017) 中,AGGREGATE 和 COMBINE 整合為:

    $h_{v}^{(k)}=\operatorname{ReLU}\left(W \cdot \operatorname{MEAN}\left\{h_{u}^{(k-1)}, \forall u \in \mathcal{N}(v) \cup\{v\}\right\}\right)$

  對於 node classification 任務,node representation $h_{v}^{(K)}$ 將作為預測的輸入;對於 graph classification 任務,READOUT 函式聚合了最後一次迭代輸出的節點表示$h_{v}^{(K)}$ ,並生成 graph's representation $h_{G}$ :

    $ h_{G}=\operatorname{READOUT}\left(\left\{h_{v}^{(K)} \mid v \in G\right\}\right)$

  其中:READOUT 可以是簡單的 permutation invariant function,比如:summation,或者是更加複雜的 graph-level pooling function 。

2.2 Weisfeiler-Lehman test

  圖同構問題( graph isomorphism problem):詢問這兩個圖在拓撲結構上是否相同。

  WL test  為了辨別多標籤圖,具體步驟如下:[ 參考《Weisfeiler-Lehman(WL) 演算法和WL Test》 ]

    • 迭代地聚合節點及其鄰域的標籤;
    • 將聚合後的標籤雜湊為唯一的新標籤。如果在某次迭代中,兩個圖之間的節點標籤不同,則該演算法判定兩個圖是非同構的;

  基於 WL test 的多圖相似性判別演算法 WL subtree kernel 也被提出,圖示如下:

    

  圖示分析:如果有兩層聚合,無論是 GCN 還是 WL test,以藍色節點為例,先由其二階鄰居資訊聚合得到一階鄰居節點資訊,再由一階鄰居資訊聚合得到自己。

    • 中間圖:表示有根的子樹結構,WL測試使用它來區分不同的圖;
    • 右圖:如果 GNN 的聚合函式捕獲了鄰居的 full multiset,那麼 GNN 可以以遞迴的方式捕獲有根的子樹,其功能與WL測試一樣強大;
    • 上圖中藍色節點進行2次WL測試後的標籤可以用以藍色節點為根節點的2層子樹來表示;

3 Theoretical framework:overview

  Definition 1 (Multiset). A multiset is a generalized concept of a set that allows multiple instances for its elements. More formally, a multiset is a 2-tuple  $X=(S, m)$  where  $S$  is the underlying set of  $X$  that is formed from its distinct elements, and  $m: S \rightarrow \mathbb{N}_{\geq 1}$  gives the multiplicity of the elements.

  個人理解:思考 Multiset ,某節點 $v$ 及其鄰居集合 $\mathcal{N} (v)$ ,假設節點 $v$ 的 label 是 1 ,其 $\mathcal{N} (v)$ 對應的 label 是 1、1、2、3、4,可以把鄰居集合看成一個 Multiset 。[ 我們的目標是使得 $v$ 的表示和 鄰居集合中label 為 1 的鄰居表示相似。]

4 Building powerful graph neural networks

  作者提出 Lemma 2. 說明 WL test 是GNN效能的上限。

  Lemma 2. Let  $G_{1}$  and  $G_{2}$  be any two non-isomorphic graphs. If a graph neural network  $\mathcal{A}: \mathcal{G} \rightarrow \mathbb{R}^{d}$  maps  $G_{1}$  and  $G_{2}$  to different embeddings, the Weisfeiler-Lehman graph isomorphism test also decides  $G_{1}$  and  $G_{2}$  are not isomorphic.

  作者提出 Theorem 3:如果 GNN 中 Aggregate、Combine 和 Readout 函式是單射,GNN 可以和 WL test 一樣強大。

  Theorem 3. Let  $\mathcal{A}: \mathcal{G} \rightarrow \mathbb{R}^{d}$  be a  GNN . With a sufficient number of GNN layers,  $\mathcal{A}$  maps any graphs  $G_{1}$  and  $G_{2}$  that the Weisfeiler-Lehman test of isomorphism decides as non-isomorphic, to different embeddings if the following conditions hold:

   a) A aggregates and updates node features iteratively with

    $h_{v}^{(k)}=\phi\left(h_{v}^{(k-1)}, f\left(\left\{h_{u}^{(k-1)}: u \in \mathcal{N}(v)\right\}\right)\right)$

       where the functions $f$,  which operates on multisets, and $\phi$ are injective(單射). 

   b)  $\mathcal{A}$'s graph-level readout, which operates on the multiset of node features $\left\{h_{v}^{(k)}\right\}$ , is injective. 

4.1 Graph isomorphism network(GIN)

  為建模鄰居聚合的單射多集函式。下述 Lemma 5.  和 Corollary 6.  為闡述 sum aggregators 是單射的:

  Lemma 5. Assume $\mathcal{X}$ is countable. There exists a function $f: \mathcal{X} \rightarrow \mathbb{R}^{n}$ so that $h(X)=\sum_{x \in X} f(x)$ is unique for each multiset $X \subset \mathcal{X}$ of bounded size. Moreover, any multiset function g can be decomposed as $g(X)=\phi\left(\sum\limits _{x \in X} f(x)\right)$ for some function $\phi $.

  Lemma 5.  闡明在 "deep multiset" 和 set 上的一個重要區別是,某些在 set 上是單射的函式並不在 multist 上是單射的 ,如平均聚合器。下面 Corollary 6. 設想表示一個節點及其鄰居的通用函式的聚合方案,從而滿足 Theorem 3 中的注入條件(a)。

  Corollary 6. Assume  $\mathcal{X}$  is countable. There exists a function  $f: \mathcal{X} \rightarrow \mathbb{R}^{n}$  so that for infinitely many choices of  $\epsilon$ , including all irrational numbers,  $h(c, X)=(1+\epsilon) \cdot f(c)+\sum\limits _{x \in X} f(x)$  is unique for each pair  $(c, X)$ , where  $c \in \mathcal{X}$  and  $X \subset \mathcal{X}$  is a multiset of bounded size. Moreover, any function $g$ over such pairs can be decomposed as $ g(c, X)=\varphi\left((1+\epsilon) \cdot f(c)+\sum\limits_{x \in X} f(x)\right)$  for some function  $\varphi $.

  對於 Corollary 6. 引入多層感知機MLP,去學習 $\varphi$ 和 $f$ ,以保證單射性。最終得到基於 MLP+SUM 的 GIN 框架:

    $h_{v}^{(k)}=\operatorname{MLP}^{(k)}\left(\left(1+\epsilon^{(k)}\right) \cdot h_{v}^{(k-1)}+\sum\limits _{u \in \mathcal{N}(v)} h_{u}^{(k-1)}\right)$

  為什麼引入 MLP ,理由:MLP 可以擬合任意函式,故可以擬合出單射函式。

  在第一次迭代中,如果輸入特徵是一個 one-hot,那麼我們不需要在求加前使用 MLP,因為它們的 SUM 是單射的。

4.2 Graph-level readout of GIN 

  通過 GIN 學習的 Node embeddings 可以用於類似於節點分類、連線預測這樣的任務。對於圖分類任務,文中提出了一個“Readout”函式:給定獨立的節點的embeddings,生成整個圖的 embedding。

  Readout 模組使用 concat+sum,對每次迭代得到的所有節點特徵求和得到圖的特徵,然後拼接起來。

    $h_{G}=\operatorname{CONCAT}\left(\operatorname{READOUT}\left(\left\{h_{v}^{(k)} \mid v \in G\right\}\right) \mid k=0,1, \ldots, K\right)$

  即

    $h_{G}=\operatorname{CONCAT}\left(\operatorname{sum}\left(\left\{h_{v}^{(k)} \mid v \in G\right\}\right) \mid k=0,1, \ldots, K\right)$

5 Less powerful but still interesting GNNs

   本文研究不滿足 Theorem 3 的 GraphSAGE 和 GCN,做了兩個消融實驗:

    • 1-layer perceptrons instead of MLPs .  
    • mean or max-pooling instead of the sum.  

5.1 1-layer perceotrons are not sufficient

  Lemma 5 中的 $f$ 將不同的 multiset 對映成唯一的 embedding。儘管如此,許多現有的 GNN 反而使用 1-layer perceptron $\sigma \circ W$ ,一個線性對映,然後是一個非線性啟用函式,如ReLU。Lemma 7 表明,確實存在一些網路鄰域(multisets),而具有一層感知器的模型永遠無法區分。

  Lemma 7. There exist finite multisets  $X_{1} \neq X_{2}$  so that for any linear mapping  $W $,  $\sum\limits_{x \in X_{1}} \operatorname{ReLU}(W x)=\sum\limits_{x \in X_{2}} \operatorname{ReLU}(W x)$.

  Lemma 7. 的主要思想是,1-layer perceptrons 表現得很像線性對映,因此 GNN 層退化為對鄰域特徵的簡單求和。本文的證明建立線上性對映中缺乏偏差項這一事實之上。有了偏差項和足夠大的輸出維數,1-layer perceptrons 可能能夠區分不同的 multiset。

5.2 Structures that confuse mean and max-pooling

  現在考慮將 $h(X)=\sum\limits _{x \in X} f(x)$ 中的 sum 替換為 Mean-pooling 和 Max-pooling 將產生什麼問題。

  Mean-pooling 和 max-pooling aggregators 在某種程度上是一種好的 multiset functions [ 具有平移不變性 ],但是他們不是單射的。

  Figure 2 根據三個 aggregators 的表示能力進行了排序。

    

  三種不同的 Aggregate:

    • sum:學習全部的標籤以及數量,可以學習精確的結構資訊(不僅儲存了分佈資訊,還儲存了類別資訊);[ 藍色:4個;紅色:2 個  ] 
    • mean:學習標籤的比例(比如兩個圖示籤比例相同,但是節點有倍數關係),偏向學習分佈資訊;[ 藍色:$4/6=2/3$ 的比例;紅色:$2/6=1/3$ 的比例  ] 
    • max:學習最大標籤,忽略多樣,偏向學習有代表性的元素資訊;[ 兩類(類內相同),所以各一個  ] 

  Figure 3 說明了mean-pooling aggregators 和 max-pooling aggregators 無法區分的結構對。 

    

  在 Figure 3a 中:Every node has the same feature $a$ and $f(a)=h_a$ is the same across all nodes.

    • mean:左 $\frac{1}{2}(h_a+h_a)=h_a$ ,右:$\frac{1}{3}(h_a+h_a+h_a)=h_a$,無法區分;
    • max:左 $h_a$ , 右 $h_a$ 無法區分;
    • sum:左 $2h_a$ , 右 $3h_a$ , 可以區分;

  在 Figure 3b 中:Let $h_{\text {color }}(r \text { for red, } g \text { for green })$ denote node features transformed by $f $. 

    • mean: 左 $ \frac{1}{2}(h_r+h_g)$ ,右: $\frac{1}{3}(h_g+2h_r) $ ,可以區分;
    • max : 左 $max (h_r, h_g) $ ,右: $max (h_g, h_r, h_r) $ ,無法區分;
    • sum: 左 $sum(h_r+h_g)$ , 右 $sum(2 h_r+h_g)$ , 可以區分;

  在 Figure 3c 中:

    • mean:左 $\frac{1}{2}(h_r+h_g) $ ,右:$\frac{1}{4}(2 h_g+2 h_r) $ ,無法區分;
    • max:左 $\max (h_g, h_g, h_r, h_r)$ ,右:$\max (h_g, h_r)$ ,無法區分;
    • sum:左 $h_r+h_g$ ,右:$2 h_r+2 h_g$ ,可以區分;

5.3 Mean learns distrubutions

   旨在說明等比例 nodes ,使用 mean 是無法區分的。

  Corollary 8. Assume  $\mathcal{X}$  is countable. There exists a function  $f: \mathcal{X} \rightarrow \mathbb{R}^{n}$  so that for  $h(X)=   \frac{1}{|X|} \sum\limits _{x \in X} f(x), h\left(X_{1}\right)=h\left(X_{2}\right)$  if and only if multisets  $X_{1}$  and  $X_{2}$  have the same distribution. That is, assuming  $\left|X_{2}\right| \geq\left|X_{1}\right| , we have  X_{1}=(S, m)$  and  $X_{2}=(S, k \cdot m)$  for some $k \in \mathbb{N}_{\geq 1}$ .

5.4 Max-pooling learns sets with distinct elements

  Figure 3 中的示例說明了最大池化考慮的是一個節點與只有一個節點具有相同特性的多個節點(即,將一個 multiset 視為一個集合)。

  Corollary 9. Assume  $\mathcal{X}$  is countable. Then there exists a function  $f: \mathcal{X} \rightarrow \mathbb{R}^{\infty}$  so that for  $h(X)=\underset{x \in X}{max} f(x), h\left(X_{1}\right)=h\left(X_{2}\right)$  if and only if  $X_{1}$  and  $X_{2}$  have the same underlying set.

6 Experiments

6.1 Training set performance of GINs

    

  在訓練中,GIN 和WL test 一樣,可以擬合所有資料集,這表說了 GIN 表達能力達到了上限

6.2 Generalization ability of GNNs

    

    • GIN-0 比GIN-eps 泛化能力強:可能是因為更簡單的緣故;
    • GIN 比 WL test 效果好:因為GIN進一步考慮了結構相似性,即WL test 最終是one-hot輸出,而GIN是將WL test對映到低維的embedding;
    • max 在無節點特徵的圖(用度來表示特徵)基本無效;

7 Conclusion

  本文主要 基於對 graph分類,證明了 sum 比 mean 、max 效果好,但是不能說明在node 分類上也是這樣的效果,另外可能優先場景會更關注鄰域特徵分佈, 或者代表性, 故需要都加入進來實驗。

相關文章