SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2608.20991 · 2026

Trojaning the Alignment: Stealthy Backdoor Attacks against Graph Foundation Models

Xiang Zhang, Hanqing Lu, Suhang Wang, Minhua Lin, Yilong Wang, Zhicheng Gao

arXiv · PDF · Open in the Atlas

Code that ran

8 of 11 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 0 have no contract verdict; 7 failures of our instrument; 3 no recorded run), measured 2026-11-24; 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/2608.20991.json · badge: /api/ran/2608.20991.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
ventr1c/STAG canonical (classifier label)
classifier basis: census
8 ran · 3 no recorded run
FunctionStatusWhere it lives
cal_cl_loss Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
ventr1c/STAG/dual_backdoor_trainer.py
code served (permissive licence) · get_code("699d71c422ff7641")
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 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 numpy as np

torch.manual_seed(0)

# Create a small batch of contrastive learning data
batch_size = 2
embedding_dim = 4

# Create cosine similarity matrix (batch_size x batch_size)
logits_m = torch.randn(batch_size, batch_size)

# Create labels for the batch
labels = torch.tensor([0, 1])

# Create embeddings for optional euclidean distance computation
embeddings_x = torch.randn(batch_size, embedding_dim)
embeddings_y = torch.randn(batch_size, embedding_dim)

ARGS = {
    "logits_m": logits_m,
    "labels": labels,
    "embeddings_x": embeddings_x,
    "embeddings_y": embeddings_y,
}
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 Tensor, 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
cal_cl_loss Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
ventr1c/STAG/text-graph-grounding/model_gt.py
code served (permissive licence) · get_code("90838ce40c63b6a8")
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 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 numpy as np
import torch
import torch.nn.functional as F
from torch import nn, optim

torch.manual_seed(0)

# The function expects:
# - s_features: tensor that can be matrix-multiplied with t_features.t()
# - t_features: tensor that can be matrix-multiplied with s_features
# - labels: tensor of class indices for cross_entropy loss

# For cross_entropy, labels should be shape (batch_size,) with class indices
# logits will be shape (batch_size, batch_size) from the @ operation
# So we need s_features and t_features to both be (batch_size, embedding_dim)

batch_size = 2
embedding_dim = 4

s_features = torch.randn(batch_size, embedding_dim)
t_features = torch.randn(batch_size, embedding_dim)
labels = torch.tensor([0, 1], dtype=torch.long)

ARGS = {
    "s_features": s_features,
    "t_features": t_features,
    "labels": labels,
}
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 Tensor, 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
convert_single_item Ran
ran; our contract draft was wrong, not the code
ventr1c/STAG/convert_to_graphgpt_format.py
code served (permissive licence) · get_code("0283acfd123ca0f9")
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 dict. 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
from typing import List, Dict, Any

# Construct a valid item dict for convert_single_item
item = {
    'id': 42,
    'graph': [
        [0, 1, 2, 0, 3],  # source nodes
        [1, 2, 3, 4, 1]   # target nodes
    ],
    'summary': 'This paper presents a novel neural network architecture for deep learning applications with focus on optimization techniques.'
}

ARGS = {
    'item': item
}
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 dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
duplicate_row_at_index Ran
ran; our contract draft was wrong, not the code
ventr1c/STAG/graphgpt/model/GraphLlama.py
code served (permissive licence) · get_code("b3cc82c4c163ab87")
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 2, dtype family float, shape (5, 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 torch

torch.manual_seed(0)

# Create a small 2D tensor with shape (4, 3)
a = torch.tensor([
    [1.0, 2.0, 3.0],
    [4.0, 5.0, 6.0],
    [7.0, 8.0, 9.0],
    [10.0, 11.0, 12.0]
])

# Create an index to duplicate a row
index = 1

ARGS = {
    "a": a,
    "index": index
}
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 2, dtype family float, shape (5, 3) — shape (5, 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
extract_nodes_from_edges Ran
ran, honoured the contract we drafted
ventr1c/STAG/convert_to_graphgpt_format.py
code served (permissive licence) · get_code("0f27fa685e61035a")
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 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

# Set seed for reproducibility
torch.manual_seed(0)

# Construct arguments for extract_nodes_from_edges
# The function expects edge_index which is a List[List[int]]
# It represents edges as [[source_nodes], [target_nodes]]

edge_index = [
    [0, 1, 2, 1, 3],  # source nodes
    [1, 2, 3, 4, 0]   # target nodes
]

ARGS = {
    "edge_index": edge_index
}
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 int — 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
loss_func Ran
ran; our contract draft was wrong, not the code
ventr1c/STAG/graphclip/model/reconstruct.py
code served (permissive licence) · get_code("8460148151bb97d8")
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 torch
import torch.nn as nn

torch.manual_seed(0)

# Create small tensors for adjacency matrix and reconstructed adjacency
# adj: adjacency matrix (2x2 for small batch)
adj = torch.randn(2, 2)

# A_hat: reconstructed adjacency matrix (same shape as adj)
A_hat = torch.randn(2, 2)

# attrs: attribute matrix (2x4 for batch_size=2, num_attributes=4)
attrs = torch.randn(2, 4)

# X_hat: reconstructed attributes (same shape as attrs)
X_hat = torch.randn(2, 4)

# alpha: weight parameter between structure and attribute costs
alpha = 0.5

ARGS = {
    "adj": adj,
    "A_hat": A_hat,
    "attrs": attrs,
    "X_hat": X_hat,
    "alpha": alpha,
}
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 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
mean_pooling Ran
ran; our contract draft was wrong, not the code
ventr1c/STAG/dual_backdoor_trainer.py
code served (permissive licence) · get_code("975dab31afc23b51")
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 2, dtype family float, shape (2, 4) as a later run recorded it. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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)

# Create a small batch of token embeddings
# Shape: (batch_size=2, seq_length=3, embedding_dim=4)
model_output = torch.randn(2, 3, 4)

# Create attention mask
# Shape: (seq_length=3,) - but the function expects it to match the token_embeddings dimensions
# Looking at the function, it unsqueezes and expands attention_mask to match token_embeddings.size()
# So we need attention_mask to have compatible shape
attention_mask = torch.ones(2, 3)

ARGS = {
    "model_output": model_output,
    "attention_mask": attention_mask,
}
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 2, dtype family float, shape (2, 4) — shape (2, 4) 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
mean_pooling Ran
ran; our contract draft was wrong, not the code
ventr1c/STAG/text-graph-grounding/model_gt.py
code served (permissive licence) · get_code("4ab6a5942ba98e27")
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 2, dtype family float, shape (2, 4) 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)

# Construct model_output: token embeddings
# Shape should be (batch_size, sequence_length, embedding_dim)
batch_size = 2
sequence_length = 3
embedding_dim = 4
model_output = torch.randn(batch_size, sequence_length, embedding_dim)

# Construct attention_mask: binary mask indicating which tokens are real
# Shape should be (batch_size, sequence_length)
attention_mask = torch.tensor([
    [1, 1, 0],  # First sample has 2 real tokens
    [1, 1, 1]   # Second sample has 3 real tokens
], dtype=torch.float32)

ARGS = {
    "model_output": model_output,
    "attention_mask": attention_mask
}
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 2, dtype family float, shape (2, 4) — shape (2, 4) 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_model_pretrained Not yet run
unverified (harvested, no recorded run)
ventr1c/STAG/graphgpt/model/GraphLlama.py
code served (permissive licence) · get_code("5d42027fc7838b78")
How it ran

no invocation recorded.

parse_source_data Not yet run
unverified (harvested, no recorded run)
ventr1c/STAG/dual_attack_cotraining.py
code served (permissive licence) · get_code("8b210a8478b41ac0")
How it ran

no invocation recorded.

transfer_param_tograph Not yet run
unverified (harvested, no recorded run)
ventr1c/STAG/graphgpt/model/GraphLlama.py
code served (permissive licence) · get_code("5e2f11dfdb343c77")
How it ran

no invocation recorded.

Also present in other papers' code

Of 11 samples lifted from this paper's linked repositories, 11 carry a function identity and 0 do not. Of the 11 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 11 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.

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-24.

Repositories linked to this paper

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

Abstract

Graph Foundation Models (GFMs) on textattributed graphs (TAGs) align graph representations with language semantics to support transferable graph learning. Despite these advantages, the backdoor vulnerability of GFMs on TAGs remains insufficiently understood, especially under graphlanguage alignment, where graph and text representations are trained to constrain each other in a shared semantic space. Existing backdoor attacks mainly target either the graph side or the text side, treating the two modalities independently. This makes direct adaptation ineffective: graph-only triggers can be constrained by clean text semantics, while text-only triggers alter the language view but do not directly shift the graph representation being aligned and scored. TAGs also impose a stealth challenge because triggers are exposed as both node text and local graph structure, making incoherent trigger attributes or anomalous subgraphs easy to inspect or filter. In this paper, we propose STAG, a stealthy trojan attack framework designed for the graph-language alignment interface of GFMs on TAGs. STAG coordinates a graph-trigger generator with a text-side soft prompt so that trigger-attached graph representations and triggered text representations move toward the same targetclass text region. To address TAG-specific stealthiness, STAG realizes trigger nodes as readable text through candidate retrieval and regularizes the trigger-attached subgraph so that its local structure remains close to the original subgraph. Extensive experiments on multiple TAG datasets and representative GFMs demonstrate the effectiveness and stealthiness of STAG. Our code is available at https://github.com/ventr1c/STAG.

For agents

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

get_harvested_code_for_paper("2608.20991")
get_code_for_paper("2608.20991")
have("2608.20991")

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

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

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

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

Connect an agent — have() is free.