Relating transformers to models and neural representations of the hippocampal formation β€” part 4/4

Cleaned-text code points [46966, 54700). Bibliography omitted here; source.md includes it.

Formally, given data of the form D = { ( 𝒙 ≀ T k , 𝒂 ≀ T k ) } D=\{({\bm{x}}^{k}_{\leq T},{\bm{a}}^{k}_{\leq T})\} with k ∈ { 1 , β‹― , N } k\in\{1,\cdots,N\} (which environment it is in), where 𝒙 ≀ T {\bm{x}}_{\leq T} and 𝒂 ≀ T {\bm{a}}_{\leq T} are a sequence of sensory observations and associated actions/relations (Figure 6 ), N N is the number of environments in the dataset, and T T is the duration of time-steps in each environment, our model should maximise its probability of observing the sensory observations for each environment.

The sensory stimuli are chosen randomly, with replacement, at each node. We understand that this is not like the real world, where adjacent locations have sensory correlations - most notable in space (though names in a family tree will be less correlated). Sensory correlations help with sensory predictions, thus if we use environments with sensory correlations, we would not know what was causing the learned representations, sensory correlations, or transition structure. To answer this question cleanly, and to know that transition structure is the sole cause, we do not use environments with sensory correlations.

### A.4 Additional details of TEM

We present a more detailed model schematic of TEM in Figure 7 . We see there are two components to TEM - a RNN for understanding position ( π’ˆ {\bm{g}} , in green top of Figure 7 ) that also indexes memories via β€˜queries’ 𝒒 = 𝑾 g ​ π’ˆ {\bm{q}}={\bm{W}}_{g}{\bm{g}} . A memory network that binds together 𝒙 {\bm{x}} and π’ˆ {\bm{g}} , via an outer product (middle green in 7 , with more detail in Figure 8 A). When the memory network is queried (red in Figure 7 ), it undergoes attractor dynamics to retrieve the full memory. To make a sensory prediction, the retrieved memory is β€˜deconjunctified’ into a sensory representation (Figure 8 C).

Model flow. TEM transitions through time and infers π’ˆ t {\bm{g}}_{t} and 𝒑 t {\bm{p}}_{t} at each time-step. π’ˆ t {\bm{g}}_{t} is inferred before forming each new memory 𝒑 t {\bm{p}}_{t} . In other words variables π’ˆ {\bm{g}} and 𝒑 {\bm{p}} are inferred in the following order π’ˆ t {\bm{g}}_{t} , 𝒑 t {\bm{p}}_{t} , π’ˆ t + 1 {\bm{g}}_{t+1} , 𝒑 t + 1 {\bm{p}}_{t+1} , π’ˆ t + 2 β‹― {\bm{g}}_{t+2}\cdots . This flow of information is shown in a schematic in Figure 7 .

Independently, at each time-step, the model model asks β€˜are the inferred variables what I would have predicted given my current understanding of the world (weights)’. I.e. 1) Is the inferred π’ˆ t {\bm{g}}_{t} the one I would have predicted from π’ˆ t βˆ’ 1 {\bm{g}}_{t-1} . 2) Is the inferred 𝒑 t {\bm{p}}_{t} the one I would have predicted from π’ˆ t {\bm{g}}_{t} . 3) Is 𝒙 t {\bm{x}}_{t} what I would have predicted from 𝒑 t {\bm{p}}_{t} . This leads to errors (at each timestep) between inferred and predicted variables π’ˆ t {\bm{g}}_{t} and 𝒑 t {\bm{p}}_{t} , and between sensory data 𝒙 t {\bm{x}}_{t} and its prediction.

At then end of a sequence, these errors are accumulated, with model parameters updated along the gradient (from back-propagation through time) that matches each others variables and also matches the data.

Since the model runs along uninterrupted, it’s activity at one time-step influence those at later time-steps. Thus when learning (using back-propagation through time - BPTT), gradient information flows backwards in time. This is important as, should a bad memory be formed at one-time step, it will have consequences for later predictions - thus BPTT allows us to learn how to form memories and latent representations such that they will be useful many steps into the future.

### A.5 Related work

Here we discuss and compare other models that recapitulate spatial representations found in the brain. These models fall into several categories. 1) Auto-encoder like models trained on spatial representations ( Dordek et al., 2016 ) . 2) Graph representation models ( Gustafson & Daw, 2011 ; Stachenfeld et al., 2017 ) . 3) Latent state inference models ( George et al., 2021 ) . 4) Path integrating models with RNNs trained on spatial representations ( Cueva & Wei, 2018 ; Banino et al., 2018 ) . 5) Models mixing RNNs and memory networks that are trained on sequences of sensory observations.

We note that models (1-4) are learned using curated spatial representation, i.e. the modeller has already worked how how space works, and the model is finding an alternate representation of that space. This is not how you or I learn. Instead, we learn by extracting regularities from the sensory world, and transfer/generalise this knowledge from domain to domain. Model category (5) does unsupervised learning by predicting sequences of sensory observations alone. From just sensory observations, it can slowly build up a picture of how space is structured, and then transfer this knowledge to situations that share the same underlying spatial structure. Our model TEM-t fall in the model (5) category, along with TEM ( Whittington et al., 2020 ) and other similar models Uria et al. (2020) .

For model to make sensory predictions as fast as possible, it is necessary to have two components. a) A RNN that understand position, and b) a memory network that can remember what you see and where you see them. Now the model can be asked what ’what will you see when heading East ’ and correctly respond Cat even it it has never gone East at that location before. This is because it can simulate going East via its RNN and then retrieve the memory it had stored at that location (it must have visited the Cat location before thought!). The other models, e.g. an autoencoder, could not solve this task since it learns slow statistical structures between sensory observations over many many training examples. Thus it would be clueless to the entirely new configuration of sensory observations in the new environment. In sum, it is necessary to have an understanding of position, and the ability to make and retrieve memories to successfully make sensory predictions as fast as possible .

We describe the relationship between TEM (and thus the hippocampal-entorhinal system) as close not because it produces the same representations, instead we are saying the relationship is close because we have shown a mathematical relationship between the two models . This could not happen for most ML models as most ML systems do not have both RNN structured representations and a memory system and so is not mathematically relatable to current models of the hippocampal formation. However, equipped with the mathematical relationship, we can say that the memory part of the transformer is related to the hippocampal memory system in TEM. And the positional encodings are related to the entorhinal grid RNN system in TEM.

### A.6 Further learned cell representations

## Instructions for reporting errors

We are continuing to improve HTML versions of papers, and your feedback helps enhance accessibility and mobile support. To report errors in the HTML that will help us improve conversion and rendering, choose any of the methods listed below:

Click the "Report Issue" ( ) button, located in the page header.

Tip: You can select the relevant text first, to include it in your report.

Our team has already identified the following issues . We appreciate your time reviewing and reporting rendering errors we may not have found yet. Your efforts will help us improve the HTML versions for all readers, because disability should not be a barrier to accessing research. Thank you for your continued support in championing open access for all.

Have a free development cycle? Help support accessibility at arXiv! Our collaborators at LaTeXML maintain a list of packages that need conversion , and welcome developer contributions .