Papers › Representing Long-Range Context for Graph Neural Networks with Global Attention

Representing Long-Range Context for Graph Neural Networks with Global Attention

21 Jan 2022NeurIPS 2021 12arXiv:2201.08821archive 2025-07-28

Zhanghao Wu, Paras Jain, Matthew A. Wright, Azalia Mirhoseini, Joseph E. Gonzalez, Ion Stoica

Graph neural networks are powerful architectures for structured datasets. However, current methods struggle to represent long-range dependencies. Scaling the depth or width of GNNs is insufficient to broaden receptive fields as larger GNNs encounter optimization instabilities such as vanishing gradients and representation oversmoothing, while pooling-based approaches have yet to become as universally useful as in computer vision. In this work, we propose the use of Transformer-based self-attention to learn long-range pairwise relationships, with a novel "readout" mechanism to obtain a global graph embedding. Inspired by recent computer vision results that find position-invariant attention performant in learning long-range relationships, our method, which we call GraphTrans, applies a permutation-invariant Transformer module after a standard GNN module. This simple architecture leads to state-of-the-art results on several graph classification tasks, outperforming methods that explicitly encode graph structure. Our results suggest that purely-learning-based approaches without graph structure may be suitable for learning high-level, long-range relationships on graphs. Code for GraphTrans is available at https://github.com/ucbrise/graphtrans.

PaperPDFConference PDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2201.08821")

Code

Syntology Ran 7 of 14 code samples harvested from 1 repository linked to this paper; 7 have no recorded run. Of those that ran: 1 ran · our draft was wrong; 6 ran with no contract checked.

By repository: official repository: 14 samples from 1 repository, 7 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

ucbrise/graphtrans officialmentioned in paperpytorch report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

14 samples harvested; 7 ran; 0 honoured the contract we drafted; 7 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

1ran · our draft was wrong
6ran
7unverified

Licence: 0 of the 14 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from ucbrise/graphtrans. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

Block ucbrise/graphtrans/models/gnn_transformer.py official repository ran Apache-2.0 (permissive) · 5e621bc325bada93 · report
CausalSelfAttention ucbrise/graphtrans/models/gnn_transformer.py official repository ran Apache-2.0 (permissive) · 54f4034695672c97 · report
MaskedOnlyTransformerEncoder ucbrise/graphtrans/models/gnn_transformer.py official repository ran Apache-2.0 (permissive) · 47a9110e2ff3cb6d · report
MaskedTransformerBlock ucbrise/graphtrans/models/gnn_transformer.py official repository ran Apache-2.0 (permissive) · a24d2e60a5f1edb0 · report
PositionalEncoding ucbrise/graphtrans/models/gnn_transformer.py official repository ran Apache-2.0 (permissive) · 44450c1a1d39195f · report
TransformerNodeEncoder ucbrise/graphtrans/models/gnn_transformer.py official repository ran Apache-2.0 (permissive) · a4bc443f49dd810c · report
pad_batch ucbrise/graphtrans/models/gnn_transformer.py official repository ran · our draft was wrong Apache-2.0 (permissive) · cec619dc729ca927 · report
BaseModel ucbrise/graphtrans/models/gnn_transformer.py official repository unverified Apache-2.0 (permissive) · dff37bf121adcf54 · report
GCNConv ucbrise/graphtrans/models/gnn_transformer.py official repository unverified Apache-2.0 (permissive) · de1fa9d2896a253e · report
GINConv ucbrise/graphtrans/models/gnn_transformer.py official repository unverified Apache-2.0 (permissive) · ca2f5cd1f82b9713 · report
GNNNodeEmbedding ucbrise/graphtrans/models/gnn_transformer.py official repository unverified Apache-2.0 (permissive) · 4ac493315fba009f · report
GNNTransformer ucbrise/graphtrans/models/gnn_transformer.py official repository unverified Apache-2.0 (permissive) · 58d376fe82ba1dc2 · report
GNN_node ucbrise/graphtrans/models/gnn_transformer.py official repository unverified Apache-2.0 (permissive) · e6ce121697c42f5e · report
GNN_node_Virtualnode ucbrise/graphtrans/models/gnn_transformer.py official repository unverified Apache-2.0 (permissive) · e4c5152d3248ee46 · report

Tasks

Graph ClassificationGraph Embedding

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

Absolute Position EncodingsAdamAttentionBPEDense ConnectionsDropoutLabel SmoothingLayer NormalizationLinear LayerMulti-Head AttentionPosition-Wise Feed-Forward LayerResidual ConnectionSoftmaxTransformer

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections