The Transformer architecture has gained growing attention in graph representation learning recently, as it naturally overcomes several limitations of graph neural networks (GNNs) by avoiding their strict structural inductive biases and instead only encoding the graph structure via positional encoding. Here, we show that the node representations generated by the Transformer with positional encoding do not necessarily capture structural similarity between them. To address this issue, we propose the Structure-Aware Transformer, a class of simple and flexible graph transformers built upon a new self-attention mechanism. This new self-attention incorporates structural information into the original self-attention by extracting a subgraph representation rooted at each node before computing the attention. We propose several methods for automatically generating the subgraph representation and show theoretically that the resulting representations are at least as expressive as the subgraph representations. Empirically, our method achieves state-of-the-art performance on five graph prediction benchmarks. Our structure-aware framework can leverage any existing GNN to extract the subgraph representation, and we show that it systematically improves performance relative to the base GNN model, successfully combining the advantages of GNNs and transformers.
翻译:转换器结构最近在图形表述学习中日益受到越来越多的注意,因为它自然地克服了图形神经网络(GNNs)的若干局限性,避免了严格的结构性感应偏差,而只是通过定位编码对图形结构进行编码。在这里,我们表明,由变换器产生的带有位置编码的节点表示不一定反映它们之间的结构相似性。为了解决这一问题,我们提议了结构-软件变换器,这是建立在新的自我注意机制基础上的简单灵活的图形变换器。这种新的自我注意将结构信息纳入原始自我注意中,在计算注意之前,从每个节点提取一个子图示表示法。我们提出了自动生成子图表示法的若干方法,并在理论上表明,由此产生的表示法至少与子表示法一样明确。我们的方法在五个图形预测基准上实现了最新业绩。我们的结构-认知框架可以利用现有的任何GNNE来提取子描述,我们显示它系统地改进了基础GNNN模型的性能,成功地将GNN和变压器的优势结合起来。