Adversarial Graph Contrastive Learning with Information Regularization

https://dl.acm.org/doi/pdf/10.1145/3485447.3512183

Adversarial Graph Contrastive Learning with Information Regularization,2022,WWW

总结: 个人觉得这篇文章创新性是比较强的,第一次看到这种将对抗训练引入对比学习中的文章,对抗训练和对比学习结合的方式也比较新颖。关于信息正则化项的理论分析,思路也很清晰,容易看懂,值得借鉴。

实验部分内容不多,但是相对比较完整,ARIEL性能也还不错。

1. 简介

1.1 摘要

Contrastive learning is an effective unsupervised method in graph representation learning. Recently, the data augmentation based contrastive learning method has been extended from images to graphs. However, most prior works are directly adapted from the models designed for images. Unlike the data augmentation on images, the data augmentation on graphs is far less intuitive and much harder to provide high-quality contrastive samples, which are the key to the performance of contrastive learning models. This leaves much space for improvement over the existing graph contrastive learning frameworks. In this work, by introducing an adversarial graph view and an information regularizer, we propose a simple but effective method, Adversarial Graph Contrastive Learning (ArieL), to extract informative contrastive samples within a reasonable constraint. It consistently outperforms the current graph contrastive learning methods in the node classification task over various real-world datasets and further improves the robustness of graph contrastive learning.

在图表示学习中,对比学习是一种有效的无监督方法。最近,基于数据增强的对比学习方法被研究人员从图像扩展到图学习中。然后,现有的大多数工作直接改变为images设计的方法。和图像上的数据增强不同,图上的数据增强不够直观,并且通常很难获取到高质量的对比样本,但这是对比学习模型的关键。因此现有的图对比学习框架存在很大提升空间。本文,我们通过引入一个对抗图视角和信息正则化,提出了一种简单但有效的方法ArieL,可以在合理的约束下获得信息丰富的对比样本。对于节点分类任务,在现实世界多个数据集上,我们的方法都优于现有GCL方法,并且鲁棒性更好。

1.2 本文工作

背景: 对比学习被广泛应用于各类图表示学习任务,其底层思想在于最小化正样本对之间的距离,最大化负样本对之间的距离。对比学习最先被应用于images,后来被引入图学习领域。对比学习中的一个关键步骤是数据增强,但是和images不同,在图数据中的这种增强很难被人类直观感受到,生成的图视角要么和原始图过于相似,要么和原始图差异过大。

动机: how to generate a new graph that is hard enough for the model to discriminate from the original one, and in the meanwhile also maintains the desired properties?

本文工作: 作者基于对抗训练提出了一种新的框架ARIEL。通过拓扑和节点特征上的对抗攻击,从原始图中生成一个新的view。一方面由于这种扰动是在一定约束下进行的,因此新生成的view和原始图足够相似。另一方面,这种对抗攻击可以保证新view和原始图难以区分。

在此基础上,作者还引入了一种信息正则化机制可以让ARIEL更稳定。

2. 方法

2.1 一些准备

2.1.1 图对比学习

一个通用的GCL框架就是:给定原始图GG,生成两个增强视角G1G_1G2G_2,分别在两个视角中计算节点嵌入H1=f( A1,X1)\mathrm{H}_1=f\left(\mathrm{~A}_1, \mathrm{X}_1\right) and H2=f( A2,X2)\mathrm{H}_2=f\left(\mathrm{~A}_2, \mathrm{X}_2\right)

将两个视图中的相同节点看做正样本,其他节点看做负样本。定义θ(u,v)\theta(\mathbb u, \mathbb v)用于度量样本对之间的相似度,ui=H1[i,:] and vi=H2[i,:]\mathbf{u}_i=\mathbf{H}_1[i,:] \text { and } \mathbf{v}_i=\mathbf{H}_2[i,:]表示节点嵌入。对比损失定义如下:

Lcon (G1,G2)=12ni=1n(l(ui,vi)+l(vi,ui)),l(ui,vi)=logeθ(ui,vi)/τeθ(ui,vi)/τ+jieθ(ui,vj)/τ+jieθ(ui,uj)/τ,\begin{aligned} L_{\text {con }}\left(G_1, G_2\right)&=\frac{1}{2 n} \sum_{i=1}^n\left(l\left(\mathbf{u}_i, \mathbf{v}_i\right)+l\left(\mathbf{v}_i, \mathbf{u}_i\right)\right), \\ l\left(\mathbf{u}_i, \mathbf{v}_i\right)&= -\log \frac{e^{\theta\left(\mathbf{u}_i, \mathbf{v}_i\right) / \tau}}{e^{\theta\left(\mathbf{u}_i, \mathbf{v}_i\right) / \tau}+\sum_{j \neq i} e^{\theta\left(\mathbf{u}_i, \mathbf{v}_j\right) / \tau}+\sum_{j \neq i} e^{\theta\left(\mathbf{u}_i, \mathbf{u}_j\right) / \tau}}, \end{aligned}

2.1.2 PGD攻击

Projected Gradient Descent (PGD)攻击是一种常用的攻击方式,它在每次迭代结束时,将扰动投射到感兴趣的ball上。

假设L()L(\cdot)表示损失函数,ZRn×dZ\in\mathbb R^{n\times d}表示输入矩阵。在t-th iteration,扰动矩阵ΔRn×d\Delta\in\mathbb R^{n\times d}计算方式如下:

Δt=ΠΔδ(Δt1+ηsgn(Δt1L(Z+Δt1))\Delta_t=\Pi_{\|\Delta\|_{\infty} \leq \delta}\left(\Delta_{t-1}+\eta \cdot \operatorname{sgn}\left(\nabla_{\Delta_{t-1}} L\left(Z+\Delta_{t-1}\right)\right)\right.

其中η\eta表示step size,sgn()sgn(\cdot)表示sign函数,ΠΔδ\Pi_{||\Delta||\leq\delta}在无穷范式的约束下,将扰动投影到δball\delta-ball上(这个不太懂)。

2.2 ARIEL

对抗训练通常被用在有监督学习方法中,我们看看本文作者是如何将对抗训练和对比学习相结合的。

ARIEL架构图如上图所示,结构非常简单。

  • 原始图GG,使用数据增强,生成两个增强视角G1G_1G2G_2

  • 原始图G,通过对抗训练,生成一个对抗视角GadvG_{adv}

  • 两重对比,GadvG_{adv}G1G_1进行对比,G1G_1G2G_2进行对比。和普通GCL方法相比,就多了前者。因此ARIEL的对比损失是下面这样的:

    L(G1,G2,Gadv )=Lcon (G1,G2)+ϵ1Lcon (G1,Gadv )L\left(G_1, G_2, G_{\text {adv }}\right)=L_{\text {con }}\left(G_1, G_2\right)+\epsilon_1 L_{\text {con }}\left(G_1, G_{\text {adv }}\right)

  • 红色三角形部分是嵌入相似度,也就是前面提到的信息正则化项,加了这一部分后ARIEL损失函数变成了这样:

    L(G1,G2,Gadv)=Lcon(G1,G2)+ϵ1Lcon(G1,Gadv)+ϵ2LI(G1,G2,G)L\left(G_1, G_2, G_{\mathrm{adv}}\right)=L_{\mathrm{con}}\left(G_1, G_2\right)+\epsilon_1 L_{\mathrm{con}}\left(G_1, G_{\mathrm{adv}}\right)+\epsilon_2 L_I\left(G_1, G_2, G\right)

我们发现ARIEL的逻辑非常简单,我们需要关心的只有两点:

  • 对抗视角是怎样生成的?
  • 信息正则化具体是怎样的实现的?

下面我们看看这两点在本文的具体实现。

2.2.1 对抗视角的生成

朴素地理解对抗学习就是给训练模型的过程增加一点难度,这样训练出来的模型肯定更牛一点,测试数据集上表现也就更好。

那如何增加训练难度呢?当然是让损失函数尽可能的大,这样模型肯定更难收敛,也就更难训练。在对比学习中就是下面这样:

Gadv=argmaxGLcon(G1,G)G_{\mathrm{adv}}=\arg \max _{G^{\prime}} L_{\mathrm{con}}\left(G_1, G^{\prime}\right)

对抗攻击的目标就是在图上加一点扰动,让对比损失最大。其中G1G_1是前文提到的第一个增强视角,GG'是从原始图GG中生成得到,其生成方式如下:

i,j A[i,j]A[i,j]ΔA,i,jX[i,j]X[i,j]ΔX.\begin{aligned} &\sum_{i, j}\left|\mathrm{~A}^{\prime}[i, j]-\mathrm{A}[i, j]\right| \leq \Delta_{\mathrm{A}}, \\ &\sum_{i, j}\left|\mathrm{X}^{\prime}[i, j]-\mathrm{X}[i, j]\right| \leq \Delta_{\mathrm{X}} . \end{aligned}

本文作者采用前文提到的PGD攻击来生成对抗视角。令A=1n×nInA\overline{\mathrm{A}}=1_{n \times n}-\mathrm{I}_n-\mathrm{A},其中1n×n1_{n \times n}是全1矩阵。扰动后的邻接矩阵为:

Aadv=A+CLA,C=AA,\begin{aligned} \mathrm{A}_{\mathrm{adv}} &=\mathrm{A}+\mathrm{C} \circ \mathrm{L}_{\mathrm{A}}, \\ \mathrm{C} &=\overline{\mathrm{A}}-\mathrm{A}, \end{aligned}

其中LA{0,1}n×n\mathrm{L}_{\mathrm{A}} \in\{0,1\}^{n \times n}表示边的修改情况。

PGD中属性扰动如下:

Xadv=X+LX\mathrm{X}_{\mathrm{adv}}=\mathrm{X}+\mathrm{L}_{\mathrm{X}}

其中LXRn×dL_X\in\mathbb R^{n\times d}表示特征矩阵的修改。

接下来就是关于如何优化LAL_ALXL_X了,这块不太懂,感兴趣的可以自行阅读原文,应该是涉及到PGD的一些底层实现。

2.2.2 信息正则化

对抗训练可以有效地提高模型对扰动的鲁棒性,但是会增加训练崩溃的风险,即模型在训练的早期阶段locate到了一个参数比较烂的区域。反映在本文是模型在某些场景下无法收敛。

为了提高模型的稳定性,作者增加了一个信息化正则项:

di=2θ(H1[i,:],H2[i,:])(θ(H2[i,:],H[i,:])+θ(H1[i,:],H[i,:]))LI(G1,G2,G)=1ni=1nmax{di,0}\begin{aligned} &d_i=2 \cdot \theta\left(\mathrm{H}_1[i,:], \mathrm{H}_2[i,:]\right)-\left(\theta\left(\mathrm{H}_2[i,:], \mathrm{H}[i,:]\right)+\theta\left(\mathrm{H}_1[i,:], \mathrm{H}[i,:]\right)\right)\\ &L_I\left(G_1, G_2, G\right)=\frac{1}{n} \sum_{i=1}^n \max \left\{d_i, 0\right\} \end{aligned}

其理论证明如下:

  1. 如果三个随机变量Z1,Z2Z_1, Z_2 and Z3Rn×dZ_3 \in \mathbb{R}^{n \times d^{\prime}}遵循Markov relation Z1Z2Z3\mathrm{Z}_1 \rightarrow \mathrm{Z}_2 \rightarrow \mathrm{Z}_3,则I(Z1;Z3)I(Z1;Z2)I\left(\mathrm{Z}_1 ; \mathrm{Z}_3\right) \leq I\left(\mathrm{Z}_1 ; \mathrm{Z}_2\right),通俗理解就是Z1Z_1Z3Z_3之间的互信息要小于Z1Z_1Z2Z_2之间的互信息。

  2. 根据现有研究,两个增强视角的节点嵌入和原始图的节点嵌入,满足Markov relation H1HH2H_1\rightarrow H\rightarrow\rightarrow H_2,因此三者满足以下不等式:

    I(H1;H2)I(H;H1),I(H1;H2)I(H;H2).\begin{aligned} &I\left(\mathrm{H}_1 ; \mathrm{H}_2\right) \leq I\left(\mathrm{H} ; \mathrm{H}_1\right), \\ &I\left(\mathrm{H}_1 ; \mathrm{H}_2\right) \leq I\left(\mathrm{H} ; \mathrm{H}_2\right) . \end{aligned}

  3. 其实上述不等式在node-level也是成立的。加入使用l层GNN作为图编码器,那么任意节点viv_i的节点嵌入是通过其l-hop邻居计算得到,它的l-hop邻居构成的子图页满足Markov relation(这里不太懂)。因此可以得到以下不等式:

    I(H1[i,:];H2[i,:])I(H[i,:];H1[i,:])I(H1[i,:];H2[i,:])I(H[i,:];H2[i,:]).\begin{aligned} &I\left(\mathrm{H}_1[i,:] ; \mathrm{H}_2[i,:]\right) \leq I\left(\mathrm{H}[i,:] ; \mathrm{H}_1[i,:]\right) \\ &I\left(\mathrm{H}_1[i,:] ; \mathrm{H}_2[i,:]\right) \leq I\left(\mathrm{H}[i,:] ; \mathrm{H}_2[i,:]\right) . \end{aligned}

  4. 由于对比损失Lcon(G1,G2)L_{con}(G_1,G_2)是互信息的下限,直接使用上述约束比较困难。作者提出定理:对于两个增强视角G1G_1G2G_2,学习到的节点嵌入满足不等式g(H2[i,:],H1[i,:])g(H2[i,:],H[i,:])g\left(\mathrm{H}_2[i,:], \mathrm{H}_1[i,:]\right) \leq g\left(\mathrm{H}_2[i,:], \mathrm{H}[i,:]\right)g(H1[i,:],H2[i,:])g(H1[i,:],H[i,:])g\left(\mathrm{H}_1[i,:], \mathrm{H}_2[i,:]\right) \leq g\left(\mathrm{H}_1[i,:], \mathrm{H}[i,:]\right)。其中g()g(\cdot)就是前文提到的对比损失中的函数。定理证明如下:

    根据Markov relation,有以下不等式:

    p(H2[i,:]H1[i,:])=p(H2[i,:]H[i,:])p(H[i,:]H1[i,:])p(H2[i,:]H[i,:])\begin{aligned} p\left(\mathrm{H}_2[i,:] \mid \mathrm{H}_1[i,:]\right) &=p\left(\mathrm{H}_2[i,:] \mid \mathrm{H}[i,:]\right) p\left(\mathrm{H}[i,:] \mid \mathrm{H}_1[i,:]\right) \\ & \leq p\left(\mathrm{H}_2[i,:] \mid \mathrm{H}[i,:]\right) \end{aligned}

    因此有:

    p(H2[i,:]H1[i,:])p(H2[i,:])p(H2[i,:]H[i,:])p(H2[i,:]).\frac{p\left(\mathrm{H}_2[i,:] \mid \mathrm{H}_1[i,:]\right)}{p\left(\mathrm{H}_2[i,:]\right)} \leq \frac{p\left(\mathrm{H}_2[i,:] \mid \mathrm{H}[i,:]\right)}{p\left(\mathrm{H}_2[i,:]\right)} .

    g(a,b)p(ab)p(a)g(\mathrm{a}, \mathrm{b}) \propto \frac{p(\mathrm{a} \mid \mathrm{b})}{p(\mathrm{a})}(因为g()g(\cdot)类似相似度函数,正比于这两个概率的比值),所以我们可以得到g(H2[i,:],H1[i,])g(H2[i,:],H[i,:])g\left(\mathrm{H}_2[i,:], \mathrm{H}_1[i,]\right) \leq g\left(\mathrm{H}_2[i,:], \mathrm{H}[i,:\right.])

  5. 由于g(a,b)=eθ(a,b)/τg(\mathbf{a}, \mathbf{b})=e^{\theta(\mathbf{a}, \mathbf{b}) / \tau},因此我们可以直接使用θ(,)\theta(\cdot,\cdot)替换上一步定理中的g(,)g(\cdot,\cdot)

    2θ(H1[i,:],H2[i,:])θ(H2[i,:],H[i,:])+θ(H1[i,:],H[i,:])2 \cdot \theta\left(\mathrm{H}_1[i,:], \mathrm{H}_2[i,:]\right) \leq \theta\left(\mathrm{H}_2[i,:], \mathrm{H}[i,:]\right)+\theta\left(\mathrm{H}_1[i,:], \mathrm{H}[i,:]\right)

    至此,我们就完成了正则化项的理论分析。将上述不等式移项就能得到前面定义的正则化项。

3. 实验

实验部分作者主要回答3个问题:

  1. 在节点分类任务中,ARIEL能带来多少性能提升?
  2. ARIEL给模型鲁棒性带来的增益如何?
  3. ARIEL每一部分是否都有贡献?

3.1 基础对比

3.2 攻击下的实验

3.3 消融实验

  1. 对抗对比损失的作用

  2. 信息正则化项

    如下图所示,在不使用正则化时,在Amazon-Photo数据集上,模型无法收敛。

打赏
  • 版权声明: 本博客所有文章除特别声明外,著作权归作者所有。转载请注明出处!
  • Copyrights © 2021-2022 Yin Peng
  • 引擎: Hexo   |  主题:修改自 Ayer
  • 访问人数: | 浏览次数:

请我喝杯咖啡吧~

支付宝
微信