Zoology: Measuring and Improving Recall in Efficient Language Models β€” part 14/14

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

We note that we have the input dimension d = c d=c . Now, for any input sequence 𝒖 ∈ { 0 , 1 } N Γ— d \bm{u}\in\{0,1\}^{N\times d} , we get the input-dependent kernels as in equation 19 using autocorrelation of the input. We will now outline the following computations for the BaseConv layers: π’š \displaystyle\bm{y} = π™»πš’πš—πšŽπšŠπš› 𝐐 ​ ( 𝒖 ) βŠ™ ( 𝐑 K βˆ— π™»πš’πš—πšŽπšŠπš› 𝐊 ​ ( 𝒖 ) ) \displaystyle={\tt Linear}_{{\bf Q}}(\bm{u})\odot\left({\bf h}^{K}*{\tt Linear}_{{\bf K}}(\bm{u})\right) = 𝐐 βŠ™ ( 𝐑 K βˆ— 𝐊 ) \displaystyle={\bf Q}\odot\left({\bf h}^{K}*{\bf K}\right) (21) 𝒛 \displaystyle\bm{z} = π™»πš’πš—πšŽπšŠπš› 𝐄 ​ ( π’š ) βŠ™ ( 𝐑 V βˆ— π™»πš’πš—πšŽπšŠπš› 𝐕 ​ ( 𝒖 ) ) \displaystyle={\tt Linear}_{{\bf E}}(\bm{y})\odot\left({\bf h}^{V}*{\tt Linear}_{{\bf V}}(\bm{u})\right) = 𝐄 βŠ™ ( 𝐑 V βˆ— 𝐕 ) , \displaystyle={\bf E}\odot\left({\bf h}^{V}*{\bf V}\right), (22) where we have the linear projections π™»πš’πš—πšŽπšŠπš› 𝐐 ​ ( 𝒖 ) = 𝐐 {\tt Linear}_{{\bf Q}}(\bm{u})={\bf Q} , π™»πš’πš—πšŽπšŠπš› 𝐊 ​ ( 𝒖 ) = 𝐊 {\tt Linear}_{{\bf K}}(\bm{u})={\bf K} , π™»πš’πš—πšŽπšŠπš› 𝐕 ​ ( 𝒖 ) = 𝐕 {\tt Linear}_{{\bf V}}(\bm{u})={\bf V} and π™»πš’πš—πšŽπšŠπš› 𝐄 ​ ( π’š ) = 𝐄 {\tt Linear}_{{\bf E}}(\bm{y})={\bf E} defined as 𝐄 [ i , : ] := π™»πš’πš—πšŽπšŠπš› 𝐄 ( π’š ) [ i , : ] = { 𝟏 d if ​ βˆƒ j ∈ [ d ] ​ such that ​ π’š ​ [ i , j ] = 1 𝟎 d otherwise . {\bf E}[i,:]:={\tt Linear}_{{\bf E}}(\bm{y})[i,:]=\begin{cases}{\bf 1}^{d}&\text{if }\exists\ j\in[d]\text{ such that }\bm{y}[i,j]=1\\ {\bf 0}^{d}&\text{otherwise}\end{cases}. (23) Here, we will first present the argument for the special case when we have t = 1 t=1 as that will help us elucidate the general case. To this end, as the kernels from equation 19 for t = 1 t=1 are given by 𝐑 k ​ ( X ) \displaystyle{\bf h}^{k}(X) ≑ X s 1 ; \displaystyle\equiv X^{s_{1}}; (24) 𝐑 v ​ ( X ) \displaystyle{\bf h}^{v}(X) ≑ X s 1 βˆ’ 1 , \displaystyle\equiv X^{s_{1}-1}, we observe that convolving with these kernels 𝐑 βˆ— π’š {\bf h}\ast\bm{y} is equivalent to operating with the following primitives ( Section H.3 ): πšœπš‘πš’πšπš ​ _ ​ πšπš˜πš πš— ​ ( π’š , s 1 ) ; \displaystyle\tt{\displaystyle shift\_down}(\bm{y},s_{1}); (25) πšœπš‘πš’πšπš ​ _ ​ πšπš˜πš πš— ​ ( π’š , s 1 βˆ’ 1 ) . \displaystyle\tt{\displaystyle shift\_down}(\bm{y},s_{1}-1). We note that we shift down instead of shifting up as the index of the top-left entry is ( 0 , 0 ) (0,0) . We can then write down the computations performed in equation 21 and equation 22 as follows: π’š \displaystyle\bm{y} = 𝐐 βŠ™ πšœπš‘πš’πšπš ​ _ ​ πšπš˜πš πš— ​ ( 𝐊 , s 1 ) \displaystyle={\bf Q}\odot{\tt shift\_down}({\bf K},s_{1}) (26) 𝒛 \displaystyle\bm{z} = 𝐄 βŠ™ πšœπš‘πš’πšπš ​ _ ​ πšπš˜πš πš— ​ ( 𝐕 , s 1 βˆ’ 1 ) , \displaystyle={\bf E}\odot{\tt shift\_down}({\bf V},s_{1}-1), (27) We begin by examining π’š \bm{y} below: π’š [ i , : ] \displaystyle\bm{y}[i,:] = ( 𝐐 βŠ™ πšœπš‘πš’πšπš _ πšπš˜πš πš— ( 𝐊 , s 1 ) ) [ i , : ] \displaystyle=\left({\bf Q}\odot{\tt shift\_down}({\bf K},s_{1})\right)[i,:] = 𝐐 [ i , : ] βŠ™ πšœπš‘πš’πšπš _ πšπš˜πš πš— ( 𝐊 , s 1 ) [ i , : ] \displaystyle={\bf Q}[i,:]\odot{\tt shift\_down}({\bf K},s_{1})[i,:] (28) = ( { 𝒖 [ i , : ] if ​ i ∈ 𝒬 𝟎 d otherwise ) βŠ™ ( { 𝒖 [ i βˆ’ s 1 , : ] if ​ i βˆ’ s 1 ∈ 𝒦 , 𝟎 d otherwise ) \displaystyle=\left(\begin{cases}\bm{u}[i,:]&\text{if }i\in\mathcal{Q}\\ {\bf 0}^{d}&\text{otherwise}\end{cases}\right)\odot\left(\begin{cases}\bm{u}[i-s_{1},:]&\text{if }i-s_{1}\in\mathcal{K},\\ {\bf 0}^{d}&\text{otherwise}\end{cases}\right) (29) = { 𝒖 [ i , : ] βŠ™ 𝒖 [ i βˆ’ s 1 , : ] if ​ i ∈ 𝒬 ​ and ​ i βˆ’ s 1 ∈ 𝒦 , 𝟎 d otherwise \displaystyle=\begin{cases}\bm{u}[i,:]\odot\bm{u}[i-s_{1},:]&\text{if }i\in\mathcal{Q}\text{ and }i-s_{1}\in\mathcal{K},\\ {\bf 0}^{d}&\text{otherwise}\end{cases} Here, we use the fact that the Hadamard product is row-independent in equation 28 , and the definitions of the projections from equation 20 in equation 29 . Examining the j j th entry, we get 𝒖 ⁑ [ i , j ] βŠ™ 𝒖 ⁑ [ i βˆ’ s 1 , j ] \displaystyle\bm{u}[i,j]\odot\bm{u}[i-s_{1},j] = { 1 if ​ i ∈ 𝒬 , i βˆ’ s 1 ∈ 𝒦 ​ and ​ 𝒒 i ≑ π’Œ i βˆ’ s 1 ≑ 𝐞 j 0 otherwise. \displaystyle=\begin{cases}1&\text{if }i\in\mathcal{Q},i-s_{1}\in\mathcal{K}\text{ and }\bm{q}_{i}\equiv\bm{k}_{i-s_{1}}\equiv{\bf e}_{j}\\ 0&\text{otherwise.}\end{cases} That is, we can express π’š [ i , : ] \displaystyle\bm{y}[i,:] = { 𝐞 j if ​ i ∈ 𝒬 , i βˆ’ s 1 ∈ 𝒦 ​ and ​ 𝒒 i ≑ π’Œ i βˆ’ s 1 ≑ 𝐞 j 𝟎 d otherwise . \displaystyle=\begin{cases}{\bf e}_{j}&\text{if }i\in\mathcal{Q},i-s_{1}\in\mathcal{K}\text{ and }\bm{q}_{i}\equiv\bm{k}_{i-s_{1}}\equiv{\bf e}_{j}\\ {\bf 0}^{d}&\text{otherwise}\end{cases}. (30) Consequently, as per the definition in equation 23 , we get 𝐄 [ i , : ] = { 𝟏 d if ​ i ∈ 𝒬 , i βˆ’ s 1 ∈ 𝒦 ​ and ​ 𝒒 i ≑ π’Œ i βˆ’ s 1 𝟎 d otherwise \displaystyle{\bf E}[i,:]=\begin{cases}{\bf 1}^{d}&\text{if }i\in\mathcal{Q},i-s_{1}\in\mathcal{K}\text{ and }\bm{q}_{i}\equiv\bm{k}_{i-s_{1}}\\ {\bf 0}^{d}&\text{otherwise}\end{cases} (31) We can now finally specify the output 𝒛 \bm{z} from equation 27 as follows: 𝒛 [ i , : ] \displaystyle\bm{z}[i,:] = ( 𝐄 βŠ™ πšœπš‘πš’πšπš _ πšπš˜πš πš— ( 𝐕 , s 1 βˆ’ 1 ) ) [ i , : ] \displaystyle=\left({\bf E}\odot{\tt shift\_down}({\bf V},s_{1}-1)\right)[i,:] = 𝐄 [ i , : ] βŠ™ πšœπš‘πš’πšπš _ πšπš˜πš πš— ( 𝐕 , s 1 βˆ’ 1 ) [ i , : ] \displaystyle={\bf E}[i,:]\odot{\tt shift\_down}({\bf V},s_{1}-1)[i,:] (32) = ( { 𝟏 d if ​ i ∈ 𝒬 , i βˆ’ s 1 ∈ 𝒦 ​ and ​ 𝒒 i ≑ π’Œ i βˆ’ s 1 𝟎 d otherwise ) βŠ™ ( { 𝒖 [ i βˆ’ s 1 + 1 , : ] if ​ i βˆ’ s 1 + 1 ∈ 𝒱 , 𝟎 d otherwise ) \displaystyle=\left(\begin{cases}{\bf 1}^{d}&\text{if }i\in\mathcal{Q},i-s_{1}\in\mathcal{K}\text{ and }\bm{q}_{i}\equiv\bm{k}_{i-s_{1}}\\ {\bf 0}^{d}&\text{otherwise}\end{cases}\right)\odot\left(\begin{cases}\bm{u}[i-s_{1}+1,:]&\text{if }i-s_{1}+1\in\mathcal{V},\\ {\bf 0}^{d}&\text{otherwise}\end{cases}\right) (33) = { 𝒖 [ i βˆ’ s 1 + 1 , : ] if ​ i ∈ 𝒬 , i βˆ’ s 1 ∈ 𝒦 , i βˆ’ s 1 + 1 ∈ 𝒱 ​ and ​ 𝒒 i ≑ π’Œ i βˆ’ s 1 𝟎 d otherwise \displaystyle=\begin{cases}\bm{u}[i-s_{1}+1,:]&\text{if }i\in\mathcal{Q},i-s_{1}\in\mathcal{K},i-s_{1}+1\in\mathcal{V}\text{ and }\bm{q}_{i}\equiv\bm{k}_{i-s_{1}}\\ {\bf 0}^{d}&\text{otherwise}\end{cases} = { 𝒗 i βˆ’ s 1 if ​ 𝒒 i ≑ π’Œ i βˆ’ s 1 𝟎 d otherwise \displaystyle=\begin{cases}\bm{v}_{i-s_{1}}&\text{if }\bm{q}_{i}\equiv\bm{k}_{i-s_{1}}\\ {\bf 0}^{d}&\text{otherwise}\end{cases} (34) Again, we use the fact that the Hadamard product is row-independent in equation 32 , and the definitions of the projections from equation 20 in equation 33 . Overall, we have solved associative recall for all queries that have interaction distance exactly equal to s 1 s_{1} .

In order to generalize this to arbitrary t ≀ N 3 t\leq\frac{N}{3} , we first increase the internal dimension so that the input to the kernels 𝒖 β€² ∈ ℝ ( N β‹… t ) Γ— d \bm{u}^{\prime}\in\mathbbm{R}^{(N\cdot t)\times d} in equation 19 and the projections 𝐊 β€² , 𝐐 β€² , 𝐕 β€² ∈ ℝ ( N β‹… t ) Γ— d {\bf K^{\prime},Q^{\prime},V^{\prime}}\in\mathbbm{R}^{(N\cdot t)\times d} are given by 𝒖 β€² ≑ ( 𝟎 d 𝟎 d 𝒖 ) , 𝑲 β€² ≑ ( 𝟎 d 𝟎 d 𝐊 ) , 𝐐 β€² ≑ ( 𝐐 𝐐 𝐐 ) , 𝐕 β€² ≑ ( 𝟎 d 𝟎 d 𝐕 ) , \bm{u}^{\prime}\equiv\begin{pmatrix}{\bf 0}^{d}\\ \hline\cr\\ \vdots\\ \hline\cr\\ {\bf 0}^{d}\\ \hline\cr\\ \bm{u}\end{pmatrix},\bm{K}^{\prime}\equiv\begin{pmatrix}{\bf 0}^{d}\\ \hline\cr\\ \vdots\\ \hline\cr\\ {\bf 0}^{d}\\ \hline\cr\\ {\bf K}\end{pmatrix},{\bf Q}^{\prime}\equiv\begin{pmatrix}{\bf Q}\\ \hline\cr\\ \vdots\\ \hline\cr\\ {\bf Q}\\ \hline\cr\\ {\bf Q}\end{pmatrix},{\bf V}^{\prime}\equiv\begin{pmatrix}{\bf 0}^{d}\\ \hline\cr\\ \vdots\\ \hline\cr\\ {\bf 0}^{d}\\ \hline\cr\\ {\bf V}\end{pmatrix}, We then observe that for 𝐑 β„“ k ​ ( X ) := X s β„“ {\bf h}^{k}_{\ell}(X):=X^{s_{\ell}} and 𝐑 β„“ v ​ ( X ) := X s β„“ βˆ’ 1 {\bf h}^{v}_{\ell}(X):=X^{s_{\ell}-1} , we have 𝐑 k ​ ( X ) \displaystyle{\bf h}^{k}(X) ≑ βˆ‘ β„“ ∈ [ t ] 𝐑 β„“ k ​ ( X ) β‹… X ( β„“ βˆ’ 1 ) β‹… N 3 , \displaystyle\equiv\sum_{\ell\in[t]}{\bf h}^{k}_{\ell}(X)\cdot X^{(\ell-1)\cdot\frac{N}{3}}, 𝐑 v ​ ( X ) \displaystyle{\bf h}^{v}(X) ≑ βˆ‘ β„“ ∈ [ t ] 𝐑 β„“ k ​ ( X ) β‹… X ( β„“ βˆ’ 1 ) β‹… N 3 . \displaystyle\equiv\sum_{\ell\in[t]}{\bf h}^{k}_{\ell}(X)\cdot X^{(\ell-1)\cdot\frac{N}{3}}. In analogy with equation 25 , we can then equivalently write ( 𝐑 K βˆ— 𝐊 ) \displaystyle\left({\bf h}^{K}\ast{\bf K}\right) ≑ ( 𝐑 t K 𝐑 2 K 𝐑 1 K ) βˆ— ( 𝟎 d 𝟎 d 𝐊 ) \displaystyle\equiv\begin{pmatrix}{\bf h}^{K}_{t}\\ \hline\cr\\ \vdots\\ \hline\cr\\ {\bf h}^{K}_{2}\\ \hline\cr\\ {\bf h}^{K}_{1}\end{pmatrix}\ast\begin{pmatrix}{\bf 0}^{d}\\ \hline\cr\\ \vdots\\ \hline\cr\\ {\bf 0}^{d}\\ \hline\cr\\ {\bf K}\end{pmatrix} ≑ ( 𝐑 t K βˆ— 𝐊 𝐑 2 K βˆ— 𝐊 𝐑 1 K βˆ— 𝐊 ) \displaystyle\equiv\begin{pmatrix}{\bf h}^{K}_{t}\ast{\bf K}\\ \hline\cr\\ \vdots\\ \hline\cr\\ {\bf h}^{K}_{2}\ast{\bf K}\\ \hline\cr\\ {\bf h}^{K}_{1}\ast{\bf K}\end{pmatrix} ≑ ( πšœπš‘πš’πšπš ​ _ ​ πšπš˜πš πš— ​ ( 𝐊 , s t ) πšœπš‘πš’πšπš ​ _ ​ πšπš˜πš πš— ​ ( 𝐊 , s 2 ) πšœπš‘πš’πšπš ​ _ ​ πšπš˜πš πš— ​ ( 𝐊 , s 1 ) ) . \displaystyle\equiv\begin{pmatrix}{\tt shift\_down}({\bf K},s_{t})\\ \hline\cr\\ \vdots\\ \hline\cr\\ {\tt shift\_down}({\bf K},s_{2})\\ \hline\cr\\ {\tt shift\_down}({\bf K},s_{1})\end{pmatrix}. Similarly, we also have ( 𝐑 V βˆ— 𝐕 β€² ) \displaystyle\left({\bf h}^{V}\ast{\bf V}^{\prime}\right) ≑ ( πšœπš‘πš’πšπš ​ _ ​ πšπš˜πš πš— ​ ( 𝐕 , s t βˆ’ 1 ) πšœπš‘πš’πšπš ​ _ ​ πšπš˜πš πš— ​ ( 𝐕 , s 2 βˆ’ 1 ) πšœπš‘πš’πšπš ​ _ ​ πšπš˜πš πš— ​ ( 𝐕 , s 1 βˆ’ 1 ) ) . \displaystyle\equiv\begin{pmatrix}{\tt shift\_down}({\bf V},s_{t}-1)\\ \hline\cr\\ \vdots\\ \hline\cr\\ {\tt shift\_down}({\bf V},s_{2}-1)\\ \hline\cr\\ {\tt shift\_down}({\bf V},s_{1}-1)\end{pmatrix}. That is, the argument for t = 1 t=1 now applies to each of the t t shifts as we now have ( cf. equation 21 ) π’š β€² \displaystyle\bm{y}^{\prime} ≑ 𝐐 β€² βŠ™ ( 𝐑 V βˆ— 𝐕 ) \displaystyle\equiv{\bf Q}^{\prime}\odot\left({\bf h}^{V}\ast{\bf V}\right) ≑ ( 𝐐 𝐐 𝐐 ) βŠ™ ( πšœπš‘πš’πšπš ​ _ ​ πšπš˜πš πš— ​ ( 𝐕 , s t βˆ’ 1 ) πšœπš‘πš’πšπš ​ _ ​ πšπš˜πš πš— ​ ( 𝐕 , s 2 βˆ’ 1 ) πšœπš‘πš’πšπš ​ _ ​ πšπš˜πš πš— ​ ( 𝐕 , s 1 βˆ’ 1 ) ) \displaystyle\equiv\begin{pmatrix}{\bf Q}\\ \hline\cr\\ \vdots\\ \hline\cr\\ {\bf Q}\\ \hline\cr\\ {\bf Q}\end{pmatrix}\odot\begin{pmatrix}{\tt shift\_down}({\bf V},s_{t}-1)\\ \hline\cr\\ \vdots\\ \hline\cr\\ {\tt shift\_down}({\bf V},s_{2}-1)\\ \hline\cr\\ {\tt shift\_down}({\bf V},s_{1}-1)\end{pmatrix} ≑ ( 𝐐 βŠ™ πšœπš‘πš’πšπš ​ _ ​ πšπš˜πš πš— ​ ( 𝐕 , s t βˆ’ 1 ) 𝐐 βŠ™ πšœπš‘πš’πšπš ​ _ ​ πšπš˜πš πš— ​ ( 𝐕 , s 2 βˆ’ 1 ) 𝐐 βŠ™ πšœπš‘πš’πšπš ​ _ ​ πšπš˜πš πš— ​ ( 𝐕 , s 1 βˆ’ 1 ) ) \displaystyle\equiv\begin{pmatrix}{\bf Q}\odot{\tt shift\_down}({\bf V},s_{t}-1)\\ \hline\cr\\ \vdots\\ \hline\cr\\ {\bf Q}\odot{\tt shift\_down}({\bf V},s_{2}-1)\\ \hline\cr\\ {\bf Q}\odot{\tt shift\_down}({\bf V},s_{1}-1)\end{pmatrix} ≑ ( π’š t π’š 2 π’š 1 ) , \displaystyle\equiv\begin{pmatrix}\bm{y}_{t}\\ \hline\cr\\ \vdots\\ \hline\cr\\ \bm{y}_{2}\\ \hline\cr\\ \bm{y}_{1}\\ \end{pmatrix}, where, for each β„“ ∈ [ t ] \ell\in[t] , we have ( cf. equation 30 ) π’š β„“ [ i , : ] ≑ { 𝐞 j if i ∈ 𝒬 , i βˆ’ s β„“ ∈ 𝒦 and 𝒒 i ≑ π’Œ i βˆ’ s β„“ ≑ 𝐞 j , 𝟎 d otherwise . \bm{y}_{\ell}[i,:]\equiv\begin{cases}{\bf e}_{j}&\text{if }i\in\mathcal{Q},i-s_{\ell}\in\mathcal{K}\text{ and }\bm{q}_{i}\equiv\bm{k}_{i-s_{\ell}}\equiv{\bf e}_{j},\\ {\bf 0}^{d}&\text{otherwise}\end{cases}. We then analogously get 𝐄 β€² {\bf E}^{\prime} as follows: 𝐄 β€² ≑ π™»πš’πš—πšŽπšŠπš› 𝐄 ​ ( π’š β€² ) ≑ ( π™»πš’πš—πšŽπšŠπš› 𝐄 ​ ( π’š t ) π™»πš’πš—πšŽπšŠπš› 𝐄 ​ ( π’š 2 ) π™»πš’πš—πšŽπšŠπš› 𝐄 ​ ( π’š 1 ) ) ≑ ( 𝐄 t 𝐄 2 𝐄 1 ) , {\bf E}^{\prime}\equiv{\tt Linear}_{{\bf E}}(\bm{y}^{\prime})\equiv\begin{pmatrix}{\tt Linear}_{{\bf E}}(\bm{y}_{t})\\ \hline\cr\\ \vdots\\ \hline\cr\\ {\tt Linear}_{{\bf E}}(\bm{y}_{2})\\ \hline\cr\\ {\tt Linear}_{{\bf E}}(\bm{y}_{1})\end{pmatrix}\equiv\begin{pmatrix}{\bf E}_{t}\\ \hline\cr\\ \vdots\\ \hline\cr\\ {\bf E}_{2}\\ \hline\cr\\ {\bf E}_{1}\end{pmatrix}, where, for each β„“ ∈ [ t ] \ell\in[t] , we have ( cf. equation 31 ) 𝐄 β„“ [ i , : ] = { 𝟏 d if ​ i ∈ 𝒬 , i βˆ’ s β„“ ∈ 𝒦 ​ and ​ 𝒒 i ≑ π’Œ i βˆ’ s β„“ 𝟎 d otherwise {\bf E}_{\ell}[i,:]=\begin{cases}{\bf 1}^{d}&\text{if }i\in\mathcal{Q},i-s_{\ell}\in\mathcal{K}\text{ and }\bm{q}_{i}\equiv\bm{k}_{i-s_{\ell}}\\ {\bf 0}^{d}&\text{otherwise}\end{cases} The output in the general case is then given by 𝒛 β€² \displaystyle\bm{z}^{\prime} ≑ 𝐄 β€² βŠ™ ( 𝐑 V βˆ— 𝐕 β€² ) \displaystyle\equiv{\bf E}^{\prime}\odot\left({\bf h}^{V}*{\bf V}^{\prime}\right) ≑ ( 𝐄 t 𝐄 2 𝐄 1 ) βŠ™ ( πšœπš‘πš’πšπš ​ _ ​ πšπš˜πš πš— ​ ( 𝐕 , s t βˆ’ 1 ) πšœπš‘πš’πšπš ​ _ ​ πšπš˜πš πš— ​ ( 𝐕 , s 2 βˆ’ 1 ) πšœπš‘πš’πšπš ​ _ ​ πšπš˜πš πš— ​ ( 𝐕 , s 1 βˆ’ 1 ) ) \displaystyle\equiv\begin{pmatrix}{\bf E}_{t}\\ \hline\cr\\ \vdots\\ \hline\cr\\ {\bf E}_{2}\\ \hline\cr\\ {\bf E}_{1}\end{pmatrix}\odot\begin{pmatrix}{\tt shift\_down}({\bf V},s_{t}-1)\\ \hline\cr\\ \vdots\\ \hline\cr\\ {\tt shift\_down}({\bf V},s_{2}-1)\\ \hline\cr\\ {\tt shift\_down}({\bf V},s_{1}-1)\end{pmatrix} ≑ ( 𝐄 t βŠ™ πšœπš‘πš’πšπš ​ _ ​ πšπš˜πš πš— ​ ( 𝐕 , s t βˆ’ 1 ) 𝐄 2 βŠ™ πšœπš‘πš’πšπš ​ _ ​ πšπš˜πš πš— ​ ( 𝐕 , s 2 βˆ’ 1 ) 𝐄 1 βŠ™ πšœπš‘πš’πšπš ​ _ ​ πšπš˜πš πš— ​ ( 𝐕 , s 1 βˆ’ 1 ) ) \displaystyle\equiv\begin{pmatrix}{\bf E}_{t}\odot{\tt shift\_down}({\bf V},s_{t}-1)\\ \hline\cr\\ \vdots\\ \hline\cr\\ {\bf E}_{2}\odot{\tt shift\_down}({\bf V},s_{2}-1)\\ \hline\cr\\ {\bf E}_{1}\odot{\tt shift\_down}({\bf V},s_{1}-1)\end{pmatrix} ≑ ( 𝒛 t 𝒛 2 𝒛 1 ) , \displaystyle\equiv\begin{pmatrix}\bm{z}_{t}\\ \hline\cr\\ \vdots\\ \hline\cr\\ \bm{z}_{2}\\ \hline\cr\\ \bm{z}_{1}\\ \end{pmatrix}, where, for each β„“ ∈ [ t ] \ell\in[t] , we have ( cf. equation 34 ) 𝒛 β„“ [ i , : ] ≑ { 𝒗 i βˆ’ s β„“ if ​ 𝒒 i ≑ π’Œ i βˆ’ s β„“ 𝟎 d otherwise \bm{z}_{\ell}[i,:]\equiv\begin{cases}\bm{v}_{i-s_{\ell}}&\text{if }\bm{q}_{i}\equiv\bm{k}_{i-s_{\ell}}\\ {\bf 0}^{d}&\text{otherwise}\end{cases} Finally, we define the last output layer to compute 𝒛 o ​ u ​ t ≑ π™»πš’πš—πšŽπšŠπš› sum ​ ( 𝒛 β€² ) ≑ βˆ‘ β„“ ∈ [ t ] 𝒛 β„“ \bm{z}_{out}\equiv{\tt Linear}_{\mathrm{sum}}(\bm{z}^{\prime})\equiv\sum_{\ell\in[t]}\bm{z}_{\ell} so that we have 𝒛 o ​ u ​ t [ i , : ] ≑ { 𝒗 i βˆ’ s β„“ if ​ 𝒒 i ≑ π’Œ i βˆ’ s β„“ ​ for some ​ β„“ ∈ [ t ] 𝟎 d otherwise \bm{z}_{out}[i,:]\equiv\begin{cases}\bm{v}_{i-s_{\ell}}&\text{if }\bm{q}_{i}\equiv\bm{k}_{i-s_{\ell}}\text{ for some }\ell\in[t]\\ {\bf 0}^{d}&\text{otherwise}\end{cases} To recall, we retrieved the top t t interaction distances of the input 𝒖 \bm{u} using auto-correlation and defined the corresponding convolution kernels (equation 19 ). We then shifted djown the keys 𝐊 {\bf K} using the first kernel and gated with the corresponding queries 𝐐 {\bf Q} so that we got a match exactly when there exists a key that is at s β„“ s_{\ell} interaction distance from the corresponding query. After β€œsmearing” this match to get 𝐄 {\bf E} , we used it as a mask to retrieve the value in the next layer. Overall, since we have t t atomic kernels that perform t t shifts with each of these kernels using π’ͺ ⁑ ( N ​ d ) \mathcal{O}(Nd) parameters, we can conclude that the output solves the associative recall problem for all queries with exactly β„“ \ell interaction distance from the corresponding keys for all β„“ ∈ [ t ] \ell\in[t] using π’ͺ ⁑ ( 1 ) \mathcal{O}(1) layers and π’ͺ ⁑ ( t β‹… N ​ c ) \mathcal{O}(t\cdot Nc) parameters as we have d = c d=c . ∎

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