提出高效注意力机制HydraRec,加速序列推荐计算且保持精度。
An Efficient Attention Mechanism for Sequential Recommendation Tasks: HydraRec
- 基于Hydra注意力设计线性复杂度的Transformer模型
- 在长序列上显著提升速度,准确率优于同类线性模型
- 适合大规模动态商品推荐场景
基于Transformer的模型在推荐系统中应用日益广泛。预训练模型如BERT在语言建模中表现优异,其变体(如BERT4Rec、SASRec)也在序列推荐任务中取得成功。传统Transformer的点积注意力具有与序列长度成平方关系的复杂度,这在推荐系统中尤为突出,因用户历史序列随新商品不断增长。为此,近期研究提出多种线性注意力模型以实现序列长度上的线性复杂度。Hydra注意力是一种用于视觉Transformer的线性复杂度方法,能同时降低注意力对序列数量和嵌入维度的复杂度。本文在此基础上提出面向序列推荐的高效Transformer模型HydraRec,显著降低长序列与大数据集下的注意力计算复杂度,同时保留时间上下文信息。大量实验表明,在使用因果掩码的下一物品预测任务中,HydraRec优于其他线性注意力模型及点积注意力模型;对于双向模型,其性能可媲美BERT4Rec,且运行时间更优。
原文摘要 · Abstract (English)
Transformer based models are increasingly being used in various domains including recommender systems (RS). Pretrained transformer models such as BERT have shown good performance at language modelling. With the greater ability to model sequential tasks, variants of Encoder-only models (like BERT4Rec, SASRec etc.) have found success in sequential RS problems. Computing dot-product attention in traditional transformer models has quadratic complexity in sequence length. This is a bigger problem with RS because unlike language models, new items are added to the catalogue every day. User buying history is a dynamic sequence which depends on multiple factors. Recently, various linear attention models have tried to solve this problem by making the model linear in sequence length (token dimensions). Hydra attention is one such linear complexity model proposed for vision transformers which reduces the complexity of attention for both the number of tokens as well as model embedding dimensions. Building on the idea of Hydra attention, we introduce an efficient Transformer based Sequential RS (HydraRec) which significantly improves theoretical complexity of computing attention for longer sequences and bigger datasets while preserving the temporal context. Extensive experiments are conducted to evaluate other linear transformer-based RS models and compared with HydraRec across various evaluation metrics. HydraRec outperforms other linear attention-based models as well as dot-product based attention models when used with causal masking for sequential recommendation next item prediction tasks. For bi-directional models its performance is comparable to the BERT4Rec model with an improvement in running time.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。