SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2404.01197 · ECCV · 2024

Getting it Right: Improving Spatial Consistency in Text-to-Image Models

Chitta Baral, Hannaneh Hajishirzi, Yezhou Yang, Sayak Paul, Ludwig Schmidt, Vasudev Lal, Melech Stan, Estelle Aflalo, Agneet Chatterj, Gabriel Ben, Dhru Ghosh, Tej Gokhale

arXiv · PDF · Open in the Atlas

Code that ran

3 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; 0 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 3 failures of our instrument; 3 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/2404.01197.json · badge: /api/ran/2404.01197.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
SPRIGHT-T2I/SPRIGHT canonical (classifier label)
classifier basis: census
3 ran · 3 no recorded run
FunctionStatusWhere it lives
create_payload Ran
ran; our contract draft was wrong, not the code
SPRIGHT-T2I/SPRIGHT/eval/gpt4/eval_with_gpt4.py
code served (permissive licence) · get_code("75533a417777ed7f")
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 base64
import io
from PIL import Image
import numpy as np

# Create a small test image and convert to base64
def create_test_image():
    # Create a simple 10x10 RGB image
    img_array = np.random.randint(0, 256, (10, 10, 3), dtype=np.uint8)
    img = Image.fromarray(img_array, 'RGB')
    
    # Convert to base64
    buffered = io.BytesIO()
    img.save(buffered, format="JPEG")
    img_string = base64.b64encode(buffered.getvalue()).decode()
    return img_string

image_string = create_test_image()
caption = "A large red object on the left side with a small blue object on the right side in the background."

ARGS = {
    'image_string': image_string,
    'caption': caption
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, numpy — 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
encode_image Ran
ran; our contract draft was wrong, not the code
SPRIGHT-T2I/SPRIGHT/eval/gpt4/eval_with_gpt4.py
code served (permissive licence) · get_code("57bfaec2f02fdac2")
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.

from PIL import Image
import torch
import numpy as np

# Create a small PIL Image object
# The function calls image.save(), so we need a real PIL Image
img_array = np.random.randint(0, 256, (10, 10, 3), dtype=np.uint8)
pil_image = Image.fromarray(img_array, mode='RGB')

ARGS = {
    'image': pil_image
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, 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
sort_file_paths Ran
ran; our contract draft was wrong, not the code
SPRIGHT-T2I/SPRIGHT/eval/gpt4/collate_gpt4_results.py
code served (permissive licence) · get_code("61d2ea68e47261f9")
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 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 numpy as np

# Define ARGS dictionary with valid arguments for sort_file_paths
ARGS = {
    'file_paths': [
        'dataset_v1_3_train.txt',
        'dataset_v1_1_test.txt',
        'dataset_v1_2_val.txt',
        'dataset_v1_5_backup.txt',
        'dataset_v1_4_extra.txt'
    ]
}
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 float — 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
copy_images Not yet run
unverified (harvested, no recorded run)
SPRIGHT-T2I/SPRIGHT/eval/gpt4/create_eval_dataset.py
code served (permissive licence) · get_code("4cdc2946cd076c08")
How it ran

no invocation recorded.

get_ratings_from_json Not yet run
unverified (harvested, no recorded run)
SPRIGHT-T2I/SPRIGHT/eval/gpt4/collate_gpt4_results.py
code served (permissive licence) · get_code("7907eec720d8a01d")
How it ran

no invocation recorded.

get_response Not yet run
unverified (harvested, no recorded run)
SPRIGHT-T2I/SPRIGHT/eval/gpt4/eval_with_gpt4.py
code served (permissive licence) · get_code("b153819851508e8f")
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, 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 6 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-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

One of the key shortcomings in current text-to-image (T2I) models is their inability to consistently generate images which faithfully follow the spatial relationships specified in the text prompt. In this paper, we offer a comprehensive investigation of this limitation, while also developing datasets and methods that support algorithmic solutions to improve spatial reasoning in T2I models. We find that spatial relationships are under-represented in the image descriptions found in current vision-language datasets. To alleviate this data bottleneck, we create SPRIGHT, the first spatially focused, large-scale dataset, by re-captioning 6 million images from 4 widely used vision datasets and through a 3-fold evaluation and analysis pipeline, show that SPRIGHT improves the proportion of spatial relationships in existing datasets. We show the efficacy of SPRIGHT data by showing that using only ⇠0.25% of SPRIGHT results in a 22% improvement in generating spatially accurate images while also improving FID and CMMD scores. We also find that training on images containing a larger number of objects leads to substantial improvements in spatial consistency, including state-of-theart results on T2I-CompBench with a spatial score of 0.2133, by finetuning on <500 images. Through a set of controlled experiments and ablations, we document additional findings that could support future work that seeks to understand factors that affect spatial consistency in text-to-image models. Project page : https://spright-t2i.github.io/

For agents

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

get_harvested_code_for_paper("2404.01197")
get_code_for_paper("2404.01197")
have("2404.01197")

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

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

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

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

Connect an agent — have() is free.