arXiv:2409.01482cs.CLcs.LG2024-09被引 2

用掩码卷积替代注意力,让语言模型在小上下文下更高效且检索效果更好

Masked Mixers for Language Generation and Retrieval

  • 以掩码卷积替代自注意力,保留更多输入信息
  • 小上下文下比主流Transformer更优,检索任务性能超越大模型
  • 适合追求高效检索的场景,尤其小规模数据训练

当前语言模型普遍依赖注意力机制对输入元素进行选择性聚焦,但这种机制会丢失大量输入信息。我们观察到,变压器模型在输入表示准确性方面表现较差,而采用掩码卷积的掩码混合器(masked mixers)则表现出更高精度。掩码混合器在小上下文窗口(n_ctx < 512)条件下,能更高效地学习因果语言建模,甚至优于经过优化的现代Transformer。实验表明,不同模型在各类任务中的训练效率差异,可由输入表示的准确率或全局可逆性预测。我们假设,由于检索任务更接近双射函数,变压器的信息损失对其影响更大。结果发现,无论是否修改预训练嵌入模型(通过余弦相似度的InfoNCE损失最小化),掩码混合器在检索任务上均表现更优;一个小规模掩码混合器甚至超越了一个大型、接近最先进水平的基于Transformer的检索模型,尽管后者使用了多数量级更多的数据和算力。

原文摘要 · Abstract (English)

Attention mechanisms that confer selective focus on a strict subset of input elements are nearly ubiquitous in language models today. We posit there to be downside to the use of attention: most input information is lost. In support of this idea we observe poor input representation accuracy in transformers and more accurate representation in what we term masked mixers, which replace self-attention with masked convolutions. The masked mixer learns causal language modeling more efficiently than early transformer implementations and even outperforms optimized, current transformers when training on small ($n_{ctx}<512$) but not larger context windows. Evidence is presented for the hypothesis that differences in transformer and masked mixer training efficiencies for various tasks are best predicted by input representation accuracy, or equivalently global invertibility. We hypothesize that the information loss exhibited by transformers would be more detrimental to retrieval than generation, as the former is more closely approximated by a bijective and thus invertible function. We find that masked mixers are more effective retrieval models both when the pretrained embedding model is unchanged as well as when the embedding model is modified via cosine similarity-based InfoNCE loss minimization. A small masked mixer is shown to outperform a large and near state-of-the-art transformer-based retrieval model, despite the latter being trained with many orders of magnitude more data and compute.

语言生成检索模型掩码卷积Transformer替代

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。