SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2110.09753 · 2021

Unifying Multimodal Transformer for Bi-directional Image and Text Generation

arXiv · PDF · Open in the Atlas

Code that ran

6 of 8 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 6 have no contract verdict; 0 failures of our instrument; 2 no recorded run), measured 2026-11-22; 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/2110.09753.json · badge: /api/ran/2110.09753.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
researchmm/generate-it canonical (classifier label)
classifier basis not recorded on the link
6 ran · 2 no recorded run
FunctionStatusWhere it lives
array_to_str Ran
ran on a synthesized input
researchmm/generate-it/it-generator/loss.py
code served (permissive licence) · get_code("6a609c6155c138b3")
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)

# The function array_to_str takes an array-like object and converts it to a string
# It iterates through elements, converts each to string, and stops at EOS token
# Parameters:
# - arr: array-like object with len() and indexing support
# - EOS: end-of-sequence marker (default 0)

# Test case 1: numpy array with EOS marker
arr_numpy = np.array([1, 2, 3, 0, 5, 6])

# Test case 2: torch tensor
arr_torch = torch.tensor([7, 8, 9, 0, 11, 12])

# Test case 3: python list
arr_list = [4, 5, 6, 0, 8, 9]

# We'll use a simple list for the main test
arr = [1, 2, 3, 0, 5, 6]
EOS = 0

ARGS = {
    'arr': arr,
    'EOS': EOS
}
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
clean_text Ran
ran on a synthesized input
researchmm/generate-it/diverse-it-generator/sample_images.py
code served (permissive licence) · get_code("54027d44ffd92b3d")
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

torch.manual_seed(0)

# The function clean_text takes a string (sent) and performs various text cleaning operations
# It uses only string methods like replace(), split(), and join()
# No complex objects needed - just a simple string

ARGS = {
    'sent': 'Hello  world.\n This is a test/string with �� bad chars and  spaces.'
}
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
collate_fn_test Ran
ran on a synthesized input
researchmm/generate-it/diverse-it-generator/dataset.py
code served (permissive licence) · get_code("2b8adb12cabcf6e3")
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. 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)

# The function expects a batch parameter which is a list of tuples
# Each tuple contains (grid_feature, image_id, cluster_index)
# grid_feature can be None or a tensor
# image_id should be a tensor (will be stacked)
# cluster_index can be None or a tensor

# Create sample batch items
batch_item_1 = (
    torch.randn(4, 3),  # grid_feature
    torch.tensor(1),     # image_id
    torch.tensor([0, 1, 2, 3])  # cluster_index
)

batch_item_2 = (
    torch.randn(4, 3),  # grid_feature
    torch.tensor(2),     # image_id
    torch.tensor([1, 2, 3, 0])  # cluster_index
)

batch = [batch_item_1, batch_item_2]

ARGS = {
    "batch": batch
}
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 — a tuple 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
collate_fn_train Ran
ran on a synthesized input
researchmm/generate-it/diverse-it-generator/dataset.py
code served (permissive licence) · get_code("8c40495897857bbf")
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. 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 torch.nn.utils.rnn import pad_sequence

torch.manual_seed(0)

# Create sample batch data
# Each element in batch is a tuple of:
# (cluster_index, input_token_id, masked_token_id, grid_feature, segment_type_id, mask_idx, position_id)

batch_item_1 = (
    torch.randint(0, 5, (3,)),  # cluster_index
    torch.randint(1, 10, (5,)),  # input_token_id
    torch.randint(1, 10, (5,)),  # masked_token_id
    torch.randn(4, 8),  # grid_feature
    torch.randint(0, 3, (5,)),  # segment_type_id
    torch.tensor([1, 2]),  # mask_idx
    torch.randint(0, 10, (5,)),  # position_id
)

batch_item_2 = (
    torch.randint(0, 5, (3,)),  # cluster_index
    torch.randint(1, 10, (4,)),  # input_token_id (different length)
    torch.randint(1, 10, (4,)),  # masked_token_id (different length)
    torch.randn(4, 8),  # grid_feature
    torch.randint(0, 3, (4,)),  # segment_type_id (different length)
    torch.tensor([0, 1]),  # mask_idx
    torch.randint(0, 10, (4,)),  # position_id (different length)
)

batch = [batch_item_1, batch_item_2]

ARGS = {
    "batch": batch
}
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 — a tuple 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
eval_clipscore Ran
ran on a synthesized input
researchmm/generate-it/it-generator/evaluate_images.py
code served (permissive licence) · get_code("894007cc85d7765f")
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 float, 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 tempfile
import pathlib
from PIL import Image
import os

torch.manual_seed(0)

# Create a mock ClipScorer class since we can't import the real one
class MockClipScorer:
    def __call__(self, image_list, text_list):
        # Return a tensor of scores, one per image
        return torch.ones(len(image_list), dtype=torch.float32)

# Patch the loss module
import sys
from types import ModuleType

loss_module = ModuleType('loss')
loss_module.ClipScorer = MockClipScorer
sys.modules['loss'] = loss_module

# Create a temporary directory with test images and filenames
temp_dir = tempfile.mkdtemp()

# Create test images with descriptive filenames
test_cases = [
    ('img1.a%20dog%20running.png', 'a dog running'),
    ('img2.a%20cat%20sitting.jpg', 'a cat sitting'),
]

for filename, _ in test_cases:
    # Create a simple PIL image
    img = Image.new('RGB', (4, 3), color=(73, 109, 137))
    filepath = os.path.join(temp_dir, filename)
    img.save(filepath)

ARGS = {
    'img_save_dir': temp_dir,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, loss, torch, tqdm — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, 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
to_contiguous Ran
ran on a synthesized input
researchmm/generate-it/it-generator/loss.py
code served (permissive licence) · get_code("df768a32f36d7728")
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 (4, 2) 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 non-contiguous tensor by transposing
tensor = torch.randn(2, 4).t()  # Transpose to make it non-contiguous

ARGS = {
    "tensor": tensor
}
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 (4, 2) — shape (4, 2) 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
eval_rprec Not yet run
unverified (harvested, no recorded run)
researchmm/generate-it/it-generator/evaluate_images.py
code served (permissive licence) · get_code("97216c8f596bae40")
How it ran

no invocation recorded.

eval_rprec_hard Not yet run
unverified (harvested, no recorded run)
researchmm/generate-it/it-generator/evaluate_images.py
code served (permissive licence) · get_code("8f915c7ceb3fc46f")
How it ran

no invocation recorded.

Also present in other papers' code

Of 8 samples lifted from this paper's linked repositories, 8 carry a function identity and 0 do not. Of the 8 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, 1 later) and 7 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
to_contiguous 3 other papers
2 dated earlier, 1 later
1804.09160 (2018-04)
No Metrics Are Perfect: Adversarial Reward Learning for Visual Storytelling
1909.11059 (2019-09)
Unified Vision-Language Pre-Training for Image Captioning and VQA

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

Repositories linked to this paper

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

Abstract

We study the joint learning of image-to-text and text-to-image generations, which are naturally bi-directional tasks. Typical existing works design two separate task-specific models for each task, which impose expensive design efforts. In this work, we propose a unified image-and-text generative framework based on a single multimodal model to jointly study the bi-directional tasks. We adopt Transformer as our unified architecture for its strong performance and task-agnostic design. Specifically, we formulate both tasks as sequence generation tasks, where we represent images and text as unified sequences of tokens, and the Transformer learns multimodal interactions to generate sequences. We further propose two-level granularity feature representations and sequence-level training to improve the Transformer-based unified framework. Experiments show that our approach significantly improves previous Transformer-based model X-LXMERT's FID from 37.0 to 29.9 (lower is better) for text-to-image generation, and improves CIDEr-D score from 100.9% to 122.6% for fine-tuned image-to-text generation on the MS-COCO dataset. Our code is available online.

For agents

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

get_harvested_code_for_paper("2110.09753")
get_code_for_paper("2110.09753")
have("2110.09753")

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

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

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

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

Connect an agent — have() is free.