PoM: A Linear-Time Replacement for Attention with the Polynomial Mixer
Authors: David Picard, Nicolas Dufour, Lucas Degeorge, Arijit Ghosh, Davide Allegro, Tom Ravaud, Yohann Perron, Corentin Sautier, Zeynep Sonat Baltaci, Fei Meng, Syrine Kalleli, Marta López-Rauhut, Thibaut Loiseau, Ségolène Albouy, Raphael Baena, Elliot Vincent, Loic Landrieu
Organizations: LIGM, CNRS, Univ Gustave Eiffel, ENPC, Institut Polytechnique de Paris, France · LIX, École Polytechnique, CNRS, IP Paris, France · AMIAD, Pole recherche · Department of Information Engineering, Università degli Studi di Padova, Italy · EFEO · Valeo.ai, France · LASTIG, Univ Gustave Eiffel, IGN, Géodata Paris, Paris, France
This paper introduces the Polynomial Mixer (PoM), a novel token mixing mechanism with linear complexity that serves as a drop-in replacement for self-attention. PoM aggregates input tokens into a compact representation through a learned polynomial function, from which each token retrieves contextual information. We prove that PoM satisfies the contextual mapping property, ensuring that transformers equipped with PoM remain universal sequence-to-sequence approximators. We replace standard self-attention with PoM across five diverse domains: text generation, handwritten text recognition, image generation, 3D modeling, and Earth observation. PoM matches the performance of attention-based models while drastically reducing computational cost when working with long sequences. The code is available at https://github.com/davidpicard/pom.
Figures & tables
Figure 1
Figure 3: Evaluation Across Domains. We evaluate PoM on various tasks from multiple domains, simply replacing some or all the self-attention blocks in SOTA Transformer-based models. Left : For OCR, given a page of handwritten text (top) split into lines, the goal is to recognize each character and group them into words (bottom). Middle : For Earth observation, given a time series of satellite images (top), the goal is to classify each pixel as a crop type by the end of the series (bottom). Right : For 3D segmentation, given a 3D point cloud (top), the goal is to classify each point according to classes (bottom).
Table 1: Natural Language Processing.
#Params
Performance
Throughput
Model
×106
OA ↑
mIoU ↑
km 2 /s
TSViT (paper)
1.7
83.4
65.1
-
TSViT (retrained)
1.7
82.8
64.6
7.2
TSViPoM
1.7
82.7
64.6
26.3
Table 3: Satellite Image Time Series Segmentation. We compare of TSViT and TSViPoM on PASTIS fold 1. We report the overall accuracy (OA), mean IoU (mIoU), and throughput.
#Param
Performance
Throughput
Model
×106
mIoU ↑
106 pts/s
Scannet
PTv3
46.2
76.7
1.98
PPoMv3
47.9
75.9
2.17
PPoMv3 Hyb.
46.8
76.8
2.01
SKITTI
PTv3
46.2
67.2
1.12
PPoMv3
47.9
66.6
1.22
Table 4: 3D Point Cloud Segmentation. We compare PTv3 with PPoMv3 on two classic 3D datasets.
Figure 4: Computational Efficiency. We report the speed at generating image for various resolutions for SiT-XL/2 and its PoM counterpart SiPoM-XL/2.
Figure 5: Qualitative Results on Class-Conditional Generation . Images sampled from SiPom-XL/2 with different classes at 256 resolution. We use classifier-free guidance with ω=6 .
#Param
Performance
Throughput
Model
×106
FID ↓
img/s
SiT-L/2
458
18.8
1, 9842
SiPoM-L/2
414
17.6
11,954
SiT-XL/2
675
17.2
1, 4041
SiPoM-XL/2
609
17.2
1, 8146
Table 5: Class-Conditional Image Generation . We compare SiT [ 52 ] with SiPoM trained on ImageNet for generating images of resolution 256 2 for a batch size of 1024.
State-of-the-art speech-to-text models typically employ Transformer-based encoders that model token dependencies via self-attention mechanisms. However, the quadratic complexity of self-attention in both memory and computation imposes significant constraints on scalability. In this work, we propose a novel token-mixing mechanism, the Polynomial Mixer (PoM), as a drop-in replacement for multi-head self-attention. PoM computes a polynomial representation of the input with linear complexity with respect to the input sequence length. We integrate PoM into a self-supervised speech representation learning framework based on BEST-RQ and evaluate its performance on downstream speech recognition tasks. Experimental results demonstrate that PoM achieves a competitive word error rate compared to full self-attention and other linear-complexity alternatives, offering an improved trade-off between performance and efficiency in time and memory.
Eva Feillet, Ryan Whetten, David Picard +1
Universit´e Paris-Saclay, CNRS, Laboratoire Interdisciplinaire des Sciences du Num´erique · Miles team, Universit´e Paris-Dauphine-PSL · Laboratoire Informatique d’Avignon, Avignon Universit´e +1
The substantial inference costs of attention in transformers motivated the development of efficient sequence mixers: namely sparse and sliding window attention, convolutions and linear attention. Although these approaches result in impressive reductions in inference costs, they often trade-off with quality, specifically in-context recall. Apriori fixing this quality-cost tradeoff at training time means being suboptimal from the get-go: some downstream applications might fundamentally require more memory for in-context recall, while other tasks may require lower latency and memory. We propose a conceptually simple meta-sequence mixer with inference-cost controllability: the Compress & Attend Transformer (CAT). CAT decodes chunks of tokens by attending to compressed chunks of the sequence so far. Both compression and decoding can use any existing sequence mixer. Decoding from the compressed sequence yields compute and memory savings, with chunk size setting the operating point on the quality-cost trade-off. Importantly, training CAT across multiple chunk sizes at once unlocks test-time control of this trade-off without any retraining, all in a single model. Instantiated with the most basic choice, dense attention as the mixer, CAT surprisingly suffices to match 10 popular and diverse efficient models (linear, hybrids, sparse) on real-world long-context recall at comparable inference costs, all from a single trained model. CAT further performs competitively on long-context understanding benchmarks while providing 1.4-3.7x higher generation throughput than a dense transformer. Code is at: https://github.com/rajesh-lab/cat-transformer
Softmax attention is the cornerstone of modern large language models, but its memory scales linearly and compute quadratically with sequence length. Linear recurrent models, such as linear attention and state space models, have become widely studied as alternatives to attention due to their linear compute and constant memory. While these sub-quadratic token mixing methods, or mixers, achieve promising efficiency gains and competitive results on a wide range of benchmarks, current linear recurrent models still lag behind on tasks that require long-context retrieval or in-context learning. A growing body of work studies hybrid architectures that attempt to mitigate these trade-offs by statically interleaving or merging attention and recurrent blocks. In this work, we explore a new axis of developing hybrid models: across the token sequence. We propose Oryx, a hybrid model that can, throughout a sequence, flexibly switch between different mixers, for example quadratic attention for rich context utilization and linear recurrences for efficient generation. Oryx ties at least 90% of its parameters across mixers, enabling attention and recurrent modes to operate over shared internal representations. We validate our design with Mamba-2 and Gated DeltaNet variants, up to 1.4B models. Under fixed token budgets and a mixed-training strategy, Oryx achieves comparable or better performance than its single-mixer baselines. At the 1.4B scale, all instances of Oryx outperform their respective baselines by at least 0.7 percentage points on averaged language modeling tasks. On retrieval tasks, Oryx achieves performance comparable to the Transformer baseline even when processing only a tiny fraction (<10%) of the tokens in attention mode. These results suggest that attention and linear recurrent models can share internal representations, and motivate sequence-axis hybridization as a promising direction.
Kevin Y. Li, Asher Trockman, Ananda Theertha Suresh +1