SKI 加速:通过非对称核加速 Toeplitz 神经网络
SKI to go Faster: Accelerating Toeplitz Neural Networks via Asymmetric Kernels
AI总结:
本文针对 Toeplitz 神经网络计算开销大的问题,提出稀疏加低秩分解与非对称 SKI 方法,将双向模型复杂度降至 O(n),并通过频域 Hilbert 变换保持因果模型 O(n log n) 复杂度,在 Long Range Arena 上实现最快速度且性能损失极小。
摘要:
Toeplitz 神经网络(TNNs)(Qin 等人,2023)是近期提出的一种序列模型,取得了令人瞩目的结果。它们需要 O(n log n) 的计算复杂度,以及 O(n) 次相对位置编码器(RPE)多层感知机(MLP)和衰减偏置调用。我们的目标是同时降低这两方面的开销。我们首先注意到,RPE 是一个非 SPD(对称正定)核,而 Toeplitz 矩阵是伪 Gram 矩阵。此外,1)学习到的核在主对角线附近表现出尖峰行为,其余部分则较为平滑;2)RPE MLP 速度较慢。对于双向模型,这促使我们采用稀疏加低秩的 Toeplitz 矩阵分解。对于稀疏分量的作用,我们执行一个小型的一维卷积。对于低秩分量,我们用线性插值替换 RPE MLP,并使用非对称结构化核插值(SKI)(Wilson 等人,2015)以实现 O(n) 复杂度:我们提供了严格的误差分析。对于因果模型,“快速”因果掩码(Katharopoulos 等人,2020)抵消了 SKI 的优势。在频域中工作,我们避免了显式的衰减偏置。为了强制因果性,我们使用 RPE 通过其频率响应的实部来表示核,并通过 Hilbert 变换计算虚部。这保持了 O(n log n) 的复杂度,但实现了绝对的加速。直接对频率响应建模在双向训练中也具有竞争力,且少用一次 FFT。我们在 Long Range Arena(Tay 等人,2020)上取得了速度上的最优水平,同时分数下降极小。
英文摘要:
Toeplitz Neural Networks (TNNs) (Qin et. al. 2023) are a recent sequence model with impressive results. They require O(n log n) computational complexity and O(n) relative positional encoder (RPE) multi-layer perceptron (MLP) and decay bias calls. We aim to reduce both. We first note that the RPE is a non-SPD (symmetric positive definite) kernel and the Toeplitz matrices are pseudo-Gram matrices. Further 1) the learned kernels display spiky behavior near the main diagonals with otherwise smooth behavior; 2) the RPE MLP is slow. For bidirectional models, this motivates a sparse plus low-rank Toeplitz matrix decomposition. For the sparse component's action, we do a small 1D convolution. For the low rank component, we replace the RPE MLP with linear interpolation and use asymmetric Structured Kernel Interpolation (SKI) (Wilson et. al. 2015) for O(n) complexity: we provide rigorous error analysis. For causal models, "fast" causal masking (Katharopoulos et. al. 2020) negates SKI's benefits. Working in the frequency domain, we avoid an explicit decay bias. To enforce causality, we represent the kernel via the real part of its frequency response using the RPE and compute the imaginary part via a Hilbert transform. This maintains O(n log n) complexity but achieves an absolute speedup. Modeling the frequency response directly is also competitive for bidirectional training, using one fewer FFT. We set a speed state of the art on Long Range Arena (Tay et. al. 2020) with minimal score degradation.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。