Summary
Attention mechanism in Transformers have quadratic time complexity in the sequence length, which can create computational bottlenecks. Various methods have been proposed to address this, with kernel-based approaches for "linearizing" attention gaining significant interest in the ML community. In this work, the authors introduce Spectraformer, an unified framework for approximating and learning the kernel function in linear Transformers. The authors explore a range of sampling techniques and random features, demonstrating that different tasks benefit from different combinations of kernel methods, with no single method emerging as superior across all cases. The empirical results are evaluated using the LRA benchmark.
Strengths
- Good overview and discussion about various random feature mechanisms for linearizing attention in Transformers.
- Interesting observation that there is no clear random feature method excelling at all the tasks.
Weaknesses
- Please rewrite Sec 3.4 in terms of pseudocode. Please do not point to specific lines of code.
- Writing needs to be improved, for example the concepts are mentioned before they are defined. Def 3.2 defines a valid component function even though this concept was mentioned in line 262-263.
- QMC is explored in the context of shift-invariant kernels in [1] and also in general random features [2]. It feels incremental without any theoretical results as the authors are merely combining different matrices (that have been used to reduce variance) in some well-known modern random feature mechanism. It would be an extremely valuable work if the authors show that incorporating these matrices would lower variance over the orthogonal ones.
- The empirical results needs to be stronger. Specifically :
* How does these methods perform in simply approximating the softmax kernel.
* We generally see a quality gap when training Performers from scratch compared to regular transformers, does any of this combination close the gap? For ex. see performance gap between Performer-ViT vs Regular ViT (Fig 8. in [3]).
- As pointed out by the authors, different combinations work well for various tasks thus the paper should provide some guidance for practitioners on how to choose the right combination.
[1] Quasi-Monte Carlo Feature Maps for Shift-Invariant Kernels. Avron et al. JMLR 2016.
[2] Hybrid Random Features. Choromanski et al. ICLR 2022.
[3] From block-Toeplitz matrices to differential equations on graphs: towards a general theory for scalable masked Transformers. Choromanski et al. ICML 2022.
Questions
In addition to the questions above, I have a few more additional questions.
- Why for any $\mathbf{W}$, $f$ = Trig a valid component function? (line 263)
- In line 284, what does it mean “among combination with trig RF”? This is true for positive random features as well (see Sec 4.2 in [1])
- Finally training the kernel to mimic the spikyness of softmax can lead to performance gains as observed in [2]. Does similar observations work in this setting?
[1] Rethinking Attention with Performers. Choromanski et al. ICLR 2021
[2] The Hedgehog & the Porcupine: Expressive Linear Attentions with Softmax Mimicry. Zhang et al. ICLR 2024