iclr 2022 Compositional attention: Disentangling search and retrieval

文章指出了Multi-headAttention中的参数冗余问题,特别是在搜索和检索操作中。为解决此问题,提出了CompositionalAttention,它允许更灵活地组合搜索和检索,从而提高性能并减少冗余。通过动态选择价值矩阵,CompositionalAttention能更好地处理OODGeneralization任务。
摘要由CSDN通过智能技术生成

Mittal S, Raparthy S C, Rish I, et al. Compositional attention: Disentangling search and retrieval[J]. arXiv preprint arXiv:2110.09419, 2021.

Motivation

作者认为,在multi-head attention中存在redundant parameters的问题。比如在下面这张图中,对于retrieve location的操作在multi-head attention中进行了两次,这造成了参数的冗余。

为了解决这个问题,They propose Compositional Attention, where the search and retrieval operations can be flexibly composed: the key-query search mechanism is no longer bound to a fifixed value retrieval matrix, instead it is dynamically selected from a shared pool of value matrices accessible by several compositional attention heads. This results in increased flexibility and improved performance.

image-20230110123701600

主要贡献

这篇文章的主要贡献有三点:

  • 指出了multi-head attention中的不足
  • 提出了解决方法Compositional attention
  • 利用自己的方法解决了multi-head attention中出现的问题,并能够很好地解决OOD Generalization中出现的问题。
  • 讨论了一下Compositional attention的计算复杂度

Multi-head attention中的不足

Key-Value Attention: Given a set of queries and key-value pairs, key-value attention computes a scaled cosine similarity metric between each query and the set of keys. This similarity score determines the contribution of each value in the output for the corresponding query.

你看,在multi-head attention中,不也是先计算query与key之间的映射,然后再通过value进行检索的吗?为什么这样的方法就会造成信息的冗余呢?

我们可以先把multi-head attention分为两个阶段:search、 retrieval。

  • search过程指的是根据query+key的过程
  • retrieval指的是对value中的值进行组合的过程

Multi-head Attention as a rigid pairing of Searches and Retrievals

作者任务在mutil-head attention中存在两种类型的冗余:

  • Search Redundancy

    which leads to learning of redundant query-key matrices

  • Retrieval Redundancy

    which leads to learning of redundant value matrices

image-20230110140206525

要想实现c这种检测,value的向量是需要能够投影出来location的信息,q和k的向量需要映射为color的信息。这在原来的方法中是不能进行替换的,而是通过多头的方式来进行检查c这个任务,但这并不能 factorize knowledge more efficiently

虽然目前我还没有看完这篇文章,但是我猜测这篇文章的方法呢,是利用了多个value的投影,在这个retrieval的阶段,又多了一次选择,而不是仅仅通过mutli-head的方式进行选择。

🤡 除了限制了知识更有效的利用,使用这种rigid可能会限制知识的重新组合、导致冗余的参数并潜在的限制了OoD泛化。

COMPOSITIONAL ATTENTION - DISENTANGLING SEARCH AND RETRIEVAL

这篇文章中提出了一个全新的attention mechanism,释放了原来那种静态的search-retrieval并支持一种更灵活地、动态的mapping。具体上,为了做到这些,Compositional attention放弃了head这个概念。

image-20230110152233627

Compositional Attention allow us to do what?

解决了前面提到的fixed search-retrieval pairing的问题

We highlight that Compositional Attention disentangles search and retrieval and solves the redundancies of multi-head attention

a. 可以设置S和R,分别表示Search-Retrieval的数量

b. 可以动态地共享retrieval的结果给所有的search

c. 从假设上来讲,Compositional Attention的pair容量是相当于S*R个multi-head attention(fixed pair)

Experiments

后面就是一套实验,用来证明这篇文章的方法确实别Multi-head Attention要好。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值