当前位置:网站首页>【Transformer】SOFT: Softmax-free Transformer with Linear Complexity
【Transformer】SOFT: Softmax-free Transformer with Linear Complexity
2022-07-29 05:21:00 【呆呆的猫】

本文收录于 NeurIPS 2021
论文链接:https://arxiv.org/pdf/2110.11945.pdf
代码链接:https://github.com/fudan-zvg/SOFT
一、背景
基于 self-attention 的 transformer 虽然取得了较好的效果,但其计算量和内存都和是输入分辨率大小的平方。
作者认为这种计算限制来源于计算概率时使用的 softmax self-attention。
一般的 self-attention 都是计算规范化的 token 特征的内积计算得到,保持这种 softmax 操作对后面的线性化操作有些挑战。
所以,本文作者提出了 softmax-free transformer, SOFT,在 self-attention 中移除了 softmax,使用高斯核函数来代替内积,能够通过低秩矩阵分解来近似得到 self-attention 矩阵。

二、方法
2.1 Softmax-free self-attention formulation

输入为 X,要进行 attention ,首先要通过映射得到 Q, K, V:

self-attention 的计算如下:

α \alpha α 为计算 self-attention map 的过程,由非线性函数 β \beta β 和 relation function γ \gamma γ 组成:
一般的形式如下:
为了简化计算,作者使用如下方式代替:
为了保持 attention matrix 的对称性,作者设定 Q 和 K 的映射函数一样,所以,本文的 self-attention matrix 如下:
2.2 通过矩阵分解来实现低秩规范化
为了降低计算量,作者参考 Nystrom[38] 来实现低秩矩阵近似,可以不用计算全部的 self-attention。
规范化的 self-attention matrix S ^ \hat S S^ 如下:
三、效果
SOFT 及其变体如下:


边栏推荐
- These process knowledge you must know
- 【综述】图像分类网络
- Xsan is highly available - xdfs and San are integrated with new vitality
- Training log III of "Shandong University mobile Internet development technology teaching website construction" project
- Nailing alarm script
- 【卷积核设计】Scaling Up Your Kernels to 31x31: Revisiting Large Kernel Design in CNNs
- 【语义分割】语义分割综述
- 并发编程学习笔记 之 ReentrantLock实现原理的探究
- Tear the ORM framework by hand (generic + annotation + reflection)
- 中海油集团,桌面云&网盘存储系统应用案例
猜你喜欢

Reporting Service 2016 自定义身份验证

Most PHP programmers don't understand how to deploy safe code

【ML】机器学习模型之PMML--概述

Markdown syntax
![[database] database course design - vaccination database](/img/4d/e8aff67e3c643fae651c9f62af2db9.png)
[database] database course design - vaccination database

手撕ORM 框架(泛型+注解+反射)

Process management of day02 operation

Training log II of the project "construction of Shandong University mobile Internet development technology teaching website"

【目标检测】Generalized Focal Loss V1

iSCSI vs iSER vs NVMe-TCP vs NVMe-RDMA
随机推荐
Super simple integration HMS ml kit face detection to achieve cute stickers
yum本地源制作
【图像分类】如何使用 mmclassification 训练自己的分类模型
【目标检测】KL-Loss:Bounding Box Regression with Uncertainty for Accurate Object Detection
ASM插桩:学完ASM Tree api,再也不用怕hook了
有价值的博客、面经收集(持续更新)
Training log II of the project "construction of Shandong University mobile Internet development technology teaching website"
Ribbon学习笔记一
Study and research the way of programming
[pycharm] pycharm remote connection server
【TensorRT】将 PyTorch 转化为可部署的 TensorRT
How to make interesting apps for deep learning with zero code (suitable for novices)
【ML】机器学习模型之PMML--概述
Centos7 silently installs Oracle
Spring, summer, autumn and winter with Miss Zhang (3)
【CV】请问卷积核(滤波器)3*3、5*5、7*7、11*11 都是具体什么数?
【综述】图像分类网络
[clustmaps] visitor statistics
"Shandong University mobile Internet development technology teaching website construction" project training log V
以‘智’提‘质|金融影像平台解决方案