SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2505.24875 · 2025

ReasonGen-R1: CoT for Autoregressive Image generation models through SFT and RL

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; 0 honoured the contract we drafted, 0 violated it and 1 has no contract verdict; 6 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/2505.24875.json · badge: /api/ran/2505.24875.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
Franklin-Zhang0/ReasonGen-R1 community (classifier label)
classifier basis not recorded on the link
7 ran · 6 no recorded run
FunctionStatusWhere it lives
checkpoint_wrapper Ran
ran on a synthesized input
Franklin-Zhang0/ReasonGen-R1/Janus/janus/models/modeling_vlm.py
code served (permissive licence) · get_code("3130a89440c64972")
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 function. 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
from torch.utils.checkpoint import checkpoint

torch.manual_seed(0)

# Define a simple function that will be checkpointed
def simple_fn(x, y):
    return x + y

# Define a simple module that uses checkpointing
class SimpleModule(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)

# Create small tensors
x = torch.randn(2, 4)
y = torch.randn(2, 4)

# Define gradient checkpointing kwargs
gradient_checkpointing_kwargs = {
    'use_reentrant': True
}

ARGS = {
    'fn': simple_fn,
    'gradient_checkpointing_kwargs': gradient_checkpointing_kwargs
}
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 function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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
expand2square Ran
ran; our contract draft was wrong, not the code
Franklin-Zhang0/ReasonGen-R1/Janus/janus/models/image_processing_vlm.py
code served (permissive licence) · get_code("592b3c1a88f93d7c")
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) and returned Image. 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.

from PIL import Image

# Create a small test image (non-square)
pil_img = Image.new('RGB', (8, 6), color='red')

# Define background color for padding
background_color = (255, 255, 255)

ARGS = {
    'pil_img': pil_img,
    'background_color': background_color,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
PIL — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Image — a Image output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Image output the recorded ndim 3 and dtype family int 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_huggingface_actor_config Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
Franklin-Zhang0/ReasonGen-R1/verl/utils/model.py
code served (permissive licence) · get_code("fe79c459a3e4cc64")
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 MockConfig. 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
from transformers import AutoConfig

torch.manual_seed(0)

# The function uses:
# - model_name: str parameter passed to AutoConfig.from_pretrained()
# - override_config_kwargs: Dict that gets iterated with items() and used with setattr()
# - trust_remote_code: bool parameter passed to AutoConfig.from_pretrained()

# Since we can't actually download models, we need to mock AutoConfig.from_pretrained
# to return a config object that has attributes we can set

class MockConfig:
    """Mock configuration object that behaves like a PretrainedConfig"""
    def __init__(self):
        self.hidden_size = 768
        self.num_hidden_layers = 12
        self.vocab_size = 50257
        self.max_position_embeddings = 2048
    
    def __repr__(self):
        return f"MockConfig(hidden_size={self.hidden_size}, num_hidden_layers={self.num_hidden_layers})"

# Patch AutoConfig.from_pretrained to return our mock config
original_from_pretrained = AutoConfig.from_pretrained
AutoConfig.from_pretrained = lambda model_name, trust_remote_code=False: MockConfig()

ARGS = {
    "model_name": "gpt2",
    "override_config_kwargs": {
        "hidden_size": 256,
        "num_hidden_layers": 4,
        "vocab_size": 1000
    },
    "trust_remote_code": False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, transformers — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type MockConfig — a MockConfig output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a MockConfig 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
make_plural Ran
ran; our contract draft was wrong, not the code
Franklin-Zhang0/ReasonGen-R1/gen_prompt/create_prompts.py
code served (permissive licence) · get_code("556a917293596716")
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

def make_plural(name: str):
    if name[-1] in 's':
        return f'{name}es'
    return f'{name}s'

ARGS = {
    'name': 'cat'
}
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
union_tensor_dict Ran
ran; our contract draft was wrong, not the code
Franklin-Zhang0/ReasonGen-R1/verl/protocol.py
code served (permissive licence) · get_code("21331a58f93375e4")
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 TensorDict. 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
from tensordict import TensorDict

torch.manual_seed(0)

# Create two TensorDicts with identical batch size
batch_size = torch.Size([2])

# First tensor dict with some keys
tensor_dict1 = TensorDict(
    {
        "shared_key": torch.randn(2, 4),
        "key1": torch.randn(2, 3),
    },
    batch_size=batch_size,
)

# Second tensor dict with overlapping and new keys
tensor_dict2 = TensorDict(
    {
        "shared_key": tensor_dict1["shared_key"].clone(),  # Same tensor values
        "key2": torch.randn(2, 5),
    },
    batch_size=batch_size,
)

ARGS = {
    "tensor_dict1": tensor_dict1,
    "tensor_dict2": tensor_dict2,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
tensordict, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type TensorDict — a TensorDict 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
unpad_dataproto Ran
ran; our contract draft was wrong, not the code
Franklin-Zhang0/ReasonGen-R1/verl/protocol.py
code served (permissive licence) · get_code("25f0ea3f460f6ce1")
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) and returned DataProto. 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)

class DataProto:
    """Stand-in class for DataProto that supports slicing."""
    def __init__(self, data):
        self.data = data
    
    def __getitem__(self, key):
        """Support slicing to return a new DataProto with sliced data."""
        sliced_data = self.data[key]
        return DataProto(sliced_data)
    
    def __repr__(self):
        return f"DataProto({self.data})"

# Create a small DataProto instance with some data
data_tensor = torch.randn(2, 4)
data_proto = DataProto(data_tensor)

ARGS = {
    "data": data_proto,
    "pad_size": 0
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type DataProto — a DataProto output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a DataProto 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
with_article Ran
ran; our contract draft was wrong, not the code
Franklin-Zhang0/ReasonGen-R1/gen_prompt/create_prompts.py
code served (permissive licence) · get_code("e56c199fc836a44e")
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

def with_article(name: str):
    if name[0] in 'aeiou':
        return f'an {name}'
    return f'a {name}'

ARGS = {
    'name': 'apple'
}
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
generate_single_object_sample Not yet run
unverified (harvested, no recorded run)
Franklin-Zhang0/ReasonGen-R1/gen_prompt/create_prompts.py
code served (permissive licence) · get_code("601de58a282ecb25")
How it ran

no invocation recorded.

get_generation_config Not yet run
unverified (harvested, no recorded run)
Franklin-Zhang0/ReasonGen-R1/verl/utils/model.py
code served (permissive licence) · get_code("660713a8fa047736")
How it ran

no invocation recorded.

get_prompt Not yet run
unverified (harvested, no recorded run)
Franklin-Zhang0/ReasonGen-R1/benchmark/generate_inference_dpg.py
code served (permissive licence) · get_code("0b420baae60fbb33")
How it ran

no invocation recorded.

get_weight_loader Not yet run
unverified (harvested, no recorded run)
Franklin-Zhang0/ReasonGen-R1/verl/models/weight_loader_registry.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from ncbi-nlp/Med-V1, is pointer only (licence: NOASSERTION) · get_code("af005d03c2088909")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from ncbi-nlp/Med-V1, and GitHub could not classify the licence of that repository (NOASSERTION). 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. No invocation recorded.

get_weight_saver Not yet run
unverified (harvested, no recorded run)
Franklin-Zhang0/ReasonGen-R1/verl/models/weight_loader_registry.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from ncbi-nlp/Med-V1, is pointer only (licence: NOASSERTION) · get_code("0cc9aa000ef7d88e")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from ncbi-nlp/Med-V1, and GitHub could not classify the licence of that repository (NOASSERTION). 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. No invocation recorded.

squeeze Not yet run
unverified (harvested, no recorded run)
Franklin-Zhang0/ReasonGen-R1/verl/utils/model.py
code served (permissive licence) · get_code("3b15e2ac7497c441")
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, 11 are also present in other papers whose code we hold (10 with at least one paper dated earlier, 7 the same month, 8 later) and 2 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
unpad_dataproto 89 other papers
12 dated earlier, 11 the same month, 62 later, 1 same year, order not determinable, 3 undated
2409.19256 (2024-09)
HybridFlow: A Flexible and Efficient RLHF Framework
2410.21236 (2024-10)
Flaming-hot Initiation with Regular Execution Sampling for Large Language Models
2025.findings-emnlp.1015 (2025 (year only))
MT-R1-Zero: Advancing LLM-based Machine Translation via R1-Zero-like Reinforcement Learning
and 86 more not named here
squeeze 82 other papers
11 dated earlier, 11 the same month, 56 later, 1 same year, order not determinable, 3 undated
2409.19256 (2024-09)
HybridFlow: A Flexible and Efficient RLHF Framework
2410.21236 (2024-10)
Flaming-hot Initiation with Regular Execution Sampling for Large Language Models
2025.findings-emnlp.1015 (2025 (year only))
MT-R1-Zero: Advancing LLM-based Machine Translation via R1-Zero-like Reinforcement Learning
and 79 more not named here
expand2square 68 other papers
59 dated earlier, 2 the same month, 6 later, 1 same year, order not determinable · 1 only as an assembly brick
2112.05682 (2021-12)
Self-attention Does Not Need $O(n^2)$ Memory
2204.03541 (2022-04)
End-to-End Zero-Shot HOI Detection via Vision and Language Knowledge Distillation
2308.10253 (2023-08)
StableLLaVA: Enhanced Visual Instruction Tuning with Synthesized Image-Dialogue Data
and 65 more not named here
union_tensor_dict 64 other papers
12 dated earlier, 13 the same month, 35 later, 1 same year, order not determinable, 3 undated · 4 only as an assembly brick
2409.19256 (2024-09)
HybridFlow: A Flexible and Efficient RLHF Framework
2410.21236 (2024-10)
Flaming-hot Initiation with Regular Execution Sampling for Large Language Models
2025.findings-emnlp.1015 (2025 (year only))
MT-R1-Zero: Advancing LLM-based Machine Translation via R1-Zero-like Reinforcement Learning
and 61 more not named here
get_generation_config 63 other papers
7 dated earlier, 4 the same month, 50 later, 2 undated
2409.19256 (2024-09)
HybridFlow: A Flexible and Efficient RLHF Framework
2410.21236 (2024-10)
Flaming-hot Initiation with Regular Execution Sampling for Large Language Models
2502.19613 (2025-02)
Self-rewarding correction for mathematical reasoning
and 60 more not named here
get_huggingface_actor_config 53 other papers
11 dated earlier, 11 the same month, 28 later, 1 same year, order not determinable, 2 undated
2409.19256 (2024-09)
HybridFlow: A Flexible and Efficient RLHF Framework
2410.21236 (2024-10)
Flaming-hot Initiation with Regular Execution Sampling for Large Language Models
2025.findings-emnlp.1015 (2025 (year only))
MT-R1-Zero: Advancing LLM-based Machine Translation via R1-Zero-like Reinforcement Learning
and 50 more not named here
get_weight_loader 4 other papers
1 dated earlier, 1 the same month, 2 later
2502.19613 (2025-02)
Self-rewarding correction for mathematical reasoning
2505.18822 (2025-05)
AdaCtrl: Towards Adaptive and Controllable Reasoning via Difficulty-Aware Budgeting
2602.12735 (2026-02)
VimRAG: Navigating Massive Visual Context in Retrieval-Augmented Generation via Multimodal Memory Graph
and 1 more not named here
generate_single_object_sample 1 other paper
1 dated earlier
2310.11513 (2023-10)
GenEval: An Object-Focused Framework for Evaluating Text-to-Image Alignment
get_weight_saver 1 other paper
1 later
2603.05308 (2026-03)
Med-V1: Small Language Models for Zero-shot and Scalable Biomedical Evidence Attribution
make_plural 1 other paper
1 dated earlier
2310.11513 (2023-10)
GenEval: An Object-Focused Framework for Evaluating Text-to-Image Alignment
with_article 1 other paper
1 dated earlier
2310.11513 (2023-10)
GenEval: An Object-Focused Framework for Evaluating Text-to-Image Alignment

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

Although chain-of-thought reasoning and reinforcement learning (RL) have driven breakthroughs in NLP, their integration into generative vision models remains underexplored. We introduce ReasonGen-R1, a two-stage framework that first imbues an autoregressive image generator with explicit text-based "thinking" skills via supervised fine-tuning on a newly generated reasoning dataset of written rationales, and then refines its outputs using Group Relative Policy Optimization. To enable the model to reason through text before generating images, We automatically generate and release a corpus of model crafted rationales paired with visual prompts, enabling controlled planning of object layouts, styles, and scene compositions. Our GRPO algorithm uses reward signals from a pretrained vision language model to assess overall visual quality, optimizing the policy in each update. Evaluations on GenEval, DPG, and the T2I benchmark demonstrate that ReasonGen-R1 consistently outperforms strong baselines and prior state-of-the-art models. More: aka.ms/reasongen.

For agents

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

get_harvested_code_for_paper("2505.24875")
get_code_for_paper("2505.24875")
have("2505.24875")

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

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

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

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

Connect an agent — have() is free.