利用Flash Attention实现快速高斯核求和
Fast Gauss Sums via Flash Attention
高斯核求和可通过FLASH attention计算:两项小型输入增广即可把归一化softmax归约转为非归一化高斯和,无需编写任何自定义GPU代码。在fp16下特征维度D>8时,该方法在速度和内存上优于编译版PyTorch代码,在速度与精度上优于PyKeOps核,内存保持线性扩展。
arXiv:2609.04910v2 Announce Type: replace Abstract: Gauss kernel sums are the computational core of maximum mean discrepancies (MMDs), kernel gradient flows, Stein variational gradient descent (SVGD), and many other kernel methods. At the same time, softmax attention has received an extraordinary amount of hardware-aware code engineering, culminating in FLASH attention. We show that Gauss kernel sums with arbitrary, signed weights can be evaluated via FLASH attention: two small input augmentations turn the normalized softmax reduction into the unnormalized Gauss sum, without writing a single line of custom GPU code. For feature dimension $D>8$ in fp16, this approach beats compiled PyTorch code in speed and memory, and PyKeOps kernels in speed and accuracy at comparable or lower memory. Its memory scaling remains linear.
来源:arXiv (AI + Vision + Imaging) · arxiv.org