[论文解读] Cluster-Former: Clustering-based Sparse Transformer for Long-Range Dependency Encoding
Cluster-Former 提出了一种新颖的稀疏 Transformer 架构,通过结合滑动窗口注意力与基于聚类的全局注意力,有效建模长序列中的长距离依赖关系。通过定期将隐藏状态聚类为中心点,并在这些聚类上应用 Transformer 注意力机制,该方法在 Quasar-T、SearchQA 和 Natural Questions(长答案)等长上下文问答基准上实现了最先进性能,且计算复杂度不呈二次增长。
Transformer has become ubiquitous in the deep learning field. One of the key ingredients that destined its success is the self-attention mechanism, which allows fully-connected contextual encoding over input tokens. However, despite its effectiveness in modeling short sequences, self-attention suffers when handling inputs with extreme long-range dependencies, as its complexity grows quadratically with respect to the sequence length. Therefore, long sequences are often encoded by Transformer in chunks using a sliding window. In this paper, we propose Cluster-Former, a novel clustering-based sparse Transformer to perform attention across chunked sequences. The proposed framework is pivoted on two unique types of Transformer layer: Sliding-Window Layer and Cluster-Former Layer, which encode local sequence information and global context jointly and iteratively. This new design allows information integration beyond local windows, which is especially beneficial for question answering (QA) tasks that rely on long-range dependencies. Experiments show that Cluster-Former achieves state-of-the-art performance on several major QA benchmarks.
研究动机与目标
- 解决标准自注意力机制在长序列中计算与内存复杂度呈二次增长的问题。
- 在滑动窗口注意力与人工设计的稀疏注意力模式之外,进一步提升长距离依赖建模能力。
- 为长上下文 NLP 任务开发一种灵活且可学习的全局上下文捕捉机制。
- 在需要长上下文推理的问答任务中实现最先进性能。
- 证明该方法在问答任务之外的泛化能力,例如语言建模任务。
提出的方法
- 该模型使用两种 Transformer 层:滑动窗口层,用于在固定长度的块内编码局部上下文。
- Cluster-Former 层对前一层的隐藏状态应用 K-均值聚类,以将语义或结构相似的表示分组。
- 通过累积隐藏状态的记忆库,定期(例如每轮训练)更新聚类中心,避免在线计算。
- 将聚类后的隐藏状态均匀划分为多个块,并由独立的 Transformer 层处理,以实现跨块注意力。
- 该框架在混合架构中结合局部(滑动窗口)与全局(基于聚类)注意力,实现效率与长距离建模之间的平衡。
- 聚类数量(C)为超参数,实验表明在问答任务中使用 512 个聚类可获得最佳性能。
实验结果
研究问题
- RQ1基于聚类的注意力是否能在建模长距离依赖方面优于人工设计的稀疏注意力模式?
- RQ2与随机哈希或固定位置选择相比,使用可学习的聚类中心是否能提升全局上下文编码效果?
- RQ3聚类数量对长上下文问答任务性能有何影响?
- RQ4Cluster-Former 架构是否能泛化到问答任务之外的其他长上下文 NLP 任务,如语言建模?
- RQ5在 Transformer 层堆栈中,哪些层位置最适合部署 Cluster-Former 层?
主要发现
- Cluster-Former 在 Quasar-T、SearchQA 和 Natural Questions(长答案)基准上实现了新的最先进结果。
- 当使用 512 个聚类时,该模型在问答任务中显著优于稀疏注意力和局部敏感哈希(LSH)基线模型。
- 512 个聚类的模型在大多数问答任务中明显优于 64 个聚类的变体,尽管在 Natural Questions 长答案任务上性能提升有限,这可能是由于存在针对特定 token 的聚类模式。
- 当至少一个 Cluster-Former 层被放置在中间层(例如第 8–16 层)时,性能最佳;而将其置于网络末尾(例如第 22–23 层)则导致性能下降。
- 在语言建模任务(Wikitext-103 和 Enwik8)中,Cluster-Former 超过强基线模型,证明其在问答任务之外也具有良好的泛化能力。
- 定性分析表明,Cluster-Former 能够成功将语义相似的词(如时间词、实体)甚至相距甚远的隐藏状态(如相距 6000+ 个 token)聚类到同一簇中,表明其具备有效的长距离依赖检测能力。
更好的研究,从现在开始
从论文设计到论文写作,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。