arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2606.07317cs.IR
收藏

门控双向线性注意力用于生成式检索

Gated Bidirectional Linear Attention for Generative Retrieval

Yandex

Artem Matveev, Vladislav Tytskiy, Sergei Makeev, Sergei Liamaev

AI总结:

提出门控双向线性注意力(GBLA),通过局部因果混合、序列级键门控和门控RMSNorm输出实现线性时间双向注意力,在保持双向自注意力质量的同时显著加速长序列编码。

摘要:

在推荐系统中,生成式检索通常采用编码器-解码器设置:编码器处理用户交互历史,自回归解码器随后生成推荐项。在大规模流媒体服务中,活跃用户随时间积累非常长的历史记录。随着历史增长,编码器成为主要延迟瓶颈,因为softmax注意力随序列长度呈二次方扩展。在我们的实验中,在编码器中使用双向注意力显著提高了质量。然而,大多数次二次注意力方法专注于因果注意力。我们提出了门控双向线性注意力(GBLA),这是一种线性时间双向注意力层,通过三个轻量级组件扩展了核化线性注意力:局部因果混合(Conv1D)、用于软遗忘的序列级键门控以及门控RMSNorm输出。在大型Yandex Music数据集上,以1:2比例交错自注意力(SA)和GBLA的混合编码器(一个SA块后跟两个GBLA块)匹配了双向自注意力的质量。在H100 GPU上,与FlashAttention-v3相比,GBLA在历史长度32768时实现了高达$8.2\times$的单层加速。最后,我们展示了相同的混合设计可以推广到我们的专有设置之外,在公共Amazon基准测试上一致地保持了自注意力检索质量。

英文摘要:

In recommender systems, generative retrieval typically uses an encoder-decoder setup: an encoder processes a user interaction history, and an autoregressive decoder then generates recommended items. In large-scale streaming services, active users accumulate very long histories over time. As histories grow, the encoder becomes a major latency bottleneck because softmax attention scales quadratically with sequence length. In our experiments, using bidirectional attention in the encoder substantially improves quality. However, most sub-quadratic attention methods focus on causal attention. We propose Gated Bidirectional Linear Attention (GBLA), a linear-time bidirectional attention layer that extends kernelized linear attention with three lightweight components: local causal mixing (Conv1D), sequence-level key gating for soft forgetting, and a gated RMSNorm output. On a large-scale Yandex Music dataset, a hybrid encoder that interleaves self-attention (SA) and GBLA in a 1:2 ratio (one SA block followed by two GBLA blocks) matches bidirectional self-attention quality. On H100 GPUs, GBLA reaches up to an $8.2\times$ single-layer speedup at a history length of 32768, compared to FlashAttention-v3. Finally, we show that the same hybrid design generalizes beyond our proprietary setting, consistently preserving self-attention retrieval quality on public Amazon benchmarks.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑