SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2104.05832 · NAACL · 2021

SPARTQA: A Textual Question Answering Benchmark for Spatial Reasoning

Parisa Kordjamshidi, Qiang Ning, Hossein Faghihi, Roshanak Mirzaee

arXiv · PDF · Open in the Atlas

Code that ran

9 of 15 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; 8 failures of our instrument; 6 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/2104.05832.json · badge: /api/ran/2104.05832.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
HLR/SpartQA_generation canonical (classifier label)
classifier basis: census
9 ran · 6 no recorded run
FunctionStatusWhere it lives
change_words Ran
ran; our contract draft was wrong, not the code
HLR/SpartQA_generation/Change_Words.py
code served (permissive licence) · get_code("d6229884b540daa0")
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)

# Analyzing the function signature:
# change_words(text, rel_rand, shape_rand, size_rand, color_rand)
# 
# The function calls:
# - relation(text, rel_rand) - rel_rand is indexed with enumerate(words) where words has 5 items
# - shape(text, shape_rand) - shape_rand is indexed with enumerate(words) where words has 3 items
# - color(text, color_rand) - color_rand is indexed with enumerate(words) where words has 3 items
# - size(text, size_rand) - size_rand is indexed with enumerate(words) where words has 3 items
#
# Each rand parameter is accessed as rand[ind] where ind goes from 0 to len(words)-1
# So each needs to be indexable and support boolean evaluation

# Create test data
text = "a blue circle on the left side is small"
rel_rand = [True, False, True, False, True]  # 5 elements for relation words
shape_rand = [True, False, True]  # 3 elements for shape words
color_rand = [False, True, False]  # 3 elements for color words
size_rand = [True, False, True]  # 3 elements for size words

ARGS = {
    "text": text,
    "rel_rand": rel_rand,
    "shape_rand": shape_rand,
    "size_rand": size_rand,
    "color_rand": color_rand
}
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
change_words_ans Ran
ran; our contract draft was wrong, not the code
HLR/SpartQA_generation/Change_Words.py
code served (permissive licence) · get_code("8bf1ca2d5402acbb")
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

torch.manual_seed(0)

# Analyzing the function change_words_ans:
# - list_ans: a list that contains strings (checked with type(word) == str)
# - rel_rand: passed to relation_ans function, used to index into a dict of 5 words
# - shape_rand: passed to shape function, used to index into a dict of 3 words
# - color_rand: passed to color function, used to index into a dict of 3 words
# - size_rand: passed to size function, used to index into a dict of 3 words

# Each rand parameter is indexed by enumerate, so they need to be indexable
# and support boolean checks (if rand[ind])

# Create test data
list_ans = [
    "the blue circle is small and left of the square",
    "a yellow big triangle near to the black square"
]

# Create rand parameters as lists of booleans
# relation_ans has 5 words (left, right, below, above, near to)
rel_rand = [True, False, True, False, True]

# shape has 3 words (circle, square, triangle)
shape_rand = [True, False, True]

# color has 3 words (blue, black, yellow)
color_rand = [True, True, False]

# size has 3 words (small, medium, big)
size_rand = [True, False, True]

ARGS = {
    "list_ans": list_ans,
    "rel_rand": rel_rand,
    "shape_rand": shape_rand,
    "size_rand": size_rand,
    "color_rand": color_rand
}
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
choose_between_rels Ran
ran; our contract draft was wrong, not the code
HLR/SpartQA_generation/Random_choice.py
code served (permissive licence) · get_code("e1ba4d64b3969bd1")
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 random

# Set seed for reproducibility
random.seed(0)

# Construct the 'rels' parameter
# Looking at the function, it expects a list of tuples where:
# - First element (sample[0]) is some identifier
# - Second element (sample[1]) is a list of relation strings
rels = [
    ("relation_1", ["touching", "near", "above"]),
    ("relation_2", ["below", "left_of"]),
    ("relation_3", ["touching", "right_of", "overlapping"]),
    ("relation_4", ["between", "inside"]),
    ("relation_5", ["touching", "adjacent"]),
]

# The num parameter - how many relations to choose
num = 5

ARGS = {
    "num": num,
    "rels": rels,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — 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
creating_annotation Ran
ran; our contract draft was wrong, not the code
HLR/SpartQA_generation/Annotation.py
code served (permissive licence) · get_code("541abab8fb2b7ac0")
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

torch.manual_seed(0)

# Build the global sprl_annotation structure that find_phrases expects
sprl_annotation_data = {
    'annotations': [
        {
            'spatial_description': [
                {
                    'trajector': {
                        'entity_id': 100,
                        'block_id': 100,
                        'phrase': 'block A',
                        'SOT_sentence': 'Block A is here',
                        'SOT_text': 'Block A'
                    },
                    'landmark': {
                        'entity_id': 101,
                        'block_id': 101,
                        'phrase': 'block B',
                        'SOT_sentence': 'Block B is there',
                        'SOT_text': 'Block B'
                    }
                },
                {
                    'trajector': {
                        'entity_id': 1,
                        'block_id': 100,
                        'phrase': 'red object',
                        'SOT_sentence': 'The red object',
                        'SOT_text': 'red'
                    },
                    'landmark': {
                        'entity_id': 2,
                        'block_id': 100,
                        'phrase': 'blue object',
                        'SOT_sentence': 'The blue object',
                        'SOT_text': 'blue'
                    }
                }
            ]
        }
    ]
}

# Create test data for blocks_rels
# Format: [[trajector_idx, landmark_idx], spatial_indicator]
blocks_rels = [
    [[0, 1], 'above'],
    [[1, 2], 'below']
]

# Create test data for objects_desc
# Format: list indexed by block_num, each containing objects
# Each object: [id, size_info, color_info, shape_info, relation_info, number]
objects_desc = [
    [
        [1, {'size': 'large'}, {'color': 'red'}, {'type': 'cube'}, {'rel': 'in'}, '1'],
        [2, {'size': 'small'}, {'color': 'blue'}, {'type': 'sphere'}, {'rel': 'on'}, '2'],
    ],
    [
        [3, {'size': 'medium'}, {'color': 'green'}, {'type': 'cylinder'}, {'rel': 'in'}, '1'],
        None,
    ],
    [
        None,
    ]
]

# Create test data for objects_rels
# Format: list indexed by block_num, each containing object relations
# Each relation: [[trajector_id, landmark_id], spatial_indicator]
objects_rels = [
    [
        [[1, 2], 'left_of'],
        [[2, 1], 'right_of'],
    ],
    [
        [[3, 1], 'above'],
    ],
    [
        None,
    ]
]

# Create test story
story = "This is a test story about blocks and objects."

ARGS = {
    'story': story,
    'block_rels': blocks_rels,
    'objects_desc': objects_desc,
    'objects_rels': objects_rels,
    '_sprl_annotation': sprl_annotation_data
}
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
forbid Ran
ran; our contract draft was wrong, not the code
HLR/SpartQA_generation/Find_Relations.py
code served (permissive licence) · get_code("8c1ae295e11d5bdd")
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

ARGS = {
    'word': 'left'
}
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
obj_obj_relation Ran
ran; our contract draft was wrong, not the code
HLR/SpartQA_generation/Find_Relations.py
code served (permissive licence) · get_code("d69e73359d1aa097")
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 numpy as np

ARGS = {
    "scene": {
        0: ("obj_0", {
            "x_loc": 10,
            "y_loc": 20,
            "size": 15
        }),
        1: ("obj_1", {
            "x_loc": 100,
            "y_loc": 150,
            "size": 20
        })
    },
    "fst": 0,
    "sec": 1,
    "limitation": [
        ((1, 0), ["left", "above"])
    ]
}
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 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
relation Ran
ran; our contract draft was wrong, not the code
HLR/SpartQA_generation/Change_Words.py
code served (permissive licence) · get_code("5af880837188dad5")
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)

# Analyze the function:
# - text: a string that gets searched and replaced
# - rand: a list/array that is indexed with enumerate(words), so needs len(rand) >= len(words)
# The function iterates through 5 words, so rand needs at least 5 boolean elements

text = "The cat is left near to the dog on the right side below the tree"
rand = [True, False, True, False, True]

ARGS = {
    "text": text,
    "rand": rand
}
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
scene_obj_relation Ran
ran; our contract draft was wrong, not the code
HLR/SpartQA_generation/Find_Relations.py
code served (permissive licence) · get_code("62a58ac46329a860")
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 random

# Construct the story dict with the required nested structure
story = {
    'structured_rep': {
        0: {  # scene 0
            'obj1': {
                'y_loc': 0,
                'x_loc': 10,
                'size': 20
            },
            'obj2': {
                'y_loc': 50,
                'x_loc': 80,
                'size': 15
            }
        },
        1: {  # scene 1
            'obj1': {
                'y_loc': 40,
                'x_loc': 0,
                'size': 25
            },
            'obj2': {
                'y_loc': 60,
                'x_loc': 70,
                'size': 30
            }
        }
    }
}

# Set random seed for reproducibility
random.seed(0)

ARGS = {
    'story': story,
    'scene': 0,
    'obj': 'obj1'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — 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
total_number_func Ran
ran, honoured the contract we drafted
HLR/SpartQA_generation/Random_choice.py
code served (permissive licence) · get_code("453eb61b94e9f7ba")
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 int, ndim 0, dtype family int, 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

torch.manual_seed(0)

# The function expects a dict with a 'structured_rep' key
# The 'structured_rep' value should be iterable where each element has a len()
# This could be a list of lists, list of tensors, etc.

story = {
    'structured_rep': [
        [1, 2, 3],           # len = 3
        [4, 5],              # len = 2
        [6, 7, 8, 9],        # len = 4
        []                   # len = 0
    ]
}

ARGS = {
    'story': story
}
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 int, ndim 0, dtype family int, 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
B Not yet run
unverified (harvested, no recorded run)
HLR/SpartQA_generation/Creating_story.py
code served (permissive licence) · get_code("471651d79ce54356")
How it ran

no invocation recorded.

B0 Not yet run
unverified (harvested, no recorded run)
HLR/SpartQA_generation/Creating_story.py
code served (permissive licence) · get_code("67d12a7be1b07cd6")
How it ran

no invocation recorded.

blocks Not yet run
unverified (harvested, no recorded run)
HLR/SpartQA_generation/Annotation.py
code served (permissive licence) · get_code("1b61b695e4b1591b")
How it ran

no invocation recorded.

objects Not yet run
unverified (harvested, no recorded run)
HLR/SpartQA_generation/Annotation.py
code served (permissive licence) · get_code("606cc962682d5541")
How it ran

no invocation recorded.

one_obj Not yet run
unverified (harvested, no recorded run)
HLR/SpartQA_generation/Creating_questions.py
code served (permissive licence) · get_code("21f5044baf23737b")
How it ran

no invocation recorded.

one_obj_restricted Not yet run
unverified (harvested, no recorded run)
HLR/SpartQA_generation/Creating_questions.py
code served (permissive licence) · get_code("8d5dfad0949f2da3")
How it ran

no invocation recorded.

Also present in other papers' code

Of 15 samples lifted from this paper's linked repositories, 15 carry a function identity and 0 do not. Of the 15 distinct functions with an identity, 8 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 8 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
blocks 1 other paper
1 later
2210.16952 (2022-10)
Transfer Learning with Synthetic Corpora for Spatial Role Labeling and Reasoning
change_words 1 other paper
1 later
2210.16952 (2022-10)
Transfer Learning with Synthetic Corpora for Spatial Role Labeling and Reasoning
change_words_ans 1 other paper
1 later
2210.16952 (2022-10)
Transfer Learning with Synthetic Corpora for Spatial Role Labeling and Reasoning
choose_between_rels 1 other paper
1 later
2210.16952 (2022-10)
Transfer Learning with Synthetic Corpora for Spatial Role Labeling and Reasoning
creating_annotation 1 other paper
1 later
2210.16952 (2022-10)
Transfer Learning with Synthetic Corpora for Spatial Role Labeling and Reasoning
objects 1 other paper
1 later
2210.16952 (2022-10)
Transfer Learning with Synthetic Corpora for Spatial Role Labeling and Reasoning
relation 1 other paper
1 later
2210.16952 (2022-10)
Transfer Learning with Synthetic Corpora for Spatial Role Labeling and Reasoning
total_number_func 1 other paper
1 later
2210.16952 (2022-10)
Transfer Learning with Synthetic Corpora for Spatial Role Labeling and Reasoning

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

This paper proposes a question-answering (QA) benchmark for spatial reasoning on natural language text which contains more realistic spatial phenomena not covered by prior work and is challenging for state-of-the-art language models (LM). We propose a distant supervision method to improve on this task. Specifically, we design grammar and reasoning rules to automatically generate a spatial description of visual scenes and corresponding QA pairs. Experiments show that further pretraining LMs on these automatically generated data significantly improves LMs' capability on spatial understanding, which in turn helps to better solve two external datasets, bAbI, and boolQ. We hope that this work can foster investigations into more sophisticated models for spatial reasoning over text.

For agents

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

get_harvested_code_for_paper("2104.05832")
get_code_for_paper("2104.05832")
have("2104.05832")

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

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

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

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

Connect an agent — have() is free.