Faster LLM Prefill With Low-Complexity Matrix Multiplication

Low-complexity matrix multiplication schemes compute the product of matrices with fewer multiplications than the textbook algorithm, at the cost of increased memory usage, limiting their practical use. Two techniques are presented to ameliorate this. First, in the neural network setting, computation of a scheme’s linear functionals can be fused with the operation preceding matrix multiplication. A way to do this in an LLM’s MLP block is described. Second, the number of writes induced by a scheme can be reduced by taking advantage of common subexpressions in its output formula. We prove the minimal number of writes induced by a scheme under this construction is seven, whereas the minimum without this construction is twelve. In ablations, common subexpressions improve performance by 2.9–3.8% and both techniques together speed up large prefills on the recent Muse Glimmer [1] and Qwen3.8 27B [2] models by 2.0–4.7% (Figure 1).

Writes that Matter figure 1

Figure 1. Batch-1 BF16 prefill wall-clock speedup over vLLM [3] on a B200 as a function of token count for two models using the low-complexity matrix multiplication techniques described here. Points are medians and error bars are interquartile ranges across ten matched fresh-process rounds, with 40 cold-L2 passes per arm per round. Code to reproduce this is is here.

1 Introduction

All low-complexity matrix multiplication schemes have the same structure. For n×nn\times n matrices XX and YY over a ring R\mathcal{R}, a low-complexity scheme requiring RR multiplications first computes linear combinations of the elements of each matrix,

A(X)={A(i)(X)i[R]}B(Y)={B(i)(Y)i[R]},\begin{gathered} A(X) = \{ A^{(i)}(X)\mid i\in [R]\} \\ B(Y) = \{ B^{(i)}(Y)\mid i\in [R]\}, \end{gathered}

where A(i),B(i):Rn×nRA^{(i)},B^{(i)} : \mathcal{R}^{n\times n} \to \mathcal{R} are linear functionals. Then, their element-wise products, P(i)=A(i)B(i)P^{(i)}=A^{(i)}B^{(i)}, are computed and combined into the result,

(XY)ij=r=1Rρij(r)P(r).(XY)_{ij} = \sum_{r=1}^R \rho^{(r)}_{ij} P^{(r)}.

A challenge in implementing low-complexity schemes is memory traffic incurred while reading X,YX,Y and writing A(X),B(Y)A(X),B(Y), as the textbook algorithm consumes X,YX,Y directly. Recent work to address this employs clever tiling [4] or specializes for schemes which allow overlapping P(1)P^{(1)}’s computation with A(X)A(X) [5]. The first idea of this work is, in the neural network context, †1 to fuse computation of AA with the operation preceding matrix multiplication. For example, if ff precedes matrix multiplication, then we convert

ZfXAA(X)intoZAfA(X),Z \xrightarrow{f} X \xrightarrow{A} A(X) \quad\text{into}\quad Z \xrightarrow{A\circ f} A(X),

removing much of A(X)A(X)’s memory overhead. Fusion into AfA\circ f can require cleverness, which §3 discusses in the context of an LLM’s MLP.

Low-complexity schemes also incur memory overhead in the reconstitution of P(i)P^{(i)}’s into output elements, as a naive implementation requires a write to global memory for every nonzero element of ρ\rho to accumulate ρij(r)P(r)\rho^{(r)}_{ij}P^{(r)}. Fortunately, however, some low-complexity schemes’ output expressions have shared subexpressions, which can be taken advantage of to reduce memory writes.

For example, consider a chain of LL products,

Qt=λtP(rt),λtR{0},t[L],Q_t=\lambda_tP^{(r_t)},\quad \lambda_t\in\mathbb{R}\setminus\{0\},\quad t\in[L],

with prefix sums

St=u=1tQu.S_t = \sum_{u=1}^{t} Q_u.

For output index ijij, let dij,t=λt1ρij(rt)d_{ij,t} = \lambda_t^{-1}\rho^{(r_t)}_{ij}, dij,L+1=0d_{ij,L+1}=0, and σij,t=dij,tdij,t+1\sigma_{ij,t}=d_{ij,t}-d_{ij,t+1}. By exchanging the summation order and telescoping,

t=1Lσij,tSt=u=1Ldij,uQu=u=1Lρij(ru)P(ru).\sum_{t=1}^{L}\sigma_{ij,t}S_t = \sum_{u=1}^{L}d_{ij,u}Q_u = \sum_{u=1}^{L}\rho^{(r_u)}_{ij}P^{(r_u)}.

However, because σij,t\sigma_{ij,t} is only non-zero when dij,tdij,t+1d_{ij,t}\neq d_{ij,t+1}, the number of memory writes needed †2 to realize this chain is how many times dij,td_{ij,t} changes, not the number of non-zero elements of ρ\rho. Theorem 1 proves every chaining of a 2×22\times 2 scheme induces at least seven writes, and §A provides a seven-write scheme. In contrast, the minimal number of writes induced by an unchained seven-multiplication 2×22\times 2 scheme is twelve (Lemma 4).

Contributions. We imagine this work being deployed in the disaggregated prefill setting, wherein prefill and decode execute on separate GPUs [6] [7], as a scheme’s B(Y)B(Y) linear functionals are larger than the weight matrix they replace, reducing memory available for large decode-stage KV caches [3]. In this setting, our contributions are:

  1. The first, to our knowledge, implementation of a low-complexity matrix multiplication scheme on the Blackwell architecture [8]. While work on practical low-complexity matrix multiplication has continued post-Blackwell [4] [5], older GPUs have been targeted. Roofline analysis [9] in §2.2 suggests this may be due to Blackwell being uniquely hostile to low-complexity schemes’ memory requirements (Figure 2).

  2. A way to use low-complexity schemes in the neural network setting by fusing computation of a scheme’s linear functionals into the operation preceding matrix multiplication. §3 describes how to do this for the MLP block of an LLM, where fusion is complicated by SwiGLU\operatorname{SwiGLU} nonlinearity.

  3. Chaining, a method for reducing memory traffic induced by a scheme during reconstitution of its products into output elements, together with a lower bound. Every chaining of every seven-multiplication 2×22\times2 scheme induces at least seven writes (Theorem 1). The scheme of §A attains this.

2 Background & Related Work

2.1 Low-Complexity Schemes

The shared structure of low-complexity schemes is due to RR-multiplication n×nn\times n schemes corresponding to rank-RR decompositions of the n×nn\times n matrix multiplication tensor [10] [11]. Recent years have witnessed considerable progress on techniques for finding low-rank decompositions of this tensor [12] [13]. This can aid implementations; for example, some schemes require fewer additions to compute A(X)A(X) and our optimal 2×22\times 2 scheme admitting a seven-write chaining was discovered via search over thousands of rank-seven decompositions of the 2×22\times 2 matrix multiplication tensor.

An s×ss\times s scheme can be lifted to compute the product of sn×snsn\times sn matrices by interpreting them as s×ss\times s matrices over the ring of n×nn\times n matrices. We’ll prove this for the s=2s=2 case, but the main idea is easily translated to arbitrary ss and non-square matrices with dimensions divisible by ss.

For 2n×2n2n\times 2n matrices X,YX,Y and any length-2n2n vector xx, write x(1)x^{(1)} and x(2)x^{(2)} to denote the first and second halves of xx and likewise divide X,YX,Y into four n×nn\times n submatrices.

x=(x(1)x(2)),X=(X(11)X(12)X(21)X(22)),Y=(Y(11)Y(12)Y(21)Y(22)).x = \begin{pmatrix} x^{(1)} \\ x^{(2)} \end{pmatrix}, \quad X = \begin{pmatrix} X^{(11)} & X^{(12)} \\ X^{(21)} & X^{(22)} \end{pmatrix}, \quad Y = \begin{pmatrix} Y^{(11)} & Y^{(12)} \\ Y^{(21)} & Y^{(22)} \end{pmatrix}.

After mechanically expanding the matrix product applied to an arbitrary input,

XYx=(X(11)X(12)X(21)X(22))(Y(11)x(1)+Y(12)x(2)Y(21)x(1)+Y(22)x(2))=((X(11)Y(11)+X(12)Y(21))x(1)+(X(11)Y(12)+X(12)Y(22))x(2)(X(21)Y(11)+X(22)Y(21))x(1)+(X(21)Y(12)+X(22)Y(22))x(2))=(X(11)Y(11)+X(12)Y(21)X(11)Y(12)+X(12)Y(22)X(21)Y(11)+X(22)Y(21)X(21)Y(12)+X(22)Y(22))x,\begin{aligned} &XYx \\ &= \begin{pmatrix} X^{(11)} & X^{(12)} \\ X^{(21)} & X^{(22)} \end{pmatrix} \begin{pmatrix} Y^{(11)}x^{(1)} + Y^{(12)}x^{(2)} \\ Y^{(21)}x^{(1)} + Y^{(22)}x^{(2)} \end{pmatrix} \\ &= \begin{pmatrix} (X^{(11)}Y^{(11)} + X^{(12)}Y^{(21)})x^{(1)} + (X^{(11)}Y^{(12)} + X^{(12)}Y^{(22)})x^{(2)} \\ (X^{(21)}Y^{(11)} + X^{(22)}Y^{(21)})x^{(1)} + (X^{(21)}Y^{(12)} + X^{(22)}Y^{(22)})x^{(2)} \end{pmatrix} \\ &= \begin{pmatrix} X^{(11)}Y^{(11)} + X^{(12)}Y^{(21)} & X^{(11)}Y^{(12)} + X^{(12)}Y^{(22)} \\ X^{(21)}Y^{(11)} + X^{(22)}Y^{(21)} & X^{(21)}Y^{(12)} + X^{(22)}Y^{(22)} \end{pmatrix} x, \end{aligned}

it is clear the product of a reinterpretation of X,YX,Y as 2×22\times 2 matrices of n×nn\times n matrices agrees with their standard product on all inputs, so is the same linear function, i.e. is the same matrix. A 2×22\times 2 scheme valid over arbitrary rings gives an alternative way to compute the formula for the re-interpreted matrix product, and therefore an alternative way to compute XYXY, as n×nn\times n matrices are themselves a ring with matrix addition and multiplication.

2.2 Low-Complexity Scheme Implementations

Writes that Matter figure 2

Figure 2. Predicted value of nn for which a 2×22\times2, seven-multiplication scheme that does not fuse linear-functional computation multiplies n×nn\times n matrices faster than the textbook algorithm. C1060, C2050, and K10 GPUs consider four-byte floats, as two-byte floats are unsupported; the remaining GPUs consider two-byte floats.

As modern GPUs have increased the ratio of floating-point operations per second to memory bandwidth, so too has the difficulty of implementing low-complexity matrix multiplication schemes; hence a long history of efforts beginning with Li et al.’s 2011 work on the NVIDIA Tesla C1060 [14], followed in 2013 by Lai et al. on NVIDIA Fermi and Kepler GPUs [15], in 2020 and 2022 by Huang et al. and AlphaTensor on the NVIDIA V100 [16] [12], and in 2026 by SubCuber [5] and FalconGEMM [4] on the NVIDIA H200, A100 and H20 GPUs.

To explain this growing difficulty, let PP be a GPU’s floating-point operations per second and BB be its memory bandwidth in bytes per second. It is typical [9] to model the time required to multiply two n×nn\times n matrices of two-byte floating-point numbers with the textbook algorithm as

TMM(n)=max(2n3P,4n2B),T_\text{MM}(n) = \max \left(\frac{2n^3}{P},\frac{4n^2}{B}\right),

where the maximum of compute and memory time is taken as efficient implementations overlap memory and compute. We omit the memory cost incurred writing the result to memory for simplicity, though, as discussed, including it would further benefit the textbook algorithm for comparison purposes.

A standard implementation of an RR-multiplication s×ss\times s scheme will incur

4n2n2s2read X,Y+4Rn2s2write A(X),B(Y)\underbrace{4n^2\vphantom{\frac{n^2}{s^2}}}_{\text{read } X,Y} + \underbrace{4R\frac{n^2}{s^2}}_{\text{write } A(X),B(Y)}

bytes of memory traffic while computing its linear functionals, for a total time cost of

TLC(n)=4n2B(1+Rs2)+max(2Rn3s3P,4Rn2s2B).T_\text{LC}(n)=\frac{4n^2}{B}(1+\frac{R}{s^2})+\max\left(\frac{2R\frac{n^3}{s^3}}{P}, \frac{4R\frac{n^2}{s^2}}{B} \right).

In the compute-bound regime, solving for when a low-complexity scheme is predicted to be faster than a textbook matrix multiply yields

TLC(n)<TMM(n)    n>2PB1+Rs21Rs3.T_{\mathrm{LC}}(n) < T_{\mathrm{MM}}(n) \iff n > \frac{2P}{B} \frac{1+\frac{R}{s^2}} {1-\frac{R}{s^3}}.

Plotting this cutoff for a seven-multiplication 2×22\times 2 scheme and each mentioned GPU (Figure 2) motivates our decision to fuse linear functional computation.

2.2.1 FalconGEMM

Our low-complexity matrix multiplication implementation builds on several great insights from the work of Zhu et al. on FalconGEMM [4].

First, for the purposes of computing linear functional outputs, Zhu et al. notice that, for an s×ss\times s scheme, each tile of linear functional output depends only on s2s^2 corresponding tiles in the linear functional input. For example, when s=2s=2 the illustration below shows how a CTA can compute a tile of every linear functional’s output when it owns four tiles of the input.

Writes that Matter figure 3

This is possible because the operations in linear functional computation, matrix addition and scalar multiplication, happen elementwise. We make use of this observation in designing our fused kernels.

Second, like FalconGEMM, we assign each CTA to a distinct tile of the output, which allows overlapping writing ρ(r)P(r)\rho^{(r)}P^{(r)} to global memory with computing P(r+1)P^{(r+1)}. †3 However, as Zhu et al. note, this increases the amount of computation per CTA, thereby increasing the opportunity cost of underfull waves. For example, the illustration below shows a case where, for a 2×12\times 1 per-CTA tile size and a GPU capable of executing a 1×21\times 2 grid of CTAs, the third wave of execution is underfull, leaving one CTA worth of computation on the table.

Writes that Matter figure 4

FalconGEMM resolves this via somewhat-involved scheduling whereby computation of P(i)P^{(i)}s is divided up amongst the GPU’s processors according to a schedule which maximizes the frequency with which a single processor owns P(1),,P(R)P^{(1)},\dots,P^{(R)}. So, in the example above, computation of the third wave’s tile would be divided among two processors, one of which computed P(1),,P(R/2)P^{(1)},\dots,P^{(R/2)} and the other the rest. This improves utilization at the cost of cross-CTA coordination, as P(R/2+1)P^{(R/2+1)}’s accumulation into global memory must be ordered with respect to the previous product’s writes to avoid overwriting.

Perhaps due to a skill issue (FalconGEMM is not open source at the time of writing), or perhaps due to particularities of the GPU (B200 versus A100 and H20), we were unable to implement this scheduling in a way that improved performance. Instead, we achieve a similar effect by varying per-CTA tile sizes in later waves. For example, we might assign CTAs in wave three 1×11\times 1 tiles.

Writes that Matter figure 5

This improves utilization at the potential cost of tensor core utilization in smaller tiles in late waves.

3 Linear Functional Fusion

Consider the MLP in the Muse Glimmer model which, on an input XX, computes

X(1)RMSNormX(2)Wgate,upX(3)SwiGLUX(4)WdownMLP(X(1)).X^{(1)} \xrightarrow{\,\operatorname{RMSNorm}} X^{(2)} \xrightarrow{\,W_\text{gate,up}} X^{(3)} \xrightarrow{\,\operatorname{SwiGLU}} X^{(4)} \xrightarrow{\,W_\text{down}} \operatorname{MLP}(X^{(1)}).

vLLM spends roughly two-thirds of 4096-token prefill execution time here, hence interest in speeding it up. This section transforms the MLP into

X(1)ARMSNormA(X(2))ASwiGLUWgate,upA(X(4))WdownMLP(X(1)),X^{(1)} \xrightarrow{\,A\circ\operatorname{RMSNorm}\,} A(X^{(2)}) \xrightarrow{\,A\circ\operatorname{SwiGLU}\circ W_{\text{gate,up}}\,} A(X^{(4)}) \xrightarrow{\,W_{\text{down}}\,} \operatorname{MLP}(X^{(1)}),

where the Wgate,upW_\text{gate,up} and WdownW_\text{down} matrix multiplications are, naturally, performed with low-complexity schemes.

For the remainder of this section, fix a 2×22\times 2 low-complexity scheme and suppose X,YR2n×2nX,Y\in\mathcal{R}^{2n\times 2n} are square matrices. The scheme thus views XX as a 2×22\times 2 matrix over Rn×n\mathcal{R}^{n\times n},

Writes that Matter figure 6

In turn, each linear functional is of the form

A(i)(X)=α11(i)X(11)++α22(i)X(22).A^{(i)}(X) = \alpha^{(i)}_{11}X^{(11)}+\dots+\alpha^{(i)}_{22}X^{(22)}.

Recall that, in the neural network setting, B(Y)B(Y) can be precomputed, as YY is a weight matrix, so we consider only A(X)A(X).

The RMSNorm kernel in vLLM assigns each CTA a row of RMSNorm(X)\operatorname{RMSNorm}(X), which is incompatible with CTAs being responsible for a tile of A(X)A(X), as row ii of AA is a function of rows ii and i+ni+n of XX,

Ai(j)(X)=α11(j)Xi(11)++α22(j)Xi(22)α11(j)Xi++α22(j)Xi+n.A^{(j)}_i(X) = \alpha^{(j)}_{11}X^{(11)}_i+\dots+\alpha^{(j)}_{22}X^{(22)}_i \approx \alpha^{(j)}_{11}X_i+\dots+\alpha^{(j)}_{22}X_{i+n}.

Hence, to compute A(RMSNorm(X))A(\operatorname{RMSNorm}(X)), CTA i[n]i\in [n] is assigned rows ii and i+ni+n of RMSNorm(X)\operatorname{RMSNorm}(X), then takes the requisite linear combinations of RMSNorm(X)i(11)\operatorname{RMSNorm}(X)^{(11)}_i, RMSNorm(X)i(12)\operatorname{RMSNorm}(X)^{(12)}_i, RMSNorm(X)i(21)\operatorname{RMSNorm}(X)^{(21)}_i, and RMSNorm(X)i(22)\operatorname{RMSNorm}(X)^{(22)}_i, which it has just computed, to compute the iith row of each linear functional.

The ASwiGLUWgate,upA\circ\operatorname{SwiGLU}\circ W_{\text{gate,up}} kernel assigns each CTA four tiles of Wgate,up(A(X(2)))W_\text{gate,up}(A(X^{(2)})), one per low-complexity quadrant,

Writes that Matter figure 7

Each of these tiles is computed per the low-complexity scheme, then, per the SwiGLU\operatorname{SwiGLU} function (SwiGLU(g,u)=SiLU(g)u\operatorname{SwiGLU(g,u)}=\operatorname{SiLU}(g)\odot u), are folded together by the CTA.

Writes that Matter figure 8

This leaves each CTA with two tiles of SwiGLU\operatorname{SwiGLU} output, not enough to compute a tile of ASwiGLUA\circ \operatorname{SwiGLU}. Suppose, however, the width of CTAi\mathrm{CTA}_i’s tile is 2k2k columns, and consider a permutation, PP, of the columns of the SwiGLU\operatorname{SwiGLU} output which moves odd-numbered width-kk groups of columns to the right half of the matrix.

Writes that Matter figure 9

Each CTA owns four tiles of a version of the SwiGLU\operatorname{SwiGLU}’s output with PP applied.

Writes that Matter figure 10

Hence, without any data movement, each CTA in our kernel actually computes a tile of A(XSwiGLUP)A(X^{\operatorname{SwiGLU}}P), and B(P1Y)B(P^{-1}Y) is fed in as the second argument to the low-complexity WdownW_\text{down} computation, compensating for the permutation and yielding MLP(X(1))\operatorname{MLP}(X^{(1)}), as expected.

4 Optimal Schemes, Chains

The seven-write chaining of a 2×22\times 2 scheme used by our implementation (§A) is optimal; i.e. there is no six-write chaining of a seven-multiplication 2×22\times 2 scheme.

An LL-product chain is a scaling and reordering of a subset of a scheme’s products

λ1P(r1),,λLP(rL),\lambda_1P^{(r_1)}, \dots, \lambda_LP^{(r_L)},

where λ1,,λL\lambda_1,\ldots,\lambda_L are nonzero, along with a write schedule w(u)R2×2w^{(u)}\in \mathbb{R}^{2\times 2} which indicates that prefix sum

Su=v=1uλvP(rv)S_u=\sum_{v=1}^u\lambda_vP^{(r_v)}

should be accumulated (written) into output ijij after being scaled by wij(u)w^{(u)}_{ij}. The total number of writes induced by a chain is therefore the number of non-zero elements in its write schedule, v=1Lw(v)0.\sum_{v=1}^L\|w^{(v)}\|_0. A chaining of a scheme is a partitioning of its products into chains whose write schedules collectively compute the scheme.

Theorem 1. The minimum number of writes induced by a chaining of a seven-multiplication 2×22\times 2 scheme over R\mathbb{R} is seven.

Lemma 1. The coefficients on products in a seven-multiplication scheme for 2×22\times 2 matrix multiplication are non-proportional; i.e. if iji\neq j then there is no non-zero scalar λ\lambda such that ρ(i)=λρ(j)\rho^{(i)}= \lambda\rho^{(j)}.

Proof. Per deGroote’s 1978 proof [18], all seven-multiplication schemes are equivalent to Strassen’s [19] modulo sandwich, scaling, and permutation symmetries. In particular, a scheme with decomposition r=1Rα(r)β(r)ρ(r)\sum_{r=1}^R\alpha^{(r)}\otimes\beta^{(r)}\otimes\rho^{(r)} is related via a sandwich symmetry to one with decomposition r=1Rα(r)β(r)ρ(r)\sum_{r=1}^R\alpha'^{(r)}\otimes\beta'^{(r)}\otimes\rho'^{(r)} if

α(r)=Pα(r)Q1,β(r)=Qβ(r)R1,(ρ(r))T=R(ρ(r))TP1,\alpha'^{(r)} = P\alpha^{(r)} Q^{-1}, \qquad \beta'^{(r)} = Q\beta^{(r)} R^{-1}, \qquad (\rho'^{(r)})^{T} = R(\rho^{(r)})^{T}P^{-1},

for invertible matrices P,Q,RP,Q,R; summands arα(r)brβ(r)crρ(r)a_r\alpha^{(r)}\otimes b_r\beta^{(r)}\otimes c_r\rho^{(r)} with nonzero ar,br,cra_r,b_r,c_r satisfying arbrcr=1a_rb_rc_r=1 are related by a scaling symmetry to α(r)β(r)ρ(r)\alpha^{(r)}\otimes \beta^{(r)}\otimes \rho^{(r)}; and schemes are related via a permutation symmetry if a reordering of one’s summands yields the other. Applied to the ρ\rho coefficients of a scheme, this yields

ρ(r)=μrM(ρSπ(r)),\rho^{(r)}=\mu_r M(\rho^{\pi(r)}_S),

where ρS(1),,ρS(7)\rho^{(1)}_S,\dots,\rho^{(7)}_S are Strassen’s coefficients, μr\mu_r is a non-zero scalar, MM is an invertible linear map, and π\pi is a permutation.

By inspection, the usual Strassen coefficients,

ρS(1)=(1001),ρS(2)=(0011),ρS(3)=(0101),ρS(4)=(1010),\rho^{(1)}_S = \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix}, \quad \rho^{(2)}_S = \begin{pmatrix} 0 & 0 \\ 1 & -1 \end{pmatrix}, \quad \rho^{(3)}_S = \begin{pmatrix} 0 & 1 \\ 0 & 1 \end{pmatrix}, \quad \rho^{(4)}_S = \begin{pmatrix} 1 & 0 \\ 1 & 0 \end{pmatrix},
ρS(5)=(1100),ρS(6)=(0001),ρS(7)=(1000),\rho^{(5)}_S = \begin{pmatrix} -1 & 1 \\ 0 & 0 \end{pmatrix}, \quad \rho^{(6)}_S = \begin{pmatrix} 0 & 0 \\ 0 & 1 \end{pmatrix}, \quad \rho^{(7)}_S = \begin{pmatrix} 1 & 0 \\ 0 & 0 \end{pmatrix},

are non-proportional. So, towards a contradiction, if ρ(i)=λρ(j)\rho^{(i)}=\lambda\rho^{(j)} for some iji\neq j and non-zero scalar λ\lambda in a seven-multiplication 2×22\times 2 scheme, then

μiM(ρSπ(i))=λμjM(ρSπ(j))soρSπ(i)=λμjμiρSπ(j),\mu_iM(\rho^{\pi(i)}_S) = \lambda \mu_jM(\rho^{\pi(j)}_S) \quad\text{so}\quad \rho^{\pi(i)}_S = \frac{\lambda \mu_j}{\mu_i}\rho^{\pi(j)}_S,

but this contradicts the non-proportionality of Strassen’s coefficients. Hence, ρ(i)\rho^{(i)} and ρ(j)\rho^{(j)} are non-proportional. ◻

Lemma 2. The products of a seven-multiplication scheme for 2×22\times 2 matrix multiplication are linearly independent.

Proof. If, modulo reordering and towards a contradiction,

P(7)=i=16λiP(i),P^{(7)} = \sum_{i=1}^6 \lambda_iP^{(i)},

then there is a rank-six decomposition of the 2×22\times 2 matrix multiplication tensor,

XY=i=16ρ(i)P(i)+ρ(7)P(7)=i=16(ρ(i)+λiρ(7))P(i),XY = \sum_{i=1}^6 \rho^{(i)}P^{(i)} + \rho^{(7)}P^{(7)} = \sum_{i=1}^6 (\rho^{(i)}+\lambda_i\rho^{(7)})P^{(i)},

contradicting Winograd’s 1971 result [20] that 2×22\times 2 matrix multiplication requires seven multiplications. ◻

Lemma 3. Let

ρ^(rv)=λv1ρ(rv)\widehat{\rho}^{(r_v)} = \lambda_v^{-1}\rho^{(r_v)}

for v[L]v\in[L], and let ρ^(rL+1)\widehat{\rho}^{(r_{L+1})} be 00. The number of writes at step vv of an LL-product chain is

ρ^(rv)ρ^(rv+1)0.\|\widehat{\rho}^{(r_v)}-\widehat{\rho}^{(r_{v+1})}\|_0.

Proof. A chain’s contribution to the output is

u=1Lw(u)Su=u=1Lw(u)(v=1uλvP(rv))=v=1Lλv(u=vLw(u))P(rv).\sum_{u=1}^{L} w^{(u)} S_u = \sum_{u=1}^{L} w^{(u)} \left(\sum_{v=1}^{u} \lambda_v P^{(r_v)}\right) = \sum_{v=1}^{L} \lambda_v \left(\sum_{u=v}^{L} w^{(u)}\right)P^{(r_v)}.

Per Lemma 2 and because the chaining correctly computes the scheme, the coefficient on P(rv)P^{(r_v)} must be ρ(rv)\rho^{(r_v)}, hence ρ(rv)=λvu=vLw(u),\rho^{(r_v)} = \lambda_v\sum_{u=v}^{L} w^{(u)}, so ρ^(rv)=u=vLw(u),\widehat{\rho}^{(r_v)} = \sum_{u=v}^{L} w^{(u)}, and therefore w(v)=ρ^(rv)ρ^(rv+1),w^{(v)} = \widehat{\rho}^{(r_v)} - \widehat{\rho}^{(r_{v+1})}, and w(v)0=ρ^(rv)ρ^(rv+1)0\|w^{(v)}\|_0 = \|\widehat{\rho}^{(r_v)}-\widehat{\rho}^{(r_{v+1})}\|_0. ◻

Proof of Theorem 1. In any length-LL chain for a seven-multiplication 2×22\times 2 scheme, as ρ^(rL+1)\widehat{\rho}^{(r_{L+1})} is definitionally zero, by Lemma 3

w(L)0=ρ^(rL)ρ^(rL+1)0=ρ^(rL)0,\|w^{(L)}\|_0 = \|\widehat{\rho}^{(r_L)}-\widehat{\rho}^{(r_{L+1})}\|_0 = \|\widehat{\rho}^{(r_L)}\|_0,

so w(L)01\|w^{(L)}\|_0\geq 1 as ρ(rL)\rho^{(r_L)} being zero would allow P(rL)P^{(r_L)} to be removed from the scheme, yielding a six-multiplication scheme, contradicting the minimality of seven-multiplication 2×22\times 2 schemes [20]. Moreover, for v<Lv<L

w(v)0=ρ^(rv)ρ^(rv+1)0\|w^{(v)}\|_0 = \|\widehat{\rho}^{(r_v)}-\widehat{\rho}^{(r_{v+1})}\|_0

is zero only if

λv1ρ(rv)=λv+11ρ(rv+1),\lambda_v^{-1}\rho^{(r_v)} = \lambda_{v+1}^{-1}\rho^{(r_{v+1})},

so per Lemma 1 w(v)01\|w^{(v)}\|_0\geq 1. Hence, a length-LL chain induces at least LL writes. The sum of lengths of chains in a chaining of a scheme is the number of products in the scheme, so every chaining induces at least seven writes. The seven-write chaining of §A attains this lower bound. ◻

5 Evaluation

Having established our kernels can speed up large prefills (Figure 1), our evaluations consider three questions: (1) Do the different floating-point numerics of low-complexity schemes degrade model performance? (2) Does reducing the number of writes, à la chaining, speed up our implementation? (3) Are prefill speedups due to our MLP fusion design or low-complexity schemes? All three resolve favorably for low-complexity schemes.

All these experiments ran on an NVIDIA B200 (180 GB HBM), vLLM commit 99a10304d, PyTorch 2.13.0/CUDA 13.0, and Triton 3.7.1. We used BF16 Muse Glimmer 30B and Qwen3.8 27B checkpoints. Timings used fresh-process runs, a clear L2 cache, and LLM prefill measurements used batch size one.

5.1 Low-Complexity Numerics

Following the evaluation used by Atom [21], we measure perplexity on the WikiText-2 test set [22]. We use a context length of 2,048 and BF16 weights and activations. Table 1 compares the stock implementation and the mean of six independent runs using our kernels. Our overall effect on perplexity is less than three hundredths of one percent for both models.

ModelStockOursRelative change
Muse Glimmer8.1823288.182803+0.0058%+0.0058\%
Qwen9.2932229.295323+0.0226%+0.0226\%

Token-level perplexity on WikiText-2. “Ours” is the mean of six independent runs. 95% confidence intervals for the relative change are [0.0009%,0.0125%][-0.0009\%,0.0125\%] for Muse Glimmer and [0.0210%,0.0242%][0.0210\%,0.0242\%] for Qwen.

Following FlashAttention-3’s operator-level analysis [23], we also compare the outputs of the conventional and low-complexity MLP computations. At a prefill length of 2,048, the relative Frobenius error is 4.44×1034.44\times10^{-3} after the gate and up projections and 8.58×1038.58\times10^{-3} after the down projection.

To determine how these local differences propagate through the model, we evaluate stock vLLM versus our kernels on HellaSwag [24], ARC-Challenge [25], and the high-school mathematics subset of MMLU [26]. We report normalized accuracy for HellaSwag and ARC-Challenge (as is conventional) and accuracy for MMLU.

ModelKernelHellaSwagARC-ChallengeMMLU HS Math
Muse GlimmerStock82.7262.3751.48
Ours82.7762.8052.22
QwenStock82.8658.7961.48
Ours82.8958.6261.48

Task accuracy in percent. HellaSwag and ARC-Challenge use normalized accuracy.

Across the six model-task pairs, the change ranges from 0.17-0.17 to +0.74+0.74 percentage points, and every difference is smaller than the corresponding per-arm standard error. Taken together, operator errors, perplexity measurements, and downstream evaluations suggest our kernels have little impact on model behavior.

5.2 Chaining Ablation

Writes that Matter figure 11

Figure 3. Speedup from scheme chaining for square BF16 matrix multiplications versus unchained kernels with a clear L2 cache. Points are medians of ten paired round-level speedups; lines show the interquartile range.

Figure 3 ablates scheme chaining. The unchained comparison was independently optimized at each matrix size. †4 Even against this tuned control, chaining improves performance by 2.92.93.8%3.8\% across the tested sizes.

5.3 Low-Complexity Ablation

Writes that Matter figure 12

Figure 4. Batch-1 BF16 Muse Glimmer prefill wall-clock comparisons on a B200. (Left) Stock vLLM is faster than the textbook (rank-eight) 2×22\times 2 scheme on all measured sizes. (Right) A rank-seven 2×22\times 2 scheme (the seven-write appendix) beats the textbook one at all measured sizes. Points are medians and error bars are interquartile ranges across ten matched fresh-process three-arm rounds, with 40 cold-L2 passes per arm per round.

An interpretation of the textbook matrix-multiplication algorithm as a rank-eight scheme admits, structurally, the same fusion as our MLP-replacement kernels but without reduced multiplications. Figure 4 compares the performance of this reinterpretation of the textbook scheme with stock vLLM and our rank-seven scheme at various prefill sizes. Despite tuning the rank-eight kernel to achieve near-identical active-warp percentages and using chaining †5, the rank-seven scheme outperforms the textbook one at all measured sizes. It seems prefill performance increases are due to low-complexity schemes, not a side-effect of our fusion design.

6 Limitations & Future Work

One cause of increased memory usage in low-complexity schemes remains unaddressed by this work: Under a seven-multiplication 2×22\times 2 scheme, B(Y)B(Y) linear functionals are 75% larger than the weight matrices they replace, as, in general, an RR-multiplication s×ss\times s scheme’s linear functionals have size Rs2YRs^{-2}|Y|. For Muse Glimmer and Qwen3.8 27B storing B(Y)B(Y) instead of weight matrices increases storage by 52.22% and 46.2%, respectively. In the disaggregated prefill setting we consider here, this is not problematic for the GPU, prefill sizes, or models. We leave balancing the tradeoff between storage, transformation cost, and throughput in the decode setting to future work.

We leave one possible direction for resolving this. As B(Y)B(Y) is a redundant encoding of YY, one might search for schemes which allow exploitation of shared sub-terms in linear functionals to partially materialize B(Y)B(Y), then fully materialize B(Y)B(Y) on demand. The scheme in §A, for example, admits a compressed representation in this way. Given B(1)(Y),B^{(1)}(Y), B(2)(Y),B^{(2)}(Y), B(5)(Y),B^{(5)}(Y), and B(7)(Y)B^{(7)}(Y) one can construct the remaining linear functional outputs via

B(3)(Y)=B(7)(Y)B(5)(Y),B(4)(Y)=B(5)(Y)B(1)(Y)B(7)(Y),B(6)(Y)=B(2)(Y)+B(5)(Y)B(7)(Y).\begin{gathered} B^{(3)}(Y)=B^{(7)}(Y)-B^{(5)}(Y), \\ B^{(4)}(Y) = B^{(5)}(Y)-B^{(1)}(Y)-B^{(7)}(Y), \\ B^{(6)}(Y)=B^{(2)}(Y)+B^{(5)}(Y)-B^{(7)}(Y). \end{gathered}

Hence, with no storage penalty, one could store B(1)(Y),B^{(1)}(Y), B(2)(Y),B^{(2)}(Y), B(5)(Y),B^{(5)}(Y), and B(7)(Y)B^{(7)}(Y) and compute the remaining values online.

7 Conclusion

We believe the common belief that low-complexity matrix multiplication schemes are impractical for practical matrix sizes may be false. While, in isolation, roofline analysis indicates memory overhead incurred computing linear functionals is unfavorable on modern GPUs (§2.2), in practice, much contemporary matrix multiplication occurs in the neural network setting where linear functional computation can be fused with the operation preceding matrix multiplication (§3). Moreover, a novel chaining technique (§4) can reduce the memory overhead incurred in reconstituting a scheme’s products into its output. Our implementation of these techniques speeds up large prefills on the recent Muse Glimmer [1] and Qwen3.8 27B [2] models (Figure 1).

Appendix

A 2×22\times 2 scheme with a seven-write chaining

The scheme’s linear functionals are

rA(r)(X)B(r)(Y)1X(12)Y(21)2X(11)Y(11)3X(12)+X(21)X(22)Y(12)Y(21)+Y(22)4X(12)X(22)Y(12)Y(22)5X(21)X(22)Y(21)Y(22)6X(21)Y(11)Y(12)+Y(21)Y(22)7X(11)X(12)X(21)+X(22)Y(12)\def\arraystretch{1.15} \begin{array}{c|l|l} r & A^{(r)}(X) & B^{(r)}(Y) \\ \hline 1 & X^{(12)} & Y^{(21)} \\ 2 & X^{(11)} & Y^{(11)} \\ 3 & X^{(12)}+X^{(21)}-X^{(22)} & Y^{(12)}-Y^{(21)}+Y^{(22)} \\ 4 & X^{(12)}-X^{(22)} & -Y^{(12)}-Y^{(22)} \\ 5 & X^{(21)}-X^{(22)} & Y^{(21)}-Y^{(22)} \\ 6 & X^{(21)} & Y^{(11)}-Y^{(12)}+Y^{(21)}-Y^{(22)} \\ 7 & X^{(11)}-X^{(12)}-X^{(21)}+X^{(22)} & Y^{(12)} \end{array}

and the unchained reconstruction is

XY=(P(1)+P(2)P(1)+P(3)+P(5)+P(7)P(1)+P(3)+P(4)+P(6)P(1)+P(3)+P(4)+P(5)).XY= \begin{pmatrix} P^{(1)}+P^{(2)} & P^{(1)}+P^{(3)}+P^{(5)}+P^{(7)} \\[2pt] P^{(1)}+P^{(3)}+P^{(4)}+P^{(6)} & P^{(1)}+P^{(3)}+P^{(4)}+P^{(5)} \end{pmatrix}.

We partition these products into the three chains

Qa=(P(1),P(3),P(5),P(7)),Qb=(P(2)),Qc=(P(4),P(6)).Q_a=(P^{(1)},P^{(3)},P^{(5)},P^{(7)}), \qquad Q_b=(P^{(2)}), \qquad Q_c=(P^{(4)},P^{(6)}).

Let these chains’ prefix-sums be SaS^a, SbS^b, and ScS^c respectively. Our matrix multiplication kernel uses a depth-two pipeline, so prefix-sums are accumulated into the stage’s two TMEM accumulators. The execution schedule is:

stepTMEM writeglobal-memory writeresident sumsP(1)S1aP(1)(XY)11S1aSaP(2)S1bP(2)(XY)11(XY)11+S1bSa,SbP(3)S2aS1a+P(3)(XY)21S2aSaP(4)S1cP(4)(XY)22S1cSa,ScP(5)S3aS2a+P(5)(XY)22(XY)22+S3aSa,ScP(6)S2cS1c+P(6)(XY)21(XY)21+S2cSa,ScP(7)S4aS3a+P(7)(XY)12S4aSa\def\arraystretch{1.18} \begin{array}{c|c|c|l} \text{step} & \text{TMEM write} & \text{global-memory write} & \text{resident sums} \\ \hline P^{(1)} & S^a_1\gets P^{(1)} & (XY)_{11}\gets S^a_1 & S^a\\ P^{(2)} & S^b_1\gets P^{(2)} & (XY)_{11}\gets (XY)_{11}+S^b_1 & S^a, S^b \\ P^{(3)} & S^a_2\gets S^a_1+ P^{(3)} & (XY)_{21}\gets S^a_2 & S^a \\ P^{(4)} & S^c_1\gets P^{(4)} & (XY)_{22}\gets S^c_1 & S^a, S^c \\ P^{(5)} & S^a_3\gets S^a_2+ P^{(5)} & (XY)_{22}\gets (XY)_{22}+S^a_3 & S^a, S^c \\ P^{(6)} & S^c_2\gets S^c_1+ P^{(6)} & (XY)_{21}\gets (XY)_{21}+S^c_2 & S^a, S^c \\ P^{(7)} & S^a_4\gets S^a_3+ P^{(7)} & (XY)_{12}\gets S^a_4 & S^a \end{array}

which computes

XY=(S1a+S1bS4aS2a+S2cS3a+S1c).XY= \begin{pmatrix} S^a_1+S^b_1 & S^a_4\\ S^a_2+S^c_2 & S^a_3+S^c_1 \end{pmatrix}.

Notice how, at any step, at most two prefix-sums are resident; hence the prefix-sums can be stored in a standard, pipelined, depth-two matrix multiplication kernel’s TMEM accumulators, incurring no additional memory traffic.

This chaining was discovered by a somewhat interesting but out-of-scope exhaustive search over ternary seven-multiplication 2×22\times 2 schemes. We were later able to prove its minimality over all schemes via Theorem 1.

B Minimum writes induced by an unchained, seven-multiplication 2×22\times 2 scheme

The number of writes induced by an unchained scheme is its number of non-zero ρ(r)\rho^{(r)} elements.

Lemma 4. The minimum number of non-zero ρ(r)\rho^{(r)} elements in a seven-multiplication 2×22\times 2 scheme is twelve; i.e.

r=17ρ(r)012.\sum_{r=1}^7 \|\rho^{(r)}\|_0 \geq 12.

Proof. Per deGroote’s 1978 proof [18], all seven-multiplication schemes are equivalent to Strassen’s modulo sandwich, scaling, and permutation symmetries. For Strassen’s coefficients (see Lemma 1), ρS(1)\rho_S^{(1)} has rank two and ρS(2),,ρS(7)\rho_S^{(2)},\ldots,\rho_S^{(7)} have rank one. Moreover, writing

ρS(r)=urvrT,r=2,,7,\rho_S^{(r)} = u_rv_r^T,\qquad r=2,\ldots,7,

the uru_r and vrv_r occupy three distinct one-dimensional subspaces of R2\mathbb{R}^2, each twice. Permutation and scaling symmetries preserve this structure.

Sandwich symmetries left- and right-multiply ρS(r)\rho_S^{(r)}s by invertible linear maps, preserving matrix rank and mapping distinct one-dimensional subspaces to distinct one-dimensional subspaces. Hence, in every seven-multiplication scheme, one ρ(r)\rho^{(r)} has rank two and the remaining six can be written ρ(r)=urvrT\rho^{(r)}=u_rv_r^T such that the uru_r and vrv_r occupy three distinct one-dimensional subspaces, each twice.

At most two distinct one-dimensional subspaces of R2\mathbb{R}^2 contain a vector with only one non-zero element. So at least one of the three distinct one-dimensional subspaces occupied by the uru_r and vrv_r has two non-zero elements, so

r=27ur02(1+1+2)=8,r=27vr08.\sum_{r=2}^7\|u_r\|_0\geq 2(1+1+2)= 8, \qquad \sum_{r=2}^7\|v_r\|_0\geq 8.

As

urvrT0=ur0vr0ur0+vr01,\|u_rv_r^T\|_0 = \|u_r\|_0\|v_r\|_0 \geq \|u_r\|_0+\|v_r\|_0-1,

the six rank-one coefficients contain at least

r=27urvrT08+86=10\sum_{r=2}^7\|u_rv_r^T\|_0 \geq 8+8-6=10

non-zero elements. The remaining coefficient has rank two, hence contains at least two non-zero elements, so

r=17ρ(r)012.\sum_{r=1}^7\|\rho^{(r)}\|_0\geq 12.

Strassen’s coefficients have twelve non-zero elements, so the bound is tight. ◻

References

  1. Muse Glimmer-30B. Meta Superintelligence Lab. 2026.

  2. Qwen3.8-27B. Qwen Team. 2026.

  3. Efficient Memory Management for Large Language Model Serving with PagedAttention. Kwon, Woosuk and Li, Zhuohan and Zhuang, Siyuan and Sheng, Ying and Zheng, Lianmin and Yu, Cody Hao and Gonzalez, Joseph E. and Zhang, Hao and Stoica, Ion. 2023.

  4. FalconGEMM: Surpassing Hardware Peaks with Lower-Complexity Matrix Multiplication. Honglin Zhu and Jiaping Cao and Jiang Shao and Siyuan Feng and Qian Qiu and Peng Chen and Xu Zhang and Yixian Zhou and Man Lung Yiu and Guang Ji and Minwen Deng and Jintao Meng and Wenxi Zhu. 2026.

  5. Compiling Strassen-like Matrix Multiplication Algorithms to Fast CUDA Kernels. Abhinav Jangda. 2026.

  6. Splitwise: Efficient Generative LLM Inference Using Phase Splitting. Patel, Pratyush and Choukse, Esha and Zhang, Chaojie and Shah, Aashaka and Goiri, 'I\ nigo and Maleki, Saeed and Bianchini, Ricardo. 2024.

  7. DistServe: Disaggregating Prefill and Decoding for Goodput-optimized Large Language Model Serving. Zhong, Yinmin and Liu, Shengyu and Chen, Junda and Hu, Jianbo and Zhu, Yibo and Liu, Xuanzhe and Jin, Xin and Zhang, Hao. 2024.

  8. NVIDIA Blackwell Architecture Technical Brief. NVIDIA Corporation. 2024.

  9. Roofline: An Insightful Visual Performance Model for Multicore Architectures. Williams, Samuel and Waterman, Andrew and Patterson, David. 2009.

  10. On Schemes for the Computation of Products and the Inverse Matrix. Pan, Victor Ya.. 1972.

  11. On the Optimal Evaluation of a Set of Bilinear Forms. Brockett, Roger W. and Dobkin, David P.. 1973.

  12. Discovering Faster Matrix Multiplication Algorithms with Reinforcement Learning. Alhussein Fawzi and Matej Balog and Aja Huang and Thomas Hubert and Bernardino Romera-Paredes and Mohammadamin Barekatain and Alexander Novikov and Francisco J. R. Ruiz and Julian Schrittwieser and Grzegorz Swirszcz and David Silver and Demis Hassabis and Pushmeet Kohli. 2022.

  13. Flip Graphs for Matrix Multiplication. Kauers, Manuel and Moosbauer, Jakob. 2023.

  14. Strassen's Matrix Multiplication on GPUs. Junjie Li and Sanjay Ranka and Sartaj Sahni. 2011.

  15. Accelerating Strassen-Winograd's Matrix Multiplication Algorithm on GPUs. Pai-Wei Lai and Humayun Arafat and Venmugil Elango and Ponnuswamy Sadayappan. 2013.

  16. Strassen's Algorithm Reloaded on GPUs. Jianyu Huang and Chenhan D. Yu and Robert A. van de Geijn. 2020.

  17. CUTLASS Tutorial: Mastering the NVIDIA Tensor Memory Accelerator (TMA). Colfax Research. 2024.

  18. On Varieties of Optimal Algorithms for the Computation of Bilinear Mappings. II. Optimal Algorithms for 2×22 \times 2-Matrix Multiplication. de Groote, Hans F.. 1978.

  19. Gaussian Elimination is Not Optimal. Volker Strassen. 1969.

  20. On Multiplication of 2×22 \times 2 Matrices. Shmuel Winograd. 1971.

  21. Atom: Low-Bit Quantization for Efficient and Accurate LLM Serving. Zhao, Yilong and Lin, Chien-Yu and Zhu, Kan and Ye, Zihao and Chen, Lequn and Zheng, Size and Ceze, Luis and Krishnamurthy, Arvind and Chen, Tianqi and Kasikci, Baris. 2024.

  22. Pointer Sentinel Mixture Models. Merity, Stephen and Xiong, Caiming and Bradbury, James and Socher, Richard. 2017.

  23. FlashAttention-3: Fast and Accurate Attention with Asynchrony and Low-Precision. Shah, Jay and Bikshandi, Ganesh and Zhang, Ying and Thakkar, Vijay and Ramani, Pradeep and Dao, Tri. 2024.

  24. HellaSwag: Can a Machine Really Finish Your Sentence?. Zellers, Rowan and Holtzman, Ari and Bisk, Yonatan and Farhadi, Ali and Choi, Yejin. 2019.

  25. Think You Have Solved Question Answering? Try ARC, the AI2 Reasoning Challenge. Clark, Peter and Cowhey, Isaac and Etzioni, Oren and Khot, Tushar and Sabharwal, Ashish and Schoenick, Carissa and Tafjord, Oyvind. 2018.

  26. Measuring Massive Multitask Language Understanding. Hendrycks, Dan and Burns, Collin and Basart, Steven and Zou, Andy and Mazeika, Mantas and Song, Dawn and Steinhardt, Jacob. 2021.


Thanks to John for advocating for the B200 access which made this possible. Also to Alayt, Anagha, Ashvin, Danny, Esme, Federico, Grace, Moses, Natalie, Nick, Noah, Pete, Quan, Sophia, Tejas, Tonya, and Zeno, for countless interesting conversations.