SlowGuess/NeurIPS_2023_OCR huggingface dataset:
We also explored whether we could vary steering strength. LRM models have learned  $\sigma^{+}$  and  $\sigma^{-}$  scaling parameters that control the magnitude of modulation. We probed whether scaling these values by  $\alpha$  has systematic effects on the strength of the cognitive steering influence ( $\alpha \cdot \sigma^{+}$ ,  $\alpha \cdot \sigma^{-}$ , for  $\alpha = 1,2,3,4$ , Fig. 5.B). In human vision, this factor is loosely equivalent to generalized cognitive effort, and our capacity to marshal increasing resources to amplify top-down effects [39].
The side-by-side images have  $2\mathrm{x}$  the horizontal pixel resolution. Our model uses PyTorch's standard, built-in Adaptive Average Pooling operation at the final convolution stage to adjust the size of the representation to match the size expected by the fully-connected layers.
C
Figure 5: Cognitive Steering Tests. (A) Example triplet from the controlled composite tests. (B). Schematic of gain modulation mechanism. (C). Results of LRM 3 architecture are shown, for both side-by-side and overlay composites tests. Subplots show different cognitive steering signal variations. Target-present conditions indicate percent of times the target category was predicted, when steering towards that target. Target-absent condition indicate the percent of times that the target-absent category was predicted, when steering towards the target absent category (false alarm). Error bars indicate the  $95\%$  bootstrapped confidence interval across composite images. Horizontal, dashed gray lines indicate the accuracy of classifying the individual target images alone, computed for the LRM3 model for its default modulated pass.
4.3 Cognitive Steering enables flexible recognition in composite images
The results of the LRM3 model with various forms of cognitive steering are shown in Fig. 5.C. We see that without any steering (in the feed-forward pass 0, black bars), the model is unable to accurately identify either category from these composite images: side-by-side  $= 24.5\%$  , overlay  $= 5.1\%$  We found that cognitive steering was generally able to improve recognition of either category, in some cases, quite dramatically. For example, category-prototype steering (with  $\alpha$  scaling  $= 3$  ) showed side-by-side recognition  $= 68.9\%$  and overlay recognition  $= 51.8\%$  . Language-based steering (also with  $\alpha$  scaling  $= 3$  ) yielded side-by-side recognition  $= 70.4\%$  , overlay recognition  $= 50.5\%$  . To contextualize these effects, the level of accuracy obtained by this model using its default modulated processing pass over the individual images is  $82.2\%$  (dashed gray lines Fig. 5.C). Finally, gain control was also particularly effective for category-prototype and CLIP-steering, with increasing  $\alpha$  scaling following a u-shape curve (for  $\alpha >4$  , accuracy continues to decrease). Comparable results were observed for the LRM2 model, and much weaker results for the LRM1 model (see Table A.4). Appendix Fig. 7 provides an additional plot highlighting the effect cognitive steering on the logits.
Broadly, the pattern of results show that category prototype steering and CLIP steering were the most effective. This pattern is perhaps surprising, revealing that a more graded, probabilistic steering target is more effective than steering based on the objective of the model or through the specific representation of the exact image. Taken together, these experiments demonstrate that these LRM feedback pathways enable effective, parameterizable cognitive steering, yielding dramatic improvements in recognizing the target categories present in composite images.
A
O'Craven et al, 1999, Nature
Modulation of human brain regions with category-based attention
B
Figure 6: (A) Modulation in face- and scene-selective visual brain regions, during top-down attention of face-scene composite images [41]. (B) Parallel results in LRM networks, where face-tuned and scene-tuned units from a late stage layer of the model show different levels of activation to a composite image, when steering by face- and house-prototypes.
4.4 Multiplicative modulation prevents rampant hallucinations
We next tested whether cognitive steering towards a non-depicted category would lead to increased false recognition. For example, given a composite of English Setter and Church, what if the model is steered to "look for" Parachute? For these tests, we used the representation of the target-absent image of each triplet for cognitive steering. The results show that the likelihood of classifying the composite image towards the absent, non-target category was negligible, for all steering types (Fig. 5).
In follow-up analyses, we directly tested the claim that the multiplicative feedback is critical for preventing excessive false alarms to the steered category. First, we implemented matched LRM models with additive feedback projections. Our (standard) LRM-multiplicative motif is  $L(x_{p+1}) + L(x_{p+1}) \cdot F_p$ ; we trained additional LRM-additive models that influence destination layers additively:  $L(x_{p+1}) + F_p$  (Appendix A.7). Second, we also considered a CORnet model, a brain-inspired recurrent neural network model with additive feedback of a layer, onto itself, over time [40], and invented a different way to inject a steering signal into its recurrent processes (Appendix A.8). We found that steering LRM-additive models and CORnet models did improve detection of the goal category, but also lead to increased false alarms. These comparisons help clarify the benefits of multiplicative over additive feedback modulation: while both motifs can boost target-aligned features, only the multiplicative motif maintains low false alarms, even when increasing attentional gain.
4.5 Cognitive Steering recapitulates neural signatures of category-based attention
In the biological vision sciences, extensive research has shown that goal-based attentional states modulate activity along the entire visual processing hierarchy (e.g. evidenced across methods, including single-unit electrophysiology [5, 42], functional magnetic resonance imaging [41, 43], and magnetoencephalography [21, 44]; for review see [45, 46, 47, 48]). For example, seminal empirical work showed that when participants viewed composite face-house images, their face-selective brain regions were more active with goal-directed attention to faces, while scene-selective regions were more active with goal-directed attention to scenes, even though the actual composite visual input was always the same (Fig. 6.A; [41]).
Our LRM models recapitulate this well-known signature of top-down category-based attention, with systematic modulation of face-selective and scene-selective units based on the steering target (Fig. 6.B; see Appendix Sec.A.6). To our knowledge, this is the first mechanistic model, operating over rich naturalistic images, to account for these empirical neural signatures (for the most related earlier work see [7, 11]). Further, to our knowledge, current feed-forward/recurrent vision models do not (yet) have mechanisms to support top down-goal based modulation of early visual processing stages.
The three LRM models tested here reflect only a small part of the space of possible long-range modulatory architectures. Our results show increasing benefits with more long-range modulatory
pathways, leaving open the search for the optimal macro-scale architecture design. Additionally, it is an open question whether similar improvements in accuracy and adversarial robustness would emerge if LRM pathways were added to standard ResNets [49] or state-of-the-art Convnexts [50] or Vision Transformers [51]. We note, however that even if improved accuracy and robustness are not observed in larger models during default operation, adding LRM feedback pathways would still enable new cognitive steering capacities, and is thus an important avenue for future work.
In this work, we have not done an analysis of the structure in the learned channel-to-channel weights, nor characterized how these modulations are changing the representational geometry of each layer, nor provided mechanistic clarity on why these feedback connections are effective. And, we have not explored the impact of the learnable normalization components relative to the learnable channel-to-channel weights on the effects reported here, nor considered alternate motifs of more spatially localized (rather than globally broadcast) modulatory influences. Given the behavioral improvements found in these LRM models, deeper exploration into these inter-workings and variations would be valuable next steps.
Finally, while we used category-supervised training here, we think an important next step where the capacities of these LRM models would particularly shine is in a self-supervised setting (e.g. [52, 53, 54]). In particular, both the category prototype steering signals and the language-based signals are completely agnostic to the content of the output space, and can operate equally well in self-supervised domains. Thus, this work sets the stage for cognitive queries to help guide self-supervised visual encoding of the world, enabling new featural distinctions to be emphasized between the feed-forward and modulated pass, related to the goals of the cognitive system.
6 Related Research
Recurrent feedback connections have been integrated in deep neural networks in prior research, often drawing inspiration from the extensive back-projections present in the visual system [e.g. 55, 56, 10, 57, 58, 9, 59, 12, 60, 6, 61]. For example, [62] introduced feedback connections to convolutional networks, with a loss function for each time step (as we did here), focusing on the benefits of iterative emergence of categorical information over many successive steps. [7] explored an external cognitive bias implemented through recurrent feedback, to guide spatial selection mechanisms to recognize overlapping digits. [11] used an extensive procedure to search through a million-dimensional parameter space of feedback connection motifs, yielding models that show a similar capacity to correct mis-classification errors with recurrent steps [see also 9].
Our model introduces a relatively simple multiplicative feedback modulation, contrasting with modeling approaches in which feedback activation signals additively influence earlier layer activation [e.g. 10, 57], or more structured approaches which process top-down signals through separate parallel architectural branches [e.g. 63, 58, 64]. We also designed our model to operate with one modulatory pass, enabling rapid goal-directed steering with separate gain modulation—this departs from traditional recurrent neural networks which typically focus on the benefits of recurrence over longer roll-outs [e.g. 62, 56]. Our work focuses on how feedback connections can be used for top-down goal-directed visual encoding—this has parallels to work focusing on top-down regulation, to aid in recognition despite partial occlusion or clutter, or in object localization [e.g. 59, 55, 63, 12, 65, 66]. Top-down feedback networks have also been used to connect with theories of predictive coding, typically in support of more temporally extended processing of bottom-up visual information through time [e.g. 67, 68, 60, 69, 58], whereas here we focus on their use for external guidance signals to influence feed-forward visual processing.
Here we introduce cognitively- and biologically-inspired long-range modulatory pathways. We show that these learned modulatory feedback routes create fixed circuitry that can be leveraged for more flexible, goal-based modulation of visual input processing, enabling "cognitive steering" of visual processing. Broadly, we suggest that these architectural pathways provide novel targets for the introduction of top-down steering, offering new possibilities for integrative systems (e.g. multi-modal vision-language alignment; RL agents with goal-directed visual encoding) to enable more flexible communication between visual and cognitive components of the models.
[73] Ewa Wojciulik, Nancy Kanwisher, and Jon Driver. Covert visual attention modulates face-specific activity in the human fusiform gyrus: fmri study. Journal of neurophysiology, 79(3):1574-1578, 1998.
[74] Jacob S Prince, George A Alvarez, and Talia Konkle. A contrastive coding account of category selectivity in the ventral visual stream. bioRxiv, pages 2023-08, 2023.
[75] Neil A Macmillan and C Douglas Creelman. Detection theory: A user's guide. Psychology press, 2004.
A.1 Modulatory Motif Detail
Here is a more detailed description of how source activations modulate the destination layer activations. First, a channel normalization operation serves to emphasize some source features, and de-emphasize others, over a given image. We include learnable  $u_{c}$  and  $\sigma_{c}$  parameters across all channels  $c$  in the source layer. For a source layer activation in channel  $c$ , the normalization function  $\mathcal{N}$  was defined as:
$$
\mathcal {N} (a _ {c}; u _ {c}, \sigma_ {c}) = \frac {a _ {c} - u _ {c}}{\sigma_ {c}}
$$
For convolutional layers that operate jointly over channels and spatial locations  $(x,y)$ , the normalization function was extended to:
$$
\mathcal {N} (a _ {c, x, y}; u _ {c, x, y}, \sigma_ {c, x, y}) = \frac {a _ {c , x , y} - u _ {c , x , y}}{\sigma_ {c , x , y}}
$$
After normalization, the activations  $a'$  are passed through the tanh function, with learned scaling parameters. Function  $S$  scales the output of the tanh function based on the sign of the normalized activation:
$$
\mathcal {S} (a ^ {\prime}; \sigma^ {+}, \sigma^ {-}) = \left\{ \begin{array}{l l} \sigma^ {+} \cdot \tanh (a ^ {\prime}) & i f a ^ {\prime} \geq 0 \\ \sigma^ {-} \cdot \tanh (a ^ {\prime}) & i f a ^ {\prime} <   0 \end{array} \right.
$$
where  $\sigma^{+}$  is the learnable scalar for positive activation scaling, and  $\sigma^{-}$  is the learnable scalar for negative activation scaling. Next, the size of source activations  $a^{\prime \prime}$  is aligned to the size of the destination map  $D_{w,h}$ . If the source layer is fully-connected and the destination layer is a convolutional layer, the source channels' activations  $S_{c}$  are spatially broadcast to the size of the of the destination map activation map.
$$
\operatorname {R e s i z e} \left(a _ {c} ^ {\prime \prime}\right) = a _ {c} ^ {\prime \prime} \times \mathbf {1} _ {D _ {w, h}}
$$
where  $a_{c}^{\prime \prime}$  is the activation of each source channel  $c$  and  $\mathbf{1}_{D_{w,h}}$  is a matrix of ones with dimensions  $D_{w,h}$ . If both the source and destination layers are convolutional, the source activation map is upsampled to be the size of the destination activation map:
$$
\mathcal {U} (a _ {c, x, y} ^ {\prime \prime}; S _ {w, h} \to D _ {w, h}) = U p s a m p l e (a _ {c, x, y} ^ {\prime \prime}, S _ {w, h}, D _ {w, h})
$$
where  $a_{c,x,y}^{\prime \prime}$  represents the activation of the source channel  $c$  at spatial location  $(x,y)$  and the function Upsample up-samples the source activation map from size  $S_{w,h}$  to size  $D_{w,h}$ . Following the normalization and scaling operations, the key transformation in the LRM pathways is the learned channel-to-channel influences. This is implemented using a 1x1 convolutional layer:
$$
f _ {c ^ {\prime}, x, y} = \sum_ {c} W _ {c ^ {\prime}, c} \cdot a _ {c, x, y} ^ {\prime \prime}
$$
where  $W_{c',c}$  are the learnable weights of the 1x1 convolution,  $a_{c,x,y}''$  is the source activation, and  $f_{c',x,y}$  is the resulting activation that will be used to modulate the destination layer's next pass.
A.2 Impact of steering on logits
Fig. 7 provides a more detailed depiction of the cognitive steering signal effects, focusing the goal-directed pass of the LRM3 model (category-prototype steering,  $\alpha$ -scaling=3). The output activation unit of target 1, target 2, and the target-absent category are shown. When steering toward the category prototype of the either target, there is substantial increased activation along that output unit dimension. Steering towards the absent, non-target category does not have the same consequence (a benefit of the purely multiplicative modulatory interaction).
Figure 7: Impact of steering on output unit activation levels (1000 units corresponding to each image category). Average activation is plotted for the output unit corresponding to the category of each triplet image, including the two that were presented (target1, target2) and the image that was absent (absent-image), for both overlay and side-by-side composite images. Error bars reflect standard deviation over images. Data reflect activations from the LRM3 model, after the first modulated pass with category-prototype steering and gain modulation of  $\alpha = 3$ .
A.3 Cognitive Steering with Clip Text Embeddings
One potential application of LRM networks is to enable top-down steering of visual encoding via natural-language queries — e.g., steering the visual encoder by asking "Is there an English Springer present?" — amplifying any visual responses aligned with the query throughout the visual encoder. Ideally this language-based steering would be implemented via an integrated vision+language multimodal model, such as CLIP [70], using an LRM network as the vision encoder. We haven't yet trained a multi-modal LRM network, but as a proof of concept for this application, we generated steering vectors from category labels using an intermediate model that was trained to map CLIP text outputs and LRMNet vision outputs. Our approach was modeled after the "diffusion prior" of the Dalle2 architecture [38] using the lucidrains PyTorch implementation (https://github.com/lucidrains/DALLE2-pytorch), modified to allow mapping from N-D to M-D feature spaces, since our vision models had a different output dimension than the CLIP text encoders. The goal was to provide a category label, e.g., "English springer", to a CLIP text encoder, and to then map the CLIP text output to the expected LRM network output for an image from that category, specifically to the mean vision output for that image category. This predicted embedding could then be used as a steering vector to exert top-down control over visual processing within the LRM network (see "clip-text prototypes", Sections 4.2 and 4.3).
A.3.1 Image Embeddings
We first extracted the output vector for each image in the ImageNet training set, then averaged across images within each category, yielding a 1000x1000 tensor of "visual category prototypes" (1000 categories x 1000 output units). We also computed the prototypes for the ImageNet validation set. These visual category prototypes were computed separately for each LRM network.
A.3.2 Text Embeddings
We used the "ViT-B/16" text encoder from the official open source CLIP models https: //github.com/openai/CLIP. To generate clip-text embeddings for each ImageNet category, we used the zero-shotImagenet labels and prompts from the original CLIP paper [70], as described here https://github.com/openai/CLIP/blob/main/notebooks/Prompt_Engineering_for/ImageNet.ipynb. Each ImageNet target label was converted to the ImageNet
classname (e.g., label=0, classname = "tench"), and each classname was included within seven zero-shot prompts ("a photo of the large {}.","a {}. in a video game.", "art of the {}.","a photo of the small {}.","itap of a {}.","a bad photo of the {}.","a origami {}."). These text prompts were then passed through the text encoder and the outputs were averaged across prompts, yielding a 512-D text embedding, and 77x512 text encoding (embedding per token, max sequence length 77) for each ImageNet category. These clip-text representations could then be used to predict the image embeddings of an LRMNetwork.
A.3.3 Text-to-Image Diffusion Model
Following [38], we trained a diffusion model to generate image vectors conditioned on text embeddings and encodings. We used the lucidrains DiffusionPriorNetwork and DiffusionPrior modules: prior_network=DiffusionPriorNetwork(dim=1000, depth=6, dim_head=64, heads=8), and DiffusionPrior(net=prior_network, image_embedding_dim=1000, timesteps=100, cond_drop_prob=.20, condition_on_text_encodings=True, image_embedding_scale=True). In order to align the text representations (512-D) with the image representations (1000-D), we used a linear projection layer (512 input channels, 1000 output channels), and then passed these 1000-D text representations into the Diffusion Prior to condition the diffusion process. The output of the Diffusion Prior is a 1000-D vector, which serves as the predicted visual category prototype for the class specified by the text label. Each batch was composed of the full set of 1000 text-embeddings and 1000 image embeddings, and the models were trained for 20000 iterations using the AdamW optimizer (lr=.0001, betas=(0.9, 0.999), weight Decay=0.01).
Finally, after a DiffusionNetwork was trained, we could "sample" text-conditioned image embeddings from the DiffusionPrior for each of the 1000 ImageNet labels. We aggregated across 100 samples per category to generate "clip-text prototypes", which we treat as the final mapping between ImageNet text labels and the visual encoder outputs.
A.3.4 Text-to-Image Embedding Quality
To measure the accuracy of the text-to-vision alignment, we computed the cosine similarity between the 1000 clip-text prototypes, and the visual category prototypes for the training set and the validation set. As shown in Table A1, the clip-text prototypes for all models showed high cosine similarity scores on both the training set  $(>= .938\%)$  and validation set  $(>= .88\%)$ . For comparison, the cosine similarity between training and validation set vision prototypes was .94 for all LRM models.
LRM1	LRM2	LRM3
Training Set	0.950	0.944	0.938
Validation Set	0.895	0.889	0.884
A.4 Composite Test Accuracy, All Models
Table 2: Cosine Similarity between Clip-Text Prototypes and Visual Category Prototypes for each LRM network
Composite Test	Model	Pass 0	1-Hot	Instance	Category	Clip
Side-by-Side	LRM1	0.246	0.143	0.275	0.395	0.400
LRM2	0.236	0.109	0.382	0.743	0.718
LRM3	0.245	0.235	0.507	0.689	0.704
Overlap	LRM1	0.016	0.024	0.139	0.250	0.236
LRM2	0.014	0.051	0.234	0.674	0.635
LRM3	0.016	0.075	0.272	0.543	0.527
Table 3: Composite test accuracy vs. steering type for all models with alpha modulation 3.
A.5 Additional Cognitive Steering Variations
We also tested discriminative steering signals that take into account both the targets, in order to amplify one and suppress the other ( $v_{target1} - v_{target2}$ ). These steering vectors effectively query the system to "look for X's as distinct from Y's". To our surprise, we found that discriminative steering did not have a dramatic impact on composite recognition accuracy, relative to target-based steering (Fig 8).
One interpretation of this result is that the modulatory circuitry may have already learned to amplify the target category relative to all other categories, so the additional suppressive steering for the distractor category is not effective. Another possibility is that the particular images used in this side-by-side test are by design relatively distinct, and the discriminative steering signals may be more effective if the target and distractor categories are more similar (e.g. kit fox vs arctic fox). Future work will be required to clarify the mechanisms and theory around the most effective cognitive steering signals.
Finally, we also explored whether extra modulatory passes would amplify any steering effects. However, we found that across models and all levels of  $\alpha$ -scaling and all cognitive steering variations, additional passes had negligible impact beyond the first modulatory pass. This feature of our LRM models further dissociates them from traditional recurrent neural networks, which have the assumed characteristic of running over multiple timesteps times. In contrast, our model has a single parameter  $(\alpha)$  that controls the gain on the modulation, operating on a single modulated pass.