SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2503.01838 · ICLR · 2025

GRAIN: Exact Graph Reconstruction from Gradients

Martin Vechev, Maximilian Baader, Dimitar Dimitrov, St Kliment Ohridski, Maria Drencheva, Ivo Petrov

arXiv · PDF · Open in the Atlas

Code that ran

5 of 6 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 0 violated it and 4 have no contract verdict; 0 failures of our instrument; 1 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/2503.01838.json · badge: /api/ran/2503.01838.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
insait-institute/grain canonical (classifier label)
classifier basis not recorded on the link
5 ran · 1 no recorded run
FunctionStatusWhere it lives
bootstrap_ci Ran
ran on a synthesized input
insait-institute/grain/src/extract_neptune.py
code served (permissive licence) · get_code("fda60abed9a9f350")
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 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 numpy as np

# Set seed for reproducibility
np.random.seed(0)

# Create sample data - a simple array of numerical values
data = np.array([1.2, 2.3, 3.1, 2.8, 4.5, 1.9, 3.3, 2.1, 4.2, 3.7])

# Define arguments for bootstrap_ci function
ARGS = {
    "data": data,
    "num_samples": 1000,
    "ci": 95
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — 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 float — 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
get_dataset_stats Ran
ran on a synthesized input
insait-institute/grain/src/data_loading/data_utils.py
code served (permissive licence) · get_code("be3c8c258cbff27b")
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 numpy as np

class Args:
    def __init__(self):
        self.use_degree = True
        self.num_extra_features = 10

ARGS = {
    'args': Args(),
    'dataset': 'citeseer'
}
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, 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
get_full Ran
ran on a synthesized input
insait-institute/grain/src/extract_neptune.py
code served (permissive licence) · get_code("60f968de9e7be188")
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 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 numpy as np

class MockProject:
    def __init__(self, stat_name, values):
        self.stat_name = stat_name
        self.values = values
        self.data = {}
    
    def __getitem__(self, key):
        return self.data[key]

class MockStat:
    def __init__(self, values):
        self.values = values
    
    def fetch_values(self):
        return MockFetchResult(self.values)

class MockFetchResult:
    def __init__(self, values):
        self.values = values
    
    def __getitem__(self, key):
        if key == 'value':
            return self
        return self.values
    
    def to_numpy(self):
        return np.array(self.values)

# Create mock projects with stat data
# bounds = [2, 4, 3, 1], so we need projects with at least these many values
project_0_stat = MockStat([1, 0, 1, 1, 0])
project_1_stat = MockStat([1, 1, 0, 1, 0, 1])
project_2_stat = MockStat([1, 0, 0, 1, 0])
project_3_stat = MockStat([1, 0])

project_0 = MockProject('accuracy', [1, 0, 1, 1, 0])
project_0.data['accuracy'] = project_0_stat

project_1 = MockProject('accuracy', [1, 1, 0, 1, 0, 1])
project_1.data['accuracy'] = project_1_stat

project_2 = MockProject('accuracy', [1, 0, 0, 1, 0])
project_2.data['accuracy'] = project_2_stat

project_3 = MockProject('accuracy', [1, 0])
project_3.data['accuracy'] = project_3_stat

projects = [project_0, project_1, project_2, project_3]

ARGS = {
    'projects': projects,
    'stat': 'accuracy'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — 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 float — 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
get_param Ran
ran, honoured the contract we drafted
insait-institute/grain/src/extract_neptune.py
code served (permissive licence) · get_code("68917fefa350c8e4")
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 ndarray, ndim 1, dtype family float, shape (3,) 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 numpy as np

class MockProject:
    def __init__(self):
        self.data = {
            "param1": MockFetchable(np.array([1.0, 2.0, 3.0])),
            "param2": MockFetchable(np.array([[1, 2], [3, 4]])),
        }
    
    def exists(self, param):
        return param in self.data
    
    def __getitem__(self, param):
        return self.data[param]

class MockFetchable:
    def __init__(self, value):
        self.value = value
    
    def fetch(self):
        return self.value

project = [MockProject()]

ARGS = {
    "project": project,
    "param": "param1"
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 1, dtype family float, shape (3,) — shape (3,) 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
get_setting Ran
ran on a synthesized input
insait-institute/grain/src/data_loading/data_utils.py
code served (permissive licence) · get_code("7e2f7e46dd5c7346")
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 str. 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

# The function takes a dataset parameter (a string) and returns a setting based on the dataset name
# It checks if 'zpn' is in the dataset string, or if dataset equals specific values

ARGS = {
    'dataset': 'zpn_example'
}
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 str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
get_pokec_data Not yet run
unverified (harvested, no recorded run)
insait-institute/grain/src/data_loading/data_utils.py
code served (permissive licence) · get_code("52135ba0acd23d72")
How it ran

no invocation recorded.

Also present in other papers' code

Of 6 samples lifted from this paper's linked repositories, 6 carry a function identity and 0 do not. Of the 6 distinct functions with an identity, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 0 later) and 5 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
get_param 1 other paper
1 dated earlier
2405.15586 (2024-05)
DAGER: Exact Gradient Inversion for Large Language Models

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

Federated learning claims to enable collaborative model training among multiple clients with data privacy by transmitting gradient updates instead of the actual client data. However, recent studies have shown the client privacy is still at risk due to the, so called, gradient inversion attacks which can precisely reconstruct clients' text and image data from the shared gradient updates. While these attacks demonstrate severe privacy risks for certain domains and architectures, the vulnerability of other commonly-used data types, such as graph-structured data, remain under-explored. To bridge this gap, we present GRAIN, the first exact gradient inversion attack on graph data in the honest-but-curious setting that recovers both the structure of the graph and the associated node features. Concretely, we focus on Graph Convolutional Networks (GCN) and Graph Attention Networks (GAT) -two of the most widely used frameworks for learning on graphs. Our method first utilizes the low-rank structure of GNN gradients to efficiently reconstruct and filter the client subgraphs which are then joined to complete the input graph. We evaluate our approach on molecular, citation, and social network datasets using our novel metric. We show that GRAIN reconstructs up to 80% of all graphs exactly, significantly outperforming the baseline, which achieves up to 20% correctly positioned nodes.

For agents

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

get_harvested_code_for_paper("2503.01838")
get_code_for_paper("2503.01838")
have("2503.01838")

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

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

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

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

Connect an agent — have() is free.