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}) .