Research
Change the Product, Keep the Parameters: Associative Algebra Layers for Transformers
Change the Product, Keep the Parameters: Associative Algebra Layers for Transformers Overview Research area: Machine learning / efficient deep learning architectures — specifically algebraic complexit

- arXiv
- 2609.32814
- Published
- 2026-09-26
- Authors
- Ilya Koziev, Ivan Oseledets
AI summary
Change the Product, Keep the Parameters: Associative Algebra Layers for TransformersOverview
Research area: Machine learning / efficient deep learning architectures — specifically algebraic complexity theory applied to Transformer linear layers (feed-forward projections), GPU kernel efficiency, and language-model pretraining.
Technical level: Advanced. The paper combines bilinear-rank theory (Alder–Strassen bounds), associative algebra constructions, GPU kernel scheduling, and a small-scale language-model pretraining study. Readers need comfort with block matrix algebra, tensor products, and Transformer internals.
Scope: The paper proposes replacing ordinary matrix multiplication in Transformer projections with a cheaper associative multiplication law over the same learned weight blocks, proves its arithmetical optimality, derives hardware shape constraints, and validates it with kernel benchmarks and a 110M-parameter pretraining pilot.
What This Paper Is About
Fast matrix multiplication research traditionally keeps the product fixed and hunts for a cheaper algorithm to evaluate it. This paper asks the reverse question: since the learned projections in a Transformer are trained jointly with everything else, can the product itself be replaced by a different, cheaper multiplication law that remains associative and unital? The authors define such a law over the same weight blocks, prove it uses the minimum possible number of multiplications, and then test whether Transformers built with it train at all and run faster.
Key Contributions
-
A graph-based family of associative unital algebras. Given a directed graph without self-loops, the authors define a multiplication law where vertices become diagonal slots and edges become off-diagonal interaction slots, with edge–edge products vanishing. They prove the law is associative and unital, with dimension |V| + |E|.
-
An exact bilinear-rank theorem. They prove R(Q_G) = |V| + 2|E|, matching the specialized Alder–Strassen lower bound R ≥ 2m − v. The smallest case (four slots, two vertices) therefore needs 6 multiplications and the displayed evaluation is optimal for that table.
-
A quadratic-arithmetic construction at fixed physical block size. Using the complete graph on q vertices with ordinary b×b inner products, the direct block algorithm costs (2/q − 1/q²)n³ MACs; choosing q = n/b gives 2bn² − b²n = Θ(n²). The authors derive finite rectangular shape screening conditions for GPU execution.
-
An empirical feasibility and trainability check. They train two approximately 110M-parameter decoder-only LMs from the same recipe on 12.3B tokens each, differing only in the FFN layer, and report kernel-level speedups on public Transformer shapes plus end-to-end throughput and downstream quality.
Main Findings
-
Throughput improves in every tested domain. The algebraic model generates faster on all four prompt domains: Code 987.8 → 1054.5 tok/s (6.8%), Math 991.4 → 1060.6 (7.0%), QA 958.6 → 1033.1 (7.8%), and WMT ru–en 985.9 → 1047.1 (6.2%). The unweighted mean of the four throughput ratios is 1.070.
-
Downstream quality is lower on every reported metric. GSM8K (EM, flexible) drops from 3.18 to 2.20, a gap of 0.98 points; IFEval (instance, loose) drops from 34.5 to 31.1, a gap of 3.4 points; MBPP pass@1 drops from 6.60 to 3.80, a gap of 2.8 points.
-
The throughput gain is smaller than the FFN arithmetic reduction. The algebraic FFN's projection MAC fraction is 9/16, and the tested configuration's decoder-block projection fraction is 59/80. Attention contractions, the language-model head, sampling, tokenization, and memory traffic dilute the saving.
-
Kernel-level speedups on real Transformer shapes are substantial but shape-dependent. Pure expansion projections in BF16 on one H200 NVL gave 3.04×/2.84× for Qwen3-1.7B at q* = 32, 3.14×/2.94× for Qwen3-4B, 5.04×/4.52× for Qwen3-8B, 1.57×/1.30× for a Qwen3-30B-A3B expert, 2.91×/2.47× for a DeepSeek-V3 expert, and on Qwen3-32B 5.06×/4.86× at M = 2048, 8.33×/8.60× at M = 8192, and 11.51×/11.70× at M = 32768 (warm / cache-flushed).
-
The same weight bank is retained with fewer products. All four weight blocks in the two-group law remain independent learned parameters, while the rule uses six block GEMMs instead of eight. In general, all q² slots are retained with dim Q_q = q² and R(Q_q) = 2q² − q.
-
Arithmetic scales toward quadratic order. At fixed physical block size b and q = n/b, MACs fall to 2bn² − b²n = Θ(n²). At fixed q the cost remains cubic; for q = Θ(n^α) it is Θ(n^{3−α}).
-
Wider algebras restrict each position's map. A token of type i computes y_i = x_i W_ii and, for j ≠ i, y_j = x_i W_ij + x_j W_jj. More groups reduce active computation while restricting each position's linear map, though the map can still have full rank when its diagonal blocks are invertible.
-
The recursive tensor-square law used in the pilot differs from the direct four-group law. Both are sixteen-dimensional with semisimple quotient F⁴ but are not isomorphic; the tensor square uses 36 explicit products at dimension sixteen with exact rank in [28, 36], while the direct four-group law attains 28.
-
Cost model for realized speedup. With ρ_q = (2q − 1)/q², effective algebraic-to-dense rate ratio η_q, and overhead δ_q, a compute-dominated speedup requires ρ_q/η_q + δ_q < 1.
Methodology in Plain English
The authors begin from a simple observation: a Transformer's linear layer multiplies activations by learned weights, and after splitting feature dimensions into groups this becomes a sum of ordinary block matrix products. The row–column rule decides which activation block meets which weight block; the learned entries decide the values.
Their idea is to keep the weights but change the rule. In the two-group case, they delete exactly the two products that close the off-diagonal cycle, leaving six block products instead of eight, while keeping all four weight blocks learned and usable. They show that two such layers compose into a layer of the same form (associativity), that an identity exists, and that every parameter can affect an output. They generalize this to a graph: vertices are diagonal slots, edges are off-diagonal slots, and edge–edge products vanish.
To show the rule cannot be made cheaper, they connect it to bilinear rank — the minimum number of scalar multiplications in an exact algorithm — and apply the Alder–Strassen lower bound for associative unital algebras, which specializes to 2m − v for such graph tables.
Next they lift the square block table to rectangular Transformer projections: each token position is assigned a row type by a fixed deterministic schedule, and computes only its row's products. They derive MAC counts for forward, backward (three forward evaluations' worth), and single-token decoding, and impose practical constraints on group count q so that the remaining leaf GEMMs are large enough for efficient GPU execution.
Empirically, they first benchmark kernels on synthetic BF16 tensors on one H200 NVL with FP32 accumulation and CUDA Graph replay, sweeping M ∈ {1, 32, 512, 2048} and q ∈ {4, 8, 16, 32, 64} across the FFN shapes of Qwen3-1.7B, 4B, 8B, a Qwen3-30B-A3B expert, a DeepSeek-V3 expert, and larger Qwen3-32B workloads. Then they train two approximately 110M-parameter models from scratch on 12.3B tokens each — same data, tokenizer, initialization, and optimizer, differing only in whether the FFN uses ordinary dense products or the recursive tensor-square algebraic action. Both use 12 blocks, width 768, FFN width 1536, 32 attention heads, context length 1536, the GPT-2 tokenizer with vocabulary 50,257, and a per-GPU batch size of 40 on two H100 GPUs.
Why This Matters
Impact on research. The paper reframes an architectural choice as an algebraic one: the multiplication table becomes a designable object subject to certified rank bounds, rather than a fixed primitive. It also connects algebraic complexity theory to practical GPU behaviour, showing that arithmetic savings and wall-clock savings are governed by separate choices (algebra size versus physical block size).
Real-world applications:
- Serving and inference cost reduction. Generating text faster at the same parameter count lowers the cost of deployed assistants, translation services, and code tools.
- Small-model deployment on constrained hardware. Models that keep the same dense-sized weight bank but perform less arithmetic can be attractive where compute, not memory, is the bottleneck.
- Edge and latency-critical systems. The 6.2–7.8% generation-throughput gain measured here represents a directly usable latency improvement in interactive applications, if the quality trade-off is acceptable.
- Architecture search tooling. The rank theorems give a principled way to compare candidate multiplication tables before training, rather than only by empirical trial.
Industry relevance. The measured kernel speedups are on the FFN shapes of widely used open models (Qwen3 family, DeepSeek-V3), and the pretraining pilot uses commodity two-GPU hardware, making the results directly interpretable for practitioners considering alternative layer designs. The authors note that fully realizing the acceleration potential would require fused kernels, which they leave to future work.
Future Directions
-
Larger algebras and larger models. The paper tests one recursive FFN law, one model scale, and one training run per model; larger algebras, larger models, and repeated seeds remain untested.
-
Algebraic attention. The appendix develops an extension to algebraic attention scores, including cache and normalization formulas, but the experiment keeps attention dense. Whether attention projections can also use the restriction is an open question.
-
Kernel fusion. Fully realizing the acceleration potential requires fused kernels; the experiments compare unfused projections and include separate gated-block comparisons in the appendix.
-
Isolating the layer effect and establishing quality preservation. The throughput gain is diluted by attention, the LM head, sampling, tokenization, and memory traffic; generation lengths differ between models (mean code response 195.5 tokens dense versus 182.4 algebraic), so fixed-length repeated full-model timings are needed. Associativity guarantees composition, not quality preservation, so the results do not establish an advantage at equal quality or training time.
Target Audience
This paper is best suited to machine learning systems researchers and engineers working on efficient Transformer architectures, GPU kernel developers interested in structured sparsity and block algebra, and theoretically inclined readers in algebraic complexity who want to see tensor-rank results reach a practical training run. Practitioners evaluating inference-cost reductions will find the kernel and throughput sections directly relevant, while readers looking for a state-of-the-art small language model will not — the algebraic model scores lower on all three reported downstream metrics, and the authors present the work explicitly as a feasibility and trainability check at small scale.
Authors’ abstract
Fast matrix multiplication algorithms keep the product fixed and search for a cheaper way to evaluate it. We instead ask whether a Transformer's learned projections can use a different, cheaper product altogether. Building on an associative-algebra construction that replaces ordinary matrix multiplication with a sparser interaction table over the same weight blocks, we construct a family with quadratic arithmetic in the matrix dimension when the physical block size remains fixed, and derive finite-shape constraints for GPU execution. The construction is provably optimal for its bilinear rank by the Alder--Strassen bound and can be realized as row-typed rectangular projections compatible with causal masking and KV-cached decoding. We provide an empirical test of this approach by training two approximately 110M-parameter decoder-only Transformer LMs from the same recipe and 12.3B-token budget, differing only in their feed-forward layer: one uses ordinary dense matrix multiplication and the other uses the associative-algebra product. Across four prompt domains, the algebraic model achieves a 6.2--7.8\% increase in end-to-end generation throughput, while obtaining lower scores on all three reported downstream metrics. We treat these results as a feasibility and trainability check for the proposed approach at small scale, leaving further investigation to future work.