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

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

Similarly, for any input ๐ฎ BaseConv โˆˆ โ„ N ร— d \bm{u}_{\textsc{BaseConv}}\in\mathbbm{R}^{N\times d} and ( N , L , d , N โ€ฒ , d ) โˆ’ (N,L,d,N^{\prime},d)- Coyote such that ๐ณ BaseConv โ‰ก BaseConv โ€‹ ( ๐ฎ ) \bm{z}_{\textsc{BaseConv}}\equiv\textsc{BaseConv}(\bm{u}) with a set of filters ๐ก โ„“ \bm{h}^{\ell} for โ„“ โˆˆ [ L ] \ell\in[L] , there exists a series of Hyena layers such that we have Hyena โก ( Hyena โก ( โ€ฆ โ€‹ Hyena โ€‹ ( ๐’– BaseConv , ๐’‰ ) ) ) โŸ L โ€‹ layers โ‰ก ๐’› BaseConv . \underbrace{\mathrm{Hyena}\left(\mathrm{Hyena}\left(\ldots\mathrm{Hyena}(\bm{u}_{\textsc{BaseConv},\bm{h}})\right)\right)}_{L\text{ layers}}\equiv\bm{z}_{\textsc{BaseConv}}.

###### Proof.

For the input ๐’– Hyena โˆˆ โ„ N ร— d \bm{u}_{\mathrm{Hyena}}\in\mathbbm{R}^{N\times d} , the output of the โ„“ \ell th layer ๐’› Hyena โ„“ โˆˆ โ„ N โ€ฒ ร— d โ€ฒ \bm{z}^{\ell}_{\mathrm{Hyena}}\in\mathbbm{R}^{N^{\prime}\times d^{\prime}} for Hyena is given by (see Algorithm 3 ) ๐’› Hyena โ„“ โ‰ก ๐’‘ Hyena โ„“ โŠ™ ( ๐’‰ l โˆ— ๐’› โ„“ โˆ’ 1 ) , \displaystyle\bm{z}^{\ell}_{\mathrm{Hyena}}\equiv\bm{p}^{\ell}_{\mathrm{Hyena}}\odot(\bm{h}^{l}\ast\bm{z}^{\ell-1}), where ๐’‘ Hyena โ„“ โ‰ก Linear โ€‹ ( ๐’– Hyena ) โˆˆ โ„ N โ€ฒ ร— d \bm{p}^{\ell}_{\mathrm{Hyena}}\equiv\texttt{Linear}(\bm{u}_{\mathrm{Hyena}})\in\mathbbm{R}^{N^{\prime}\times d} . Now, using the original input ๐’– Hyena โˆˆ โ„ N ร— d \bm{u}_{\mathrm{Hyena}}\in\mathbbm{R}^{N\times d} to Hyena, we define the following input for BaseConv using one layer: ๐’– BaseConv โ‰ก ( ๐’– Hyena ๐ŸŽ ( N โ€ฒ โˆ’ N ) ร— d ๐’– Hyena ) \bm{u}_{\textsc{BaseConv}}\equiv\begin{pmatrix}\bm{u}_{\mathrm{Hyena}}\\ \hline\cr\\ \bm{0}^{(N^{\prime}-N)\times d}\\ \hline\cr\\ \bm{u}_{\mathrm{Hyena}}\end{pmatrix} Then, we simply use the ๐š›๐šŽ๐š–๐šŽ๐š–๐š‹๐šŽ๐š› N , N , N โ€ฒ โˆ’ N , N โ€ฒ โˆ’ N ( ๐’– BaseConv : ๐’– Hyena , ๐’– Hyena , ๐’‰ Hyena โ„“ , ๐’‘ Hyena โ„“ ) {\tt remember}_{N,N,N^{\prime}-N,N^{\prime}-N}(\bm{u}_{\textsc{BaseConv}}:\bm{u}_{\mathrm{Hyena}},\bm{u}_{\mathrm{Hyena}},\bm{h}^{\ell}_{\mathrm{Hyena}},\bm{p}^{\ell}_{\mathrm{Hyena}}) primitive for BaseConv . Consequently, this allows us to โ€œrememberโ€ the input ๐’– Hyena \bm{u}_{\mathrm{Hyena}} in the output of the previous BaseConv layer ๐’› BaseConv โ„“ โˆ’ 1 \bm{z}^{\ell-1}_{\textsc{BaseConv}} . We then use this to retrieve ๐’‘ Hyena โ„“ โ‰ก linear โก ( ๐’– Hyena ) \bm{p}^{\ell}_{\mathrm{Hyena}}\equiv\mathrm{linear}(\bm{u}_{\mathrm{Hyena}}) with the projection used for BaseConv given by p BaseConv โ„“ โ‰ก Linear โ€‹ ( ๐’› BaseConv โ„“ โˆ’ 1 ) โ‰ก ( ๐Ÿ N ร— d ๐’‘ Hyena โ„“ . ) p^{\ell}_{\textsc{BaseConv}}\equiv\texttt{Linear}(\bm{z}^{\ell-1}_{\textsc{BaseConv}})\equiv\begin{pmatrix}\bm{1}^{N\times d}\\ \hline\cr\\ \bm{p}^{\ell}_{\mathrm{Hyena}}.\end{pmatrix} Overall, the output of the โ„“ \ell th layer for BaseConv is given by ๐’› BaseConv โ„“ โ‰ก ( ๐’‘ Hyena โ„“ โŠ™ ( ๐’‰ Hyena โ„“ โˆ— ๐’– Hyena ) ๐ŸŽ ( M โˆ’ N ) ร— d ๐’– Hyena ) โ‰ก ( ๐’› Hyena โ„“ ๐ŸŽ ( M โˆ’ N ) ร— d ๐’– Hyena ) \bm{z}^{\ell}_{\textsc{BaseConv}}\equiv\begin{pmatrix}\bm{p}^{\ell}_{\mathrm{Hyena}}\odot\left(\bm{h}^{\ell}_{\mathrm{Hyena}}\ast\bm{u}_{\mathrm{Hyena}}\right)\\ \hline\cr\\ \bm{0}^{(M-N)\times d}\\ \hline\cr\\ \bm{u}_{\mathrm{Hyena}}\end{pmatrix}\equiv\begin{pmatrix}\bm{z}^{\ell}_{\mathrm{Hyena}}\\ \hline\cr\\ \bm{0}^{(M-N)\times d}\\ \hline\cr\\ \bm{u}_{\mathrm{Hyena}}\end{pmatrix} Hence, we can reproduce the output of the โ„“ \ell th layer of Hyena using five layers of BaseConv after augmenting the input and using the remembering primitive ( Proposition H.10 ) with internal dimension N โ€ฒ + N N^{\prime}+N .

Now, for the input ๐’– BaseConv โˆˆ โ„ N ร— d \bm{u}_{\textsc{BaseConv}}\in\mathbbm{R}^{N\times d} , the output of the โ„“ \ell th layer for BaseConv is given by z BaseConv โ„“ โ‰ก Linear โ€‹ ( z BaseConv โ„“ โˆ’ 1 ) โŠ™ conv โก ( h l , z BaseConv โ„“ โˆ’ 1 ) . \displaystyle z^{\ell}_{\textsc{BaseConv}}\equiv\texttt{Linear}(z^{\ell-1}_{\textsc{BaseConv}})\odot\mathrm{conv}(h^{l},z^{\ell-1}_{\textsc{BaseConv}}). Here, we show inductively that simply using โ„“ \ell -many Hyena models recursively simulates z BaseConv โ„“ z^{\ell}_{\textsc{BaseConv}} . For โ„“ = 1 \ell=1 , we have Hyena โก ( ๐’– BaseConv , ๐’‰ ) โ‰ก Linear โ€‹ ( ๐’– BaseConv ) โŠ™ ( ๐’‰ 1 โˆ— ๐’– BaseConv ) โ‰ก ๐’› BaseConv 1 . \mathrm{Hyena}(\bm{u}_{\textsc{BaseConv},\bm{h}})\equiv\texttt{Linear}(\bm{u}_{\textsc{BaseConv}})\odot(\bm{h}^{1}\ast\bm{u}_{\textsc{BaseConv}})\equiv\bm{z}^{1}_{\textsc{BaseConv}}. We now assume that ( โ„“ โˆ’ 1 ) (\ell-1) -many recursive Hyena models produce z BaseConv ( โ„“ โˆ’ 1 ) z^{(\ell-1)}_{\textsc{BaseConv}} . For the โ„“ \ell th layer, we then have Hyena โก ( Hyena โก ( โ€ฆ โ€‹ Hyena โ€‹ ( ๐’– BaseConv , ๐’‰ ) ) ) \displaystyle\mathrm{Hyena}\left(\mathrm{Hyena}\left(\ldots\mathrm{Hyena}(\bm{u}_{\textsc{BaseConv},\bm{h}})\right)\right) โ‰ก \displaystyle\equiv\quad Hyena โก ( z BaseConv ( l โˆ’ 1 ) ) \displaystyle\mathrm{Hyena}\left(z^{(l-1)}_{\textsc{BaseConv}}\right) โ‰ก \displaystyle\equiv\quad linear โก ( z BaseConv ( l โˆ’ 1 ) ) โŠ™ conv โก ( h l , z BaseConv ( l โˆ’ 1 ) ) \displaystyle\mathrm{linear}\left(z^{(l-1)}_{\textsc{BaseConv}}\right)\odot\mathrm{conv}\left(h^{l},z^{(l-1)}_{\textsc{BaseConv}}\right) โ‰ก \displaystyle\equiv\quad z BaseConv โ„“ . \displaystyle z^{\ell}_{\textsc{BaseConv}}. โˆŽ

### H.4 Linear Arithmetic Circuits

In this section we show the relation between linear arithmetic circuits and BaseConv . We recall a few definitions from [ Dao et al., 2020 ] .

###### Definition H.13 (Linear Arithmetic Circuit [ Bรผrgisser et al., 1996 ] ) .

An arithmetic circuit is called a linear arithmetic circuit if it only uses addition, subtraction and scalar multiplication. Further, every multiplication has a fixed constant from ๐”ฝ \mathbbm{F} as at least one of its two inputs. In other words, all gates in the circuit are linear functions of their inputs (i.e. of the form a โ€‹ x + b โ€‹ y ax+by for fixed constants a , b โˆˆ ๐”ฝ a,b\in\mathbbm{F} ).

###### Definition H.14 (Butterfly Matrices [ Dao et al., 2020 ] ) .

A butterfly factor of size k โ‰ฅ 2 k\geq 2 (denoted as ๐ k \mathbf{B}_{k} ) is a matrix of the form ๐ k = \mathbf{B}_{k}= [ ๐ƒ 1 ๐ƒ 2 ๐ƒ 3 ๐ƒ 4 ] \left[\begin{array}[]{ll}\mathbf{D}_{1}&\mathbf{D}_{2}\\ \mathbf{D}_{3}&\mathbf{D}_{4}\end{array}\right] where each ๐ƒ i \mathbf{D}_{i} is a k 2 ร— k 2 \frac{k}{2}\times\frac{k}{2} diagonal matrix. We restrict k k to be a power of 2 .

A butterfly factor matrix of size n n with block size k k (denoted as ๐ k ( n ) \mathbf{B}_{k}^{(n)} ) is a block diagonal matrix of n k \frac{n}{k} (possibly different) butterfly factors of size k k : ๐ k ( n ) = diag โก ( [ ๐ k ] 1 , [ ๐ k ] 2 , โ€ฆ , [ ๐ k ] n k ) \mathbf{B}_{k}^{(n)}=\operatorname{diag}\left(\left[\mathbf{B}_{k}\right]_{1},\left[\mathbf{B}_{k}\right]_{2},\ldots,\left[\mathbf{B}_{k}\right]_{\frac{n}{k}}\right) Finally, a butterfly matrix of size n n (denoted as ๐ ( n ) \mathbf{B}^{(n)} ) is a matrix that can be expressed as a product of butterfly factor matrices: ๐ ( n ) = ๐ n ( n ) โ€‹ ๐ n 2 ( n ) โ€‹ โ€ฆ โ€‹ ๐ 2 ( n ) \mathbf{B}^{(n)}=\mathbf{B}_{n}^{(n)}\mathbf{B}_{\frac{n}{2}}^{(n)}\ldots\mathbf{B}_{2}^{(n)} . Equivalently, we may define ๐ ( n ) \mathbf{B}^{(n)} recursively as a matrix that can be expressed in the following form: ๐ ( n ) = ๐ n ( n ) โ€‹ [ [ ๐ ( n 2 ) ] 1 0 0 [ ๐ ( n 2 ) ] 2 ] \mathbf{B}^{(n)}=\mathbf{B}_{n}^{(n)}\left[\begin{array}[]{cc}{\left[\mathbf{B}^{\left(\frac{n}{2}\right)}\right]_{1}}&0\\ 0&{\left[\mathbf{B}^{\left(\frac{n}{2}\right)}\right]_{2}}\end{array}\right] (Note that [ ๐ ( n 2 ) ] 1 \left[\mathbf{B}^{\left(\frac{n}{2}\right)}\right]_{1} and [ ๐ ( n 2 ) ] 2 \left[\mathbf{B}^{\left(\frac{n}{2}\right)}\right]_{2} may be different.)

From Definition H.14 , we observe that size n n butterfly factor is comprised of three vectors ๐’… , ๐’… + , ๐’… โˆ’ โˆˆ โ„ n \bm{d,d^{+},d^{-}}\in\mathbbm{R}^{n} such that ๐’… \displaystyle\bm{d} = ( diag โˆ’ 1 โก ( ๐ƒ 1 ) , diag โˆ’ 1 โก ( ๐ƒ 4 ) ) , \displaystyle=\left(\operatorname{diag}^{-1}\left({\bf D}_{1}\right),\operatorname{diag}^{-1}\left({\bf D}_{4}\right)\right), ๐’… + \displaystyle\bm{d}^{+} = ( ๐ŸŽ n 2 , diag โˆ’ 1 โก ( ๐ƒ 2 ) ) , and \displaystyle=\left(\bm{0}^{\tfrac{n}{2}},\operatorname{diag}^{-1}\left({\bf D}_{2}\right)\right),\text{ and } ๐’… โˆ’ \displaystyle\bm{d}^{-} = ( diag โˆ’ 1 โก ( ๐ƒ 3 ) , ๐ŸŽ n 2 ) , \displaystyle=\left(\operatorname{diag}^{-1}\left({\bf D}_{3}\right),\bm{0}^{\tfrac{n}{2}}\right),

where diag โˆ’ 1 โก ( ๐ƒ ) : โ„ n ร— n โ†ฆ โ„ n \operatorname{diag}^{-1}({\bf D}):\mathbbm{R}^{n\times n}\mapsto\mathbbm{R}^{n} is the mapping from diagonal matrices to the vector of its diagonal entries. Let us define ๐ƒ ๐Ÿ , ๐ƒ ๐Ÿ , ๐ƒ ๐Ÿ‘ โˆˆ โ„ n ร— n {\bf D_{1},D_{2},D_{3}}\in\mathbbm{R}^{n\times n} as diag โก ( ๐’… ) , diag โก ( ๐’… + ) \operatorname{diag}\left(\bm{d}\right),\operatorname{diag}\left(\bm{d^{+}}\right) , and diag โก ( ๐’… โˆ’ ) \operatorname{diag}\left(\bm{d^{-}}\right) respectively. Then we note that

๐ƒ 1 โ‰ก [ ๐ƒ 1 ๐ŸŽ ๐ŸŽ ๐ƒ 4 ] ๐ƒ 2 โ€‹ ๐‘บ n 2 โ‰ก [ ๐ŸŽ ๐ƒ 2 ๐ŸŽ ๐ŸŽ ] ๐‘บ n 2 โ€‹ ๐ƒ 3 โ‰ก [ ๐ŸŽ ๐ŸŽ ๐ƒ 3 ๐ŸŽ ] {\bf D}_{1}\equiv\left[\begin{array}[]{ll}\mathbf{D}_{1}&\mathbf{0}\\ \mathbf{0}&\mathbf{D}_{4}\end{array}\right]\qquad{\bf D}_{2}\bm{S}^{\tfrac{n}{2}}\equiv\left[\begin{array}[]{ll}\mathbf{0}&\mathbf{D}_{2}\\ \mathbf{0}&\mathbf{0}\end{array}\right]\qquad\bm{S}^{\tfrac{n}{2}}{\bf D}_{3}\equiv\left[\begin{array}[]{ll}\mathbf{0}&\mathbf{0}\\ \mathbf{D}_{3}&\mathbf{0}\end{array}\right] (5)

where ๐’ k โˆˆ ๐”ฝ n ร— n {\bf S}^{k}\in\mathbbm{F}^{n\times n} is a shift matrix for i โˆˆ [ n / 2 ] i\in[n/2] . This gives us the following proposition:

###### Proposition H.15 .

For any powers of 2, n = k โ‰ฅ 2 n=k\geq 2 , any butterfly factor matrix ๐ k ( n ) {\bf B}^{(n)}_{k} is equivalent to ๐ k ( n ) = ๐’ k 2 โ€‹ ๐ƒ 3 + ๐ƒ 2 โ€‹ ๐’ n 2 + ๐ƒ 1 {\bf B}^{(n)}_{k}={\bf S}^{\tfrac{k}{2}}{\bf D}_{3}+{\bf D}_{2}{\bf S}^{\tfrac{n}{2}}+{\bf D}_{1} where ๐ƒ ๐Ÿ‘ , ๐ƒ ๐Ÿ , ๐ƒ ๐Ÿ , ๐’ ๐ง ๐Ÿ {\bf D_{3},D_{2},D_{1},S^{\frac{n}{2}}} are defined as in equation 5 .

We use Proposition H.15 to show that butterfly matrices can easily be computed by BaseConv .

###### Lemma H.16 .

For any n , d โ‰ฅ 2 n,d\geq 2 , k โ‰ฅ 1 k\geq 1 , and arbitrary vector ๐ฑ โˆˆ โ„ n โ€‹ d \bm{x}\in\mathbbm{R}^{nd} : (1) there exists a ( N , L , d , N โ€ฒ , d โ€ฒ ) โˆ’ BaseConv \left(N,L,d,N^{\prime},d^{\prime}\right)-\text{{BaseConv}} that can represent ๐ k ( n โ€‹ d ) โ‹… ๐’™ {\bf B}^{(nd)}_{k}\cdot\bm{x} with N = n , N โ€ฒ = ๐’ช โก ( N ) N=n,N^{\prime}=\mathcal{O}(N) , L = ๐’ช โก ( 1 ) L=\mathcal{O}(1) , and d โ€ฒ = ๐’ช โก ( d ) d^{\prime}=\mathcal{O}(d) , and

(2) there exists a ( N , L , d , N โ€ฒ , d โ€ฒ ) โˆ’ BaseConv \left(N,L,d,N^{\prime},d^{\prime}\right)-\text{{BaseConv}} that can represent ๐ ( n โ€‹ d ) โ‹… ๐’™ {\bf B}^{(nd)}\cdot\bm{x} with N = n , N โ€ฒ = ๐’ช โก ( N ) N=n,N^{\prime}=\mathcal{O}(N) , L = ๐’ช โก ( log โก n โ€‹ d ) L=\mathcal{O}(\log nd) , and d โ€ฒ = ๐’ช โก ( d ) d^{\prime}=\mathcal{O}(d) .

###### Proof.

(1) Given ๐’™ โˆˆ โ„ n โ€‹ d \bm{x}\in\mathbbm{R}^{nd} , construct ๐’– โˆˆ โ„ n ร— d \bm{u}\in\mathbbm{R}^{n\times d} where ๐’™ \bm{x} is the row-major form of ๐’– \bm{u} . We show that BaseConv can compute ๐ n โ€‹ d โ‹… ๐’™ {\bf B}_{nd}\cdot\bm{x} column by column.

Let ๐€ = ๐’ k 2 โ€‹ ๐ƒ 3 โ€ฒ , ๐‚ = ๐ƒ 2 โ€ฒ โ€‹ ๐’ n 2 {\bf A}={\bf S}^{\tfrac{k}{2}}{\bf D}^{\prime}_{3},{\bf C}={\bf D}^{\prime}_{2}{\bf S}^{\tfrac{n}{2}} , and ๐ƒ = ๐ƒ 1 {\bf D}={\bf D}_{1} for ๐ƒ i , ๐’ k 2 โˆˆ โ„ n โ€‹ d ร— n โ€‹ d {\bf D}_{i},{\bf S}^{\tfrac{k}{2}}\in\mathbbm{R}^{nd\times nd} for 1 โ‰ค i โ‰ค 3 1\leq i\leq 3 as defined in Proposition H.15 . We take ๐’… 1 = ๐Ÿ n โ€‹ d โ€‹ ๐ƒ , ๐’… 2 = ๐Ÿ n โ€‹ d โ€‹ ๐‚ 2 , ๐’… 3 = ๐Ÿ n โ€‹ d โ€‹ ๐€ \bm{d}_{1}=\bm{1}^{nd}{\bf D},\ \bm{d}_{2}=\bm{1}^{nd}{\bf C}_{2},\bm{d}_{3}=\bm{1}^{nd}{\bf A} , which extracts the diagonal entries of ๐ƒ i {\bf D}_{i} . With this we construct ๐ƒ i โ€ฒ โˆˆ โ„ n ร— d {\bf D}^{\prime}_{i}\in\mathbbm{R}^{n\times d} where ๐’… i \bm{d}_{i} is the row major form of ๐‘ซ i โ€ฒ \bm{D}^{\prime}_{i} . This implies that ๐ƒ i โ€‹ ๐’™ โ‰ก ๐ƒ i โ€ฒ โŠ™ ๐’– . {\bf D}_{i}\bm{x}\equiv{\bf D}^{\prime}_{i}\odot\bm{u}.

Then we can decompose ๐ n โ€‹ d โ‹… ๐’™ {\bf B}_{nd}\cdot\bm{x} into ๐ n โ€‹ d โ€‹ ๐’™ โ‰ก ๐ƒ 1 โŠ™ ๐’– + ๐ƒ 2 โŠ™ ๐’– + ๐ƒ 3 โŠ™ ๐’– . {\bf B}_{nd}\bm{x}\equiv{\bf D}_{1}\odot\bm{u}+{\bf D}_{2}\odot\bm{u}+{\bf D}_{3}\odot\bm{u}.

By Lemma H.7 , each Hadamard product ๐€ โŠ™ ๐’– , ๐ โŠ™ ๐’– , ๐‚ โŠ™ ๐’– {\bf A}\odot\bm{u},{\bf B}\odot\bm{u},{\bf C}\odot\bm{u} can be trivially be performed with a single layer BaseConv model. Let each of these model outputs be denoted ๐’š ๐Ÿ , ๐’š ๐Ÿ , ๐’š ๐Ÿ‘ \bm{y_{1},y_{2},y_{3}} , respectively. Finally all that remains is to compute the ๐’š ๐Ÿ + ๐’š ๐Ÿ + ๐’š ๐Ÿ‘ \bm{y_{1}+y_{2}+y_{3}} . We achieve this using layers of add primitives 11 11 11 Recall that add n ( ๐’š : ๐’™ , ๐‘บ ) \texttt{add}_{n}(\bm{y}:\bm{x},\bm{S}) adds the subvector ๐’™ \bm{x} to ๐‘บ \bm{S} for the input ๐’š \bm{y} . : add n ( ๐’š 1 : ๐’š 1 , ๐ŸŽ ) \displaystyle\texttt{add}_{n}(\bm{y}^{1}:\bm{y}_{1},\bm{0}) add n ( ๐’š 2 : ๐’š 2 , ๐’š 1 ) \displaystyle\texttt{add}_{n}(\bm{y}^{2}:\bm{y}_{2},\bm{y}_{1}) add n ( ๐’š 3 : ๐’š 3 , ๐’š 1 + ๐’š 2 ) , \displaystyle\texttt{add}_{n}(\bm{y}^{3}:\bm{y}_{3},\bm{y}_{1}+\bm{y}_{2}), where using by Proposition H.9 and Lemma H.11 , this requires six more layers, and we get ๐’š 3 โ‰ก ๐’š ๐Ÿ + ๐’š ๐Ÿ + ๐’š ๐Ÿ‘ โ‰ก ๐ n โ€‹ d โ€‹ ๐’™ . \bm{y}^{3}\equiv\bm{y_{1}+y_{2}+y_{3}}\equiv{\bf B}_{nd}\bm{x}. Then we can construct the ( N , L , d , N โ€ฒ , d โ€ฒ ) โˆ’ BaseConv \left(N,L,d,N^{\prime},d^{\prime}\right)-\text{{BaseConv}} as desired with L = O โก ( 1 ) L=O(1) layers.

(2) From Definition H.14 , ๐ ( n โ€‹ d ) = ๐ n โ€‹ d ( n โ€‹ d ) โ€‹ ๐ n โ€‹ d 2 ( n โ€‹ d ) โ€‹ โ€ฆ โ€‹ ๐ 2 ( n โ€‹ d ) \mathbf{B}^{(nd)}=\mathbf{B}_{nd}^{(nd)}\mathbf{B}_{\frac{nd}{2}}^{(nd)}\ldots\mathbf{B}_{2}^{(nd)} . From (1), BaseConv can compute any butterfly matrix by simulating the log โก ( n โ€‹ d ) \log(nd) butterfly factor matrices which comprise ๐ ( n โ€‹ d ) \mathbf{B}^{(nd)} . With Lemma H.11 , this creates a BaseConv with 5 โ‹… log โก ( n โ€‹ d ) = ๐’ช โก ( log โก ( n โ€‹ d ) ) 5\cdot\log(nd)=\mathcal{O}(\log(nd)) layers. Lemma H.11

โˆŽ

Butterfly matrices comprise the kaleidoscope hierarchy, which we define below:

###### Definition H.17 (The Kaleidoscope Hierarchy [ Dao et al., 2020 ] ) .

โ€ข Define โ„ฌ \mathcal{B} as the set of all matrices that can be expressed in the form ๐ ( n ) {\bf B}^{(n)} (for some n n ).

โ€ข Define ( โ„ฌโ„ฌ โˆ— ) \left(\cal{BB}^{*}\right) as the set of matrices ๐Œ {\bf M} of the form ๐Œ = ๐Œ 1 โ€‹ ๐Œ 2 โˆ— {\bf M}={\bf M}_{1}{\bf M}_{2}^{*} for some ๐Œ ๐Ÿ , ๐Œ 2 โˆˆ โ„ฌ {\bf M_{1}},{\bf M}_{2}\in\mathcal{B} .

โ€ข Define ( โ„ฌโ„ฌ โˆ— ) w \left(\cal{BB}^{*}\right)^{w} as the set of matrices ๐Œ {\bf M} that can be expressed as ๐Œ = ๐Œ w โ€‹ โ€ฆ โ€‹ ๐Œ 2 โ€‹ ๐Œ 1 {\bf M}={\bf M}_{w}\ldots{\bf M}_{2}{\bf M}_{1} , with each ๐Œ i โˆˆ ( โ„ฌโ„ฌ โˆ— ) โ€‹ ( 1 โ‰ค i โ‰ค w ) . {\bf M}_{i}\in\left(\cal{BB}^{*}\right)(1\leq i\leq w). (The notation w w represents width.)

โ€ข Define ( โ„ฌโ„ฌ โˆ— ) e w \left(\cal{BB}^{*}\right)^{w}_{e} as the set of n ร— n n\times n matrices ๐Œ {\bf M} that can be expressed as ๐Œ = ๐’๐„๐’ โŠค {\bf M}={\bf SES}^{\top} for some e โ€‹ n ร— e โ€‹ n en\times en matrix ๐„ โˆˆ ( โ„ฌโ„ฌ โˆ— ) w {\bf E}\in\left(\cal{BB}^{*}\right)^{w} , where ๐’ โˆˆ ๐”ฝ n ร— e โ€‹ n = [ ๐ˆ n 0 โ€ฆ 0 ] ] {\bf S}\in\mathbbm{F}^{n\times en}=\begin{bmatrix}{\bf I}_{n}&0&\ldots&0\end{bmatrix}] (i.e. ๐Œ {\bf M} is the upper-left corner of ๐„ {\bf E} ). (The notation e e represents expansion relative to n n .)

We similarly show how BaseConv can simulate any kaleidoscope matrix.

###### Lemma H.18 .

Given n , d โ‰ฅ 2 n,d\geq 2 , e > 0 e>0 for any n โ€‹ d ร— n โ€‹ d nd\times nd matrix ๐Œ โˆˆ ( โ„ฌโ„ฌ โˆ— ) e w {\bf M}\in\left(\cal{BB}^{*}\right)^{w}_{e} , and ๐ฑ โˆˆ โ„ n โ€‹ d \bm{x}\in\mathbbm{R}^{nd} there exists a ( N , L , d , N โ€ฒ , d โ€ฒ ) โˆ’ BaseConv \left(N,L,d,N^{\prime},d^{\prime}\right)-\text{{BaseConv}} that can represent ๐Œ โ‹… ๐ฑ {\bf M}\cdot\bm{x} with N = n , L = ๐’ช โก ( w โ€‹ log โก ( e โ€‹ n โ€‹ d ) ) N=n,L=\mathcal{O}(w\log(end)) , N โ€ฒ = e โ€‹ n , N^{\prime}=en, and d โ€ฒ = d \ d^{\prime}=d .

###### Proof.

By Definition H.17 , ๐Œ {\bf M} can be decomposed with respect to size e โ€‹ n โ€‹ d ร— e โ€‹ n โ€‹ d end\times end matrix ๐„ = ๐„ 1 โ‹… ๐„ 2 โ‹ฏ ๐„ w . {\bf E}={\bf E}_{1}\cdot{\bf E}_{2}\cdots{\bf E}_{w}.