机器学习周报(8.26-9.1)

摘要

本周先是好好理解了一下self-attention的QKV的理解,关于如何让自注意力机制更有效的问题,学习了self-attention的多种变形,包括减少注意力矩阵的计算量、加快注意力机制的运算速度、去掉attention等。

Abstract

This week, I first had a good understanding of the QKV of self-attention, about how to make the self-attention mechanism more effective, and learned a variety of variants of self-attention, including reducing the computation amount of attention matrix, speeding up the computation speed of attention mechanism, removing attention and so on.

self-attetion

QKV理解

以搜索查询商品为例:
query可以理解为输入要查询的商品;
key为商品的标签或者title;
value可理解为商品的评价之类的;

相似度=querykey(矩阵乘法) 根据相似度 召回
总分=相似度
value 根据总分排序输出

在这里插入图片描述

Q(query):模型从token中提取出来的对token的理解信息,用于主动与其他token计算相似程度
K(key):模型从token提取出来的,与其他token的关系信息,被用于与其他token计算相似程度
V(value):表示当前token的重要程度

  • self-attention中self的理解
    self-attention的self,表示query,key,value都来自自己,每个token都能提取出来自己的query,key,value

  • 计算过程

A t t e n t i o n ( Q , K , V ) = s o f t m a x ( Q K T d k V ) Attention(Q,K,V)=softmax(\frac{QK^T}{\sqrt{d_k}}V) Attention(Q,K,V)=softmax(

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值