Paper commentary
Adaptive Fourier Neural Operators: Efficient Token Mixers for Transformers
- Problem Self-attention mixes tokens at a cost that grows quadratically with the number of tokens, which becomes impractical for high-resolution images.
- Method Adapts the Fourier neural operator into AFNO, with block-diagonal channel mixing, MLP weights shared across tokens, and soft-thresholded frequency modes.
- Results AFNO-100% reached 80.9 mIoU on Cityscapes at 1024 × 1024 with the Segformer-B3/4 backbone.

Figure 2 : The multi-layer transformer network with FNO, GFN, and AFNO mixers. GFNet performs element- wise matrix multiplication with separate weights across channels ( k). FNO performs full matrix multiplica- tion that mixes all the channels. AFNO performs block-wise channel mixing using MLP along with soft- thresholding. The symbolsh,w,d, andk refer to the height, width, channel size, and block count, respectively.
Original paper · CC BY 4.0 · John Guibas, Morteza Mardani, Zongyi Li, Andrew Tao, Anima Anandkumar, Bryan Catanzaro · Adaptive Fourier Neural Operators: Efficient Token Mixers for Transformers · Original paper figure · Extracted the figure area from page 2 of the original PDF.Why self-attention is costly for high-resolution tokens
Vision transformers mix information across tokens, and self-attention does this by weighting every pair of tokens by their similarity. Its cost grows quadratically with the number of tokens, so a high-resolution image with many patches quickly becomes expensive to mix.
Efficient variants such as sparse, low-rank and kernel-based attention lower this cost, but they generally trade accuracy for it. Fourier-based alternatives drop the explicit graph and use a global convolution, which GFN implements in the frequency domain. GFN, however, has no channel mixing, and its parameter count grows with the sequence size, which limits its adaptivity at high resolution.
The question is whether a mixer can keep the global reach of attention while its cost stays close to linear in the sequence size.
Treating tokens as a function and reusing FNO
The approach starts from operator learning, where the object being learned is a map between functions rather than between fixed vectors. Under this view a token is a sample of a continuous function on the image plane, and a mixing layer becomes a kernel integral over that plane. When the kernel depends only on the difference between two positions, the integral is a global convolution, and the convolution theorem turns that convolution into a product in the Fourier domain.
The Fourier neural operator (FNO) applies this on a discrete grid: the tokens are transformed with the discrete Fourier transform, each token is multiplied by its own complex channel-mixing matrix, and the result is transformed back. Its cost is \( O(N \log(N) d^2) \), quasi-linear in the number of tokens, but each token holds its own \(d \times d\) matrix, so the parameter count is \( O(Nd^2) \).
Those per-token matrices are static after training, and their number scales with image resolution.
The authors add a residual term to the token demixing step, since the DFT assumes periodic images while real images have non-periodic boundaries. The modifications target three issues: the quadratic cost of channel mixing, the static weights, and the lack of any selection among frequency modes.
The AFNO mixing step
Within each transformer layer, AFNO takes a token tensor of shape \(h \times w \times d\) and returns a tensor of the same shape. The flow is a real 2D Fourier transform, a reshape that splits the channels into \(k\) groups, a block MLP, soft shrinkage, an inverse transform, and an addition of the input as a bias.
The channel mixing is block-diagonal: the channel weight is split into \(k\) blocks of size \(d/k \times d/k\), and each block acts independently, which makes the blocks easy to run in parallel. Each block can be read as a subspace, similar to a head in multi-head self-attention. The MLP has two linear layers with a nonlinearity between them, \( \tilde z = W_2\sigma(W_1 z)+b \), and its weights are shared by all tokens, so the parameter count does not grow with the number of tokens.
Sparsity comes from treating channel mixing as a LASSO problem, whose solution is soft-thresholding, \( S_\lambda(x)=\mathrm{sign}(x)\max\{|x|-\lambda,0\} \), where \(\lambda\) controls the degree of sparsity. The authors base this on the observation that images are concentrated at low frequencies, so a learned mask can keep the informative modes.
The parameter count of AFNO is \((1+4/k)d^2+4d\), compared with \(3d^2\) for self-attention and \(Nd^2\) for FNO.
Inpainting pretraining against self-attention and efficient mixers
Pretraining masks pixels along a uniformly random walk on the image grid and trains the model with a mean squared error loss on the masked pixels. Quality is scored with PSNR and SSIM between the ground truth and the reconstruction, using a ViT-B/4 backbone on ImageNet-1k validation data.
Because inpainting is the pretraining stage here, these numbers are the starting point for the downstream transfer tested next.
Transfer to few-shot segmentation
Models pretrained for inpainting are fine-tuned for segmentation on three few-shot datasets: CelebA-Faces, ADE-Cars and LSUN-Cats. Training uses cross-entropy loss, and performance is the mIoU over the validation set.
On CelebA-Faces self-attention reached 56.91 mIoU and AFNO 55.75, so AFNO is lower on that dataset. On ADE-Cars AFNO reached 49.60 against 49.26 for self-attention, and on LSUN-Cats it reached 35.73 against 35.57. LS and GFN are lower on several datasets, with LS at 20.29 mIoU on LSUN-Cats.
The authors attribute the small gains on the out-of-domain datasets partly to the sparsity regularization built into AFNO. AFNO used 257.2 GFLOPs against 357.2 for self-attention in this setting, so the comparison is on par with fewer operations. The comparison covers three datasets and a single ViT-B/4 backbone.
High-resolution Cityscapes segmentation
Segmentation is evaluated at 1024 × 1024 on Cityscapes with the Segformer-B3 backbone, trained with cross-entropy loss and scored by mIoU on the validation set. AFNO is run here at a sequence size of 65k.
AFNO-100% reached 80.9 mIoU, above efficient self-attention at 79.7, LS at 80.5 and GFN at 80.4. Its mixer cost is 23.7 GFLOPs, against 129.9 for efficient self-attention, 85.0 for LS and 2.6 for GFN, while its total cost is 440.0 GFLOPs. For GFN and AFNO the MLP layers form the bottleneck of the complexity, so the total cost stays high even when the mixer itself is cheap.
AFNO-25%, which keeps only 25% of the low-frequency modes, reached 80.4 mIoU with 12.4 mixer GFLOPs and 429.0 total GFLOPs. The text says this variant loses 0.05 mIoU relative to AFNO-100%, while Table 4 lists 80.9 for AFNO-100% and 80.4 for AFNO-25%.
ImageNet-1K classification at 16M parameters
Classification uses a ViT-S/4 backbone at 224 × 224 on ImageNet-1K, with top-1 and top-5 validation accuracy.
AFNO reached 80.89 top-1 and 95.39 top-5, LS 80.87 and 95.31, and GFN 78.77 and 94.4. Theoretical cost was 15.3 GFLOPs for AFNO, 15.8 for LS and 6.1 for GFN.
The authors attribute the more than 2% top-1 advantage over GFN to adaptive weight sharing, which allows a larger channel size.
Which AFNO choices carry the gains
The sparsity threshold λ was swept from 0 to 10, where λ = 0 means no sparsity, and each model was pretrained for inpainting and then fine-tuned for few-shot segmentation on CelebA-Faces. Both the inpainting PSNR and the segmentation mIoU peak at λ = 0.01.
Block counts from 1 to 64 were tested, with the hidden size adjusted so the total parameter count stays equal, and measured by inpainting PSNR on ImageNet-1K. Eight blocks gave the best PSNR, which the authors read as evidence that blocking is effective.
Static weights in place of adaptive weights gave 25.1 and 44.04, and hard thresholding that keeps 35% of the low-frequency modes gave 23.58 and 34.17. The authors conclude that adaptive weights are crucial to AFNO's performance and that its modifications are needed to improve on FNO.
Limits of the evidence
The self-attention baseline is missing from the Cityscapes comparison at 1024 × 1024, because its sequence length is too long in the first few layers. The text and Table 4 disagree on the AFNO-25% loss: the text gives 0.05 mIoU, while the table gives 80.9 and 80.4.
Each main comparison uses one backbone configuration: ViT-B/4 for inpainting and few-shot segmentation, Segformer-B3/4 for Cityscapes, and ViT-S/4 for classification. The sparsity sweep was run only with CelebA-Faces fine-tuning, and the block-count sweep only with inpainting PSNR on ImageNet-1K.
Several cost figures are theoretical FLOPs rather than measured runtimes, and latency is reported only for the inpainting comparison. Using alternatives to the DFT, such as the wavelet transform, is named as future work.
Paper info
- Authors
- John Guibas, Morteza Mardani, Zongyi Li, Andrew Tao, Anima Anandkumar, Bryan Catanzaro
- Venue
- arXiv · Preprint
- First published
- 2021-11-24
- Added
- 2026-11-6
- Updated
- 2022-3-27
- Version
- v2
- arXiv
- 2111.13587
- Category
- cs.CV · cs.LG
- Original paper terms
- CC BY 4.0
- What we show
- Paper info, commentary and permitted figures from the original paper
AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.
Abstract
Vision transformers have delivered tremendous success in representation learning. This is primarily due to effective token mixing through self attention. However, this scales quadratically with the number of pixels, which becomes infeasible for high-resolution inputs. To cope with this challenge, we propose Adaptive Fourier Neural Operator (AFNO) as an efficient token mixer that learns to mix in the Fourier domain. AFNO is based on a principled foundation of operator learning which allows us to frame token mixing as a continuous global convolution without any dependence on the input resolution. This principle was previously used to design FNO, which solves global convolution efficiently in the Fourier domain and has shown promise in learning challenging PDEs. To handle challenges in visual representation learning such as discontinuities in images and high resolution inputs, we propose principled architectural modifications to FNO which results in memory and computational efficiency. This includes imposing a block-diagonal structure on the channel mixing weights, adaptively sharing weights across tokens, and sparsifying the frequency modes via soft-thresholding and shrinkage. The resulting model is highly parallel with a quasi-linear complexity and has linear memory in the sequence size. AFNO outperforms self-attention mechanisms for few-shot segmentation in terms of both efficiency and accuracy. For Cityscapes segmentation with the Segformer-B3 backbone, AFNO can handle a sequence size of 65k and outperforms other efficient self-attention mechanisms.
Quote from the paper
John Guibas, Morteza Mardani, Zongyi Li, Andrew Tao, Anima Anandkumar, Bryan Catanzaro (2021). Adaptive Fourier Neural Operators: Efficient Token Mixers for Transformers. arXiv:2111.13587v2. https://arxiv.org/abs/2111.13587v2
BibTeX
@misc{guibas2021adaptive,
title = {{Adaptive Fourier Neural Operators: Efficient Token Mixers for Transformers}},
author = {John Guibas and Morteza Mardani and Zongyi Li and Andrew Tao and Anima Anandkumar and Bryan Catanzaro},
year = {2021},
eprint = {2111.13587},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/2111.13587v2}
}