Venue: NAACL 2021

# SpartQA: A Textual Question Answering Benchmark

for Spatial Reasoning

Roshanak Mirzae\({}^{\star}\)   Hossein Rajaby Faghihi\({}^{\clubsuit}\)   Qiang Ning\({}^{\spadesuit}\)1  Parisa Kordjamshidi\({}^{\clubsuit}\)

Footnote 1: footnotemark:

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

+
Footnote †: _Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies_, pages 4582–4598

June 6-11, 2021. ©2021 Association for Computational Linguistics

## 1 Introduction

Spatial reasoning is a cognitive process based on the construction of mental representations for spatial objects, relations, and transformations Clements and Battista (1992), which is necessary for many natural language understanding (NLU) tasks such as natural language navigation Chen et al. (2019); Roman Roman et al. (2020); Kim et al. (2020), human-machine interaction Landsiedel et al. (2017); Roman Roman et al. (2020), dialogue systems Udagawa et al. (2020), and clinical analysis Datta and Roberts (2020).

Modern language models (LM), e.g., BERT Devlin et al. (2019), ALBERT Lan et al. (2020), and XLNet Yang et al. (2019) have seen great successes in natural language processing (NLP). However, there has been limited investigation into _spatial reasoning capabilities of LMs_. To the best of our knowledge, bAbI Weston et al. (2015) (Fig 9) is the only dataset with direct textual spatial question answering (QA) (Task 17), but it is synthetic and overly simplified: (1) The underlying scenes are spatially simple, with only three objects and relations only in four directions. (2) The stories for these scenes are two short, templated sentences, each describing a single relation between two objects. (3) The questions typically require up to two-steps reasoning due to the simplicity of those stories.

To address these issues, this paper proposes a new dataset, SpartQA1 (see Fig. 1). Specifically, (1) SpartQA is built on NLVR's Suhr et al. (2017) images containing more objects with richer spatial structures (Fig. 0(b)). (2) SpartQA's stories are more natural, have more sentences, and richer in spatial relations in each sentence. (3) SpartQA's questions require deeper reasoning and have four types: _find relation_ (FR), _find blocks_ (FB), _choose object_ (CO), and _yes/no_ (YN), which allows for more fine-grained analysis of models' capabilities.

Footnote 1: _SPatial Reasoning on Textual Question Answering._

We showed annotators random images from NLVR, and instructed them to describe objects and relationships not exhaustively at the cost of naturalness (Sec. 3). In total, we obtained 1.1k unique QA pair annotations on spatial reasoning, evenly distributed among the aforementioned types. Similar to bAbI, we keep this dataset in relatively small scale and suggest to use as little training data as possible. Experiments show that modern LMs (e.g., BERT) do not perform well in this low-resource setting.

This paper thus proposes a way to obtain distant supervision signals for spatial reasoning (Sec. 4). As spatial relationships are rarely mentioned in existing corpora, we take advantage of the fact that spatial language is grounded to the geometry of visual scenes. We are able to automatically generate stories for NLVR images Suhr et al. (2017) via our newly designed context free grammars (CFG) and context-sensitive rules. In the process of story generation, we store the information about all ob

jects and relationships, such that QA pairs can also be generated automatically. In contrast to bAbI, we use various spatial rules to infer new relationships in these QA pairs, which requires more complex reasoning capabilities. Hereafter, we call this automatically-generated dataset SpartQA-Auto, and the human-annotated one SpartQA-Human.

Experiments show that, by further pretraining on SpartQA-Auto, we improve LMs' performance on SpartQA-Human by a large margin.2 The spatially-improved LMs also show stronger performance on two external QA datasets, bAbI and boolQ Clark et al. (2019): BERT further pretrained on SpartQA-Auto only requires half of the training data to achieve 99% accuracy on bAbI as compared to the original BERT; on boolQ's development set, this model shows better performance than BERT, with 2.3% relative error reduction.3

Footnote 2: Further pretraining LMs has become a common practice and baseline method for transferring knowledge between tasks Phang et al. (2018); Zhou et al. (2020). We leave more advanced methods for future work.

Footnote 3: To the best of our knowledge, the test set or leaderboard of boolQ has not been released yet.

**Our contributions can be summarized as follows.** First, we propose the first human-curated benchmark, SpartQA-Human, for spatial reasoning with richer spatial phenomena than the prior synthetic dataset bAbI Task 17).

Second, we exploit the scene structure of images and design novel CFGs and spatial reasoning rules to automatically generate data (i.e., SpartQA-Auto) to obtain distant supervision signals for spatial reasoning over text.

Third, SpartQA-Auto proves to be a rich source of spatial knowledge that improved the performance of LMs on SpartQA-Human as well as on different data domains such as bAbI and boolQ.

## 2 Related work

Question answering is a useful format to evaluate machines' capability of reading comprehension Gardner et al. (2019) and many recent works have been implementing this strategy to test machines' understanding of linguistic formalisms: He et al. (2015); Michael et al. (2018); Levy et al. (2017); Jia et al. (2018); Ning et al. (2020); Du

Figure 1: Example from SpartQA (specifically from SpartQA-Auto)



and Cardie (2020). An important advantage of QA is using natural language to annotate natural language, thus having the flexibility to get annotations on complex phenomena such as _spatial reasoning_. However, spatial reasoning phenomena have been covered minimally in the existing works.

To the best of our knowledge, Task 17 of the bAbI project Weston et al. (2015) is the only QA dataset focused on textual spatial reasoning (examples in Appendix F). However, bAbI is synthetic and does not reflect the complexity of the spatial reasoning in natural language. Solving Task 17 of bAbI typically does not require sophisticated reasoning, which is an important capability emphasized by more recent works (e.g., Dua et al. (2019); Khashabi et al. (2018); Yang et al. (2018); Dasigi et al. (2019); Ning et al. (2020)).

Spatial reasoning is arguably more prominent in multi-modal QA benchmarks, e.g., NLVR Suhr et al. (2017), VQA Antol et al. (2015), GQA Hudson and Manning (2019), CLEVR Johnson et al. (2017). However, those spatial reasoning phenomena are mostly expressed naturally through images, while this paper focuses on studying spatial reasoning on natural language. Some other works on visual-spatial reasoning are based on geographical information inside maps and diagrams Huang et al. (2019) and navigational instructions Chen et al. (2019); Anderson et al. (2018).

As another approach to evaluate spatial reasoning capabilities of models, a dataset proposed in Ghanimifard and Dobnik (2017) generates a synthetic training set of spatial sentences and evaluates the models' ability to generate spatial facts and sentences containing composition and decomposition of relations on grounded objects.

## 3 SpartQA-Human

To mitigate the aforementioned problems of Task 17 of bAbI, i.e., simple scenes, stories, and questions, we describe the data annotation process of SpartQA-Human, and explain how those problems were addressed in this section.

First, we randomly selected a subset of NLVR images, each of which has three blocks containing multiple objects (see Fig 1b). The scenes shown by these images are more complicated than those described by bAbI because (1) there are more objects in NLVR images; (2) the spatial relationships in NLVR are not limited to just four relative directions as objects are placed arbitrarily within blocks.

Second, two student volunteers produced textual description of those objects and their corresponding spatial relationships based on these images. Since the blocks are always horizontally aligned in each NLVR image, to allow for more flexibility, annotators could also rearrange these blocks (see Fig. 1a). Relationships between objects within the same block can take the forms of relative direction (e.g., left or above), qualitative distance (e.g., near or far), and topological relationship (e.g., touching or containing).

However, we instructed the annotators not to describe all objects and relationships, (1) to avoid unnecessarily verbose stories, and (2) to intentionally miss some information to enable more complex reasoning later. Therefore, annotators describe only a random subset of blocks, objects, and relationships.

To query more interesting phenomena, annotators were then encouraged to write questions requiring detecting relations and reasoning over them using multiple spatial rules. A spatial rule can be one of the transitivity (\(A\to B,B\to C\Rightarrow A\to C\)), symmetry (\(A\to B\Rightarrow B\to A\)), converse (\((A,~{}R,~{}B)\Rightarrow(B,~{}reverse(R),~{}A)\)), inclusion (\(obj1~{}in~{}A\)), and exclusion (\(obj1~{}not~{}in~{}B\)) rules.

There are four types of questions (Q-Type). (1) _FR_: find relation between two objects. (2) _FB_: find the block that contains certain object(s). (3) _CO_: choose between two objects mentioned in the question that meets certain criteria. (4) _YN_: a yes/no question that tests if a claim on spatial relationship holds.

FB, FR, and CO questions are formulated as multiple-choice questions4 and receive a list of candidate answers, and YN questions' answer is choosing from Yes, No, or "DK" (Do not Know). The "DK" option is due to the open-world assumption of the stories, where if something is not described

Figure 2: For “A blue circle is above a big triangle. To the left of the big triangle, there is a square,” if the question is: “Is the square to the left of the blue circle?”, the answer is neither Yes nor No. Thus, the correct answer is “Do not Know” (DK) in our setting.

 

in the text, it is not considered as false (See Fig. 2).

Finally, annotators were able to create 1.1k QA pairs on spatial reasoning on the generated descriptions, distributed among the aforementioned types. We intentionally keep this data in a relatively small scale due to two reasons. First, there has been some consensus in our community that modern systems, given their sufficiently large model capacities, can easily find shortcuts and overfit a dataset if provided with a large training data Gardner et al. (2020); Sen and Saffari (2020). Second, collecting spatial reasoning QAs is very costly: The two annotators spent 45-60 mins on average to create a single story with 8-16 QA pairs. We estimate that SpartQA-Human costed about 100 human hours in total. The expert performance on 100 examples of SpartQA-Human's test set measured by their accuracy of answering the questions is 92% across four Q-Types on average, indicating its high quality.

## 4 Distant Supervision: SpartQA-Auto

Since human annotations are costly, it is important to investigate ways to generate distant supervision signals for spatial reasoning. However, unlike conventional distant supervision approaches (e.g., Mintz et al. (2009); Zeng et al. (2015); Zhou et al. (2020)) where distant supervision data can be selected from large corpora by implementing specialized filtering rules, spatial reasoning does not appear often in existing corpora. Therefore, similar to SpartQA-Human, we take advantage of the ground truth of NLVR images, design CFGs to generate stories, and use spatial reasoning rules to ask and answer spatial reasoning questions. This automatically generated data is called SpartQA-Auto, and below we describe its generation process in detail.

Story generationSince NLVR comes with structured descriptions of the ground truth locations of those objects, we were able to choose random blocks and objects from each image programmatically. The benefit is two-fold. First, a random selection of blocks and objects allows us to create multiple stories for each image; second, this randomness also creates spatial reasoning opportunities with missing information.

Once we decide on a set of blocks and objects to be included, we determine their relationships: Those relationships between blocks are generated randomly; as for those between objects, we refer to the ground truth of these images to determine them.

Now we have a scene containing a set of blocks and objects and their associated relationships. To produce a story for this scene, we design CFGs to produce natural language sentences that describe those blocks/objects/relationships in various expressions (see Fig. 3 for two portions of our CFG describing relative and nested relations between objects).

The big black shape is above the medium triangle.\[S\rightarrow<Article><Object>is<Relation><Article><Object>. Article\(\quad\)=the |a Relation\(\quad\)=above |left|... Object\(\quad\)="Size"\(\ast\)<Color>*\(<Shape|Indshape>\) Size\(\quad\)=small ||_medium |big Color\(\quad\)=yellow |blue |black Shape\(\quad\)=square triangle |circle Ind_shape\(\quad\)=shape |object |thing_

Being grounded to visual scenes guarantees spatial coherency in a story, and using CFGs helps to have correct sentences (grammatically) and various expressions. We also design context-sensitive rules to limited options for each CFG's variable based on the chosen entities (e.g. black circle), or what is described in the previous sentences (e.g. Block A has \(a\) circle. _The_ circle is below \(a\) triangle.)

Question generationTo generate questions based on a passage, there are rule-based sys

Figure 3: Two parts of our designed CFG



tems Heilman and Smith (2009); Labutov et al. (2015), neural networks Du et al. (2017), and their combinations Dhole and Manning (2020). However, in our approach, during generating each story, the program stores the information about the entities and their relationships. Thus, without processing the raw text, which is error-prone, we generate questions by only looking at the stored data. The question generation operates based on four primary functionalities, _Choose-objects_, _Describe-objects_, _Find-all-relations_, and _Find-similar-objects_. These modules are responsible to control the logical consistency, correctness, and the number of steps required for reasoning in each question.

_Choose-objects_ randomly chooses up to three objects from the set of possible objects in a story under a set of constraints such as preventing selection of similar objects, or excluding objects with relations that are directly mentioned in the text.

_Describe-Objects_ generates a mention phrase for an object using parts of its full name (presented in the story). The generated phrase is either pointing to a unique object or a group of objects such as "the big circle," or "big circles." To describe a unique object, it chooses an attribute or a group of attributes that apply to a unique object among others in the story. To increase the steps of reasoning, the description may include the relationship of the object to other objects instead of using a direct unique description. For example, "the circle which is above the black triangle."

_Find-all-relations_ completes the relationship graph between objects by applying a set of spatial rules such as transitivity, symmetry, converse, inclusion, and exclusion on top of the direct relations described in the story. As shown in Fig. 4, it does an exhaustive search over all combinations of the relations that link two objects to each other.

_Find-similar-objects_ finds all the mentions matching a description from the question to objects in the story. For instance, for the question "is there any blue circle above the big blue triangle?", this module finds all the mentions in the story matching the description "a blue circle".

Similar to the SpartQA-Human, we provide four Q-Types FR, FB, CO, and YN. To generate FR questions, we choose two objects using _Choose-objects_ module and question their relationships. The YN Q-Type is similar to FR, but the question specifies one relationship of interest chosen from all relation extracted by _Find-all-relations_ module to be questioned about the objects. Since most of the time, Yes/No questions are simpler problems, we make this question type more complex by adding quantifiers (adding "all" and "any"). These quantifiers help to evaluates the models' capability to aggregate relations between more than two objects in the story and do the reasoning over all find relations to find the final answer. In FB Q-Type, we mention an object by its indirect relation to another object using the nested relation in _Describe-objects_ module and ask to find the blocks containing or not containing this object. Finally, the CO question selects an anchor object (_Choose-objects_) and specifies a relationship (using _Find-all-relations_) in the question. Two other objects are chosen as candidates to check whether the specified relationship holds between them and the anchor object. We tend to force the algorithm to choose objects as candidates that at least have one relationship to the anchor object. To see more details about different question' templates see Table 7 in the Appendix.

Answer generationWe compute all direct and indirect relationships between objects using _Find-all-relations_ function and based on the Q-Types generate the final answer.

For instance, in YN Q-Type if the asked relation exists in the found relations, the answer is "Yes", if the inverse relation exists it must be "No", and otherwise, it is "DK"5.

Footnote 5: The SpartQA-Auto generation code and the file of dataset are available at [https://github.com/HLR/SpartQA_generation](https://github.com/HLR/SpartQA_generation)

### Corpus Statistics

We generate the train, dev, and test set splits based on the same splits of the images in the NLVR dataset. On average, each story contains 9 sentences (Min:3, Max: 22) and 118 tokens (Min: 66,

Figure 4: Find the implicit relation between \(obj1\) and \(obj4\) by _Transitivity_ rule. (1) Find a set of objects that have a relation with \(obj1\). Continue the same process on the new set until \(obj4\) is found. (2) Get the union of the intermediate relations between these two objects and it is the final answer.

 

Max: 274). Also, the average tokens of each question (on all Q-Type ) is 23 (Min:6, Max: 57).

Table 1 shows the total number of each question type in SpartQA-Auto (Check Appendix to see more statistic information about the labels in Tab 8.)

## 5 Models for Spatial Reasoning over Language

This section describes the model architectures on different Q-Types: FR, YN, FB, and CO. All Q-Types can be cast into a sequence classification task, and the three transformer-based LMs tested in this paper, BERT Devlin et al. (2019), ALBERT Lan et al. (2020), and XLNet Yang et al. (2019), can all handle this type of tasks by classifying the representation of [CLS], a special token prepended to each target sequence (see Appendix E). Depending on the Q-Type, the input sequence and how we do inference may be different.

FR and YN both have a predefined label set as candidate answers, and their input sequences are both the concatenation of a story and a question. While the answer to a YN question is a single label chosen from _Yes, No_, and _DK_, FR questions can have multiple correct answers. Therefore, we treat each candidate answer to FR as an independent binary classification problem, and take the union as the final answer. As for YN, we choose the label with the highest confidence (Fig 8b).

As the candidate answers to FB and CO are not fixed and depend on each story and its question the input sequences to these Q-Types are concatenated with each candidate answer. Since the defined YN and FR model has moderately less accurate results on FB and CO Q-Types, we add a LSTM Hochreiter and Schmidhuber (1997) layer to improve it. Hence, to find the final answer, we run the model with each candidate answer and then apply an LSTM layer on top of all token representations. Then, we use the last vector of the LSTM outputs for classification (Fig 8a). The final answers are selected based on Eq. (1).

\[x_{i}=[s,c_{i},q] \tag{1}\] \[\vec{T}_{i}=[\vec{t^{i}_{1}},...,\vec{t^{i}_{m^{i}}}]=LM(x_{i})\] \[[\vec{h^{i}_{1}},...,\vec{h^{i}_{m^{i}}}]=LSTM(\vec{T}_{i})\] \[\vec{y_{i}}=[y^{0}_{i},y^{1}_{i}]=Softmax(\vec{h^{i}_{m^{i}}}W))\] Answer \[=\left\{c_{i}|\operatorname*{arg\,max}_{j}(y^{j}_{i})=1\right\}\]

where \(s\) is the story, \(c_{i}\) is the candidate answer, \(q\) is the question, \([~{}]\) indicates the concatenation of the listed vectors, and \(m_{i}\) is tokens' number in \(x_{i}\). The parameter vector, \(W\), is shared for all candidates.

### Training and Inference

We train the models based on the summation of the cross-entropy losses of all binary classifiers in the architecture. For FR and YN Q-Types, there are multiple classifiers, while there is only one classifier used for CO and FB Q-Types.

We remove inconsistent answers in post-processing for FR and YN Q-Types during inference phase. For instance on FR, _left_ and _right_ relations between two objects cannot be valid at the same time. For YN, as there is only one valid answer amongst the three candidates, we select the candidate with the maximal predicted probability of being the true answer.

## 6 Experiments

As fine-tuning LMs has become a common baseline approach to knowledge transfer from a source dataset to a target task, including but not limited to Phang et al. (2018); Zhou et al. (2020); He et al. (2020), we study the capability of spatial reasoning of modern LMs, specifically BERT, ALBERT, and XLNet, after fine-tuning them on SpartQA-Auto. This fine-tuning process is also known as _further pretraining_, to distinguish with the fine-tuning process on one's target task. It is an open problem to find out better transfer learning techniques than simple further pretraining, as suggested in He et al. (2020); Khashabi et al. (2020), which is beyond the scope of this work. All experiments use the models proposed in Sec. 5. We use AdamW Loshchilov and Hutter (2017) with \(2\times 10^{-6}\) learning rate and Focal Loss Lin et al. (2017) with \(\gamma=2\) for training all the models.6

Footnote 6: All codes are available at [https://github.com/HLR/SmartQA-baselines](https://github.com/HLR/SmartQA-baselines)

### Further pretraining on SpartQA-Auto improves spatial reasoning

Table 2 shows performance on SpartQA-Human in a low-resource setting, where 0.6k QA pairs from SpartQA-Human are used for fine-tuning these LMs and 0.5k for testing (see Table 1 for information on this split).7 During our annotation, we found that the description of "near to " and "far



from" varies largely between annotators. Therefore, we ignore these two relations from FR Q-Type in our evaluations.

In Table 2, System 5, BERT (SpartQA-Auto), is the proposed method of further pretraining BERT on SpartQA-Auto. We can see that System 2, the original BERT, performs consistently lower than System 5, indicating that having SpartQA-Auto as a further pretraining task improves BERT's spatial understanding.

In addition, we implement another two baselines. System 3, BERT (Stories only; MLM): further pretraining BERT only on the stories of SpartQA-Auto as a masked language model (MLM) task; System 4, BERT (SpartQA-Auto; MLM): we convert the QA pairs in SpartQA-Auto into textual statements and further pretrain BERT on the text as an MLM (see Fig. 5 for an example conversion).

To convert each question and its answer into a sentence, we utilize static templates for each question type which removes the question words and rearranges other parts into a sentence.

We can see that System 3 slightly improves over System 2, an observation consistent with many prior works that seeing more text generally helps an LM (e.g., Gururangan et al. (2020)). The significant gap between System 3 and the proposed System 5 indicates that supervision signals come more from our annotations in SpartQA-Auto rather than from seeing more unannotated text. System 4 is another way to make use of the annotations in SpartQA-Auto, but it is shown to be not as effective as further pretraining BERT on SpartQA-Auto as a QA task.

While the proposed System 5 overall performs better than the other three baseline systems, one exception is its accuracy on YN, which is lower than that of System 3. Since all systems' YN accuracies are also lower than the majority baseline8, we hypothesize that this is due to imbalanced data. To verify it, we compute the \(F_{1}\) score for YN Q-Type in Table 3, where we see all systems effectively achieve better scores than the majority baseline. However, further pretraining BERT on SpartQA-Auto still does not beat other baseline systems, which implies that straightforward pretraining is not necessarily helpful in capturing the complex reasoning phenomena required by YN questions.

Footnote 8: which predicts the label that is most common in each set of SpartQA

The human performance is evaluated on 100 ran

Figure 5: Convert a triplet of (paragraph, question, answer) into a single piece of text for the MLM task.

\begin{table}
\begin{tabular}{|l|l|c|c|c|c|c|} \hline \# & Model & FB & FR & CO & YN & Avg \\ \hline
1 & Majority & 28.84 & 24.52 & 40.18 & 53.60 & 36.64 \\ \hline
2 & BERT & 16.34 & 20 & 26.16 & 45.36 & 30.17 \\
3 & BERT (Stories only; MLM) & 21.15 & 16.19 & 27.1 & **51.54** & 32.90 \\
4 & BERT (SpartQA-Auto; MLM) & 19.23 & 29.54 & **32.71** & 47.42 & 34.88 \\
5 & BERT (SpartQA-Auto) & **62.5** & **46.66** & **32.71** & 47.42 & **47.25** \\ \hline
6 & Human & 91.66 & 95.23 & 91.66 & 90.69 & 92.31 \\ \hline \end{tabular}
\end{table}
Table 2: **Further pretraining BERT on SpartQA-Auto improves accuracies on SpartQA-Human. All systems are fine-tuned on the training data of SpartQA-Human, but Systems 3-5 are also further pretrained in different ways. System 3: further pretrained on the stories from SpartQA-Auto as a masked language model (MLM) task. System 4: further pretrained on both stories and QA annotations as MLM. System 5: the proposed model that is further pretrained on SpartQA-Auto as a QA task. Avg: The micro-average on all four Q-Types.** 

dom questions from each SpartQA-Auto and SpartQA-Human test set. The respondents are graduate students that were trained by some examples of the dataset before answering the final questions. We can see from Table 2 that all systems' performances fall behind human performance by a large margin. We expand on the difficulty of SpartQA in the next subsection.

### SpartQA is challenging

In addition to BERT, we continue to test another two LMs, ALBERT and XLNet (Table 5). We further pretrain these LMs on SpartQA-Auto, and test them on SpartQA-Human (the numbers of BERT are copied from Table 2) and two held-out test sets of SpartQA-Auto, _Seen_ and _Unseen_. Note that when a system is tested against SpartQa-Human, it is fine-tuned on SpartQA-Human's training data following its further pretraining on SpartQA-Auto. We use the unseen set to test to what extent the baseline models use shortcuts in the language surface. This set applies minor modifications randomly on a number of stories and questions to change the names of shapes, colors, sizes, and relationships in the vocabulary of the stories, which do not influence the reasoning steps (more details in Appendix C.1).

All models perform worst in YN across all Q-Types, which suggests that YN presents a more complex phenomena, probably due to additional quantifiers in the questions. XLNet performs the best on all Q-Types except its accuracy on SpartQA-Human's YN section. However, the drops in _Unseen_ and _human_ suggest overfitting on the training vocabulary. The low accuracies on human test set from all models show that solving this benchmark is still a challenging problem and requires more sophisticated methods like considering spatial roles and relations extraction Kordjamshidi et al. (2010); Dan et al. (2020); Rahgooy et al. (2018) to understand stories and questions better.

To evaluate the reliability of the models, we also provide two extra consistency and contrast test sets. **Consistency set** is made by changing a part of the question in a way that seeks for the same information Hudson and Manning (2019); Suhr et al. (2019). Given a pivot question and answer of a specific consistency set, answering other questions in the set does not need extra reasoning over the story.

**Contrast set** is made by minimal modification in a question to change its answer Gardner et al. (2020). For contrast sets, there is a need to go back to the story to find the new answer for the question's minor variations (see Appendix C.2 for examples.) The consistency and contrast sets are evaluated only on the correctly predicted questions to check if the actual understanding and reasoning occurs. This ensures the reliability of the models.

Table 5 shows the result of this evaluation on four Q-Types of SpartQA-Auto, where we can see, for another time, that the high scores on the _Seen_ test set are likely due to overfitting on training data rather than correct detection of spatial terms and reasoning over them.

### Extrinsic evaluation

In this subsection, we take BERT as an example to show, once pretrained on SpartQA-Auto, BERT can achieve better performance on two extrinsic evaluation datasets, namely bAbI and boolQ.

We draw the learning curve on bAbI, using the original BERT as a baseline and BERT further pretrained on SpartQA-Auto (Fig. 6). Although both systems achieve perfect accuracy given large enough training data (i.e., 5k and 10k), BERT (SpartQA-Auto) is showing better scores given less training data. Specifically, to achieve an accuracy of 99%, BERT (SpartQA-Auto) requires

\begin{table}
\begin{tabular}{|l|l|r r r|r r r|r r r|r r|} \hline \multirow{3}{*}{\#} & \multicolumn{4}{c|}{FB} & \multicolumn{4}{c|}{FC} & \multicolumn{4}{c|}{CO} \\ \cline{3-17}  & \multicolumn{1}{c|}{Scen} & \multicolumn{1}{c|}{Unesen} & \multicolumn{1}{c|}{Human*} & \multicolumn{1}{c|}{Scen} & \multicolumn{1}{c|}{Unseen} & \multicolumn{1}{c|}{Unseen} & \multicolumn{1}{c|}{Unseen} & \multicolumn{1}{c|}{Unseen} & \multicolumn{1}{c|}{Unseen} & \multicolumn{1}{c|}{Unseen} & \multicolumn{1}{c|}{Human*} \\ \hline
1 & Majority & 48.70 & 48.70 & 28.84 & 40.81 & 40.81 & 24.52 & 20.59 & 20.38 & 40.18 & 49.94 & 49.91 & **53.60** \\ \hline
2 & BERT & 87.13 & 69.38 & 62.5 & 85.68 & 73.71 & 46.66 & 71.44 & 61.09 & 32.71 & 78.29 & 76.81 & 47.42 \\
3 & ALBERT & 97.66 & 83.53 & 56.73 & 91.61 & 83.70 & 44.76 & 95.20 & 84.55 & 49.53 & 79.38 & 75.05 & 41.75 \\
4 & XLNet & **98.00** & **84.85** & **73.07** & **94.60** & **91.63** & **57.14** & **97.11** & **90.88** & **50.46** & **79.91** & **78.54** & 39.69 \\ \hline
5 & Human & 85 & 91.66 & 90 & 95.23 & 94.44 & 91.66 & 90 & 90.69 \\ \hline \end{tabular}
\end{table}
Table 4: **Spatial reasoning is challenging. We further pretrain three transformer-based LMs, BERT, ALBERT, and XLNet, on SpartQA-Auto, and test their accuracy in three ways: _Seen_ and _Unseen_ are both from SpartQA-Auto, where _Unseen_ has applied minor modifications to its vocabulary; to get those _Human_ columns, all models are fine-tuned on SpartQA-Human’s training data. Human performance on _Seen_ and _Unseen_ is the same since the changes applied to _Unseen_ does not affect human reasoning.** 

1k training examples, while BERT requires twice as much. We also notice that BERT (SpartQA-Auto) converges faster in our experiments.

As another evaluation dataset, we chose boolQ for two reasons. First, we needed a QA dataset with Yes/No questions. To our knowledge boolQ is the only available one used in the recent work. Second, indeed, SpartQA and boolQ are from different domains, however, boolQ needs multi-step reasoning in which we wanted to see if SpartQA helps.

Table 6 shows that further pretraining BERT on SpartQA-Auto yields a better result than the original BERT and those reported numbers in Clark et al. (2019), which also tested on various distant supervision signals such as SQuAD Rajpurkar et al. (2016), Google's Natural Question dataset NQ Kwiatkowski et al. (2019), and QNLI from GLUE Wang et al. (2018).

We observe that many of the boolQ examples answered correctly by the BERT further pretrained on SpartQA-Auto require multi-step reasoning. Our hypothesis is that since solving SpartQA-Auto questions needs multi-step reasoning, fine-tuning BERT on SpartQA-Auto generally improves this capability of the base model.

## 7 Conclusion

Spatial reasoning is an important problem in natural language understanding. We propose the first human-created QA benchmark on spatial reasoning, and experiments show that state-of-the-art pretrained language models (LM) do not have the capability to solve this task given limited training data, while humans can solve those spatial reasoning questions reliably. To improve LMs' capability on this task, we propose to use hand-crafted grammar and spatial reasoning rules to automatically generate a large corpus of spatial descriptions and corresponding question-answer annotations; further pretraining LMs on this distant supervision dataset significantly enhances their spatial language understanding and reasoning. We also show that a spatially-improved LM can have better results on two extrinsic datasets (bAbI and boolQ).

## Acknowledgements

This project is supported by National Science Foundation (NSF) CAREER award #2028626 and (partially) supported by the Office of Naval Research grant #N00014-20-1-2005. We thank the reviewers for their helpful comments to improve this paper and Timothy Moran for his help in the human data generation.

## References

* Anderson et al. (2018) Peter Anderson, Qi Wu, Damien Teney, Jake Bruce, Mark Johnson, Niko Sunderhauf, Ian Reid, Stephen Gould, and Anton van den Hengel. 2018. Vision

\begin{table}
\begin{tabular}{|l|c|} \hline
**Model** & **Accuracy** \\ \hline Majority baseline & 62.2 \\ Recurrent model (ReM) & 62.2 \\ ReM fine-tuned on SQuAD & 69.8 \\ ReM fine-tuned on QNLI & 71.4 \\ ReM fine-tuned on NQ & 72.8 \\ \hline BERT (our setup) & 71.9 \\ BERT (SpartQA-Auto) & **74.2** \\ \hline \end{tabular}
\end{table}
Table 6: System performances on the dev set of boolQ (since the test set is not available to us). Top: numbers reported in Clark et al. (2019). Bottom: numbers from our experiments. BERT (SpartQA-Auto): further pretraining BERT on SpartQA-Auto as a QA task.

Figure 6: Learning curve of BERT and BERT further pretrained on SpartQA-Auto on bAbI.

 

and-language navigation: Interpreting visually-grounded navigation instructions in real environments. In _Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition_, pages 3674-3683.
* Antol et al. (2015) Stanislaw Antol, Aishwarya Agrawal, Jiasen Lu, Margaret Mitchell, Dhruv Batra, C Lawrence Zitnick, and Devi Parikh. 2015. VQA: Visual question answering. In _Proceedings of the IEEE international conference on computer vision_, pages 2425-2433.
* Chen et al. (2019) Howard Chen, Alane Suhr, Dipendra Misra, Noah Snavely, and Yoav Artzi. 2019. TOUCHDOWN: Natural language navigation and spatial reasoning in visual street environments. In _Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition_, pages 12538-12547.
* Clark et al. (2019) Christopher Clark, Kenton Lee, Ming-Wei Chang, Tom Kwiatkowski, Michael Collins, and Kristina Toutanova. 2019. BoolQ: Exploring the surprising difficulty of natural yes/no questions. In _Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers)_, pages 2924-2936.
* Clements and Mattista (1992) Douglas H Clements and Michael T Battista. 1992. Geometry and spatial reasoning. _Handbook of research on mathematics teaching and learning_, pages 420-464.
* Dan et al. (2020) Soham Dan, Parisa Kordjamshidi, Julia Bonn, Archna Bhatia, Zheng Cai, Martha Palmer, and Dan Roth. 2020. From spatial relations to spatial configurations. In _Proceedings of the 12th Language Resources and Evaluation Conference_, pages 5855-5864, Marseille, France. European Language Resources Association.
* Dasigi et al. (2019) Pradeep Dasigi, Nelson F. Liu, Ana Marasovic, Noah A. Smith, and Matt Gardner. 2019. Quoref: A reading comprehension dataset with questions requiring coreferential reasoning. In _Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP)_, pages 5925-5932.
* Datta and Roberts (2020) Surabhi Datta and Kirk Roberts. 2020. A hybrid deep learning approach for spatial trigger extraction from radiology reports. In _Proceedings of the Third International Workshop on Spatial Language Understanding_, pages 50-55, Online. Association for Computational Linguistics.
* Devlin et al. (2019) Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: Pre-training of deep bidirectional transformers for language understanding. In _Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers)_, pages 4171-4186.
* Dhole and Manning (2020) Kaustubh Dhole and Christopher D. Manning. 2020. Syn-QG: Syntactic and shallow semantic rules for question generation. In _Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics_, pages 752-765.
* Du and Cardie (2020) Xinya Du and Claire Cardie. 2020. Event extraction by answering (almost) natural questions. In _Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP)_.
* Du et al. (2017) Xinya Du, Junru Shao, and Claire Cardie. 2017. Learning to Ask: Neural question generation for reading comprehension. In _Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)_, pages 1342-1352.
* Dua et al. (2019) Dheeru Dua, Yizhong Wang, Pradeep Dasigi, Gabriel Stanovsky, Sameer Singh, and Matt Gardner. 2019. DROP: A reading comprehension benchmark requiring discrete reasoning over paragraphs. In _Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers)_, pages 2368-2378.
* Gardner et al. (2020) Matt Gardner, Yoav Artzi, Victoria Basmov, Jonathan Berant, Ben Bogin, Sihao Chen, Pradeep Dasigi, Dreheru Dua, Yanai Elazar, Ananth Gottumukkala, Nitish Gupta, Hannanesh Hajishirzi, Gabriel Illarco, Daniel Khashabi, Kevin Lin, Jianming Liu, Nelson F. Liu, Phoeeb Mulcaire, Qiang Ning, Sameer Singh, Noah A. Smith, Sanjay Subramanian, Reut Tsarfaty, Eric Wallace, Ally Zhang, and Ben Zhou. 2020. Evaluating models' local decision boundaries via contrast sets. In _Findings of the Association for Computational Linguistics: EMNLP 2020_.
* Gardner et al. (2019) Matt Gardner, Jonathan Berant, Hannaneh Hajishirzi, Alon Talmor, and Sewon Min. 2019. Question Answering is a Format; when is it useful? _ArXiv_, abs/1909.11291.
* Ghanimifard and Dobnik (2017) Mehdi Ghanimifard and Simon Dobnik. 2017. Learning to compose spatial relations with grounded neural language models. In _IWCS 2017-12th International Conference on Computational Semantics-Long papers_.
* Gururangan et al. (2020) Suchin Gururangan, Ana Marasovic, Swabha Swayadipta, Kyle Lo, Iz Beltagy, Doug Downey, and Noah A. Smith. 2020. Don't Stop Pretraining: Adapt language models to domains and tasks. In _Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics_, pages 8342-8360.
* He et al. (2020a) Hangfeng He, Qiang Ning, and Dan Roth. 2020a. QuASE: Question-answer driven sentence encoding. In _Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics_, pages 8743-8758, Online. Association for Computational Linguistics.

 

Hangfeng He, Mingyuan Zhang, Qiang Ning, and Dan Roth. 2020b. Foreshadowing the benefits of incidental supervision. _arXiv preprint arXiv:2006.05500_.
* He et al. (2015) Luheng He, Mike Lewis, and Luke Zettlemoyer. 2015. Question-Answer Driven Semantic Role Labeling: Using natural language to annotate natural language. In _Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing_, pages 643-653.
* Heilman and Smith (2009) Michael Heilman and Noah A Smith. 2009. Question generation via overgenerating transformations and ranking. Technical report, CARNEGIE-MELLON UNIV PITTSBURGH PA LANGUAGE TECHNOLOGIES INST.
* Hochreiter and Schmidhuber (1997) Sepp Hochreiter and Jurgen Schmidhuber. 1997. Long short-term memory. _Neural computation_, 9(8):1735-1780.
* Huang et al. (2019) Zixian Huang, Yulin Shen, Xiao Li, Yu'ang Wei, Gong Cheng, Lin Zhou, Xinyu Dai, and Yuzhong Qu. 2019. GeoSQA: A benchmark for scenario-based question answering in the geography domain at high school level. In _Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP)_, pages 5866-5871.
* Hudson and Manning (2019) Drew A Hudson and Christopher D Manning. 2019. GQA: A new dataset for real-world visual reasoning and compositional question answering. In _Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition_, pages 6700-6709.
* Jia et al. (2018) Zhen Jia, Abdalghani Abujabal, Rishiraja Saha Roy, Jannik Strutgen, and Gerhard Weikum. 2018. TempQuestions: A benchmark for temporal question answering. In _Companion Proceedings of the The Web Conference 2018_, pages 1057-1062.
* Johnson et al. (2017) Justin Johnson, Bharath Hariharan, Laurens van der Maaten, Li Fei-Fei, C Lawrence Zitnick, and Ross Girshick. 2017. CLEVR: A diagnostic dataset for compositional language and elementary visual reasoning. In _Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition_, pages 2901-2910.
* Khashabi et al. (2018) Daniel Khashabi, Snigdha Chaturvedi, Michael Roth, Shyam Upadhyay, and Dan Roth. 2018. Looking Beyond the Surface:a challenge set for reading comprehension over multiple sentences. In _Proceedings of North American Chapter of the Association for Computational Linguistics (NAACL)_.
* Khashabi et al. (2020) Daniel Khashabi, Sewon Min, Tushar Khot, Ashish Sabharwal, Oyvind Tafjord, Peter Clark, and Hannen Hajishirzi. 2020. UnifiedQA: Crossing format boundaries with a single QA system. In _Findings of the Association for Computational Linguistics: EMNLP 2020_, pages 1896-1907.
* Kim et al. (2020) Hyounghun Kim, Abhaysin Zahla, Graham Burri, Hao Tan, and Mohit Bansal. 2020. ArraMon: A joint navigation-assembly instruction interpretation task in dynamic environments. In _Findings of the Association for Computational Linguistics: EMNLP 2020_, pages 3910-3927, Online. Association for Computational Linguistics.
* Kordjamshidi et al. (2010) Parisa Kordjamshidi, Marie-Francine Moens, and Martijn Van Otterlo. 2010. Spatial Role Labeling: Task definition and annotation scheme. In _Proceedings of the Seventh conference on International Language Resources and Evaluation (LREC'10)_, pages 413-420. European Language Resources Association (ELRA).
* Kwiatkowski et al. (2019) Tom Kwiatkowski, Jennimaria Palomaki, Olivia Redfield, Michael Collins, Ankur Parikh, Chris Alberti, Danielle Epstein, Illia Polosukhin, Jacob Devlin, Kenton Lee, et al. 2019. Natural Questions: a benchmark for question answering research. _Transactions of the Association for Computational Linguistics_, 7:453-466.
* Labuto et al. (2015) Igor Labuto, Sumit Basu, and Lucy Vanderwende. 2015. Deep questions without deep understanding. In _Proceedings of the 53rd Annual Meeting of the Association for Computational Linguistics and the 7th International Joint Conference on Natural Language Processing (Volume 1: Long Papers)_, pages 889-898.
* Lan et al. (2020) Zhenzhong Lan, Mingda Chen, Sebastian Goodman, Kevin Gimpel, Piyush Sharma, and Radu Soricut. 2020. ALBERT: A lite bert for self-supervised learning of language representations. In _International Conference on Learning Representations_.
* Landsiedel et al. (2017) Christian Landsiedel, Verena Rieser, Matthew Walter, and Dirk Wollherr. 2017. A review of spatial reasoning and interaction for real-world robotics. _Advanced Robotics_, 31(5):222-242.
* Levy et al. (2017) Omer Levy, Minjoon Seo, Eunsol Choi, and Luke Zettlemoyer. 2017. Zero-Shot relation extraction via reading comprehension. In _CONLL_, pages 333-342.
* Lin et al. (2017) Tsung-Yi Lin, Priya Goyal, Ross Girshick, Kaiming He, and Piotr Dollar. 2017. Focal loss for dense object detection. In _Proceedings of the IEEE international conference on computer vision_, pages 2980-2988.
* Loshchilov and Hutter (2017) Ilya Loshchilov and Frank Hutter. 2017. Decoupled weight decay regularization. _arXiv preprint arXiv:1711.05101_.
* Michael et al. (2018) Julian Michael, Gabriel Stanovsky, Luheng He, Ido Dagan, and Luke Zettlemoyer. 2018. Crowdsourcing question-answer meaning representations. In _Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 2 (Short Papers)_, pages 560-568 

Mike Mintz, Steven Bills, Rion Snow, and Dan Jurafsky. 2009. Distant supervision for relation extraction without labeled data. In Proceedings of the Joint Conference of the 47th Annual Meeting of the ACL and the 4th International Joint Conference on Natural Language Processing of the AFNLP, pp. 1003-1011. Cited by: SS5.
* Q. Ning, H. Wu, R. Han, N. Peng, T. Gardner, and D. Roth (2020)TORQUE: a reading comprehension dataset of temporal ordering questions. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 1158-1172. Cited by: SS6.
* J. Phang, T. Fevry, and S. R. Bowman (2018)Sentence encoders on stilts: supplementary training on intermediate labeled-data tasks. arXiv preprint arXiv:1811.01088. Cited by: SS1, SS2.
* T. Rahgooy, U. Manzoor, and P. Kordjamshidi (2018)Visually guided spatial relation extraction from text. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 2 (Short Papers), pp. 788-794. External Links: Document, Link Cited by: SS1, SS2.
* P. Rajpurkar, J. Zhang, K. Lopyrev, and P. Liang (2016)SOuAD: 100,000+ questions for machine comprehension of text. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pp. 2383-2392. Cited by: SS1, SS2.
* H. Roman Roman, Y. Bisk, J. Thomson, A. Celikyilmaz, and J. Gao (2020)RMM: a recursive mental model for dialogue navigation. In Findings of the Association for Computational Linguistics: EMNLP 2020, Online, pp. 1732-1745. External Links: Link, Document Cited by: SS1, SS2.
* P. Sen and A. Saffari (2020)What do models learn from question answering datasets?. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 2429-2438. Cited by: SS1, SS2.
* A. Suhr, M. Lewis, J. Yeh, and Y. Artzi (2017)A corpus of natural language for visual reasoning. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers), Vancouver, Canada, pp. 217-223. External Links: ISBN 978-1-4503-387X, Link, Document Cited by: SS1, SS2.
* A. Suhr, S. Zhou, A. Zhang, I. Zhang, H. Bai, and Y. Artzi (2019)A corpus for reasoning about natural language grounded in photographs. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 6418-6428. Cited by: SS1, SS2.
* I. Tenney, P. Xia, B. Chen, A. Wang, A. Poliak, R. McCoy, N. Kim, B. Van Durme, S. R. Bowman, D. Das, et al. (2019)What do you learn from context? probing for sentence structure in contextualized word representations. arXiv preprint arXiv:1905.06316. Cited by: SS1, SS2.
* Takuma Udagawa, T. Yamazaki, and A. Azizawa (2020)A linguistic analysis of visually grounded dialogues based on spatial expressions. In Findings of the Association for Computational Linguistics: EMNLP 2020, Online, pp. 750-765. External Links: Link, Document Cited by: SS1, SS2.
* A. Wang, A. Singh, J. Michael, F. Hill, O. Levy, and S. Bowman (2018)GLUE: a multi-task benchmark and analysis platform for natural language understanding. In Proceedings of the 2018 EMNLP Workshop BlackboxNLP: Analyzing and Interpreting Neural Networks for NLP, pp. 353-355. Cited by: SS1, SS2.
* J. Weston, A. Bordes, S. Chopra, A. M. Rush, B. van Merrienboer, Armand Joulin, and Tomas Mikolov (2015)Towards ai-complete question answering: a set of prerequisite toy tasks. arXiv preprint arXiv:1502.05698. Cited by: SS1, SS2.
* Z. Yang, Z. Dai, Y. Yang, J. Carbonell, R. Salakhutdinov, and Quoc V. Le (2019)XLNet: generalized autoregressive pretraining for language understanding. In Advances in neural information processing systems, pp. 5754-5764. Cited by: SS1, SS2.
* Z. Yang, P. Qi, S. Zhang, Y. Bengio, W. Cohen, R. Salakhutdinov, and C. D. Manning (2018)HotpotQA: a dataset for diverse, explainable multi-hop question answering. pp. 2369-2380. Cited by: SS1, SS2.
* D. Zeng, K. Liu, Y. Chen, and J. Zhao (2015)Distant supervision for relation extraction via piecewise convolutional neural networks. In Proceedings of the 2015 conference on empirical methods in natural language processing, pp. 1753-1762. Cited by: SS1, SS2.
* B. Zhou, Q. Ning, D. Khashabi, and D. Roth (2020)Temporal common sense acquisition with minimal supervision. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp. 7579-7589.

 

Question Templates and statistics Information

Table 7 shows the templates used to create questions in SpartQA-Auto. The "<object>" is a variable replaced by objects from the story (using _Choose-objects_ and _Describe-objects_ modules), and the "<relation>" variable can be replaced by the chosen relations between objects (using _Find-all-relations_ module).

The articles and the indefinite pronouns in each template play an essential role in understanding the question's objective. For example, "Are all blue circles near to a triangle?" is different from "Are there any blue circles near to a triangle?", and "Are there any blue circles near to all triangles?". Therefore, we check the uniqueness of the object definition, using "a" or "the" in proper places and randomly place the terms "any" or "all" in the YN questions to generate different questions.

Table 8 shows the percentage of correct labels in train and test sets. In multi-choice Q-Types, more than one label can be true.

## Appendix B Sentences of the Dataset

Table 10 shows some generated sentences in SpartQA-Auto with some specific features that challenge models to understand different forms of relation description in spatial language.

 

can be used to evaluate models based on their steps of reasoning and decisions.

### SpRL Annotation

We also provided spatial annotations for each sentence and question, based on Spatial Role Labeling (SpRL) annotation scheme Kordjamshidi et al. (2010)(Fig. 11). This annotation is generated by hand-crafted rules during the main data generation. SpRL is used for recognizing spatial expressions and arguments in a sentence. This annotation is useful for applications that need to detect and reason about spatial expressions and arguments.

## Appendix E QA Language Models for Spatial Reasoning over Text

Figures 7(a) and 7(b) depict the architecture used for further fine-tuning language models on SpartQA described in section 5.

## Appendix F bAbI and boolQ Datasets

Figure 9 shows an example of the bAbI dataset Weston et al. (2015) task 17.

To solve task 17 of bAbI , we implement two SpRL+rule-based and neural network models. The SpRL+rule-based model first, finds different spat

\begin{table}
\begin{tabular}{|p{86.7pt}|l|p{143.4pt}|} \hline
**Q-Type** & **Q-Templates** & **Candidate answer** \\ \hline FR & what is the relation between ¡object¿and ¡object? & Left, Right, Below, Above, Touching, Far from, Near to \\ \hline CO & What is ¡relation ¿the ¡object¿? & \\  & an ¡object!1>or an ¡object?? & Object1, object2, \\  & Which object is ¡relation ¿an ¡object? & Both, None \\  & the ¡object!1>or the ¡object2?? & \\ \hline YN & Is (the \(|\) a ) ¡object!1>relation?(the \(|\) a) ¡object2¿? & \\  & Is there any ¡object!yés cyclizationall ¡object2¿s? & Yes, No, Don’t Know \\ \hline FB & Which block has an ¡object? & \\  & Which block doesn’t have an ¡object? & Name of blocks, None \\ \hline \end{tabular}
\end{table}
Table 7: Questions and answers templates.

Figure 8: LM\({}_{QA}\) for Spatial Reasoning over Text

Figure 7: Scene-graph



tial relation triplets (Landmark, Spatial-indicator, trajectory) for each fact in a story the applies spatial rules over these extracted triplets and report all possible relations between two asked objects. Finally, it checks whether the asked relation existed in the find relation. This model solves task 17 of the bAbI with \(100\%\) accuracy.

To implement the neural network approach, we use huggingface implementation of pre-trained BERT Devlin et al. (2019). We apply a boolean classifier on the output of "[CLS]" token from the last layer of BERT model for each "Yes" and "No" answers (the same as model used on YN question types.) We use Adamw Loshchilov and Hutter (2017) optimizer and \(2e-6\) learning rate with negative log-likelihood loss objective and train the model on the 10k, 5k, 2k, 1k, 500, and 100 portion of bAbI's training questions. The model yields \(100\%\) accuracy on 10k, and 5k and \(99\%\) accuracy on 2k and 1k training samples.

Figure 10 shows an example of boolQ dataset. To Answering the questions of this dataset, we use the same setting as neural network model on bAbI to further fine-tune BERT on boolQ.

**Q: Has the UK been hit by a hurricane? P: The Great Storm of 1987 was a violent extratropical cyclone which caused casualties in England, France and the Channel Islands ... A: Yes. [An example event is given.] Q: Does France have a Prime Minister and a President? P: ... The extent to which those decisions lie with the Prime Minister or President depends upon .... A: Yes. [Both are mentioned, so it can be inferred both exist.] 

sentence: "Medium blue square number one is touching the bottom edge of this block."
* spatial_description: [] 1 item
* 0:
* trajectory: phrase: "medium blue square number one" head: "square"
* properties: color: "blue" size: "medium" name: "number one" number: "" spatial_property: ""
* SOT: start: 167 end: 195
* landmark: phrase: "the bottom edge of this block" head: "block" properties: spatial_property: "the bottom edge" SQT: spatial_indicator: phrase: "touching" spatial_value: "TPP" g_type: "Region" s_type: "RCCS" polarity: false FoR: "Relative" SQT:

Figure 11: SpRL annotation for an example sentence from SpartQA.

 

* [24] M. C. B., and R. A. K. Sears, "The evolution of the system's dynamics in a single-layer model: The role of the collective behavior in the presence of a new layer", _Physica D_**386**(1), 509-517, 1994.
* [25] J. L. Miller, "A simple model for the formation of a new layer", _Nature_**406**(7258), 463-464, 1995.
* [26] P. N. G. de Oliveira, "The emergence of a new layer", _Journal of Physics A: Statistical Mechanics and its Applications_**10**(1), 1-10, 1994.

[MISSING_PAGE_POST]