SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2604.19070 · 2026

TRN-R1-Zero: Text-rich Network Reasoning via LLMs with Reinforcement Learning Only

Zi Huang, Yilun Liu, Ruihong Qiu

arXiv · PDF · Open in the Atlas

Code that ran

7 of 13 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; 2 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 5 failures of our instrument; 6 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/2604.19070.json · badge: /api/ran/2604.19070.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
superallen13/TRN-R1-Zero community
Papers with Code archive
7 ran · 6 no recorded run
FunctionStatusWhere it lives
encode_texts Ran
ran, honoured the contract we drafted
superallen13/TRN-R1-Zero/trn_r1_zero/prompts/build_training_dataset.py
code served (permissive licence) · get_code("262a0372fe03385b")
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
import torch.nn as nn
from typing import List, Dict

torch.manual_seed(0)

# Create a minimal tokenizer stand-in
class MinimalTokenizer:
    def __call__(self, texts, padding=True, truncation=True, return_tensors='pt'):
        batch_size = len(texts)
        seq_len = 5
        input_ids = torch.randint(0, 1000, (batch_size, seq_len))
        attention_mask = torch.ones(batch_size, seq_len)
        return {
            'input_ids': input_ids,
            'attention_mask': attention_mask,
            'token_type_ids': torch.zeros(batch_size, seq_len, dtype=torch.long)
        }

# Create a minimal model stand-in
class MinimalModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.embedding = nn.Embedding(1000, 4)
    
    def forward(self, input_ids, attention_mask=None, token_type_ids=None):
        token_embeddings = self.embedding(input_ids)
        return (token_embeddings,)

# Setup parameters
tokenizer = MinimalTokenizer()
model = MinimalModel()
device = torch.device('cpu')
texts = ["sample text one", "sample text two"]
batch_size = 2
desc = "Encoding texts"

ARGS = {
    'texts': texts,
    'tokenizer': tokenizer,
    'model': model,
    'batch_size': batch_size,
    'device': device,
    'desc': desc
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, tqdm, transformers — 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
format_labels Ran
ran; our contract draft was wrong, not the code
superallen13/TRN-R1-Zero/trn_r1_zero/prompts/build_training_dataset.py
code served (permissive licence) · get_code("0c1ae8f9a6249233")
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
import numpy as np

torch.manual_seed(0)

# Analyze the function:
# - format_labels takes label_names: List[str]
# - It iterates through enumerate(label_names) and formats each with index and name
# - Returns a newline-joined string

ARGS = {
    "label_names": ["cat", "dog", "bird", "fish"]
}
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 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
mean_pooling Ran
ran; our contract draft was wrong, not the code
superallen13/TRN-R1-Zero/trn_r1_zero/prompts/build_training_dataset.py
code served (permissive licence) · get_code("f08ad274808dce0d")
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)

# Create model_output as a tuple where the first element is token_embeddings
# The function accesses model_output[0], so we need a tuple or list-like structure
batch_size = 2
seq_length = 3
embedding_dim = 4

token_embeddings = torch.randn(batch_size, seq_length, embedding_dim)
model_output = (token_embeddings,)  # tuple with token_embeddings as first element

# Create attention_mask with shape (batch_size, seq_length)
# The function will unsqueeze it to (batch_size, seq_length, 1) and expand it
attention_mask = torch.tensor([
    [1, 1, 1],
    [1, 1, 0]
], dtype=torch.long)

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
pick_neighbors Ran
ran, honoured the contract we drafted
superallen13/TRN-R1-Zero/trn_r1_zero/prompts/build_training_dataset.py
code served (permissive licence) · get_code("7c2bef04d409c50e")
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 numpy as np

# Set random seed for reproducibility
np.random.seed(0)
rng = np.random.default_rng(seed=0)

# Create a simple adjacency list representation
# node_id 0 has neighbors [1, 2, 3]
# node_id 1 has neighbors [0, 2]
# node_id 2 has neighbors [0, 1, 3, 4]
# node_id 3 has neighbors [0, 2]
# node_id 4 has neighbors [2]
adj = [
    [1, 2, 3],      # neighbors of node 0
    [0, 2],         # neighbors of node 1
    [0, 1, 3, 4],   # neighbors of node 2
    [0, 2],         # neighbors of node 3
    [2]             # neighbors of node 4
]

node_id = 1
k = 2
vary_k = False

ARGS = {
    "adj": adj,
    "node_id": node_id,
    "k": k,
    "rng": rng,
    "vary_k": vary_k
}
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 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
render_context Ran
ran; our contract draft was wrong, not the code
superallen13/TRN-R1-Zero/trn_r1_zero/prompts/build_training_dataset.py
code served (permissive licence) · get_code("02f53132b25aede2")
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
import numpy as np

torch.manual_seed(0)

# Construct arguments for render_context
target_text = "This is the target node with some important information"
neighbor_texts = [
    "First neighbor node with relevant context",
    "Second neighbor node with additional details",
    "Third neighbor node providing more information"
]

ARGS = {
    "target_text": target_text,
    "neighbor_texts": neighbor_texts
}
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 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
to_adj_list Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
superallen13/TRN-R1-Zero/trn_r1_zero/prompts/build_training_dataset.py
code served (permissive licence) · get_code("5164b8f5205160b9")
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. 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)

# Construct edge_index tensor: shape [2, E] where E is number of edges
# Create a simple undirected graph with 4 nodes and 3 edges
edge_index = torch.tensor([
    [0, 1, 2],  # source nodes
    [1, 2, 3]   # destination nodes
], dtype=torch.long)

num_nodes = 4

ARGS = {
    "edge_index": edge_index,
    "num_nodes": num_nodes
}
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 list — a list 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
truncate_text Ran
ran; our contract draft was wrong, not the code
superallen13/TRN-R1-Zero/trn_r1_zero/prompts/build_training_dataset.py
code served (permissive licence) · get_code("c442d508e706ca37")
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
import numpy as np

# Define ARGS dict with valid arguments for truncate_text function
ARGS = {
    'text': 'The quick brown fox jumps over the lazy dog and runs through the forest',
    'max_words': 5
}
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 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
SGCAugment Not yet run
unverified (harvested, no recorded run)
superallen13/TRN-R1-Zero/trn_r1_zero/prompts/build_training_dataset.py
code served (permissive licence) · get_code("6092081bb8b831da")
How it ran

no invocation recorded.

TagData Not yet run
unverified (harvested, no recorded run)
superallen13/TRN-R1-Zero/trn_r1_zero/prompts/build_training_dataset.py
code served (permissive licence) · get_code("5a255c92908ad7d4")
How it ran

no invocation recorded.

build_one_problem Not yet run
unverified (harvested, no recorded run)
superallen13/TRN-R1-Zero/trn_r1_zero/prompts/build_training_dataset.py
code served (permissive licence) · get_code("d32dd84bbf934b57")
How it ran

no invocation recorded.

build_training_dataset Not yet run
unverified (harvested, no recorded run)
superallen13/TRN-R1-Zero/trn_r1_zero/prompts/build_training_dataset.py
code served (permissive licence) · get_code("088948840d28dc1b")
How it ran

no invocation recorded.

compute_margin_gain_scores Not yet run
unverified (harvested, no recorded run)
superallen13/TRN-R1-Zero/trn_r1_zero/prompts/build_training_dataset.py
code served (permissive licence) · get_code("d7692c6887a15d61")
How it ran

no invocation recorded.

load_tag Not yet run
unverified (harvested, no recorded run)
superallen13/TRN-R1-Zero/trn_r1_zero/prompts/build_training_dataset.py
code served (permissive licence) · get_code("940c1c0307ef2489")
How it ran

no invocation recorded.

Also present in other papers' code

Of 13 samples lifted from this paper's linked repositories, 13 carry a function identity and 0 do not. Of the 13 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 13 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

Zero-shot reasoning on text-rich networks (TRNs) remains a challenging frontier, as models must integrate textual semantics with relational structure without task-specific supervision. While graph neural networks rely on fixed label spaces and supervised objectives, recent large language model (LLM)-based approaches often overlook graph context or depend on distillation from larger models, limiting generalisation. We propose TRN-R1-Zero, a post-training framework for TRN reasoning trained solely via reinforcement learning. TRN-R1-Zero directly optimises base LLMs using a Neighbour-aware Group Relative Policy Optimisation objective that dynamically adjusts rewards based on a novel margin gain metric for the informativeness of neighbouring signals, effectively guiding the model toward relational reasoning. Unlike prior methods, TRN-R1-Zero requires no supervised fine-tuning or chain-of-thought data generated from large reasoning models. Extensive experiments across citation, hyperlink, social and co-purchase TRN benchmarks demonstrate the superiority and robustness of TRN-R1-Zero. Moreover, relying strictly on node-level training, TRN-R1-Zero achieves zero-shot inference on edgeand graph-level tasks, extending beyond crossdomain transfer. The codebase is publicly available at https://github.com/superallen13/TRN-R1-Zero.

For agents

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

get_harvested_code_for_paper("2604.19070")
get_code_for_paper("2604.19070")
have("2604.19070")

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

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

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

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

Connect an agent — have() is free.