HyperAIHyperAI

Command Palette

Search for a command to run...

3 months ago

FNet: Mixing Tokens with Fourier Transforms

James Lee-Thorp Joshua Ainslie Ilya Eckstein Santiago Ontanon

FNet: Mixing Tokens with Fourier Transforms

Abstract

We show that Transformer encoder architectures can be sped up, with limited accuracy costs, by replacing the self-attention sublayers with simple linear transformations that "mix" input tokens. These linear mixers, along with standard nonlinearities in feed-forward layers, prove competent at modeling semantic relationships in several text classification tasks. Most surprisingly, we find that replacing the self-attention sublayer in a Transformer encoder with a standard, unparameterized Fourier Transform achieves 92-97% of the accuracy of BERT counterparts on the GLUE benchmark, but trains 80% faster on GPUs and 70% faster on TPUs at standard 512 input lengths. At longer input lengths, our FNet model is significantly faster: when compared to the "efficient" Transformers on the Long Range Arena benchmark, FNet matches the accuracy of the most accurate models, while outpacing the fastest models across all sequence lengths on GPUs (and across relatively shorter lengths on TPUs). Finally, FNet has a light memory footprint and is particularly efficient at smaller model sizes; for a fixed speed and accuracy budget, small FNet models outperform Transformer counterparts.

Benchmarks

BenchmarkMethodologyMetrics
linguistic-acceptability-on-colaFNet-Large
Accuracy: 78%
natural-language-inference-on-multinliFNet-Large
Matched: 78
Mismatched: 76
natural-language-inference-on-multinliBERT-Large
Matched: 88
Mismatched: 88
natural-language-inference-on-qnliFNet-Large
Accuracy: 85%
natural-language-inference-on-rteFNet-Large
Accuracy: 69%
paraphrase-identification-on-quora-questionFNet-Large
F1: 85
semantic-textual-similarity-on-mrpcFNet-Large
Accuracy: 88%
semantic-textual-similarity-on-sts-benchmarkFNet-Large
Spearman Correlation: 0.84
sentiment-analysis-on-sst-2-binaryFNet-Large
Accuracy: 94

Build AI with AI

From idea to launch — accelerate your AI development with free AI co-coding, out-of-the-box environment and best price of GPUs.

AI Co-coding
Ready-to-use GPUs
Best Pricing
Get Started

Hyper Newsletters

Subscribe to our latest updates
We will deliver the latest updates of the week to your inbox at nine o'clock every Monday morning
Powered by MailChimp
FNet: Mixing Tokens with Fourier Transforms | Papers | HyperAI