SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2306.10759 · NeurIPS · 2023

SGFormer: Simplifying and Empowering Transformers for Large-Graph Representations

Qitian Wu, Hengrui Zhang, Junchi Yan, Yatao Bian, Chenxiao Yang, Wentao Zhao, Fan Nie, Haitian Jiang

arXiv · PDF · Open in the Atlas

Code that ran

9 of 15 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (2 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 4 have no contract verdict; 5 failures of our instrument; 6 no recorded run), measured 2026-11-23; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2306.10759.json · badge: /api/ran/2306.10759.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
qitianwu/SGFormer canonical (classifier label)
classifier basis: census
7 ran · 4 no recorded run
qitianwu/sgformer community
Papers with Code archive
2 ran · 2 no recorded run
FunctionStatusWhere it lives
TransConv Ran
ran on a synthesized input · constructed an object; no result was computed
qitianwu/sgformer/medium/ours.py
code served (permissive licence) · get_code("dd90ba29f6b0b76a")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, TransConv: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# Create a minimal data object that matches what TransConv.forward expects
class MinimalData:
    def __init__(self):
        # Node features: (num_nodes, in_channels)
        self.graph = {
            'node_feat': torch.randn(2, 4),
            'edge_index': torch.tensor([[0, 1], [1, 0]], dtype=torch.long),
            'edge_weight': torch.ones(2)
        }

ARGS = {
    'in_channels': 4,
    'hidden_channels': 3,
    'num_layers': 2,
    'num_heads': 1,
    'alpha': 0.5,
    'dropout': 0.5,
    'use_bn': True,
    'use_residual': True,
    'use_weight': True,
    'use_act': False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type TransConv — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a TransConv output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
TransConvLayer Ran
ran on a synthesized input · constructed an object; no result was computed
qitianwu/sgformer/medium/ours.py
code served (permissive licence) · get_code("2e7f4f12c1100a83")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, TransConvLayer: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# TransConvLayer parameters:
# - in_channels: int
# - out_channels: int
# - num_heads: int
# - use_weight: bool (default True)

in_channels = 4
out_channels = 3
num_heads = 2
use_weight = True

ARGS = {
    "in_channels": in_channels,
    "out_channels": out_channels,
    "num_heads": num_heads,
    "use_weight": use_weight,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type TransConvLayer — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a TransConvLayer output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
class_rand_splits Ran
ran; our contract draft was wrong, not the code
qitianwu/SGFormer/100M/data_utils.py
code served (permissive licence) · get_code("de5bdf76ff672322")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Create a label tensor with class indices
# We need multiple samples per class to allow for train/valid/test splits
# Create 20 samples with 4 classes (5 samples per class)
label = torch.tensor([0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3]).unsqueeze(1)

# Number of samples per class to use for training
label_num_per_class = 2

# Number of validation samples
valid_num = 5

# Number of test samples
test_num = 5

ARGS = {
    "label": label,
    "label_num_per_class": label_num_per_class,
    "valid_num": valid_num,
    "test_num": test_num,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
evaluate Ran
ran on a synthesized input
qitianwu/SGFormer/100M/nb-sample.py
code served (permissive licence) · get_code("2f1e99a101ce9610")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple, ndim 1, dtype family int; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

class SimpleGNNModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x, edge_index):
        return self.linear(x)

class SimpleGraph:
    def __init__(self):
        self.x = torch.randn(2, 4)
        self.edge_index = torch.tensor([[0, 1], [1, 0]], dtype=torch.long).t().contiguous()
        self.y = torch.tensor([0, 2], dtype=torch.long)

model = SimpleGNNModel()
graph = SimpleGraph()
batch_size = 2

ARGS = {
    "model": model,
    "graph": graph,
    "batch_size": batch_size
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family int — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
index2mask Ran
ran; our contract draft was wrong, not the code
qitianwu/SGFormer/100M/nb-sample.py
code served (permissive licence) · get_code("10e5b33e372f7d10")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 1, dtype family float, shape (5,) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# idx: a tensor of indices that will be used to index into a mask
# These indices should be valid for the given size
idx = torch.tensor([0, 2, 4], dtype=torch.long)

# size: the total size of the mask to create
size = 5

ARGS = {
    "idx": idx,
    "size": size,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 1, dtype family float, shape (5,) — shape (5,) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
load_fixed_splits Ran
ran; our contract draft was wrong, not the code
qitianwu/SGFormer/large/data_utils.py
code served (permissive licence) · get_code("ef6b5e211f3c0418")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np
import tempfile
import os

torch.manual_seed(0)

# Create a temporary directory structure for the splits files
temp_dir = tempfile.mkdtemp()
splits_dir = os.path.join(temp_dir, 'geom-gcn', 'splits')
os.makedirs(splits_dir, exist_ok=True)

# Create dummy split files for 'cora' dataset
for i in range(10):
    split_file_path = os.path.join(splits_dir, f'cora_split_0.6_0.2_{i}.npz')
    # Create small dummy masks (10 samples)
    train_mask = np.array([True, True, False, False, False, False, False, False, False, False])
    val_mask = np.array([False, False, True, True, False, False, False, False, False, False])
    test_mask = np.array([False, False, False, False, True, True, True, True, True, True])
    
    np.savez(
        split_file_path,
        train_mask=train_mask,
        val_mask=val_mask,
        test_mask=test_mask
    )

# Create a minimal dataset class with train_idx, valid_idx, test_idx for semi-supervised case
class MinimalDataset:
    def __init__(self):
        self.train_idx = np.array([0, 1])
        self.valid_idx = np.array([2, 3])
        self.test_idx = np.array([4, 5, 6, 7, 8, 9])

dataset = MinimalDataset()

ARGS = {
    'data_dir': temp_dir,
    'dataset': dataset,
    'name': 'cora',
    'protocol': 'semi'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
rand_train_test_idx Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
qitianwu/SGFormer/large/data_utils.py
pointer only (licence: MIT); the stored copy get_code serves, from CUAI/Non-Homophily-Large-Scale, is pointer only (licence: NONE) · get_code("13234652741e2264")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from CUAI/Non-Homophily-Large-Scale, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

rand_train_test_idx Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
qitianwu/SGFormer/100M/data_utils.py
code served (permissive licence) · get_code("eea43aafe5795815")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# Create a label tensor with some labeled nodes (values != -1) and some unlabeled nodes (value = -1)
# Using 10 nodes total: 7 labeled (0-6) and 3 unlabeled (-1)
label = torch.tensor([0, 1, 2, 3, 4, -1, -1, 5, 6, -1], dtype=torch.long)

ARGS = {
    "label": label,
    "train_prop": 0.5,
    "valid_prop": 0.25,
    "ignore_negative": True
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
train Ran
ran on a synthesized input
qitianwu/SGFormer/100M/nb-sample.py
code served (permissive licence) · get_code("31388e2d020da353")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned float, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
import torch.optim as optim

torch.manual_seed(0)

# Define a minimal model that accepts node features and edge indices
class SimpleGNN(nn.Module):
    def __init__(self, input_dim, output_dim):
        super().__init__()
        self.linear = nn.Linear(input_dim, output_dim)
    
    def forward(self, x, edge_index):
        # Simple forward pass: just apply linear layer to node features
        return self.linear(x)

# Create model
model = SimpleGNN(input_dim=4, output_dim=3)

# Create a simple graph object with required attributes
class SimpleGraph:
    def __init__(self):
        # Node features: 2 nodes, 4 features each
        self.x = torch.randn(2, 4)
        # Edge indices: shape [2, num_edges]
        self.edge_index = torch.tensor([[0, 1], [1, 0]], dtype=torch.long).t().contiguous()
        # Node labels: 2 nodes, 3 classes
        self.y = torch.tensor([0, 1], dtype=torch.long)

graph = SimpleGraph()

# Create loss function
loss_func = nn.CrossEntropyLoss()

# Create optimizer
optimizer = optim.SGD(model.parameters(), lr=0.01)

# Batch size
batch_size = 2

ARGS = {
    "model": model,
    "graph": graph,
    "loss_func": loss_func,
    "optimizer": optimizer,
    "batch_size": batch_size
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
SGFormer Not yet run
unverified (harvested, no recorded run)
qitianwu/sgformer/medium/ours.py
code served (permissive licence) · get_code("a01a5d91eae8f860")
How it ran

no invocation recorded.

full_attention_conv Not yet run
unverified (harvested, no recorded run)
qitianwu/SGFormer/100M/ours.py
code served (permissive licence) · get_code("aa034199e64c32ba")
How it ran

no invocation recorded.

full_attention_conv Not yet run
unverified (harvested, no recorded run)
qitianwu/sgformer/medium/ours.py
code served (permissive licence) · get_code("ceb81f08da4bb951")
How it ran

no invocation recorded.

load_fb100 Not yet run
unverified (harvested, no recorded run)
qitianwu/SGFormer/100M/load_data.py
code served (permissive licence) · get_code("67fc014db49b3eba")
How it ran

no invocation recorded.

load_twitch Not yet run
unverified (harvested, no recorded run)
qitianwu/SGFormer/100M/load_data.py
code served (permissive licence) · get_code("985aeae95edfd025")
How it ran

no invocation recorded.

parse_method Not yet run
unverified (harvested, no recorded run)
qitianwu/SGFormer/100M/parse.py
code served (permissive licence) · get_code("e4ab5e839e7c665a")
How it ran

no invocation recorded.

Also present in other papers' code

Of 15 samples lifted from this paper's linked repositories, 15 carry a function identity and 0 do not. Of the 13 distinct functions with an identity, 7 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 1 the same month, 7 later) and 6 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
rand_train_test_idx 14 other papers
2 dated earlier, 1 the same month, 11 later
2110.14446 (2021-10)
Large Scale Learning on Non-Homophilous Graphs: New Benchmarks and Strong Simple Methods
2302.01524 (2023-02)
Ordered GNN: Ordering Message Passing to Deal with Heterophily and Over-smoothing
2306.08274 (2023-06)
A Simple and Scalable Graph Neural Network for Large Directed Graphs
and 11 more not named here
load_fb100 8 other papers
3 dated earlier, 5 later
2110.14446 (2021-10)
Large Scale Learning on Non-Homophilous Graphs: New Benchmarks and Strong Simple Methods
2210.07606 (2022-10)
Revisiting Heterophily For Graph Neural Networks
2302.01524 (2023-02)
Ordered GNN: Ordering Message Passing to Deal with Heterophily and Over-smoothing
and 5 more not named here
load_fixed_splits 3 other papers
3 later
2310.05296 (2023-10)
Tailoring Self-Attention for Graph via Rooted Subtrees
2403.15480 (2024-03)
SpikeGraphormer: A High-Performance Graph Transformer with Spiking Graph Attention
2407.01290 (2024-07)
Hypformer: Exploring Efficient Transformer Fully in Hyperbolic Space
class_rand_splits 2 other papers
2 later
2403.15480 (2024-03)
SpikeGraphormer: A High-Performance Graph Transformer with Spiking Graph Attention
2407.01290 (2024-07)
Hypformer: Exploring Efficient Transformer Fully in Hyperbolic Space
index2mask 2 other papers
2 later
2310.12457 (2023-10)
MuseGNN: Forming Scalable, Convergent GNN Layers that Minimize a Sampling-Based Energy
2405.16435 (2024-05)
Node Identifiers: Compact, Discrete Representations for Efficient Graph Learning
load_twitch 2 other papers
2 later
2402.11494 (2024-02)
Graph Out-of-Distribution Generalization via Causal Intervention
2407.01290 (2024-07)
Hypformer: Exploring Efficient Transformer Fully in Hyperbolic Space
full_attention_conv
brick of this paper's assembly: helper
1 other paper
1 later
2308.11129 (2023-08)
Enhancing Graph Transformers with Hierarchical Distance Structural Encoding

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Learning representations on large-sized graphs is a long-standing challenge due to the inter-dependence nature involved in massive data points. Transformers, as an emerging class of foundation encoders for graph-structured data, have shown promising performance on small graphs due to its global attention capable of capturing all-pair influence beyond neighboring nodes. Even so, existing approaches tend to inherit the spirit of Transformers in language and vision tasks, and embrace complicated models by stacking deep multi-head attentions. In this paper, we critically demonstrate that even using a one-layer attention can bring up surprisingly competitive performance across node property prediction benchmarks where node numbers range from thousand-level to billion-level. This encourages us to rethink the design philosophy for Transformers on large graphs, where the quadratic global attention is a computation overhead hindering the scalability. We frame the proposed scheme as Simplified Graph Transformers (SGFormer), which is empowered by a simple attention model that can efficiently propagate information among arbitrary nodes at the minimal cost of one propagation layer and linear complexity w.r.t. node numbers. Moreover, SGFormer requires none of positional encodings, feature/graph pre-processing or extra loss. Empirically, SGFormer successfully scales to the web-scale graph ogbn-papers100M and yields up to 141x inference acceleration over SOTA Transformers on medium-sized graphs. Beyond current results, we believe the proposed methodology alone enlightens a new technical path of independent interest for building Transformers on large graphs. The codes are publicly available at https://github.com/qitianwu/SGFormer.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2306.10759")
get_code_for_paper("2306.10759")
have("2306.10759")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2306.10759.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2306.10759.svg)](https://syntology.ai/paper/2306.10759)

Connect an agent — have() is free.