GAMR: A Guided Attention Model for (visual) Reasoning
Authors: Mohit Vaishnav
Thomas Serre
Venue: ICLR 2023 poster (2023)
Keywords: abstract visual reasoning
visual routines
out-of-distribution generalization
external memory
zero shot generalization
compositional learning

Abstract: Humans continue to outperform modern AI systems in their ability to flexibly parse and understand complex visual scenes. Here, we present a novel module for visual reasoning, the Guided Attention Model for (visual) Reasoning ($\textit{GAMR}$), which instantiates an active vision theory -- positing that the brain solves complex visual reasoning problems dynamically -- via sequences of attention shifts to select and route task-relevant visual information into memory. Experiments on an array of visual reasoning tasks and datasets demonstrate GAMR's ability to learn visual routines in a robust and sample-efficient manner. In addition, GAMR is shown to be capable of zero-shot generalization on completely novel reasoning tasks. Overall, our work provides computational support for cognitive theories that postulate the need for a critical interplay between attention and memory to dynamically maintain and manipulate task-relevant visual information to solve complex visual reasoning tasks.

Published as a conference paper at ICLR 2023
GAMR: A GUIDED ATTENTION MODEL FOR (VISUAL) REASONING
Mohit Vaishnay 1,2.3 Thomas Serre!
I Artificial and Natural Intelligence Toulouse Institute, Université de Toulouse, France
2 Carney Institute for Brain Science, Dpt. of Cognitive Linguistic Psychological Sciences Brown University, Providence, RI 02912
3 Centre de Recherche Cerveau et Cognition, CNRS, Université de Toulouse, France mohit. vaiismaaveuivv-toulouusss
ABSTRACT
Humans continue to outperform modern Al systems in their ability to flexibly parse and understand complex visual scenes. Here, we present a novel module for visual reasoning, the Guided Attention Model for (visual) Reasoning (GAMR), which instantiates an active vision theory - positing that the brain solves complex visual reasoning problems dynamically via sequences of attention shifts to select and route task-relevant visual information into memory. Experiments on an array visual reasoning tasks and datasets demonstrate GAMR'S s ability to learn visual routines in a robust and sample-efficient manner. In addition, GAMR is shown to be capable of zero-shot generalization completely novel reasoning tasks. Overall, our work provides computational support for cognitive theories that postulate the need for critical interplay between attention and memory dynamically maintain and manipulate task-relevant visual information to solve complex visual reasoning tasks.
INTRODUCTION
Abstract reasoning refers to our ability to analyze information and discover rules to solve arbitrary tasks, and is fundamental to general intelligence in human and non-human animals (Gentner
Markman 1997. Lovett & Forbus (0177). It is considered a critical component for the development of artificial intelligence (Al) systems and has rapidly started to gain attention. growing body of literature suggests that current neural architectures exhibit significant limitations in their ability to solve relatively simple visual cognitive tasks in comparison to humans (see Ricei et al. (202T) for review). Given the vast superiority of animals over state-of-the fttthheert art AI systems, it makes sense to turn to brain sciences to find inspiration to leverage brain- mechanisms to improve the ability of modern deep neural networks to solve complex visual reasoning tasks. Indeed, a recent human ERG study has shown that attention and memory processes are needed to solve same-different visual reasoning tasks (Alamia al. 202I). This interplay between attention and memory is previously discussed in Buehner et al. 22066); Fougnie (2008); Cochrane et al. (2019) emphasizing that a model must learn to pertorm attention over the memory for reasoning.
is thus not surprising that deep neural networks which lack attention and/or memory system fail robustly solve visual reasoming problems that involve such same-different judgments (Kim et al. 2018). Recent computer vision works (Messina et al., 2021a] Vaishnav et al. 2022) have provided further computational evidence for the benefits of attention mechanisms solving variety of visual reasoning tasks. Interestingly, in both aforementioned studies, Transformer module was used to implement a form of attention known as self-attention (Cheng et al., 2016 Parikh et al., 2016). In such a static module, attention mechanisms are deployed in parallel across an entire visual scene. By contrast, modern cognitive theories active vision postulate that the visual system explores the environment dynamically via sequences of attention shifts select and route task-relevant information to memory. Psychophysics experiments (Hayhoe) 2000) on overt visual attention have shown that eye movement patterns driven according to task task-dependent routines.

---

Published as a conference paper at ICLR 2023
Inspired by active vision theory, describe dynamic attention mechanism, which call guided attention. Our proposed Guided Attention Module for (visual) Reasoning (GAMR) learns to shift attention dynamically, in task-dependent manner, based queries internally generated by LSTM executive controller. Through extensive experiments on the two visual reasoning challenges, the Synthetic Visual Reasoning Test (SVRT) by Fleuret et al. (20TT) and the Abstract Reasoning Task (ART) by [Webb et al. (2021). we demonstrate that our neural architecture is capable of learning complex compositions of relational rules in data-efficient manner and performs better than other state-of-the neural architectures for visual reasoning. Using explainability methods, we further characterize the visual strategies leveraged by the model in order to solve representative reasoning tasks. We demonstrate that our model is compositional in that it is able to generalize to novel tasks efficiently and learn novel visual routines by re-composing previously learned elementary operations. It also exhibit zero shot generalization ability by translating knowledge across the tasks sharing similar abstract rules without the need of re-eeetaan re-training.
Contributions Our contributions
follows:
We present a novel end-to-end trainable guided-attention module to learn to solve visual reasoning challenges in data-efficient manner.
We show that our guided-attention module learns to shift attention to task-relevant locations and gate relevant visual elements into a memory bank;
We show that our architecture demonstrate zero-shot generalization ability and learns compositionally. GAMR is capable of learning efficiently by re-arranging previously-eearned elementary operations stored within a reasoning module.
Our architecture sets new benchmarks two visual reasoning challenges, SVRT (Fleuret et al. 2011) and ART (Webb et al. 2021).
PROPOSED APPROACH
Controlier Module
Controller for every time step
Heasoning Module
Guided Attention
Encoder Module
Amg
Aci and LayerNorm
allez
out
Gri
fs
Figure 1: Our proposed GAMR architecture is composed of three components: encoder module (fe) builds a representation (Zimg) of an image, a controller guides the attention module to dynamically shift attention, and selectively routes task-relevant object representations (2,) to be stored in memory bank (M). The recurrent controller (fa) generates a query vector (fins,) at each time step to guide the next shift of attention based on the current fixation. After few shifts of attention, reasoning module (ra) learns to identify the relationships between objects stored in memory.
Our model can be divided into three components: an encoder, a controller, and a relational module (see Figure for an overview). In the encoder module, a low dimensional representation (Zimg) for an input image (I.m) is created. It includes feature extraction block (fe) which is composed of five convolutional blocks (SI Figure S1). The output the module is denoted as Zimg E (1288 (with h height and width). We applied instance normalization (iNorm) (Ulyanov et al. 2016) over Zing
2

---

Published as a conference paper at ICLR 2023
before passing it the controller for further processing without which the network even struggles to learn even simple relations.
Controller module is com-
Algorithm Guided Attention Model for (visual) Reasoning (GAMR). LN represents layer normalization (Ba et al. 2016) (I) indicates the concatenation of two vectors, forming a new vector. (. } indicates the concatenation of matrix and vector, forming matrix with one additional row. 3 represents element-wise multiplication and {. } represents the product between scalar and a vector. (h,w) corresponds to the height and width of the feature map obtained from the encoder (fe).
posed of two blocks: a re-
current neural network (f&) which generates an internal query to guide the attention spotlight over the task rel- evant features. These fea- tures are used to generate context vector (z+) with the help of the second block, iee, guided attention (GA) and are sent to the memory bank (M).
kr +- 0
P E R R
h==1 + 0
D E R512
M1=1 + 0
Zimg f- fe(in)
D E R. 12w,
for t in 1... do
After Rimg is built, guided- attention block is used to extracts the relevant visual information from the input image in a top-down man- ner at each time step (t). This block generates the context vector (z²) to be stored the memory bank (M) along with all the pre- vious context vectors. They are subsequently accessed again later by a reasoning module. This memory bank is inspired by the differen- tial memory used in Webb et al. (2021).
out, 9, qinte: he (h kr--))
oul R512 .9 R128 qint, R128
wi [N + qintt rene, aris 1)) R. (2w,
Ft f (Zimg W4,.uu((aris 1)). 1) E R228
is then
kr, f
else
lrr, 9 + M Mu-1-sum(aris =)
end if
Mr {M--1, 2}}
R(1.128)
end for
allobj + ro ro ( Mo;)) ÿ - falallobj oul)
In the guided attention block, attention vector (w, R. 128) is obtained by normalizing the addition of encoded feature (Zimg) with internally generated query (Tint,) fetched by fs. This normalized attention vector is used to re-weight the features every spatial location of Zimg to generate the context vector E R 128 provide a query vector (gint, E R !2) in response to a rask-specific goal in order to guide attention for the current time step t. f. also independently generates gate vector (g E R228) and output vector (oul E R512) with the help of linear layers. The gate (g) is later used to shift attention to the next task-relevant feature based the features previously stored in M. On the other hand, the decision layer uses the output vector (out) to produce the system classification output (SI Figure S3).
The recurrent controller (f,) uses Long Short-Term Memory (LSTM) to
The relational module where the reasoning takes place over the context vector (2₂) stored in the memory bank (M). This module is composed of a two layered MLP (ra) which produces a relational vector (all similar the relational network (Santoro et al. 2017). As we will show in section 5 re learns elementary operations associated with basic relational judgments between context vectors (zz) stored the memory (M). It is concatenated with the output (oul) of the controller (f.) at the last time step (L = 7) and passed through the decision layer (fz) to predict the output (j) for
particular task. We have summarized the steps in Algorithm]
3 METHOD
Dataset The SVRT dataset is composed of twenty-three different binary classification challenges, each representing either a single rule or a composition of multiple rules. A complete list of tasks with sample images from each category is shown in SI (Figure SI7 S18). We formed four different datasets with 0.5k, 1k, 5k, and 10k training samples to train our model. We used unique sets of 4k and 40k samples for validation and test purposes. Classes are balanced for all the analyses.
3

---

Published as a conference paper at ICLR 2023
We trained the model from scratch for maximum of 100 epochs with early stopping criterion of 99% accuracy on the validation set as followed in Vaishnav et al. (2022) using Adam (Kingma & Ba 2014) optimizer and binary cross-entropy loss. We used hyperparameter optimization framework Optuna (Akiba et al. 2019) to get the best learning rates and weight decays for these tasks and reports the test accuracy for the models that gave the best validation scores.
Baselines For the baselines in this dataset, we compared our architecture performance a Relational Network ( (RN), a popular architecture for reasoning in VQA. The RN uses the same CNN backbone as GAMR with feature maps of dimension R 1128,k where = 8 and w 8. We consider each spatial location of the encoded feature representation as an object (i.e., N = 8 x 8 = 64 object representations). We computed all pairwise combinations between all 64 representations using a shared MLP between all the possible pairs (totalling 4096 pairs). These combinations are then averaged and processed through another MLP to compute a relational feature vector (allat)) before the final prediction layer (fa). In a sense, GAMR is a special case of an RN network endowed with the ability to attend to a task-relevant subset (N = 4) of these representations with the help of controller instead of cxhaustively computing all 4,096 possible relations thus reducing the computing and memory requirements of the architecture very significantly.
As additional baseline model, we used 50 layered ResNet (He et al., 2016) and its Transformer- based self-attentinn network Attn-ReeNe introduced in Vaishnav et al. (2022) and follow the training mechanism defined in the paper. These have been previously evaluated on SVRT tasks (Funke)
et al. 2021 Vaishnav et al.] 2022. Messina et al.) 2021b a). Atn-ResNer serves as a powerful baseline because of more free parameters and a self-attention module compare the proposed active attention component of GAMR. In our proposed method, the controller shifts attention head sequentially to individual task-relevant features against a standard self-attention module- where all task-relevant features are attended to simultancously. We also evaluated memory based architecture, ESBN (Webb) jt al. 202T) in which we used a similar encoder to that of GAMR and pass the images in sequential order with each shape as a single stimulus and the number of time steps as the number of shapes present in the SVRT task. In order to train these models we used images of dimension 128 x 128 for architectures such as RN, ESBN, GAMR and 256 x 256 for ResNet, Attn-ResNel (to be consistent with configuration in Vaishnav et al. (2022). ). ResNet-50 (ResNet) has 23M parameters, Relation Network (R.V) has 5.1M parameters, ResNet-50 with attention (Att-ResNNe)) has 24M parameters and GAMR & ESBN both have 6.6M parameters.
4 BENCHMARKING THE SYSTEM
All twenty- tasks in the SVRT dataset can be broadly divided into two categories: saff-different (SD) and spatial relations (SR), based on the relations involved in the tasks. Same-different tasks (1, 5, 6. 7, 13, 16, 17, 19, 20, 21, 22) have been found be harder for neural networks (Ellis et al. 2015; Kim et al. 2018 Stabinger et al. 2016 2021 Puebla & Bowers 202T: Messina et al.) 202 la
Vaishnav et al. (022) compared to spatial relations tasks (2, 4, 8, 9, 10, 11, 12. 14, 15, 18, 23).
We analyzed an array of architectures and found that, on average, GAMR achieves at least 15% better test accuracy score on SD tasks for 500 samples. In contrast, for SR tasks, the average accuracy has already reached perfection. We find a similar trend for other architectures when trained with different dataset sizes. Overall, RN (GAMR minus attention) and ESBN struggled to solve SVRT tasks even with 10k training samples, pointing towards the lack of an essential component, such as attention. On the other hand, Res-Re architecture demonstrated the second-best performance, which shows its importance in visual reasoning. Results are summarized in Figure
LEARNING COMPOSITIONALITT
Below, we provide evidence that GAMR is capable of harnessing compositionality. We looked for triplets of tasks (z, y, 2) such that would be composition of tasks x and y. We systematically looked for all such available triplets in the SVRT dataset and found three triplets: (15, 1, 10), (18, 16, 10) and (21, 19, 25). All these tasks and their associated triplets are described in SI section S2.5 We study the ability of the network to learn to compose a new relation with very few training samples, given that it had previously learned the individual rules. We first trained the model with tasks and y
4

---

Published as a conference paper at ICLR 2023
Nestett AW
90
90
All Raoifte
Accuracy
00
CAAM!!
70
60
60
SR
1.00
Detaset 5k
1.00
Dateset
Accursty
80
80
60
60
SR
Figure 2: Bar plot analysis for the SVRT tasks grouped in same-different (SD) and spatially related (SR) tasks. We compared the accuracies of five baseline architectures with GAMR. We trained these models with 55k, 1k, 5k and 10k samples.
so that the rules are learned with the help reasoning module ry which is two-layered MLP. We expect that the first layer learns the elementary operation over the context vectors stored in the memory block (M)) while the second layer learns to combine those operations for the tasks z. We freeze the model after training with tasks x, and only fine-tune: (i) layer to learn combine elementary operations and (ii) a decision layer (fa) on tasks with ten samples per category and 100 epochs in total. Results from scratch on task z from a triplet of tasks (x,yzz) to show that the model is exploring indeed compositionality. We also an additional control experiment for compositionality choosing the random pair of tasks (x=5, y=/7) such that the rules are not included in tasks (z) 15, 18, and 21. When we evaluated the network in this setup, we found the performance of the network be the chance level aligning with the claim.
shown in Figure 3 (left). As baseline, trained the model
Compositionality test
Benchmarking Atlention
100
Baseline
Composition
GAMR (AN]
90
GAMR
Accuracy
80
Accuracy
80
70
70
60
50
15:1+10
18 18:1644 10
21:19 25
SVRT Tasks
SVRT Tasks
Figure 3: Compositionality test (left): We train the model with tasks containing specific rules (e.g.. task representing same-different discrimination and task 10 involving identification if the four shapes form square not). We show that with its ability to compose already learned rules, GAMR can quickly leam with 10 samples per class to adapt to novel scenario (e.g., task 15 where the rule is to identify if the four shapes forming square are identical not). Benchmarking Guided Attention (right): We compared the average accuracy over two sub-clusters of SVRT obtained by GAMR with its variant when replaced the guided-atte aedeed-attention module with the self-attention (GAMR-SA) and when we completely gave away attention and made a relational reasoning architecture (GAMR w/o Amn (RN)).

---

Published as a conference paper at ICLR 2023
6 ZERO-SHOT GENERALIZATION
Training Task
Test Task
Test Accuracy Alnn-ResNet
GAMR
ResNee
We hypothesize that if a model has learned the abstract rule underlying a given task, it should be able to re-use its knowledge of this task on other novel tasks which share similar rule. To verify that GAMR is in- deed able to generalize across tasks that share similar rules, searched for pairs of tasks in SVRT which were composed of at least one common elementary relation (Vaishnav et al., 2022) between them. For example, in pair (7, 22), task / involves the identification of two similar shapes in category and task 22 involves the identi- fication of three similar shapes in category In the selected pair, the category that judges the similar rule should belong to the same class (let say category in the above example) so that we test for the right Icarnability.
5
72.07
53.03
73.04
15
92.53
92.07
78.87
22
84.91
80.10
67.15
I
92.64
85.73
92.28
15
84.36
62.69
49.95
22
76.47
55.69
50.19
7
22
83.80
79.11
50.37
21
15
90.53
50.00
49.76
23
8
85.84
58,90
59.25
Table I: Test accuracy show if the model learns the correct rules when we train it with a task and test on different set of SVRT tasks with GAMR, Attention with ResNet-50 (Attn-ResNet) and ResNet-50 (ResNet).
We systematically identified a set z of tasks 1, 5, 7, 21, 23 representing elementary relations such as identifying same-different (I, 5), grouping (7), learning transformation like scaling and rotation paired them with other tasks sharing similar relations.
(27) and learning insideness (2.3). Then These pairs are task 1 with each of 5, 15 and 22, task 5 with each of 1. 15 and 22. Similarly other pairs of tasks are (7, 22), (21, 15) and (23, 8). We have explained how all these pairs of tasks form group in SI section [2.3] We separately trained the model on the set x and tested the same model on their respective pairs without fine-tuning further with any samples from the test (zero-shot classification). We observed that GAMR could easily generalize from one task to another without re-training. On the contrary, a chance level performance by ResNet-50 shows the network's shortcut learning and rote memorization of depeddennd features. In comparison, GAMR exhibits far greater abstraction abilities demonstrating an ability comprehend rules in unseen tasks without any training at all. We further explored the strategies learned by GAMR using attribution methods for all the tasks (see section (S5). These attribution methods confirm that GAMR does indeed use a similar visual routine between the original task for which it was trained and the new task for which it was never trained. Table[[]sun summarizees these results.
7 ABLATION STUDY
Benchmarking guided attention We evaluated our guided-attention module (GAMR) and com- pared with alternative systems with comparable base-architecture but endowed with self-attention (With-SA)
attention and/or memory (GAMR w/o Am (RN)) over 23 SVRT tasks for the same number of time steps. In GAMR with-SA, we add a self-attention layer in the guided attention module and all three input vectors to the attention module are the same (Zamg). Our intuition is that each time step, the self-attention mechanism should provide the mechanism to learn to attend to different objects in a scene. As side note, GAMR with-SA turns out to be similar ARNe (Hahne al.) 2019) used for solving Raven's ' tasks. We found that, on average, our Guided Attention Model's relative performance 11.1% 1% better than its SA counterpart and 35.6% than a comparable system lacking attention (or memory) for SD tasks; similarly, relative improvements for SR tasks are 4.5% and 10.4% higher. It shows that GAMR efficient as yields a higher performance for the same number (Ik) of training samples. Results are shown in Figure 3 (right). (right..
GAMR is a complex model with several component, so we now proceed to study what role different components of the proposed architecture play in it's ability to learn reasoning tasks. We studied the effect of these components on SD and SR categories. Our lesioning study revealed that iNorm plays a vital role in the model's reasoning and generalization capability even for learning simple rules of SR tasks. Normalizing every sample individually helps the model learn the abstract rules involved in task. We also found that for SD tasks, excluding vector out from the process is detrimental. The t-SNE plot shows that it encodes the independent abstract representation for the SVRT tasks (SI Figure S3 We systematically ran ablation study to show that each of

---

Published as a conference paper at ICLR 2023
Time Step
Ablation
100
GAMR
90
Accuracy
no_ vo_out
80
no Wt
no all
70
no_g
jo_iNorm
50
SD
SR
SVRT Tasks
t=1
t=2
t=3
t=4
(a)
(b)
Figure 4: Ablation studies (a): We pruned separate parts of the model, one at time: controller output (out), attention vector (wx), relational vector (allot)), feature channel gain factor (g) and instance normalization (i.N orm) and the bar plot show the variation in performance on SD and SR tasks when trained with 1k samples. Time steps visualization (b): Figure showing shift of attention with each time step in task-dependent manner. In the first row, the task is to answer if the two shapes are touching each other from the outside. At each time step, the network explores the area where the shapes touching each other. In other rows, attribution maps show the shifts over different shapes in an image. The controller module for the task in respective rows shifts attention across different shapes at each time step.
these components are essential to make it an efficient model. In no_allasj. , the model takes decision based the final outcome (oul) of the recurrent module (f.); for no_ output of the attention block is used to obtain instead after projecting it on 2imgs for no_g. equal weighing is applied to the feature space of the context vectors stored in the memory block. We have summarized the results in Figure (left) and added additional analyses in SI section S2 We also plot the attribution maps of the model in Figure [egureeFriige (right) each time step and show the way in which the model attends to task-dependent features while learning the rule.
ADDITIONAL EXPERIMENT
Dataset Webb et al. (2021) proposed four visual reasoning tasks (Figure $20 that we will hence- forth refer to as the Abstract Reasoning Task (ART): (I) a same-different (SD) discrimination task, (2) relation match to sample task (RMTS), (3) distribution of three tasks (Dist3) and (4) identity rule task (ID). These four tasks utilize shapes from a set of 100 unique Unicode character images They are divided into training and test sets into four generalization regimes using different holdout character sets (m = 0, 50, 85, and 95) from 100 characters. We have described training and test samples and different
for all four tasks in SI section
S7
Baseline models As a baseline, we chose the ESBN Webb et al. 2021 along with the two other prevalent reasoning architectures, the Transformer (Vaswani al. (017) and Relation Network (RN) (Santoro et al. 2017). These three share a similar encoder backbone as in GAMR. We also ran an additional baseline with ResNet-50 to verify if in multi-object scenario GAMR exploring some biases (like visual entropy) which is otherwise not present when segmented images are passed. In order to make our baselines stronger, we evaluated these models in their natural order, i.e., by passing single image at a time. We added random translation (jittering) for the shapes in the area of +5 pixels around the center to prevent these architectures from performing template matching. This jittering increases the complexity of the tasks and hence we have to increase the number of time steps from to This caused the differences in results when compared to the implementation in Webb al. (2021). For GAMR and ResNer-50, we present task-relevant images together a single stimulus (SI, F Figure S2T) while jittering each shape. We have also added ART results where each image is centered and put together in single stimulus in SI section S8 In order make our architecture
httpp::///t htt.es////iiiib....//////ooo/o// www.://wwwweeeeeeeeeeeeeeenennne coamergent__syyeee

---

Published as a conference paper at ICLR 2023
choose option from multiple stimuli (RMTS: 2, Dist3 and ID: 4), concatenate the relational vector (alloby) for every stimulus and pass them to a linear layer for final decision.
Holdout
Holdout 85
100
Transfoooe
Reokerto
80
60
Holdout 50
Holdout 0
100
40
20
0
RMTS
Dist3
RMTS
Dist3
Figure 5: ART: Average performance of GAMR and other baselines over 10 runs for different holdout values (m 0, 50, 85, 95). These models are evaluated four tasks, i.e., Same-Different (SD), Relation match to sample (RMTS), Distribution of 3 (Dist3) and Identity rules (ID).
Results We found near-chance level (50%) accuracy for all the baseline models and in all the four generalization regimes for the SD and RMTS tasks (Figure which otherwise performed with perfection when images were centered and passed through the same models. However, our proposed architecture is robust to handle this jittering, as shown in SI Figure S22 where we compare its performance when images not jittered. For the other two tasks, Distá and ID, baseline models performed better than the chance level (25%). ESBN showed an increasing trend in accuracy for progressively easier generalization conditions approaching holdouts. This points toward the fact that the first three shapes in both tasks allow ESBN to consider translation factor while comparing the next three shapes, letting choose the correct option appropriately. RN and Transformer consistently struggled to generalize. ESBN (memory based model) performance on SD tasks in both the visual reasoning datasets show that attention is needed for reasoning.
RELATED WORK
Multiple datasets have been used to assess the visual reasoning ability of neural networks. One of the first challenges included the SVRT. Recently introduced Raven style Progressive Matrix datasets, RAVEN (Zhang al. 2019). PGM Barrett et al. (2018). focuses on learning nearly seven unique rules and choose one of the eight choices. However, it was found that the dataset was seriously flawed it was later found that neural architectures could solve tasks by leveraging shortcuts (Hu al.) 2020 Spratley et al. 2020) which were later removed in I-RAVEN (Hu et al. 202T). Prior work (Kim al. 2018] Vaishnav et al. 2022, Messina et al., (2021a) on SVRT studies has focused on the role of attention in solving some of these more challenging tasks. In SVRT, tasks that involve same- same-different (SD) judgements appear be significantly harder for neural networks learn compared to those involving spatial relation judgement (SR) (Stabinger et al., 2016 Yihe et al.) 2019 Kim et al. 2018)
(see Ricci et al. (202T) for review). Motivated by neuroscience principles, Vaishnav et al. (002
studied how the addition of feature-based and spatial attention mechanisms differentially affects the learnability of the tasks. These authors found that SVRT tasks could be further taxonomized according to their differential demands for these two types of attention. In another attempt to leverage a Transformer architecture to incorporate attention mechanisms for visual reasoning, MMessina et al. (2021a) proposed recurrent extension of the classic Vision Transformer block (R-VIT) Spatial
8

---

Published as a conference paper at ICLR 2023
attention and feedback connections helped the Transformer to learn visual relations better. The authors compared the accuracy of four same-different (SVRT) tasks (tasks 1,5,20,21) to demonstrate the efficacy of their model.
With the introduction of Transformer architecture, attention mechanisms started gaining popularity in computer vision. They can either complement (Bello al. 2019] Vaishnav et al. [2022] d' d'Ascoli
let al.
1021) or completely replace existing CNN architectures (Ramachandran et al. [019 Touvron
al. 2021 Dosovitskiy al. 2020). Augmenting the attention networks with the convolution architectures helps them explore the best of the both worlds and train relatively faster. In contrast, stand-alone attention architecture takes time to develop similar inductive biases similar to CNN. As initially introduced by Vaswani et al. (2017), Transformer uses a self-aatenttion layer, followed by residual connection and layer normalization and linear projection layer to compute the association between input tokens. We used a similar system (SI Figure (52) where instead of using self-attention module, in GAMR, feature-based attention vector (an internally generated query) is obtained via an LSTM to guide the attention module to the location essential for the task and we thus call the model as guided-atenticnn then implemented memory bank. A more closely aligned model with the human visual system is proposed by MMni et al. (2014) Recurrent Attention Model (RAM). It learns a saccadic policy over visual images and is trained using reinforcement learning to learn policies (see SS2. for discussion and its performance on SVRT task). The Mnih et al system constitutes an example of overt attention. Conversely, GAMR constitutes an example of a covert attention system and assumes a fixed acuity.
Since there could be more than one location where the model will attend, we
We took inspiration for the memory bank from ESBN (Webb et al. 2021). where mechanisms for variable binding and indirection were introduced in architecture for visual reasoning with the help of external memory. Variable binding is the ability to bind two representations, and indirection is the mechanism involved in retrieving one representation to refer the other. While ESBN was indeed a source of inspiration, we would like to emphasize that GAMR constitutes a substantial improvement over ESBN. First and foremost, ESBN lacks attention. It requires items/objects to be passed serially one by one and hence it cannot solve SVRT or any other multi-object visual reasoning problems. In sense, the approach taken in ESBN is to assume an idealized frontend that uses hard attention to perfectly parse scene into individual objects and then serially pipe them through the architecture. This is where our work makes a substantial contribution by developing an attention front-end (which is soft and not hard) to sequentially attend to relevant features and route them into memory. We tested this template- papplatttmtcchingg behavior of the ESBN architecture by training it in the presence of Gaussian noise and spatial jittering. It led chance-level performance (refer SI section S8 for more details). Here, we build on this work and describe an end-to-end trainable model that learns to individuate task-relevant scenes and store their representations in memory allow the judging of complex relations between objects. Finally, our relational mechanism is inspired by the work in Santoro et al. (017)) that introduced plug-and-play model for computing relations between object-like like representations in network.
10 CONCLUSION AND LIMITATIONS
In this paper, we described a novel Guided Attention Module for (visual) Reasoning (GAMR) to bridge the gap between the reasoning abilities of humans and machines. Inspired by the cognitive science literature, and store relevant information in memory. Our proposed guided-attention mechanism is shown to outperform the self-attention mechanisms commonly used in vision transformers. Our ablation study demonstrated that an interplay between attention and memory was critical to achieving robust abstract visual reasoning. Furthermore, we demonstrated that the resulting systems are capable of solving novel tasks efficiently by simply rearranging the elemental processing steps to learn the rules without involving any training. We demonstrated GAMR's versatility, robustness, and ability to generalize compositionality through an array of experiments. We achieved state-of-the-an accuracy for the two main visual reasoning challenges in the process. One limitation of the current approach is that it currently only deals with a fixed number of time steps. Training the model with four time steps was sufficient to solve all SVRT tasks efficiently. However, a more flexible approach is needed to allow the model to automatically allocate number of time steps according to the computational demand of the task. GAMR is also limited to covert attention unlike biological system where both covert and overt attention are demonstrated.
module learns to dynamically allocate attention to task-relevant image locations
9

---

Published as a conference paper at ICLR 2023
ACKNOWLEDGMENTS
We want to thank Jonathan D. Cohen (Princeton University). Taylor Webb (UCLA), Minju Jung (Brown University) and Aimen Zerroug (ANITI, Brown University) and anonymous reviewers for helpful discussions. We also want to acknowledge Thomas Fel's (ANITI, Brown University) help in feature visualization.
This work is funded by NSF (IIS-19 (SS-1912280) and ONR (N000)4-1))))2022)) to TS. Additional support was provided by the ANR-3IA Artificial and Natural Intelligence Toulouse Institute (ANR-19-PIBA- 0004). Computing resources used supported by the Center for Computation and Visualization (NIH $100D025181 Brown and CALMIP supercomputing center (Grant 2016-p20019, 2016-p22041) at Federal University of Toulouse Midi-Pyrénées.
REFERENCES
Takuya Akiba, Shotaro Sano, Toshihiko Yanase, Takeru Ohta, and Masanori Koyama. Optuna: next-generation hyperparameter optimization framework. In Proceedings of the 25rd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, 2019.
Andrea Alamia, Canhuang Luo, Matthew Ricci, Junkyung Kim, Thomas Serre, and Rufin VanRullen. Differential involvement of eeg oscillatory components in sameness versus spatial-relation visual reasoning tasks. eNeuro, 8(1), 2021.
Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. arXiv preprint arXlv:1607.064500 2016.
David Barrett, Felix Hill, Adam Santoro, Ari Morcos, and Timothy Lillicrap. Measuring abstract reasoning in neural networks. In International conference machine learning, pp. 511-520.
PMLR, 2018
Irwan Bello, Barret Zoph, Ashish Vaswani, Jonathon Shlens, and Quoe V Le. Attention augmented convolutional networks. In Proceedings of the IEEE/CVF international conference computer vision, pp. 1286-3295,, 2019.
Markus Buehner, Stefan Krumm, Matthias Ziegler, and Tonja Pluecken. Cognitive abilities and their interplay: Reasoning, erystallized intelligence, working memory components, and sustained attention. Journal of Individual Differences, 27(2):57, 2006.
Jianpeng Cheng, Li Dong, and Mirella Lapata. Long short-term memory-networks for machine reading. arXiv preprint arXiv:1601.000 06733,, 2016.
Aaron Cochrane, Vanessa Simmering, and C Shawn Green. Fluid intelligence is related capacity in memory as well as attention: Evidence from middle childhood and adulthood. PloS one, 14(8): c0221353, 2019.
Stéphane d' Ascoli, Hugo Touvron, Matthew Leavitt, Ari Morcos, Giulio Biroli, and Levent Sagun. Convit: Improving vision transformers with soft convolutional inductive biases. arXiv preprint arXiv:2103. 10697, 2021.
Alexey Dosovitskiy. Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, et al. An image is worth 16x16 words: Transformers for image recognition at scale. arXiv preprint arXiv:2010.11929, 2020.
Kevin Ellis, Armando Solar-Lezama, and Joshua B. Tenenbaum. Unsupervised learning by program synthesis. In NIPS, 2015.
François Fleuret, Ting Li, Charles Dubout, Emma K Wampler, Steven Yantis, and Donald Geman. Comparing machines and humans on visual categorization test. Proceedings of the National Academy of Sciences, 172141): 2011.
Daryl Fougnie. The relationship between attention and working memory. New research on short-term memory, 1:45, 2008
10

---

Published as a conference paper at ICLR 2023
C. M. Funke, J. Borowski, K. Stosio, W. Brendel, T. S. A. Wallis, and M. Bethge. Five points to check when comparing visual perception in humans and machines. Journal of Vision, Mar 2021. /tttss//// arvo www.:oowww....ooooooooooo ott.riccce..pppaaarrceeee11122/1
Dedre Gentner and Arthur Markman. Structure mapping in analogy and similarity. American psychologist, 52(1):45, 1997.
Lukas Hahne, Timo Lüddecke, Florentin Wörgötter, and David Kappel. Attention on abstract visual reasoning. arXiv preprint 19/ 2019.
Mary Hayhoe. Vision using routines: A functional account of vision. Visual Cognition, 7(1-3):43-66 -6, 2000.
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference computer vision and pattern recognition, pp. 770-778, 2016.
Sheng Hu, Yuqing Ma, Xianglong Liu, Yanlu Wei, and Shihao Bai. Hicrarchical rule induction network for abstract visual reasoning. arXiv preprint arXiv:2002.06883. 2(4), 2020.
Sheng Hu, Yuqing Ma, Xianglong Liu, Yanlu Wei, and Shihao Bai. Stratified rule-aware network for abstract visual reasoning. In Proceedings of the AAAI Conference on Artificial Intelligence. volume 35, pp. 1567-1574, 2021.
Junkyung Kim, Matthew Ricci, and Thomas Serre. Not-so-clevr: learning same different relations strains feedforward neural networks. Interface focus, 8(4):20180011, 2018.
Diederik P Kingma and Jimmy Ba. Adam: method for stochastic optimization. arXiv preprint 192669, 2014.
Andrew Lovett and Kenneth Forbus. Modeling visual problem solving analogical reasoning. Psychological review, 124(1):60, 2017.
David Marr. Vision: A Computational Investigation into the Human Representation and Processing of Visual Information. Henry Holt and Co., Inc., USA, 1982. ISBN 0716715678.
Nicola Messina, Giuseppe Amato, Fabio Carrara, Claudio Gennaro, and Fabrizio Falchi. Recurrent vision transformer for solving visual reasoning problems. arXiv preprint 1rXiv:2111.1557, 2021a.
Nicola Messina, Giuseppe Amato, Fabio Carrara, Claudio Gennaro, and Fabrizio Falchi. Solving the same-different task with convolutional neural networks. Pattern Recognition Letters, 143:75-80, 2021b.
Volodymyr Mnih, Nicolas Heess, Alex Graves, et al. Recurrent models of visual attention. Advances in neural information processing systems, 27, 2014.
Ankur Parikh, Oscar Täckström, Dipanjan Das, and Jakob Uszkoreit. A decomposable attention model for natural language inference. Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pp. 2249-2225 Austin, Texas, November 2016. Association for Computational Linguistics. doi: 10.18653/v1/D16- 1244. URL htttps://aclaathholoog
org/ 6- 1244
Guillermo Puebla and Jeffrey S. Bowers. Can deep convolutional neural networks learn safe-different relations? bioRxiv, 2021. doi: 10.1100/2221..040444555335 URL httts::/www.biox.t http://oorreem//arrr///////////0
06. 438551
Prajit Ramachandran, Niki Parmar, Ashish Vaswani, Irwan Bello, Anselm Levskaya, and Jonathon Shlens. Stand-alone self-attention in vision models. arXiv preprint
2019.
Vilayanur S Ramachandran. Apparent motion subjective surfaces. Perception, 14(2):127-334, 1985.
Matthew Ricci, Rémi Cadène, and Thomas Serre Same-different conceptualization: machine vision perspective. Current Opinion in Behavioral Sciences, 37:47 55, 2021. ISSN 2352-1546. doi: https://doi.org/10..000 200pe.0..00....c....0..........0

---

Published as a conference paper at ICLR 2023
G. Rizzolatti and L. Craighero. Premotor theory of attention. Scholarpedia, 5(1):6311, 2010. doi: 42449//cholampecia.3333 1. revision #91668.
Pieter R Roelfsema and Floris P de Lange. Early visual cortex multiscale cognitive blackboard. Annual review of vision science, 2:131-151, 2016.
Pieter R Roelfsema, Victor A.F Lamme, and Henk Spekreijse. The implementation of visual routines. Vision Research, 40(10): 1380-:::1111111 2000. ISSN 0042-6989. doi: https://oiioor org//
10.1016650042-66999000000040333 URL https::///// wwwwwwwwwkoo..mom wwt.::..iiccc..e.eee. rect. com ccom/scienee
atticLe/S11/30044999900000
Adam Santoro, David Raposo, David GT Barrett, Mateusz Malinowski, Razvan Pascanu, Peter Battaglia, and Timothy Lillicrap. A simple neural network module for relational reasoning, arXiv preprint 1rXiv:1706... 01427,,......... 2017.
Karen Simonyan, Andrea Vedaldi, and Andrew Zisserman. Deep inside convolutional networks: Visualising image classification models and saliency maps. In In Workshop International Conference on Learning Representations. Citeseer, 2014.
Daniel Smilkov, Nikhil Thorat, Been Kim, Fernanda Viégas, and Martin Wattenberg. Smoothgrad: removing noise by adding noise. arXiv preprint arXiv:1706.03822 2017.
Steven Spratley, Krista Ehinger, and Tim Miller. A closer look at generalisation in raven. In European Conference Computer Vision, pp. 601-616. Springer, 2020.
Sebastian Stabinger, Antonio Rodríguez- Sánchez, and Justus Piater. 25 years of cnns: Can we compare to human abstraction capabilities? In International Conference on Artificial Neural Networks, pp. 380-387. Springer, 2016.
Sebastian Stabinger, David Peer, Justus Piater, and Antonio Rodríguez-SSncchzz Evaluating the progress of deep learning for visual relational concepts. Journal of Vision, (1 8, 10 2021. ISSN 1534-7362. doi: 10.1167/jov.1..11.. URL http::://do...oo//ooo.ooooo 11.8
Mukund Sundararajan, Ankur Taly, and Qiqi Yan. Axiomatic attribution for deep networks. In International Conference on Machine Learning, pp. 3319-3328. PMLR, 2017.
Hugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa, Alexandre Sablayrolles, and Herve Jegou. Training data-efficient image transformers and distillation through attention. In International Conference on Machine Learning, volume 139, pp. 10347-10357. July 2021.
John K Tsotsos. Analyzing vision at the complexity level. Behavioral and brain sciences, 13(3): 423-445, 1990.
Shimon Ullman. Visual routines. Cognition, 18:97-159, 1984.
Shimon Ullman. Visual routines. Readings in computer vision, pp. 298-328. Elsevier, 1987.
Dmitry Ulyanov, Andrea Vedaldi, and Victor Lempitsky. Instance normalization: The missing ingredient for fast stylization. arXiv preprint arXiv: 1607,06600 2016.
Mohit Vaishnav, Remi Cadene, Andrea Alamia, Drew Linsley, Rufin VanRullen, and Thomas Serre. Understanding the Computational Demands Underlying Visual Reasoning. Neural Computation, pp. 1-25, 02 2022. ISSN 0899-7667. doi: 10. 10.1162/neco_a_0144 001488 URL https://doi. org/ 10.1152/neco a C1485
Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in neural information processing systems, pp. 5998-6008, 2017.
Taylor W. Webb, Ishan Sinha, and Jonathan D. Cohen. Emergent symbols through binding in external memory. ArXiv, abs/2012.14601 2021.
12

---

Published as a conference paper at ICLR 2023
Lu Yihe, Scott C. Lowe, Penelope A. Lewis, and Mark C. W. van Rossum. Program synthesis performance constrained by non-linear spatial relations in synthetic visual reasoning test. ArXiv, abs/1911.07721, 2019. 2019.
Chi Zhang, Feng Gao, Baoxiong Jia, Yixin Zhu, and Song- Chng-ChunnPa Zhu Raven: dataset for relational and analogical visual reasoning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2019.
13

---

Published as a conference paper at ICLR 2023
Supplementary Information
S1 IMPLEMENTATION DETAILS
Convolutional Backbone We used the same encoder (fe) as backhone for the following architec- tures: GAMR, ESBN and RN. This encoder built with the help of six convolutional blocks each as described in Table [ST
Table S1: Convolutional backbone architecture. in ch and out
out_ch ch represent the number of input and output channels for a convolutional layer. x signifies the number times the above-mentioned block consisting of [convolution BatehhBrrt ReLU] is repeated.
Layer
Outpan
Confguraaion
in mt_ch oot 64, kernel size 3, stride padding Ratchnorm(64)
ReLU x
Comv_D
in 64, out 64, kernel size 3, stride padding =1 Batchnorm(64)
ReI.U
x 64
MaxPooling
in c 64, ch 64, kernel, = strie puiding =I
Batchnorm/64)
Cony_ 1
64 64
ReLU
32 32
MaxPooling
in 64, out = 128, kernel 3, stride = pabliig
Batchnormó 128)
ReI.U x
Comv_2
in 128, out = 128, kersel size = stride = padding =1 Batchnorm<
ReI.U
16 16
MaxPanling
in_ch= 128, ch 128, kemel stride pacding
Batchnormc (12)))(((1))))))))
Conv 3
16 16
ReLU
x
8x8
MaxPurling
in = 128, out 128, kernel size strde = packiig =1
Batchnorm: (28))
ReLU 3
in 128, out, ch 256, kernel size 3,, stride pudting =1 Batchnorm/
ReLU
in_ch 256, out ch 256, kernel size = stride padding =1
Batchnorme250)
Coov_5
ReI.U x4
Cogv Layer
8x8
in_ch 256, out_ch 128, kermolssze size
stride 1, padding =0
Image
Ha-4
Hosa
125
128
108
Figure S1: Encoder module (fe) of GAMR
An encoder module (fe) is designed as shown in Table SI The LSTM in the controller layer (fe) is a single layered with 512 units. The output (out E R of the controller is used to obtain the gate vector (g) with the help of a linear layer and ReLU non-linearity. An internal query (gint.) is also generated with the help a linear layer without any nin-linearrty.
GAMR
The architecture is described in Algorithm [
14

---

Published as a conference paper at ICLR 2023
The relational module is two-layered MLP. Both these layers have ReLU non-linearity. The first hidden layer is of size 512 dimension and the second layer is size 256 dimension. The output from the second layer is summed after t time steps. They are concatenated with the out vector and passed to the decision layer for generating ý. No non-linearity is associated with the output layer.
Relational Network (RN) In this architecture, once the Zimg R. (61,1228) is obtained from the encoder block (fe). we directly move to the relational module part (re) as defined above. Instance normalization is also applied to the Zing done in GAMRR. In the relational module, all the pairwise combinations are obtained for each spatial location of the Zinng vector making 4096 x4) combinations in total. The output from this module sent the decision layer for final prediction y.
GAMR-SA In the self-attention variant of GAMR, instead of passing qint, in the guided attention module, we pass Zing as key, query and value vectors and calculate the self-attention at that particular time step. All the other components of the architecture kept the same as in GAMR.
GAMR for ART tasks ART challenge consists of 4 types of visual reasoning tasks (SD, RMTS, Dist3, ID). GAMR assumes a multi-object setup for all these four tasks, i.e., multiple images embedded in single stimulus. This makes the SD task binary classification challenge (similar to SVRT challenge task /). However, for the other three tasks, we take the relational vector (ra E R128) and concatenate the respective relational vector for all the input stimuli (RMTS 2, Dist3/ID 4). Later, this concatenated vector is used to predict the final outcome with linear layer. We used similar technique for ResNet-50 where the linear layer after average pooling used generate R28 which is concatenated and passed to decision layer.
Controller
Controller for every time step
Reasoning Module
Guided Attention
2t
Encoder Module
Zimg
Add LayerNorm
Multheadd-Atention
all
Gint,
Figure S2: GAMR approximation with Transformer: Equivalent representation of GAMR archi- tecture where the guided attention model can be approximated Transformer encoder layer where the query (1), key (k) and value (v) are passed as Zimg. lint, and Gint, respectively.
S2
IN DEPTH ANALYSIS OF GAMR
S2.1
RELATION WITH HUMAN VISUAL REASONING
There is evidence for overt attention shifts (i.e., associated with saccades) and covert (i.c., without saccades). Both closely related and overt attention is needed to be deployed at location before
15

---

Published as a conference paper at ICLR 2023
saccade can be made at that location (see premotor theory of attention (Rizzolatti & Craighero 2010). From a computational standpoint, the only real difference between overt and covert attention exists for vision systems endowed with fovea (i.e., region of greater visual acuity the center of the retina). Mnih et al. (2014) system constitutes an example of overt attention (and indeed the authors take inputs at greater resolution at attended locations). Conversely, GAMR constitutes an example of a covert attention system and hence assumes a fixed acuity. Hence, the success of our approach provides evidence for the benefits of attention mechanisms per se and is not confounded by improvements that could arise because of greater acuity. It is also important to note that according to the premotor theory of attention covert attention is required prior to overt shifts/saccades. should be possible to extend GAMR in a biologically plausible way by explicitly enabling saccades to overtly attended regions and by taking into account different acuities at the fovea vs periphery.
Comparison with RAM model Mnih et al. 2014) proposed Recurrent Attention Model (RAM) inspired by the human visual system which learns a saccadic policy over visual images. We ran the Mnih al. model for the easier SVRT tasks. We found that the network is unable to learn task requiring to find whether the smaller one of the two shapes is in the center of the larger one or around the boundary. The results are shown in Table S2 We used an image resolution of 60x60 and train the model for 200 epochs with 500 samples. We also trained the model with increased image resolution up to 128x 128 but this led to a very significant drop in accuracy to near chance level.
In addition, we would like to point out that the architecture proposed by Mnih et al. is non- differentiable and it trained using reinforcement learning learn policies, which makes it signifi- cantly different from our proposed end-to-end differentiable model. In short, we believe that there exist both qualitative and quantitative differences between the two classes of architectures and while the work by Mnih et al was pioneering it is far less expressive than our proposed GAMR.
Table S2: Recurrent Attention Model (RAM): Test and validation accuracy of RAM over SVRT
task 2
Glimpse
Accuracy
4
5
10
Best validation accuracy
78.00
72.00
74.00
72.00
Test Accuracy
62.26
61.55
71.21
58.98
$2.2 CHARACTERIZING THE LEARNED STRATEGIES WITH EXPLAINABILITY METHODS
We used three attribution methods: Integrated gradients (Sundararajan et al.. 2017 Saliency (Si- monyan et al.) 22144) and SmoothGrad (Smilkov et al. 2017). Common to these methods is the use of the gradient of the classification units w.r.t. the input image. These methods help characterize the visual features that are diagnostic for the network prediction (e.g., SI section S4
S2.3 LEARNING RULES
Rules involving Same-Different (SD) identification task 1, the challenge is to differentiate between the two shapes and recognize these two shapes are the same or different. When we trained the model on task 1, it (1) learned a mechanism to attend to the two shapes presented in an image; (2) learned to judge the similarity between the two shapes. To test the models' generalization ability, we selected tasks demanding similar judgment to decide. There are three of those from the set of 23 satisfying this criterion, S, 15 and 22. In task 15, four shapes form a square; in category 1, all these shapes are identical. Compositions involved in this task are identifying the same shape and counting them to make a correct decision. GAMR has shown ability to attend to all the identical shapes (Figure [II]) and make a correct decision with 92.53% accuracy. The model learns a similar ability when trained with task 21. It has two shapes that are in rotation, scaled, or translated form. The reason task 2/ could solve task 15 is same before with /.
In task 22, there are three shapes aligned in a row. All of them are identical in category 1. Again, the model must count the number of identical shapes and make the correct decision if the count reaches 3. In this task, our model achieves 84.91% %% accuracy. Another task taking the decision based on counting is 5. The model needs identify if two pairs of identical shapes are present in the image.
16

---

Published as a conference paper at ICLR 2023
However, when we evaluate ResNet-50 on these three tasks, we believe that the model must have found a shortcut to make a decision. ResNet-50 has learned a strategy to count only one pair of identical shapes, and it takes the decision soon as it finds that identical pair in tasks 5, 15, 22 and performs better than the chance level.
Next, we try to understand the learning of the model trained on task 5. The model trained with task 5 has learned to identify two pairs of identical shapes from a group of four. We found that the network is exploring shortcut solve this task. Rather than learning to find both pairs of identical shapes, it learned to attend to only one pair to take a judgment (Figure (Sp). Still, the model's routine helps extend this mechanism and attends to more than two shapes if shown in the same stimulus. At the same time, ResNet-50 uses its template matching technique to explore one pair of identical shapes, which helps to solve task / but does not help on tasks 15 and 22.
In task 7, the model learns to identify and count identical shapes in an image. There are three pairs of two identical shapes vs. two pairs of three identical shapes, as seen Figure [S5] We tested this model on task 22 and obtained 83.8% accuracy. Here the rule is to identify if three identical shapes form a row or not. However, a model trained on task 22 cannot solve task 7 because it explores a shortcut in solving task 22. It compares two shapes and arrives at a decision (Figure(S6) whereas, in task 7, grouping and counting are required to make a decision. ResNet-50, on the other hand, might still be looking for only one pair of identical shapes (there are three pairs in total) to make a decision. Thus fail to adapt to a novel task.
Rules involving Spatial Relations In addition to solving SD tasks, we show that GAMR also learns the routines when the judgment requires spatial reasoning. In tasks // and 2, the challenge is to inspect if the two shapes are touching/around the corner or not. One of the smaller shapes these tasks is towards the boundary from inside (task 2) or touching from outside (task 11). Training one and testing the other yields > 95% accuracy. In Figure S14 we can see from the attribution maps that the model is focusing on the area where the two shapes touching reach a decision. In task 23, the challenge is to learn insideness. Task 23 has two small and one large shape; both the small shapes are either inside outside in one category We test the model on task 8, which has two shapes, one inside the other and identical in one category vs. outside in category 2. When train model on task 23, it learns the judgment of insideness and also counts the number of shapes present inside. If we evaluate such a model on task 8, it quickly figures out instances when the shape is inside or outside (probably not identical).
shape inside and one outside in category 2.
For all these experiments, we take 10k samples for training the network for tasks 1, 5, 21, 23, 11, 2 and then perform the zero-shot generalization on a novel set of tasks.
S2.4 REVERSE CURRICULUM
In this part of the experiment, we go beyond making decision based on the learned rule and analyze GAMR's ability to parse those rules individually and evaluate tasks containing simpler rules. We trained GAMR on complex task and tested on its elementary subset. For example, in task 19, the rules involved are to learn the scale invariance between two shapes in stimulus. After training the model on task 19, we tested for the case where the scale factor is I (not seen during training), i.c., task 1, and obtained 94.05% accuracy. Similarly, we took another task 21, where there are two elementary operations involved, scaling and rotation together (non-zero values). To see if GAMR has the ability to parse this complex relation we tested the model trained task 21 on task 19 (scaling rotation = 0) and task / (scaling = I and rotation = 0) and obtain 86.95% and 90.86% respectively. It shows GAMR's ss unique ability to parse complex set of relations into independent simple elementary unseen relations.
and
S2.5 LEARNING COMPOSITION
We selected group corresponding to each tasks (15, 18, 21) used for composition. Task 15 has four shapes forming square and are identical. It can be composed of task / helping to identify the same shapes and task 10 which helps to learn if the four shapes are forming a square. In task 18, a rule is needed to be learned related to symmetry along the perpendicular bisector of the image. It can be taken as a composition of task 16 which requires learning mirror reflection of the image along the perpendicular bisector of the image and task 10 where in which symmetry could be discovered
17

---

Published as a conference paper at ICLR 2023
in between shapes (forming a square). At last, took task 2/ which involves both scaling and rotation between two shapes an image. As its compositional elements, we designed a variant where there is only rotation and scaling and represented it with 25 and combined with another counterpart of 2/ where there scaling and no rotation, i.e., task /9.
S2.6 ABSTRACT VARIABLE
As seen in ablation study (section 7. one of the fundamental components responsible for learning complex rules is out, and abstaining from makes the model struggle. We did a t-SNE analysis on this variable using the first 20 principal components from its 512 312-dimensional vector these components contribute to 95% of the variance. We analyzed 200 samples from each task of class-balanced validation dataset. None of these included in the training. These components encode the abstract variable for each task and have separable boundaries from each other, as seen in Figure S3
12-
10
-106
-25
Figure S3: t-SNE plot of the first 20 components of the abstract variable (out) obtained via PCA for all 23 SVRT tasks. Those components have cumulative variance of 95%. Each cluster can be clearly identified from other clusters representing different relations learned. Tasks are represented as labels with the same colored box around them placed in the mean location of the cluster.
S2.7 ROBUSTNESS
We did a study to inspect the robustness of the model. We evaluated the model on two factors: robustness scale and robustness the noise. We found that GAMR is able extract the correct rules in both of these scenarios.
Scale We analyzed the performance of the model with changing scale. We train the model with images of resolution 128 128 and test them at scale 1.5 times the original, i.e., 192 x 192. We found that the model can generalize this scale to various tasks such I, 9, 11, 14, 15, 17. In Table S2 we compared the performances of the model trained on tasks at scale (s=1) and tested on task with s=1 with tested task with s=1.5 for two different training sets, 5k and 10k. We did not use any augmentation relating to changing scale during the training, which might push the model to learn such scale-invariant representations.
In Figure S4 we demonstrate an example of task highlighting the region considered for taking decision at 1=5.5.
18

---

Published as a conference paper at ICLR 2023
Figure S4: Scale invariance shown by GAMR when it is trained with images of dimension 128 x 128 and tested on images of dimension 192 x 192 for task /. Attribution map shows that when two same shapes are present in an image, the model still tries to compare each part of both the shapes vs when two different shapes present, it focuses its attention the most salient part i.c corners. We show maps from three different attribution methods, Integrated Gradients, Saliency and SmoothGrad.
Table S2: Test accuracies when the model is trained on tasks at scale (s) = with 10k and 5k samples and tested on the same tasks at scale (s) = 1.5 without any fine-tuning.
TEST ACCURACY
TRAINING TASKS
5K SAMPLES
10K SAMPLES
$=1
$=1.5
S=1
$=1.5
94.77
71.01
97.34
75.09
99.00
70.46
99.58
72.11
11
99.85
90.89
99.75
91.05
98.66
71.84
99.62
73.45
15
98.76
73.02
98.59
68.66
17
93.09
72.98
95.13
74.98
Noise We even checked the robustness of GAMR to noise. We added Gaussian white noise to the dataset to perform this experiment with 0 mean and .05 variance. We found negligible difference in the test accuracy of the model with noise when compared to the case without any noise (Figure $25 S26 We even went further change the type of noise to salt and pepper while testing the same model. Nevertheless, the model learned the rules delivering nearly the same test accuracy as before.
S3 VISUAL ROUTINES
Every instant vast amount visual information is presented to the sensory systems in the brain, where it extracts the relevant information. This ability to visually detect, recognize, search or obtain deseriptions from the scene helps us execute various daily life tasks. Studies have also shown the insensitivity to changes in the visual scenes during eye movement, also called "changing blindness." " This phenomenon indicates that a scene is represented with only a small amount of available information. For doing this, some mechanism should exist in order to select the relevant information based on the current circumstances.
Despite the complexities of these tasks, the underlying principles of visual processing in the brain relatively simple. For example, even the visual system has the capability to analyze curves and contours, it is impossible represent all the possible combinations of these just by using feature
19

---

Published as a conference paper at ICLR 2023
detectors (Ullman 1984). A similar problem is posed in the visual search scenario. Due to the combinatorial explosion of possible features involved in the formation of a scene, the feedforward detection mechanism finds it hard to understand (Tsotsos) 1990). It shows us that mechanisms exist in our visual system other than simple feature detectors that aid in solving such tasks from the versatility of possible scenes.
To implement such task task-dependen visual processing, (Ullman 1984 1987)
proposed visual routines theory. It is one such method to process visual information beyond creating representations, thereby helping in tasks like object recognition, manipulation and abstract reasoning. A primitive set of operations are defined in [Ulman (1987) that are applied to obtain relevant information and spatial relations from a scene. Such composition of operations is called a routine.
The visual routine theory is heavily influenced by the theory of vision by Marr (1982). Ullman and Marr focused on extensive analysis and used functional approach as a starting point. This type of analysis provides a framework that, on the one hand, can be used in the theory of human cognition while, on the other hand, equally applicable in designing computer vision systems. This theory is based on similar principles that visual systems can solve tasks that feed-forward feature detectors could not do. Tasks are solved with the help of some mechanisms applied on top of these representations obtained by feature detectors (known as base representations). Ullman showed that a model could solve complex tasks if finite set of simple operations helping the model to reason sequenced properly (forming a routine). Another similar idea was presented in a utilitarian theory of perception (Ramachandran, 1985). This theory mentions that perception is similar to various parts of the human body, which are collections of ad-hoc pieces, working in their own way as well as together.
Another piece of evidence presented by Roelfsema al. 2000) showed how the elemental operations required for routines are implemented in the brain. When an image is presented, feed-forward processes in the brain lead to the activity pattern distributed across visual areas. Afterward, the elemental operation comes into play as firing rate modulations. These modulations enforce the grouping of neural responses into coherent object representations. Later, Hayhoe (2000) discussed evidence of routine in vision, indicating that only small part of the information of a scene is represented in a brain at each moment.
A cognitive blackboard theory is postulated in Roelfsema & de Lange (2016), explaining how the activity of neurons in the early visual cortex helps infer the visual world. The writing operations on the blackboard are compared to the feedback signals from higher cortical areas in the early visual cortex. These feedback signals are read by cortical regions and sub-cortical structures in later processing steps, thereby supporting an exchange of intermediate computational steps.
S3.1 RELATING VISUAL ROUTINE THEORY WITH GAMR:
Visual processing by Ullman can be divided into three stages. First stage is the creation of base representation. is a bottom-up process in which base representations are generated from the visual input. Once these representations are constructed, a visual processor is used to apply sequences of elemental operations to them in the second stage. It extracts the desired information from the base representations in top-down manner. In the third stage, this extracted information is used to reason in any given task. In humans, the bottom-up process corresponds to the retinotopic maps to capture properties like edge, color, speed and direction of motion. These base representations depend on a fixed set of operations uniformly applied over the entire input without any objec//aak-speciffc knowledge.
Such sequences of operations to extract information from the base representations are known as visual routines. These elemental operations are task-specific that are used to create incremental representations containing information to be used in the next operation. Thus, by applying these routines, incremental representations are constructed using sequences of elemental operations, which are finally used to provide a solution particular to the task. Some examples of these elemental operations are as follows: shifting the processing focus, indexing, marking an object or location for future reference, tracing boundaries, and spreading activation over area delimited by boundaries. In the shift of processing focus, the spotlight of selective attention helps to shift the processing focus on the image from one part to the other. Indexing enlists all locations where processing focus can shift. Routines are generally generated in response to some internally generated queries by assembly mechanisms in response to some specific goals.
20

---

Published as a conference paper at ICLR 2023
Aligned with this theory, proposed model has different building blocks. These are base representa- tions (Ztmg), incremental representations (2t), memory block to save these incremental representations (M), guided attention, and finally reasoning module (rp). In our model, base representation (2img) is created using a convolutional encoder (f²) which is a purely bottom-up process. This representation fixed and calculated using feed-forward network for any particular input. Zing is used to create incremental representation (z²) using visual routine processor represented by our guided attention module. At each time step, the guided attention module takes the input as the base representation (Zimg) and query vector coming from recurrent module (f&). This guided attention module gives the desired task-relevant feature vector create 2g, which is stored in the memory bank (M) and later used for reasoning.
21

---

Published as a conference paper at ICLR 2023
S4
ATTRIBUTION MAP VISUALIZATION
Category
Category
Task 1
0
Task 2
Task
4
Task 5
Task 6
4
Task 7
Task
Integrated Gradient
Sallency
SmoothGred
Integrated
Saliency
SmoothGrad
Gradient
Figure S5: Attribution map visualization for SVRT tasks. The map represents the area of the image, which significant decision-making for GAMR. Tasks represented are from 8. We used three different attribution methods here Integrated Gradients, Saliency and SmoothGrad.
22

---

Published as a conference paper at ICLR 2023
Category
Category
Task
Task 10
Task 11
Task
D
Task 13
Task 14
Task 15
Task 16
Integrated
Saliency
SmoothGGad
Integrated
Saliency
Gradient
Gradient
Attribution map visualization for SVRT tasks. The map represents the area of the image, which are significant in decision- for GAMR. Tasks represented are from 9 to 16. We used three different attribution methods here Integrated Gradients, Saliency and SmoothGrad.
Figure S6:
23

---

Published as a conference paper at ICLR 2023
Category
Category
A
0
Task 19
3 A
8
Tassk
0
Task 21
0
Task 22
up a
Task
Integrated
Saliency
Integrated
Sallency
SmoothGrad
Gradient
Gradient
Figure S7: Attribution map visualization for SVRT tasks. The map represents the area of the image, which are significant in decision -akinng for GAMR. Tasks represented are from 17 to 23. We used three different attribution methods here Integrated Gradients, Saliency and SmoothGrad.
24

---

Published as a conference paper at ICLR 2023
S5 EXPLANATION OF ROUTINES LEARNED AND CORRESPONDING ATTRIBUTION MAPS
This section explains the different mechanisms our model learns when we train with a task and shows how it uses those learning mechanisms to understand the rule while testing novel set of tasks.
the explainability maps corresponding the model trained with tasks 5, 19, 20 2/ and wc test those models on task I. Figure [S3 shows that task 5, the model learned a shortcut select only one identical pair from group of pairs to take decision. The model learns this shortcut because it was sufficient to make the correct decision. At the same time, to decide on images from category 2, the model stops searching soon as it finds non-identical region between two shapes.
In Figure 58
In task 19, the model learns scale invariance. The model chooses one shape and examines similar part around the second shape to check the scale-invarian representation. A broader version of transformations learned in task 21, where the model understands rotation, scaling, and translation concurrently. So the model uniformly attends to the two shapes present in the image and compares them.
In task 20, the model learns one of the three types of similarity transformation, i.e., reflection. If model learns distinguish similarity, it can solve any reasoning tasks associated with differeee identification.
Category
Category
Trained on 5
Trained on 19
Trained on 20
Trained on
A
P
!
Figure S8: Attribution maps corresponding to the mechanisms involved in visual routines when testing on images from task and the model is trained on different tasks as mentioned above each example image from both the category.
Moving to Figure $9 the challenge is to identify if the three shapes arranged in a row are identical or not. As seen from the previous discussions, task / learns to identify if two shapes are the same not. As there are three shapes existing, the model tries to compare two shapes in pairs before deciding. So we can see the high heat map values the two shapes for both tasks. As discussed before, task 20 learned similarity transformation between two shapes, and it makes a pairwise comparison between three shapes to take decision.
we test the rules learned by tasks /, 7 & 20 and test on task 22 where
25

---

Published as a conference paper at ICLR 2023
Glancing the performance of task 7 task 22, claim that the model learned to compare the shapes as well as count them to make decision. Similar to category 2 of task 7, here again, we have three shapes responsible for such good performance.
Category 1
Category
Trained on
8V
Ø
Id
Trained 7
Q
Q
Trained on 20
Figure S9: Attribution maps corresponding to the mechanisms involved in visual routines when testing on images from task 22, and the model trained on different tasks as mentioned above each example image from both the category.
Category
Calegory 2
Trained on 23
Figure $10: Attribution maps corresponding to the mechanisms involved when training model on task 23 and testing on images from task One of the rules learned in task 23 see if smaller shape exists inside the large shape, which is the same rule to be tested in category 2 of task 4.
Next, we look at the strategy used to solve task 15 in Figure S1T The rule to formulate the task involved identifying if the four shapes required to form a square are identical. The model trained on task 7, 5, 21 and 22 starts by picking up shape and stop comparing when it comes to the fourth shape. This the reason all of the four shapes in category 2, which are similar, are seen to be involved in Decision-making.
26

---

Published as a conference paper at ICLR 2023
Category
Calegory
Trained on 1
C
Trained on 5
Trained 21
Trained 22
0
Figure $11: We show the visual routines learned by GAMR when training the model task 21, 22 and we test the same model on task 15 (four shapes forming a square). shows that once the model has learned recognize one pair of identical shapes, it can extend the ability count all the identical shapes present in an image. The visualization shows the attribution methods Integrated Gradients, Saliency, and SmoothGrad from left to right.
Category
Category
Trained 23
Figure S12: Attribution maps corresponding the mechanisms learned when training model on task 23 and testing task 8. One of the rules learned in task 23 is to comprehend if one small shape exists inside the large shape. somewhat similar rule involved in task 8 identify the smaller shape existing inside is also identical not. The model is probably only answering the bases of insideness without considering the same-different judgment.
Category
Category 2
Trained on 15
C
Figure S13: Attribution maps corresponding the mechanisms learned when training the model on task 15 and testing on task /0. Rules required task is to say if the four identical shapes are forming square not. Model, when trained on this task 15, learns form square using four shapes in category 2, so it also solves the task 10.
27

---

Published as a conference paper at ICLR 2023
Category
Category 2
Trained on 2
Figure S14: Visual routines learned when training the model when on task 2 is if the two shapes touch from inside or not. We test the model on task 11, where the two shapes touch from the outside. shows that the model has learned to recognize touch and use the same relation to solve the task.
Category
Catagory
Trained 21
Ø
P
Figure S15: Task 2/ involves rules related to the geometric transformation related to scaling and rotation. One of the components of this rule present in task /9 related scaling, which helps it to understand this task.
Category
Category 2
Trained on 4
Figure S16: Attribution maps corresponding to the mechanisms learned while training the model on task 4 and testing images from task 23. In task the model learns the rules say if one shape is present inside the other or not. This case is true for category 2 of task 23, We expect the model answer the same even for from category 1, where two smaller shapes are present inside the larger shape.
28

---

Published as a conference paper at ICLR 2023
S6
EXAMPLE SVRT TASKS
Category
Category
Category 1
Category
3g A
4
Each image contains two shapes. They are the seme up translation category 1.
Each image contains srapes. In category' the shapes can organizod into three groups, cach consisting two. idential shapes: calegory they organized groups ileniiaal ehapes.
Each image contains twa shapes different size, the siallle ona roughly
larger category' wheroas in category is near the boundary.
Each image conteins shapes, one larger canegory 1, the small shape inside the large one and identical the translation,, shape is outsice the large one inside, identicall to, the large one.
AA
oither
Image shapes category the four shapes and In contact whereas catogory 2 there are two tea shrpps contact.
99
Each image contains three shapes, two smail and ane large, arranged category
wherwas calegory lerge on
Each image conteins one big shepe one ahepe, category the small shope inside the big one and in category 2 the small
10
0
Each image contains four Identical shapes. category the four shapes form square.
C c
calegory
identical stepes (up to tramdasion) whemes category 2 all shapes are diferrnt.
mage shapes stzes, catogary smell shope touching the large onw.
Each Image contains two pairs of isenticall shapes, as with category problem a5, the distance between the two idendical
Figure $17: Two representative examples from each category of 23 SVRT tasks Fleuret et al. (2011). Each example has their tasks number labeled the black box with description mentioned below.
29

---

Published as a conference paper at ICLR 2023
Category
Category
Category
Category 2
o0
12
image
Each image contains si identical shapes. category they three that
same size. category the two small shapes are diozer together than either one from the larger shape.
pair posiioaed symmertioall respect bisector image.
13
Each image contains an ilenfiaal peir of small shapes and an deniical grouped consisting
Each image contains two shapes of different sizes, In category 1, the shapes sealing transialion.
pair shapes. casagory the four stapes mota shapes composilons," shape and one arge shape with the property that the two resuting compon lions equivelent, i.a. one composition translated
do
Each image alapes. calegory obtained from the other by reflection around the perpendizular bisector of Inne jaining their centers.
Each image containe three slupee of identical size and shape In three aligred.
21
A
Each image contains two shapes. One the shapes category can obtained other
rotaling.
image contiena equally-sized shapes erranged verticee equare. In category the four ehapes are dentical
16
Each containn three aligned shapes
image contains identiccal shapes. calegory one three shapes can be obtained from the other duster three shapes by refection the vertical bisector the
23
Each image conteins one large and two small shapas. oategory
the small shapes eithrr both inside both outside the
Image contains shapes, astegory 1, each shape among the idertical onea the same distance from the mon-icentical one.
Figure $18: Two representative examples from each category of 23 SVRT tasks Fleuret et al. (2011). Each example has their tasks number labeled the black box with its description mentioned below.
30

---

Published as a conference paper at ICLR 2023
S7 HYPERPARAMETERS
Table S7: ART: Number of training and testing samples used for four different types of tasks.
Tasks
m=0
m=50
m=85
m=95
Training
18,810
4,900
420
40
SD
Test
990
4,900
10,000
10,000
RMTS
Training
10,000
10,000
10,000
480
Dist3
Training
10,000
10,000
10,000
360
ID
Training
10,000
10,000
10,000
8,640
Test
10,000
10,000
10,000
10,000
Holdout set For example, holdout represents a generalization regime in which the test sets contain the same characters as those used during training. the other extreme, in holdout 95, the training set contains minimal number of characters, most of which are actually used for tests. Hence, it is necessary to learn the abstract rule in order to generalize to characters in this regime.
Table S7: ART: For four different tasks number of epochs and learning rates (LR) used to train different architectures.
Tasks
m=
m=50
m=85
m=95
GAMR
Epoch
LR
Epoch
LR
Epoch
LR
Epoch
LR
SD
50
0.0001
50
0.0005
100
0.0005
200
0.001
RMTS
50
0.00005
50
0.0001
50
0.0005
300
0.0005
Dist3
50
0.00005
50
0.0001
50
0.00005
300
0.0005
ID
50
0.00005
50
0.00005
50
0.0005
100
0.0005
Other baselines
SD
50
0.0005
50
0.0005
100
0.0005
200
0.0005
RMTS
50
0.0005
50
0.0005
50
0.0005
300
0.0005
Dist3
50
0.0005
50
0.0005
50
0.0005
300
0.0005
ID
50
0,0005
50
0.0005
50
0,0005
100
0.0005
This dataset can be generated with the code provided by the SVRT authors with images of dimension 128 x 128. No augmentation technique was used for training other than normalization and randomly flipping the image horizontally vertically, as is customary for this challenge (Vaishnav cet al. 2022).
SVRT
We trained the model for maximum of 100 epochs with stopping criterion of 99% accuracy on the validation set. The model was trained using Adam (Kingma & Ba 2014) optimizer and a binary cross-entropy loss. All the models
trained from seratch. We used hyperparameter optimization framework Optina (Akiba et al.) 2019) to get the best learning rates, and weight decays for these tasks and reports the test accuracy for the models which gave the best validation scores.
Learning compositionality One of the triplets (21, 25) involves rotation which needed more than 1,000 samples to learn. So, selected 5,000 samples each from the tasks and to pre-train network. This pre-training carried out for 100 epochs for both tasks. Once the model trained, we fine-tune it on the novel unseen task We confirmed that GAMR was able to learn the new rule with as few as ten samples per category - hence demonstrating an ability to harness compositionality.
tgi ?p-svrt......................... http:///gg..b......pp..stt..
a-mmmarry
31

---

Published as a conference paper at ICLR 2023
S8 ESBN VS. GAMR
We have identified some limitations of the ESBN architecture, such as its sensitivity to translation and noise. It also incapable scenarios where multiple shapes are presented together in the stimulus or complex relations exist (Figure ST9).
Noss
Translation
Multple shapes or Comp nelirioos
In]
(b
Figure S19: Some scenarios where the memory-basee network, ESBN (Webb et al. 2021 performs chance level which shows the need for explicit attention mechanisms required in addition to memory to build a robust system. (a) Adding any kind of noise to the dataset, (b) the image is centered, (c) there multiple shapes (or the presence of complex relations like the SVRT dataset).
To compare our architecture with that ESBN, we analyzed GAMR on ART tasks and analyzed ESBN on SVRT tasks.
At first, we evaluated GAMR on the ART dataset as shown in Figure 220 In the previous work Webb et al. (022)) each image is passed as an individual image to the ESBN model, which is stored the external memory bank for contemplating the rule, whereas GAMR is smart enough figure out the rules from single stimulus containing all the characters (Figure S21 This time we added translation to every character before passing. take into account all these complexities introduced, like numerous shapes, relations, and stimuli altogether, steps (t=6) for tasks Dist3 and ID. For these two tasks, for our model to hold up the same level of performance without translation, it was difficult without increasing the number of time steps. We compared the accuracy of our architecture and found that even in the hardest generalization scenario (m=95), it performs relatively well, where 95% of the shapes were held during training. Our model achieves at least 60% test accuracy when trained from scratch using ten different random seeds. The holdout of 95% is relatively hard for GAMR takes some time for it develop attention mechanism.
let model run for 2 additional time
We have already seen section 4 that ESBN architecture has difficulty contemplating the rules for the SD and RMTS tasks. To ensure that the updated backbone is not an issue, we ran similar experiment where we used the same encoder module (fe) as the one proposed in Webb et (2021) and obtained consistent chance level accuracy.
(a) SameeDilferent
(b) RMTS
(6) Dietribution three
(d) Identily Rules
Figure S20: ART: (a) Same/different discrimination task. (b) Relational match-to-sen satch-to-sample task (answer is 2). (c) Distribution-of offthee task (answer is 1). (d) Identity rules task (ABA pattern, answer 3).
As next step, moved on to the part where analyzed the performance of ESBN SVRT tasks. To make SVRT tasks compatible with the ESBN architecture, we disintegrated the shapes of the dataset in different image frames such that their location is intact. We did not center shapes in the
32

---

Published as a conference paper at ICLR 2023
(y) Samaiiiiooen
(0e) Ideniity Podea
Figure S21: ART for GAMR: (a) Same/different discrimination task. (b) Relational sauche task (answer is 2). (c) Distribution-of-thee task (answer is 1). (d) Identity rules task (ABA pattern, answer 3).
100
Holdout 0
Holdout 50
80
60
20
RMTS
Dist3
ID
Holdout
Holdout
Mitorol
Contered
80
40
RMTS
Dis13
1D
5D
RMTS
Dist3
ID
Test accuracy on ART with different holdout sets when the images are centered and compare the accuracy when shapes are jittered in every image. We find that unlike other baselines experiencing huge drop performance when shapes are jittered, GAMR stable. We plot the average accuracy over ten runs on the dataset. axis corresponds to the four types of tasks, and y represents the average accuracy score. These tasks are as follows: (a) same-different (SD) discrimination task, (b) Relation match sample task (RMTS); (c) Distribution of three tasks (Dist3); and (d) Identity rule task (ID).
Figure S22:
dataset as might alter the rules imbibed in the task because their spatial relational structure. representative example of this method can be in Figure S23) Still, two of the tasks (7I and 2) in SVRT cannot be accustomed to this paradigm as they involve the concept of touching. So we skipped those tasks from analysis because of the complex pre-processing steps involved in separating two touching contours into separate channels.
After this pre-processing step, pass these individual images the ESBN model and plot the performance in Figure S24 We found that ESBN even struggles with relatively simple tasks that were learned by ResNet-50 and other non-attentive models. Such tasks be solved with approximately 500 samples, whereas ESBN did not learn to solve these tasks (14, 9, 23, 10, 2) even after training with 10k samples. We believe that the inability to formulate the spatial relations between shapes presented as individuated images is one of the significant drawbacks of architectures based on object-centric attention like ESBN.
33

---

Published as a conference paper at ICLR 2023
Category 1
Category 2
Image
Integ:
Image,
Image,
Task
Task 8
Figure S23: SVRT tasks compatible with ESBN model where each object is separated into individual images and passed to the ESBN in sequential manner.
34

---

Published as a conference paper at ICLR 2023
Number of training samples are 500
100
90
Test Accuracy
80
60
Number training samples 1k
100
90
Test Accuracy
21
19
17
20
13
22
16
15
23
10
Number training samples are 5k
100
Accuracy
80
70
50
21
20
13
22
23
10
Number of training samples are 10k
1.00
90
80
70
Test
60
50
21
39
37
20
33
22
1.6
12
15
34
10
18
31
Task Number
Figure S24: Comparing task level test accuracies of ResNet-50 (ResNet), Relation Network (RN). ResNet-50 with attention Att-ResNeet and GAMR for four training set sizes 500. 1k. 5k and 10k. Tasks are arranged as per the taxonomy introduced in Vaishnav et al. (2022) representing the rules involved defining task. For BNN model, task 3, // are not evaluated.
35

---

Published as a conference paper at ICLR 2023
S8.1 NOISE ROBUSTNESS
In this experiment, we tested the robustness of these two architectures against noise for two different datasets. We selected the most basic task of same-different discrimination (Figure 520) and used both the architecture in their naturalistic training paradigm. During training and testing, we added Gaussian noise the images. We found that ESBN is not able pass chance level accuracy even for the O-holdout case where all the symbols are presented during the training time, whereas GAMR experienced an insignificant drop in accuracy (Figure (25).. We observed a similar trend in the performance when we repeated the same experiment with complex variant of same-differen tasks, ie.. SVRT, and plotted the results in Figure S26 We matched the number of parameters in the encoder block (fe in both these experiments.
SD
100
GAMR
GAMR_
80
ESBN noise
Accuracy
60
40
20
0
50
85
95
Holdout
Figure S25: Test accuracy plot for same-different (SD) differentiation task when training and testing GAMR with the presence of Gaussian noise with different holdout values. For comparison, also plot the model's accuracy without any noise and show an insignificant difference in accuracy between these two cases. However, ESBN struggles learn the holdout scenario, thereby representing its inability to attend to shapes because it lacks an attention mechanism.
MAREO with_noks
100
90
Test Accuracy
80
70
60
50
21
5
19
17
20
13
22
16
12
15
14
9
23
8
10
18
11
2
Task Number
Figure S26: Test accuracy plot when training and testing MARIO with the presence of Gaussian noise using 5k samples twenty-three SVRT tasks. For comparison, we also plot the model's accuracy without any noise and show an insignificant difference in accuracy between these two cases.
36


Reviews:
[{"review_id": "t2aTR5b8Hb", "reviewer": "Reviewer_4tvR", "summary": "", "questions": "", "limitations": "", "rating": 6, "confidence": 4, "soundness": null, "presentation": null, "contribution": null, "strengths": "", "weaknesses": "", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "main_review": "", "summary_of_the_paper": "The paper proposes a Transformer-based module for visual reasoning, the Guided Attention Module (GAMR). The model is instantiated with three components: an encoder module, a controller module, and a relational module. The encoder module uses CNN and TCN to extract image features. A guided attention module uses multi-head attention to route visual information from relevant time step and modulate the features to yield a new context vector. The controller LSTM module generates query for the guided attention. The relational module leverages a memory and the context vector to produce the final answer. In experiments, GAMR achieves new state-of-the-art on SVRT and ART. It also shows compositionality and zero-shot generalization.", "summary_of_the_review": "I think the paper is in general in a good shape, but I'm concerned about novelty in model design and experimental comparison. I'd like to temporarily treat it as borderline and will sync with fellow reviewers.", "strength_and_weaknesses": "The module design follows intuition. It's believed that memory and attention play a significant role in human cognition. The model is crafted following this theory and makes perfect sense. The experimental part is also very detailed: apart from checking in-distribution performance, the authors also verify compositionality and zero-shot generalization with illustrative charts. The model is performative compared to others, showing the superiority compared to the chosen baselines.\n\nThat being said, I do have some concerns for the paper.\n\nFor one thing, the model may not be very novel. Attention and memory have been extensively studied, either jointly or separately, in both vision and language. One very related work is Hahne et. al 2019. The model also shares very similar design to ESBN. \n\nFor another, the model is only evaluated on SVRT and ART, two very simple datasets. There have been more challenging ones for abstract reasoning, like PGM, RAVEN, Bongard, Bongard-HOI. It'd be better to show results on these datasets in order to show superiority. Besides, the authors only briefly mention Hahne et. al 2019 without comparing it extensively.", "limitations_and_societal_impact": "", "review_text": "", "extra_scores": {"correctness": "4: All of the claims and statements are well-supported and correct.", "technical_novelty_and_significance": "2: The contributions are only marginally significant or novel.", "empirical_novelty_and_significance": "2: The contributions are only marginally significant or novel."}, "extra_text": {}}, {"review_id": "mh3oX2tWbY", "reviewer": "Reviewer_SVeq", "summary": "", "questions": "", "limitations": "", "rating": 6, "confidence": 5, "soundness": null, "presentation": null, "contribution": null, "strengths": "", "weaknesses": "", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "main_review": "", "summary_of_the_paper": "This paper proposes a novel method for visual reasoning, GAMR, that combines dynamic attention, memory, and relational reasoning. The method compares favorably against other popular approaches, and shows some evidence of compositional combination of rules.", "summary_of_the_review": "In summary, I think the model presented in this work, and the results are promising, but a few extra control experiments are needed, and the clarity of the paper needs to be improved. Specifically, I think the following changes would be necessary to merit a higher score:\n- A more careful ablation analysis, particularly looking at whether the multi-head attention component is needed. Unnecessary components (including also $w_{k_{t}}$) should be removed from the model.\n- A control experiment needs to be performed on the ART tasks using a baseline that solves these tasks the same way GAMR does, using multi-object images as input (e.g. the ResNet baseline used in the SVRT experiments).\n- The method needs to be described in more detail.", "strength_and_weaknesses": "# Strengths:\n- The proposed method integrates dynamic attention, memory, and relational processing, all of which are thought to be important components for human visual reasoning.\n- The proposed method is able to perform visual reasoning over multi-object scenes.\n- The proposed method shows reasonably strong out-of-distribution generalization, and can learn from relatively few examples.\n- The experiments identify some interesting limitations of previous methods, such as the vulnerability of the ESBN to visual noise.\n\n# Weaknesses:\n- The controller module has a lot of complexity, and some of the components appear to be unnecessary. It would be easier to gain insight into how the model operates if these unnecessary components were removed.\n    - I believe that it is not possible for the multi-head attention component to be contributing to the model's performance. In multi-head attention, for every query, an output is produced which is a weighted average of the values (weighted by the dot product between the queries and keys). However, in this case, there is only a single value, $query_{t}$ (this is also a confusing naming scheme), therefore the resulting outputs can only be copies of $query_{t}$. To confirm this, I used the code provided by the authors and ran a version of the proposed model that ablates the multi-head attention, on a few of the ART tasks. The results (averaged over 10 runs each) confirmed that the multi-head attention has no effect:\n| | same/differenet | RMTS | Dist-3 |\n| ----------- | ----------- | ----------- | ----------- |\n| w/ MHA | $82.3\\pm1.6$ | $64.6\\pm3.7$ | $66.0\\pm4.0$ |\n| w/o MHA | $83.7\\pm1.3$ | $67.3\\pm2.7$ | $67.3\\pm3.3$ |\nThis is also consistent with the results in the paper showing that the number of heads in the multi-head attention had no effect. \n    - The results of the ablation study in the paper show that $w_{k_{t}}$ has no effect. Therefore, this component should be removed from the model.\n- For the ART tasks, only GAMR performs the tasks using multi-object images as inputs (as opposed to receiving pre-segmented objected as the baselines do). Performing the task in this manner should ostensibly be more difficult, but it is also possible that there's some bias (such as visual entropy, see [1]) that can be exploited in this case that is not easily exploited when performing the task over segmented objects. The authors should compare to another baseline that performs these tasks using multi-object images as input, such as the ResNet used in the SVRT experiments.\n\n[1] Joel Fagot, Edward A Wasserman, and Michael E Young. Discriminating the relation between relations: the role of entropy in abstract conceptualization by baboons (papio papio) and humans (homo sapiens). Journal of Experimental Psychology: Animal Behavior Processes, 27(4):316,\n2001.\n\n\n### Other concerns:\n- The paper describes SVRT and ART as 'the two main visual reasoning challenges'. This is certainly not true, as there are many other such tasks, including PGM, RAVEN, relation games, CLEVR, CLEVRER, etc.\n- In the 'related work', the PGM and RAVEN datasets are micharacterized. First, they are described as a single dataset called 'Raven's Progressive Matrices', but Raven's Progressive Matrices is a different problem set, on which the PGM and RAVEN datasets are (loosely) based. Second, these datasets are dismissed as being 'seriously flawed'. However, the papers cited to support this claim address a bias that is only present in the RAVEN dataset, not the PGM dataset, and one of these papers proposes an alternative version of this dataset, I-RAVEN, that addresses these concerns.\n- I believe that the proposed model does not actually employ temporal context normalization, which normalizes representations across a temporal sequence, but instead uses *instance normalization* [2], which normalizes across the spatial dimension of a feature map.\n- The 'GAMR w/ self-attention' and 'GAMR w/o attention' ablations should be described in more detail.\n- The ESBN should be given a brief high-level description in the 'baselines' subsection.\n- In the test of compositional generalization, what is the baseline? It is only described in the figure as 'baseline', and I couldn't find a description in the text.\n- The evidence for compositional generalization could be stronger. How does GAMR perform if only trained on one of the source tasks, or if trained on unrelated source tasks? \n- It would be helpful to give an illustration of one of the compositional tasks (both the two source tasks and the target task) in the main body of the paper.\n- When describing the spatial jittering of objects in presenting the ART results, it should be clarified that this differs from the original implementation of these tasks, and that this explains the discrepancy between the results in the present work and the results in the original paper.\n\n[2] Ulyanov, D., Vedaldi, A., & Lempitsky, V. (2016). Instance normalization: The missing ingredient for fast stylization. arXiv preprint arXiv:1607.08022.\n\n", "limitations_and_societal_impact": "", "review_text": "", "extra_scores": {"correctness": "3: Some of the paper’s claims have minor issues. A few statements are not well-supported, or require small changes to be made correct.", "technical_novelty_and_significance": "4: The contributions are significant, and do not exist in prior works.", "empirical_novelty_and_significance": "4: The contributions are significant, and do not exist in prior works."}, "extra_text": {}}, {"review_id": "Fx3csn2_yVC", "reviewer": "Reviewer_o1fP", "summary": "", "questions": "", "limitations": "", "rating": 8, "confidence": 4, "soundness": null, "presentation": null, "contribution": null, "strengths": "", "weaknesses": "", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "main_review": "", "summary_of_the_paper": "The authors present GAMR, a brain-inspired architecture for visual reasoning. This architecture is transformer-based, but additionally utilizes an LSTM controller module and a memory module. The architecture empirically works well on visual reasoning task. This is exciting from an engineering perspective, but also of interest to (computational) neuroscientists investigating the role of memory and attention (a central controller module) in (visual) reasoning. ", "summary_of_the_review": "This is a nice paper. \n\nThe proposed architecture is interesting both from an ML and engineering perspective (interesting from a conceptual perspective, and much improved performance over earlier methods) and from a neuroscientific perspective (further evidence that brain may need both memory and a central attention module to perform reasoning.\n\nThe proposed method’s architecture is quite elegant, and it works well empirically. \n\nThe paper’s supplementary information and appendix are great, and the paper’s ablation studies are very nice. ", "strength_and_weaknesses": "# Strengths\n\n- The proposed method’s architecture is quite elegant, and it works well empirically. \n- The proposed method’s effectiveness provides further evidence that memory and a main “controller module” in the brain are essential for reasoning. \n- The paper is generally well-written. \n- The paper’s supplementary information and appendix are great. \n- The paper’s ablation studies are very nice. \n\n# Weaknesses\n\n- The authors could have used even harder visual reasoning tasks (which might have meant creating a new dataset). As the authors point out, the model currently uses 4 time steps only for its reasoning. Reasoning tasks harder than those from ART and SVRT may require many more time steps. It would be interesting to see how the proposed method performs in these scenarios. ", "limitations_and_societal_impact": "", "review_text": "", "extra_scores": {"correctness": "4: All of the claims and statements are well-supported and correct.", "technical_novelty_and_significance": "3: The contributions are significant and somewhat new. Aspects of the contributions exist in prior work.", "empirical_novelty_and_significance": "3: The contributions are significant and somewhat new. Aspects of the contributions exist in prior work."}, "extra_text": {}}, {"review_id": "BJu7YKQg40", "reviewer": "Reviewer_Gp6M", "summary": "", "questions": "", "limitations": "", "rating": 5, "confidence": 3, "soundness": null, "presentation": null, "contribution": null, "strengths": "", "weaknesses": "", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "main_review": "", "summary_of_the_paper": "This paper presents a transformer-based model for visual reasoning. The paper puts forward an architecture that shifts attention sequentially over a preprocessed image and outputs binary labels pertaining to the relationships between objects in the visual scene. The authors suggest that this model supports cognitive theories that attention and memory interact to solve complex visual reasoning tasks, which seems like quite an uncontroversial claim for the cognitive sciences. \n\nThe model preprocesses an image using a convolutional module, and then learns a task-dependent sequential attention policy over these preprocessed features by using recurrence from an LSTM to direct attention queries over multiple sequential passes through a transformer.\n\nThe model performs well on spatially-related (SR) tasks from the SVRT dataset compared to baseline models in the low data regime (on datasets smaller than 1k), and similarly to baselines when more data is used. In same-different tasks the GAMR model outperforms the baselines in all experiments, with the main benefits again noticed in the low data regime. On the Abstract Reasoning tasks dataset GAMR again outperforms baselines.\n\nThe major contribution of this work is to highlight the importance of recurrent attentional processing for solving visual reasoning tasks. As the model fairly consistently outperforms the presented baselines, this signifies a useful contribution to the literature. The ablations were thorough. The treatment of the related cognitive science feels a little superficial however, and would benefit from a more thorough treatment (or removal altogether - which would also be fine). The paper claims that what the model learns is compositional - in that it re-composes previously learned sub-policies. \n", "summary_of_the_review": "\nThis paper presents a transformer-based model that performs sequential attention over visual images. The results highlight the importance of attentional mechanisms in visual reasoning tasks. The results do not seem particularly novel to me, but I am not an expert on this particular body of literature. The paper itself would benefit from a more considered treatment of the relation to cognitive science and improvements in clarity throughout.\n", "strength_and_weaknesses": "*Strengths:*\n\nThe paper provides some evidence that sequential visual attention in some form (although superficially different from how it works in humans) is important for visual spatial reasoning.\nComprehensive ablations clarified the important components of the model for performance. \nThe GAMR model seems to generalise to tasks with similar relations better than their baseline models like Attn-ResNet.\n\n*Weaknesses:*\n\nIt is not clear to me how the task is presented to the model. The attentional processing is said to be task-dependent but Figure 1 shows no task-based inputs to the model.\nIt seems slightly strange to consider an attentional visual reasoning network which is said to be motivated by human visual reasoning, and have the system process the entire image at each time step. Humans and other primates instead take sequential saccades - they must learn a saccadic attentional policy (most similar here to what the LSTM is doing) but which directs this attention spatially to intake and process only small local portions of the visual scene at each timestep (that which fits within a foveated glimpse). This has led to other models which are more closely aligned with the human visual system, like the 2014 paper Recurrent Models of Visual Attention (Mnih 2014) which learns a saccadic policy over visual images. I am unsure whether results have been reported on the Mnih et al network’s performance on SVRT and ART datasets, however the architectural differences and differences in learned policy might be enlightening and help to establish deeper cognitive theories as a result of the work in this paper. \n\nThe current architecture is more comparable to a system which has its eyes firmly fixed at the centre of the image, and has to process it without using saccades to view and attend to parts of interest. This is wholly unlike how humans or animal view and attend to images (see papers measuring humans’ saccadic traces over visual scenes for more details). As a result the attentional maps that the GAMR model learns show distributed attention at each time step rather than local attentional processing. This is fine if the model is not intended to be a cognitive model of human visual reasoning, but the parallel to human visual processing is made at several points in the paper and thus feels incomplete. If the authors wish to keep the link to cognitive science, the paper could benefit from exploring and justifying these architectural choices more thoroughly.\n\nThe paper claims that GAMR is more computationally efficient than with SA because it yields higher performance for the same number of training samples (1k). But this does not consider the computational cost of a forward pass which is higher since there are multiple sequential sweeps through the guided attention module.\t\nThe paper claims that what the model learns is compositional - in that it re-composes previously learned sub-policies. The evidence for this was a little unclear as it’s difficult to interpret what the appropriate baseline is in Figure 3.\n\n*Minor points:*\n\nIn introduction and justification of the work:\nA single recent EEG study suggesting attention and memory are involved in same-different visual reasoning seems out of place here and a poor justification compared to the entire history of work on visual reasoning in cognitive science and neuroscience.\nPoints to ‘modern cognitive theories’ which are from the 1980s (not so modern).\nThe legend for the architecture diagram seems to be incorrect: The legend says that the recurrent controller f_s generates the queries at each time step, but these are input as keys and values into the transformer module while the queries seem to be sources from the encoded image.\n\nIt would be helpful to explain more clearly exactly how where the guided attn model and the self-attn models deviate - I am assuming that the LSTM is removed and z_img is used as query, keys and values but this is not stated explicitly. It is similarly unclear in this comparison whether there is some self-attn model replacement to make up for the ‘out’ channel into the reasoning module which would presumably be missing.\n", "limitations_and_societal_impact": "", "review_text": "", "extra_scores": {"correctness": "3: Some of the paper’s claims have minor issues. A few statements are not well-supported, or require small changes to be made correct.", "technical_novelty_and_significance": "2: The contributions are only marginally significant or novel.", "empirical_novelty_and_significance": "3: The contributions are significant and somewhat new. Aspects of the contributions exist in prior work."}, "extra_text": {}}]

Author rebuttal:

Decision: Accept: poster