TGraphX › Insights › Research Integrity in Graph Learning: What Benchmarks Don't Tell You
← Back to Insights

Research Integrity in Graph Learning: What Benchmarks Don't Tell You

Topic: Reproducibility and research integrity

The same graph dataset can appear in many papers with different reported accuracies, and the text often does not give enough detail to reconcile them. Controlled re-evaluations show how much the protocol matters. Shchur et al. [1] found that the ranking of GNN node classifiers changes with the train/validation/test split of the same dataset. Errica et al. [2] re-ran graph classification models under a common protocol and found that, on some datasets, baselines that ignore graph structure did as well as or better than the GNNs.

This note is not about any particular paper. It lists practices that make numbers look better than they are, or make them impossible to compare, and shows a small protocol that avoids the main ones. Examples tested with TGraphX 1.5.1 on CPU.

Where inflated or incomparable numbers come from

Reporting one run, or the best run. Results depend on initialisation, dropout masks and sampling order, so one seed is one draw from a distribution. Reporting the best of several runs without saying so reports the top of that distribution.

Unequal tuning budgets. A method tuned over hundreds of configurations and compared with a baseline at default settings measures tuning effort as much as the method. A fair comparison gives every method the same search budget, selects each configuration on validation data only, and then reports mean and standard deviation over all pre-declared seeds. Picking the best seeds, for either side, is cherry-picking.

Selecting on the test set. Hyperparameters, the early-stopping epoch, architecture variants: if any of these is chosen by test performance, the test number no longer estimates performance on new data.

Splits that do not match. Cora, CiteSeer and PubMed are evaluated both on the public Planetoid split (20 labelled training nodes per class, 500 validation and 1,000 test nodes) and on random splits with far more training labels, such as 60/20/20. Numbers from the two settings are not comparable, even when they share a table.

Leakage. Test labels must never reach training or model selection. In link prediction, test edges must not be part of the message-passing graph. Feature statistics are more subtle: a transductive setting exposes all node features by design, but in an inductive setting a normaliser fitted on data that includes test graphs leaks information. Duplicates leak too. Platonov et al. [3] found many duplicated nodes in the squirrel and chameleon datasets, which causes train-test leakage, and showed that removing them changes model performance noticeably. This is subtle and often unintentional. Graph-specific split problems are covered in masks, splits, and leakage checks.

Mixing ranking protocols. In knowledge graph completion, the filtered setting [4] removes the other known true triples from the candidates before ranking; raw ranking keeps them. For the same model and test triple, the filtered rank is never worse than the raw rank. Comparing your filtered MRR with someone else's raw MRR therefore inflates your result, and the reverse deflates it. Tie handling matters too: Sun et al. [5] showed that placing the correct triple first among equally scored candidates can inflate results heavily. TGraphX's KGEvaluator computes raw and filtered metrics and gives tied candidates an average rank; say which numbers you report.

What a defensible result states

  • The number of seeds, declared before running, with mean and standard deviation over all of them.
  • The search space and budget for every method, and the rule that selected the final configuration.
  • The exact split: its published source, or the code and seed that create it.
  • For ranking metrics: raw or filtered, the candidate set (all entities, or how many sampled negatives) and the tie rule.
  • The model size.
  • The code commit, configuration and environment that identify how the number was produced.

A single number without variance or method details cannot be assessed: there is no way to tell whether a difference is larger than run-to-run noise.

A small protocol you can run

The example compares a structure-blind MLP with a two-layer GCN. Both get the same four configurations and the same five seeds. Configurations are selected by validation accuracy only, and test accuracy is reported over all five seeds. The graph is synthetic, so the numbers illustrate the procedure and say nothing about GCNs in general.

First, the data and a checked split:

python
import torch
import torch.nn as nn
import torch.nn.functional as F
import tgraphx as tgx
from tgraphx.estimators import node_train_val_test_split

torch.set_num_threads(1)   # tiny tensors: more threads only add overhead

# Synthetic graph: 3 classes, noisy features, edges mostly within a class
gen = torch.Generator().manual_seed(0)
num_nodes, num_classes = 200, 3
y = torch.arange(num_nodes) % num_classes
centers = torch.randn(num_classes, 16, generator=gen)
x = 0.6 * centers[y] + torch.randn(num_nodes, 16, generator=gen)
src = torch.randint(0, num_nodes, (1200,), generator=gen)
dst = torch.randint(0, num_nodes, (1200,), generator=gen)
keep = (y[src] == y[dst]) | (torch.rand(1200, generator=gen) < 0.1)
edge_index = torch.stack([src[keep], dst[keep]])
edge_index = torch.cat([edge_index, edge_index.flip(0)], dim=1)   # both directions

train_mask, val_mask, test_mask = node_train_val_test_split(num_nodes, 0.2, 0.2, 0.6, seed=0)
report = tgx.check_leakage(train_mask=train_mask, val_mask=val_mask, test_mask=test_mask)
assert report["ok"] and set(report["counts"]) == {"train", "val", "test"}

Pass the masks to check_leakage by keyword. Its first positional parameter is a graph, so a positional call shifts every mask by one place and can report overlapping splits as clean.

Next, the two models and one training run. Only training nodes enter the loss, and the epoch is chosen on validation nodes:

python
class MLP(nn.Module):
    def __init__(self, hidden):
        super().__init__()
        self.a, self.b = nn.Linear(16, hidden), nn.Linear(hidden, num_classes)

    def forward(self, x, edge_index):          # ignores the edges
        return self.b(F.relu(self.a(x)))


class GCN(nn.Module):
    def __init__(self, hidden):
        super().__init__()
        self.a, self.b = tgx.GCNConv(16, hidden), tgx.GCNConv(hidden, num_classes)

    def forward(self, x, edge_index):
        return self.b(F.relu(self.a(x, edge_index)), edge_index)


def run(model_cls, hidden, lr, seed, epochs=40):
    torch.manual_seed(seed)
    model = model_cls(hidden)
    opt = torch.optim.Adam(model.parameters(), lr=lr, weight_decay=5e-4)
    best_val, test_at_best = -1.0, 0.0
    for _ in range(epochs):
        model.train()
        opt.zero_grad()
        F.cross_entropy(model(x, edge_index)[train_mask], y[train_mask]).backward()
        opt.step()
        model.eval()
        with torch.no_grad():
            correct = model(x, edge_index).argmax(1) == y
        val = correct[val_mask].float().mean().item()
        if val > best_val:                     # the test value is stored, never used to choose
            best_val, test_at_best = val, correct[test_mask].float().mean().item()
    return best_val, test_at_best

Then the search, with an identical budget for both methods:

python
SEEDS = [0, 1, 2, 3, 4]
GRID = [(hidden, lr) for hidden in (16, 32) for lr in (0.01, 0.05)]

results = {}
for name, model_cls in {"mlp": MLP, "gcn": GCN}.items():
    trials = {cfg: [run(model_cls, *cfg, seed) for seed in SEEDS] for cfg in GRID}
    best = max(GRID, key=lambda cfg: sum(val for val, _ in trials[cfg]))   # validation only
    test = torch.tensor([t for _, t in trials[best]])
    results[name] = {
        "hidden": best[0], "lr": best[1],
        "test_per_seed": test.tolist(),
        "test_mean": test.mean().item(),
        "test_std": test.std().item(),         # sample standard deviation (n - 1)
        "num_parameters": tgx.count_parameters(model_cls(best[0])),
    }
    print(f"{name}: test {test.mean():.3f} +/- {test.std():.3f} over {len(SEEDS)} seeds, "
          f"hidden={best[0]}, lr={best[1]}")

Finally, record what was done:

python
import json
import tempfile
from pathlib import Path

from tgraphx.tracking import write_benchmark_results

record = dict(
    benchmark="synthetic 3-class node classification",
    tgraphx_version=tgx.__version__,
    torch_version=torch.__version__,
    seeds=SEEDS,
    split={"function": "node_train_val_test_split", "ratios": [0.2, 0.2, 0.6], "seed": 0},
    search_space={"hidden": [16, 32], "lr": [0.01, 0.05], "epochs": 40},
    selection="highest mean validation accuracy over all seeds",
    results=results,
)
out = Path(tempfile.mkdtemp()) / "benchmark_results.json"
write_benchmark_results(str(out), **record)
assert set(json.loads(out.read_text())) == set(record)   # exactly what was passed

write_benchmark_results(path, **fields) writes a JSON file containing the fields you give it, and nothing else. It does not collect hardware details or a commit hash, and it does not aggregate seeds. Add those yourself (for example tgx.env_report() and git rev-parse HEAD), and pass plain numbers, not tensors. TGraphX cannot know whether the seeds you list were ever run.

One limit of the example: five seeds on one fixed split measure variation from initialisation and training, not from the choice of split. Bouthillier et al. [6] discuss why several sources of variation, including data splits, should be sampled when comparing methods. Determinism and seeding are a separate topic, covered in reproducibility lessons for GNN projects.

Reading a paper's claims

  1. Variance. Mean and standard deviation over how many runs?
  2. Splits. The same splits as the numbers it compares against?
  3. Budget. Were the baselines tuned as carefully as the new method?
  4. Ranking protocol. Raw or filtered, which candidates, which tie rule?
  5. Code. Is there a public commit and configuration that produces the headline number?

On "state of the art"

The phrase means little without its conditions: on which dataset and split, under which evaluation protocol, with what tuning budget, and with what spread? A more useful claim says what the method does well and where it does not, and rests on a disclosed protocol.

Practical recommendations for new GNN researchers

  • Fix the number of seeds before running. More seeds give a better estimate of both mean and spread. The Open Graph Benchmark leaderboards, for example, ask for the mean and unbiased standard deviation over 10 seeds on most datasets (rules; benchmark paper [7]).
  • Give your method and the baselines the same search budget.
  • Use the standard split where one exists. If you depart from it, say why and do not compare with numbers from the standard split.
  • Save a record per run: commit, configuration, environment and metrics.
  • If you cannot reproduce a published baseline, say so and report your number next to the published one.

FAQ

Q: What variance is acceptable for a published result?
A: There is no universal threshold. Compare the difference between methods with the spread. Test set size alone matters: for independent examples, an accuracy of 0.8 measured on 1,000 of them has a binomial standard error of about 1.3 percentage points. Graph nodes are not strictly independent, so treat this as a rough guide.

Q: Should I rerun all baselines for my paper?
A: Ideally yes, with the same protocol and budget. If that is not feasible, cite the original numbers exactly and state every protocol difference.

Q: Does TGraphX prevent benchmark inflation?
A: No. check_leakage detects overlapping node masks, and the metadata writers record what you pass to them. Neither enforces an evaluation protocol.

Q: Should I report parameter counts?
A: Yes. A large gap in model size changes how an accuracy difference should be read.

References

  1. O. Shchur, M. Mumme, A. Bojchevski, S. Günnemann. Pitfalls of Graph Neural Network Evaluation. Relational Representation Learning Workshop, NeurIPS 2018.
  2. F. Errica, M. Podda, D. Bacciu, A. Micheli. A Fair Comparison of Graph Neural Networks for Graph Classification. ICLR 2020.
  3. O. Platonov, D. Kuznedelev, M. Diskin, A. Babenko, L. Prokhorenkova. A Critical Look at the Evaluation of GNNs under Heterophily: Are We Really Making Progress? ICLR 2023.
  4. A. Bordes, N. Usunier, A. García-Durán, J. Weston, O. Yakhnenko. Translating Embeddings for Modeling Multi-relational Data. NeurIPS 2013.
  5. Z. Sun, S. Vashishth, S. Sanyal, P. Talukdar, Y. Yang. A Re-evaluation of Knowledge Graph Completion Methods. ACL 2020.
  6. X. Bouthillier et al. Accounting for Variance in Machine Learning Benchmarks. MLSys 2021.
  7. W. Hu, M. Fey, M. Zitnik, Y. Dong, H. Ren, B. Liu, M. Catasta, J. Leskovec. Open Graph Benchmark: Datasets for Machine Learning on Graphs. NeurIPS 2020.