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

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

2. We again define ๐– := ๐ŸŽ N ร— d , ๐’ƒ 1 := ๐Ÿ N ร— d , ๐’ƒ 2 := ๐ŸŽ N ร— d {\bf W}:=\mathbf{0}^{N\times d},\bm{b}_{1}:=\mathbf{1}^{N\times d},\bm{b}_{2}:=\mathbf{0}^{N\times d} . Then, for input ๐’š โˆˆ โ„ N ร— d \bm{y}\in\mathbbm{R}^{N\times d} , BaseConv โ€‹ ( ๐’š , ๐ŸŽ N ร— d , ๐’† 0 , ๐Ÿ N ร— d , ๐ŸŽ N ร— d ) \textsc{BaseConv}\left({\bm{y},\mathbf{0}^{N\times d},\bm{e}_{0},\mathbf{1}^{N\times d},\mathbf{0}^{N\times d}}\right) for BaseConv in Algorithm 7 is given in equation 4 as ๐˜ 0 โ‰ก ๐’š โŠ› ๐’† 0 . \displaystyle{\bf Y}_{0}\equiv\bm{y}\circledast\bm{e}_{0}. Now, to perform shift_up ( ๐’š , s ) (\bm{y},s) , as before, we first apply the circular convolution to reverse the input ๐˜ 0 [ : , j ] = ๐’š [ : , j ] โŠ› ๐’† 0 \displaystyle{\bf Y}_{0}[:,j]=\bm{y}[:,j]\circledast\bm{e}_{0} = coeff โก ( โˆ‘ i = 0 N โˆ’ 1 ๐’š โก [ N โˆ’ 1 โˆ’ i , j ] โ‹… X i ) , \displaystyle=\mathrm{coeff}\left(\sum_{i=0}^{N-1}\bm{y}[N-1-i,j]\cdot X^{i}\right), We then apply ๐’€ 1 โ‰ก shift_down โ€‹ ( ๐’€ 0 , s ) \bm{Y}_{1}\equiv\texttt{shift\_down}(\bm{Y}_{0},s) to get ๐’€ 1 [ : , j ] \displaystyle\bm{Y}_{1}[:,j] โ‰ก coeff โก ( โˆ‘ i = s N โˆ’ 1 ๐’€ 0 โ€‹ [ N โˆ’ 1 โˆ’ ( i โˆ’ s ) , j ] โ‹… X i ) , \displaystyle\equiv\mathrm{coeff}\left(\sum_{i=s}^{N-1}\bm{Y}_{0}[N-1-(i-s),j]\cdot X^{i}\right), โ‰ก coeff โก ( โˆ‘ i = s N โˆ’ 1 ๐’€ 0 โ€‹ [ N โˆ’ 1 โˆ’ i + s , j ] โ‹… X i ) . \displaystyle\equiv\mathrm{coeff}\left(\sum_{i=s}^{N-1}\bm{Y}_{0}[N-1-i+s,j]\cdot X^{i}\right). Finally, we apply another circular convolution with the identity filter to replace N โˆ’ 1 โˆ’ i N-1-i with i i to get ๐˜ 2 [ : , j ] = ๐’€ 1 [ : , j ] โŠ› ๐’† 0 \displaystyle{\bf Y}_{2}[:,j]=\bm{Y}_{1}[:,j]\circledast\bm{e}_{0} = coeff โก ( โˆ‘ i = 0 N โˆ’ 1 ๐’š โก [ i + s , j ] โ‹… X i ) , \displaystyle=\mathrm{coeff}\left(\sum_{i=0}^{N-1}\bm{y}[i+s,j]\cdot X^{i}\right), Here, we note that we can compute both of these primitives in one and three layers, respectively (see Lemma H.11 ).

โˆŽ

Now, we present a BaseConv model with two layers that implements the add n ( ๐’š : ๐’™ , ๐‘บ ) \texttt{add}_{n}({\bm{y}:\bm{x}},{\bm{S}}) , the purpose of which is to add some window of computation ๐’™ \bm{x} to a running sum ๐‘บ \bm{S} .

###### Proposition H.9 (The Running Sum Primitive) .

For any ๐ฑ , ๐’ โˆˆ โ„ n ร— d \bm{x,S}\in\mathbbm{R}^{n\times d} contained in some ๐ฒ โˆˆ โ„ N ร— d \bm{y}\in\mathbbm{R}^{N\times d} , there exists a ( N , 2 , d , N , d ) โˆ’ BaseConv \left(N,2,d,N,d\right)-\text{{BaseConv}} that computes add n ( ๐ฒ : ๐ฑ , ๐’ ) \texttt{add}_{n}({\bm{y}:\bm{x}},{\bm{S}}) for BaseConv as in Algorithm 7 .

###### Proof.

We will show this for d โ€ฒ = 1 d^{\prime}=1 and the general case follows as we will explain at the end. We now specify the two layers that we use ๐’› 1 \displaystyle\bm{z}^{1} โ‰ก BaseConv โ€‹ ( ๐’š , ๐ŸŽ N ร— 1 , ๐’‰ 1 , ๐’ƒ 1 1 , ๐ŸŽ N ร— 1 ) โ‰ก ๐’ƒ 1 1 โŠ™ ( ๐’‰ 1 โˆ— ๐’š ) \displaystyle\equiv\textsc{BaseConv}\left({\bm{y},\mathbf{0}^{N\times 1},\bm{h}^{1},\bm{b}^{1}_{1},\mathbf{0}^{N\times 1}}\right)\equiv\bm{b}^{1}_{1}\odot\left(\bm{h}^{1}\ast\bm{y}\right) ๐’› \displaystyle\bm{z} โ‰ก BaseConv โ€‹ ( ๐’› 1 , ๐ŸŽ N ร— 1 , ๐’‰ 2 , ๐’ƒ 1 2 , ๐’ƒ 1 2 ) โ‰ก ๐’ƒ 1 2 โŠ™ ( ๐’‰ 2 โˆ— ๐’š + ๐’ƒ 2 2 ) , \displaystyle\equiv\textsc{BaseConv}\left({\bm{z}^{1},\mathbf{0}^{N\times 1},\bm{h}^{2},\bm{b}^{2}_{1},\bm{b}^{2}_{1}}\right)\equiv\bm{b}^{2}_{1}\odot\left(\bm{h}^{2}\ast\bm{y}+\bm{b}^{2}_{2}\right), where we will specify the kernels as we go along. Let us start by defining the kernel and the bias for the first layer as ๐’‰ 1 โ‰ก ( ๐’† 0 ๐’† 0 ๐ŸŽ n โ‹ฏ ๐ŸŽ n ) , ๐’ƒ 1 โ‰ก ( ๐ŸŽ n ๐Ÿ n ๐ŸŽ n โ‹ฏ ๐ŸŽ n ) . \bm{h}^{1}\equiv\begin{pmatrix}\bm{e}_{0}\\ \hline\cr\\ \bm{e}_{0}\\ \hline\cr\\ \bm{0}^{n}\\ \hline\cr\\ \cdots\\ \hline\cr\\ \bm{0}^{n}\end{pmatrix},\quad\quad\bm{b}_{1}\equiv\begin{pmatrix}\bm{0}^{n}\\ \hline\cr\\ \bm{1}^{n}\\ \hline\cr\\ \bm{0}^{n}\\ \hline\cr\\ \cdots\\ \hline\cr\\ \bm{0}^{n}\end{pmatrix}. Let us first compute ๐’‰ 1 โˆ— ๐’š \bm{h}^{1}\ast\bm{y} as follows: ๐’‰ 1 โ€‹ ( X ) โ‹… ๐’š โ€‹ ( X ) \displaystyle\bm{h}^{1}(X)\cdot\bm{y}(X) = ( X n + 1 ) โ‹… ( ๐‘บ โก ( X ) โ‹… X n + ๐’™ โก ( X ) ) \displaystyle=(X^{n}+1)\cdot(\bm{S}(X)\cdot X^{n}+\bm{x}(X)) = ๐‘บ โก ( X ) โ‹… X 2 โ€‹ n + ( ๐‘บ + ๐’™ ) โ€‹ ( X ) โ‹… X n + ๐’™ โก ( X ) . \displaystyle=\bm{S}(X)\cdot X^{2n}+(\bm{S}+\bm{x})(X)\cdot X^{n}+\bm{x}(X). We then have ๐’› 1 โ‰ก ๐’ƒ 1 1 โŠ™ ( ๐’‰ 1 โˆ— ๐’š ) โ‰ก ( ๐ŸŽ n ๐Ÿ n ๐ŸŽ n โ‹ฏ ๐ŸŽ n ) โŠ™ ( ๐’™ ๐‘บ + ๐’™ ๐‘บ โ‹ฏ ๐ŸŽ n ) โ‰ก ( ๐ŸŽ n ๐‘บ + ๐’™ ๐ŸŽ n โ‹ฏ ๐ŸŽ n ) \bm{z}_{1}\equiv\bm{b}_{1}^{1}\odot\left(\bm{h}^{1}\ast\bm{y}\right)\equiv\begin{pmatrix}\bm{0}^{n}\\ \hline\cr\\ \bm{1}^{n}\\ \hline\cr\\ \bm{0}^{n}\\ \hline\cr\\ \cdots\\ \hline\cr\\ \bm{0}^{n}\end{pmatrix}\odot\begin{pmatrix}\bm{x}\\ \hline\cr\\ \bm{S}+\bm{x}\\ \hline\cr\\ \bm{S}\\ \hline\cr\\ \cdots\\ \hline\cr\\ \bm{0}^{n}\end{pmatrix}\equiv\begin{pmatrix}\bm{0}^{n}\\ \hline\cr\\ \bm{S}+\bm{x}\\ \hline\cr\\ \bm{0}^{n}\\ \hline\cr\\ \cdots\\ \hline\cr\\ \bm{0}^{n}\end{pmatrix}

##### Resetting for Next Phase.

We now use the next layer to reset for the next phase. Here, we need the first vector to be ๐Ÿ n \bm{1}^{n} in order to start adding the next vector. We thus use the kernel and the biases ๐’‰ 2 , ๐’ƒ 1 2 , ๐’ƒ 2 2 \bm{h}^{2},\bm{b}^{2}_{1},\bm{b}^{2}_{2} defined as ๐’‰ 2 โ‰ก ( ๐’† 0 ๐ŸŽ n ๐ŸŽ n โ‹ฏ ๐ŸŽ n ) , ๐’ƒ 1 2 โ‰ก ( ๐Ÿ n ๐Ÿ n ๐ŸŽ n โ‹ฏ ๐ŸŽ n ) , ๐’ƒ 2 2 โ‰ก ( ๐Ÿ n ๐ŸŽ n ๐ŸŽ n โ‹ฏ ๐ŸŽ n ) . \bm{h}^{2}\equiv\begin{pmatrix}\bm{e}_{0}\\ \hline\cr\\ \bm{0}^{n}\\ \hline\cr\\ \bm{0}^{n}\\ \hline\cr\\ \cdots\\ \hline\cr\\ \bm{0}^{n}\end{pmatrix},\quad\quad\bm{b}^{2}_{1}\equiv\begin{pmatrix}\bm{1}^{n}\\ \hline\cr\\ \bm{1}^{n}\\ \hline\cr\\ \bm{0}^{n}\\ \hline\cr\\ \cdots\\ \hline\cr\\ \bm{0}^{n}\end{pmatrix},\quad\quad\bm{b}^{2}_{2}\equiv\begin{pmatrix}\bm{1}^{n}\\ \hline\cr\\ \bm{0}^{n}\\ \hline\cr\\ \bm{0}^{n}\\ \hline\cr\\ \cdots\\ \hline\cr\\ \bm{0}^{n}\end{pmatrix}. Explicitly, for the second layer, we compute the result of the convolution in terms of polynomials as follows: ๐’‰ 2 โ€‹ ( X ) โ‹… ๐’› 1 โ€‹ ( X ) = 1 โ‹… ( ๐‘บ + ๐’™ ) โ€‹ ( X ) โ‹… X n = ( ๐‘บ + ๐’™ ) โ€‹ ( X ) โ‹… X n . \displaystyle\bm{h}^{2}(X)\cdot\bm{z}^{1}(X)=1\cdot(\bm{S}+\bm{x})(X)\cdot X^{n}=(\bm{S}+\bm{x})(X)\cdot X^{n}. Thus, the output for the second layer is given by ๐’› โ‰ก ๐’ƒ 1 2 โŠ™ ( ๐’‰ 2 โˆ— ๐’› 1 + ๐’ƒ 2 2 ) โ‰ก ( ๐Ÿ n ๐Ÿ n ๐ŸŽ n โ‹ฏ ๐ŸŽ n ) โŠ™ ( ( ๐ŸŽ n ๐‘บ + ๐’™ ๐ŸŽ n โ‹ฏ ๐ŸŽ n ) + ( ๐Ÿ n ๐ŸŽ n ๐ŸŽ n โ‹ฏ ๐ŸŽ n ) ) โ‰ก ( ๐Ÿ n ๐Ÿ n ๐ŸŽ n โ‹ฏ ๐ŸŽ n ) โŠ™ ( ๐Ÿ n ๐‘บ + ๐’™ ๐ŸŽ n โ‹ฏ ๐ŸŽ n ) โ‰ก ( ๐Ÿ n ๐‘บ + ๐’™ ๐ŸŽ n โ‹ฏ ๐ŸŽ n ) . \bm{z}\equiv\bm{b}_{1}^{2}\odot\left(\bm{h}^{2}\ast\bm{z}^{1}+\bm{b}^{2}_{2}\right)\equiv\begin{pmatrix}\bm{1}^{n}\\ \hline\cr\\ \bm{1}^{n}\\ \hline\cr\\ \bm{0}^{n}\\ \hline\cr\\ \cdots\\ \hline\cr\\ \bm{0}^{n}\end{pmatrix}\odot\left(\begin{pmatrix}\bm{0}^{n}\\ \hline\cr\\ \bm{S}+\bm{x}\\ \hline\cr\\ \bm{0}^{n}\\ \hline\cr\\ \cdots\\ \hline\cr\\ \bm{0}^{n}\end{pmatrix}+\begin{pmatrix}\bm{1}^{n}\\ \hline\cr\\ \bm{0}^{n}\\ \hline\cr\\ \bm{0}^{n}\\ \hline\cr\\ \cdots\\ \hline\cr\\ \bm{0}^{n}\end{pmatrix}\right)\equiv\begin{pmatrix}\bm{1}^{n}\\ \hline\cr\\ \bm{1}^{n}\\ \hline\cr\\ \bm{0}^{n}\\ \hline\cr\\ \cdots\\ \hline\cr\\ \bm{0}^{n}\end{pmatrix}\odot\begin{pmatrix}\bm{1}^{n}\\ \hline\cr\\ \bm{S}+\bm{x}\\ \hline\cr\\ \bm{0}^{n}\\ \hline\cr\\ \cdots\\ \hline\cr\\ \bm{0}^{n}\end{pmatrix}\equiv\begin{pmatrix}\bm{1}^{n}\\ \hline\cr\\ \bm{S}+\bm{x}\\ \hline\cr\\ \bm{0}^{n}\\ \hline\cr\\ \cdots\\ \hline\cr\\ \bm{0}^{n}\end{pmatrix}. Therefore, we have used two BaseConv layers to add ๐’™ \bm{x} to the running sum ๐‘บ \bm{S} and reset for the next phase. Here, we note that the only operations we perform and are convolutions and Hadamard product and they generalize in the obvious way to d > 1 d>1 . โˆŽ

Next, we show that a five layer BaseConv model can perform gated convolution on windows of the input (without changing the rest of the input).

###### Proposition H.10 (The Remembering Primitive) .

For any ๐ฑ โˆˆ โ„ n ร— d , ๐ฏ โˆˆ โ„ m ร— d \bm{x}\in\mathbbm{R}^{n\times d},\bm{v}\in\mathbbm{R}^{m\times d} contained in some ๐ฒ โˆˆ โ„ N ร— d \bm{y}\in\mathbbm{R}^{N\times d} for some n + m + s + t โ‰ค N n+m+s+t\leq N so that for ๐ก โˆˆ โ„ n ร— d \bm{h}\in\mathbbm{R}^{n\times d} and ๐ฉ โˆˆ โ„ ( n + s ) ร— d \bm{p}\in\mathbbm{R}^{(n+s)\times d} with ๐ฑ โˆ— ๐ก โˆˆ โ„ ( n + s ) ร— d \bm{x}\ast\bm{h}\in\mathbbm{R}^{(n+s)\times d} and ๐ฏ โˆ— ๐ก โˆˆ โ„ ( m + t ) ร— d \bm{v}\ast\bm{h}\in\mathbbm{R}^{(m+t)\times d} , there exists a ( N , 5 , d , N , d ) โˆ’ BaseConv \left(N,5,d,N,d\right)-\text{{BaseConv}} that computes ๐š›๐šŽ๐š–๐šŽ๐š–๐š‹๐šŽ๐š› ( ๐ฒ : ๐ฑ , ๐ฏ , ๐ก , ๐ฉ ) {\tt remember}(\bm{y}:\bm{x},\bm{v},\bm{h},\bm{p}) for BaseConv as in Algorithm 7 .

###### Proof.

We will again show this for d โ€ฒ = 1 d^{\prime}=1 and the general case should follow. We now specify the first two layers that we use ๐’› 1 \displaystyle\bm{z}^{1} โ‰ก BaseConv โ€‹ ( ๐’š , ๐ŸŽ N ร— 1 , ๐’‰ 1 , ๐’ƒ 1 1 , ๐ŸŽ N ร— d ) โ‰ก ๐’ƒ 1 1 โŠ™ ( ๐’‰ 1 โˆ— ๐’š ) \displaystyle\equiv\textsc{BaseConv}\left({\bm{y},\mathbf{0}^{N\times 1},\bm{h}^{1},\bm{b}^{1}_{1},\mathbf{0}^{N\times d}}\right)\equiv\bm{b}^{1}_{1}\odot\left(\bm{h}^{1}\ast\bm{y}\right) ๐’› 2 \displaystyle\bm{z}^{2} โ‰ก BaseConv โ€‹ ( ๐’› 1 , ๐ŸŽ N ร— 1 , ๐’‰ 2 , ๐’ƒ 1 2 , ๐ŸŽ N ร— d ) โ‰ก ๐’ƒ 1 2 โŠ™ ( ๐’‰ 2 โˆ— ๐’š ) , \displaystyle\equiv\textsc{BaseConv}\left({\bm{z}^{1},\mathbf{0}^{N\times 1},\bm{h}^{2},\bm{b}^{2}_{1},\mathbf{0}^{N\times d}}\right)\equiv\bm{b}^{2}_{1}\odot\left(\bm{h}^{2}\ast\bm{y}\right), The kernel ๐’‰ 1 \bm{h}^{1} and the bias ๐’ƒ 1 1 \bm{b}^{1}_{1} for the first layer are then given by ๐’‰ 1 โ‰ก ( ๐’‰ ๐ŸŽ m ๐’† s + t ๐ŸŽ n ๐ŸŽ n โ‹ฏ ๐ŸŽ n ) , ๐’ƒ 1 1 โ‰ก ( ๐’‘ ๐ŸŽ m + t ๐ŸŽ n ๐ŸŽ s ๐Ÿ m โ‹ฏ ๐ŸŽ n ) . \bm{h}^{1}\equiv\begin{pmatrix}\bm{h}\\ \hline\cr\\ \bm{0}^{m}\\ \hline\cr\\ \bm{e}_{s+t}\\ \hline\cr\\ \bm{0}^{n}\\ \hline\cr\\ \bm{0}^{n}\\ \hline\cr\\ \cdots\\ \hline\cr\\ \bm{0}^{n}\\ \end{pmatrix},\quad\quad\bm{b}_{1}^{1}\equiv\begin{pmatrix}\bm{p}\\ \hline\cr\\ \bm{0}^{m+t}\\ \hline\cr\\ \bm{0}^{n}\\ \hline\cr\\ \bm{0}^{s}\\ \hline\cr\\ \bm{1}^{m}\\ \hline\cr\\ \cdots\\ \hline\cr\\ \bm{0}^{n}\\ \end{pmatrix}. where recall that ๐’™ โˆ— ๐’‰ โˆˆ โ„ ( n + s ) ร— d \bm{x}\ast\bm{h}\in\mathbbm{R}^{(n+s)\times d} and ๐’— โˆ— ๐’‰ โˆˆ โ„ ( m + t ) ร— d \bm{v}\ast\bm{h}\in\mathbbm{R}^{(m+t)\times d} .

We now want to first specify the result of applying the first kernel: ( ๐’‰ 1 โˆ— ๐’š ) \displaystyle\left(\bm{h}^{1}\ast\bm{y}\right) = coeff โก ( ( ๐’‰ โก ( X ) + X n + m + s + t ) โ‹… ( ๐’— โก ( X ) โ‹… X n + s + ๐’™ โก ( X ) ) ) \displaystyle=\mathrm{coeff}\left((\bm{h}(X)+X^{n+m+s+t})\cdot\left(\bm{v}(X)\cdot X^{n+s}+\bm{x}(X)\right)\right) = coeff โก ( ๐’‰ โˆ— ๐’— โก ( X ) โ‹… X n + s + ๐’‰ โˆ— ๐’™ โก ( X ) + ๐’— โก ( X ) โ‹… X 2 โ€‹ n + 2 โ€‹ s + m + t + ๐’™ โก ( X ) โ‹… X n + m + s + t ) \displaystyle=\mathrm{coeff}\left(\bm{h}\ast\bm{v}(X)\cdot X^{n+s}+\bm{h}\ast\bm{x}(X)+\bm{v}(X)\cdot X^{2n+2s+m+t}+\bm{x}(X)\cdot X^{n+m+s+t}\right) We then have ๐’› 1 โ‰ก ๐’ƒ 1 1 โŠ™ ( ๐’‰ 1 โˆ— ๐’š ) โ‰ก ( ๐’‘ ๐ŸŽ m + t ๐ŸŽ n ๐ŸŽ s ๐Ÿ m โ‹ฏ ๐ŸŽ n ) โŠ™ ( ๐’‰ โˆ— ๐’™ ๐’‰ โˆ— ๐’— ๐’™ ๐ŸŽ s ๐’— โ‹ฏ ๐ŸŽ n ) โ‰ก ( ๐’‘ โŠ™ ( ๐’‰ โˆ— ๐’™ ) ๐ŸŽ m + t ๐ŸŽ n ๐ŸŽ s ๐’— โ‹ฏ ๐ŸŽ n ) . \bm{z}_{1}\equiv\bm{b}_{1}^{1}\odot\left(\bm{h}^{1}\ast\bm{y}\right)\equiv\begin{pmatrix}\bm{p}\\ \hline\cr\\ \bm{0}^{m+t}\\ \hline\cr\\ \bm{0}^{n}\\ \hline\cr\\ \bm{0}^{s}\\ \hline\cr\\ \bm{1}^{m}\\ \hline\cr\\ \cdots\\ \hline\cr\\ \bm{0}^{n}\\ \end{pmatrix}\odot\begin{pmatrix}\bm{h}\ast\bm{x}\\ \hline\cr\\ \bm{h}\ast\bm{v}\\ \hline\cr\\ \bm{x}\\ \hline\cr\\ \bm{0}^{s}\\ \hline\cr\\ \bm{v}\\ \hline\cr\\ \cdots\\ \hline\cr\\ \bm{0}^{n}\\ \end{pmatrix}\equiv\begin{pmatrix}\bm{p}\odot(\bm{h}\ast\bm{x})\\ \hline\cr\\ \bm{0}^{m+t}\\ \hline\cr\\ \bm{0}^{n}\\ \hline\cr\\ \bm{0}^{s}\\ \hline\cr\\ \bm{v}\\ \hline\cr\\ \cdots\\ \hline\cr\\ \bm{0}^{n}\\ \end{pmatrix}. We now describe the second kernel ๐’‰ 2 \bm{h}^{2} and the bias matrix ๐’ƒ 1 2 \bm{b}^{2}_{1} as follows: ๐’‰ 2 โ‰ก ( ๐’† 0 ๐ŸŽ m + t ๐’† 0 ๐ŸŽ n + s ๐ŸŽ m โ‹ฏ ๐ŸŽ ) , ๐’ƒ 1 2 โ‰ก ( ๐ŸŽ n + s ๐ŸŽ m + t ๐ŸŽ n ๐Ÿ n + s ๐Ÿ m โ‹ฏ ๐ŸŽ ) \bm{h}^{2}\equiv\begin{pmatrix}\bm{e}_{0}\\ \hline\cr\\ \bm{0}^{m+t}\\ \hline\cr\\ \bm{e}^{0}\\ \hline\cr\\ \bm{0}^{n+s}\\ \hline\cr\\ \bm{0}^{m}\\ \hline\cr\\ \cdots\\ \hline\cr\\ \bm{0}\end{pmatrix},\quad\quad\bm{b}_{1}^{2}\equiv\begin{pmatrix}\bm{0}^{n+s}\\ \hline\cr\\ \bm{0}^{m+t}\\ \hline\cr\\ \bm{0}^{n}\\ \hline\cr\\ \bm{1}^{n+s}\\ \hline\cr\\ \bm{1}^{m}\\ \hline\cr\\ \cdots\\ \hline\cr\\ \bm{0}\end{pmatrix} This yields the following convolution computation: ๐’‰ 2 โŠ™ ๐’› 1 \displaystyle\bm{h}^{2}\odot\bm{z}^{1} โ‰ก coeff โก ( ( X m + n + s + t + 1 ) โ‹… ( ๐’— โก ( X ) โ‹… X 2 โ€‹ n + 2 โ€‹ s + m + t + ( ๐’‘ โŠ™ ( ๐’‰ โˆ— ๐’™ ) ) โ€‹ ( X ) ) ) \displaystyle\equiv\mathrm{coeff}\left(\left(X^{m+n+s+t}+1\right)\cdot\left(\bm{v}(X)\cdot X^{2n+2s+m+t}+\left(\bm{p}\odot(\bm{h}\ast\bm{x})\right)(X)\right)\right) โ‰ก coeff โก ( ๐’— โก ( X ) โ‹… X 3 โ€‹ n + 3 โ€‹ s + 2 โ€‹ m + 2 โ€‹ t + ๐’— โก ( X ) โ‹… X 2 โ€‹ n + 2 โ€‹ s + m + t CLOSE \displaystyle\equiv\mathrm{coeff}(\bm{v}(X)\cdot X^{3n+3s+2m+2t}+\bm{v}(X)\cdot X^{2n+2s+m+t} + ( ๐’‘ โŠ™ ( ๐’‰ โˆ— ๐’™ ) ) ( X ) โ‹… X m + n + s + t + ( ๐’‘ โŠ™ ( ๐’‰ โˆ— ๐’™ ) ) ( X ) ) \displaystyle\quad+\left(\bm{p}\odot(\bm{h}\ast\bm{x})\right)(X)\cdot X^{m+n+s+t}+\left(\bm{p}\odot(\bm{h}\ast\bm{x})\right)(X)) Thus we have ๐’› 2 โ‰ก ๐’ƒ 2 1 โŠ™ ( ๐’‰ 2 โˆ— ๐’› 1 ) โ‰ก ( ๐ŸŽ n + s ๐ŸŽ m + t ๐ŸŽ n ๐Ÿ n + s ๐Ÿ m โ‹ฏ ๐ŸŽ ) โŠ™ ( ๐’‘ โŠ™ ( ๐’‰ โˆ— ๐’™ ) ๐ŸŽ m + t ๐ŸŽ n ๐’‘ โŠ™ ( ๐’‰ โˆ— ๐’™ ) ๐’— โ‹ฏ ๐ŸŽ ) โ‰ก ( ๐ŸŽ n + s ๐ŸŽ m + t ๐ŸŽ n ๐’‘ โŠ™ ( ๐’‰ โˆ— ๐’™ ) ๐’— โ‹ฏ ๐ŸŽ ) \bm{z}^{2}\equiv\bm{b}_{2}^{1}\odot\left(\bm{h}^{2}\ast\bm{z}^{1}\right)\equiv\begin{pmatrix}\bm{0}^{n+s}\\ \hline\cr\\ \bm{0}^{m+t}\\ \hline\cr\\ \bm{0}^{n}\\ \hline\cr\\ \bm{1}^{n+s}\\ \hline\cr\\ \bm{1}^{m}\\ \hline\cr\\ \cdots\\ \hline\cr\\ \bm{0}\end{pmatrix}\odot\begin{pmatrix}\bm{p}\odot(\bm{h}\ast\bm{x})\\ \hline\cr\\ \bm{0}^{m+t}\\ \hline\cr\\ \bm{0}^{n}\\ \hline\cr\\ \bm{p}\odot(\bm{h}\ast\bm{x})\\ \hline\cr\\ \bm{v}\\ \hline\cr\\ \cdots\\ \hline\cr\\ \bm{0}\end{pmatrix}\equiv\begin{pmatrix}\bm{0}^{n+s}\\ \hline\cr\\ \bm{0}^{m+t}\\ \hline\cr\\ \bm{0}^{n}\\ \hline\cr\\ \bm{p}\odot(\bm{h}\ast\bm{x})\\ \hline\cr\\ \bm{v}\\ \hline\cr\\ \cdots\\ \hline\cr\\ \bm{0}\end{pmatrix} We now shift this up by 2 โ€‹ n + s + m + t 2n+s+m+t entries using the primitive operation defined in Proposition H.8 that costs three additional layers so that we end up with ๐’› โ‰ก ( ๐’‘ โŠ™ ( ๐’‰ โˆ— ๐’– ) ๐’— โ‹ฏ ๐ŸŽ ) \bm{z}\equiv\begin{pmatrix}\bm{p}\odot(\bm{h}\ast\bm{u})\\ \hline\cr\\ \bm{v}\\ \hline\cr\\ \cdots\\ \hline\cr\\ \bm{0}\end{pmatrix} Again, we note that the only operations we perform and are convolutions and Hadamard product and they generalize in the obvious way to d > 1 d>1 . โˆŽ

Finally, we show that these primitives may be composed by โ€™stackingโ€™ models with matching inner dimension ( N โ€ฒ , d โ€ฒ ) (N^{\prime},d^{\prime}) .

###### Lemma H.11 .

For f , g : โ„ N ร— d โ†’ โ„ N ร— d f,g:\mathbbm{R}^{N\times d}\to\mathbbm{R}^{N\times d} that have ( N , L 1 , d , N โ€ฒ , d โ€ฒ ) (N,L_{1},d,N^{\prime},d^{\prime}) and ( N , L 2 , d , N โ€ฒ , d โ€ฒ ) (N,L_{2},d,N^{\prime},d^{\prime}) BaseConv models then their composition f โˆ˜ g f\circ g has an ( N , L 1 + L 2 , d , N โ€ฒ , d โ€ฒ ) (N,L_{1}+L_{2},d,N^{\prime},d^{\prime}) BaseConv model which can be computed by performing their models in succession, or โ€™stackingโ€™.

###### Proof.

This result follows from noting that for any f โก ( ๐’– ) f(\bm{u}) which requires L 1 L_{1} layers to compute and that we can compute f โˆ˜ g โก ( ๐’– ) = g โก ( f โก ( ๐’– ) ) f\circ g(\bm{u})=g(f(\bm{u})) using the BaseConv model with L 2 L_{2} layers, yielding L 1 + L 2 L_{1}+L_{2} layers in total. โˆŽ

#### H.3.1 BaseConv -Hyena Equivalence

We show that the equivalence between BaseConv and Hyena by showing that each layer can simulate the otherโ€™s computation using a constant number of layers.

###### Proposition H.12 .

For any input ๐ฎ โˆˆ โ„ N ร— d \bm{u}\in\mathbbm{R}^{N\times d} and ( N , L , d , N โ€ฒ , d ) โˆ’ (N,L,d,N^{\prime},d)- Hyena such that ๐ณ Hyena โ‰ก Hyena โก ( ๐ฎ ) \bm{z}_{\mathrm{Hyena}}\equiv\mathrm{Hyena}(\bm{u}) with a set of filters ๐ก โ„“ \bm{h}^{\ell} and linear projections ๐ฉ โ„“ \bm{p}^{\ell} as per Definition H.3 for โ„“ โˆˆ [ L ] \ell\in[L] , there exists a ( N , 5 โ€‹ L , d , N โ€ฒ + N , d ) (N,5L,d,N^{\prime}+N,d) - BaseConv model such that ๐ณ Hyena โ‰ก BaseConv โ€‹ ( ๐ฎ ) \bm{z}_{\mathrm{Hyena}}\equiv\textsc{BaseConv}(\bm{u}) .