在视觉Transformer中将Softmax替换为ReLU

1,179次阅读
没有评论

Replacing softmax with ReLU in Vision Transformers

M Wortsman, J Lee, J Gilmer, S Kornblith
[Google DeepMind]

在视觉Transformer中将Softmax替换为ReLU

  • 探索用点积激活函数(如ReLU)替换transformer注意力机制中的softmax,之前的工作发现,这种改变会降低准确率。
  • 关键发现是,通过序列长度除以点积激活函数(如ReLU),可以减轻与softmax注意力相比的准确率损失。
  • 在ImageNet上的视觉transformer实验表明,除以序列长度的ReLU注意力可以达到softmax注意力的准确率。
  • ReLU注意力允许在序列长度上并行化, Gather操作较少于softmax注意力。
  • 文章假设序列长度缩放可以维持期望的注意力权重量级,在初始化时,期望的softmax权重量级为O(1/L)。

动机: 之前的研究发现,在将注意力softmax替换为ReLU等点对点激活时,准确率会降低。在视觉Transformer中,本文发现通过除以序列长度可以减轻这种降级。实验表明,在ImageNet-21k上训练小到大的视觉Transformer时,ReLU-attention可以在计算方面达到或接近softmax-attention的性能。 方法:探索了替代softmax操作的点对点方法,这些方法不一定输出概率分布。特别地,观察到通过序列长度除以ReLU的注意力可以在计算方面达到或接近传统softmax注意力的性能。这为并行化提供了新的机会,因为相比传统注意力,ReLU-attention在序列长度维度上可以进行更少的gather操作。 优势:提出了一种替代softmax的点对点注意力机制,通过除以序列长度可以减轻准确率降低的问题,并提供了更好的计算性能和并行化机会。

提出一种用ReLU替换softmax的点对点注意力机制,通过除以序列长度可以减轻准确率降低的问题,提供了更好的计算性能和并行化机会。

Previous research observed accuracy degradation when replacing the attention softmax with a pointwise activation such as ReLU. In the context of vision transformers, we find that this degradation is mitigated when dividing by sequence length. Our experiments training small to large vision transformers on ImageNet-21k indicate that ReLU-attention can approach or match the performance of softmax-attention in terms of scaling behavior as a function of compute.

https://arxiv.org/abs/2309.08586 

在视觉Transformer中将Softmax替换为ReLU

在视觉Transformer中将Softmax替换为ReLU

 

Read More 

正文完
可以使用微信扫码关注公众号(ID:xzluomor)
post-qrcode
 0
评论(没有评论)

文心AIGC

2023 年 9 月
 123
45678910
11121314151617
18192021222324
252627282930  
文心AIGC
文心AIGC
人工智能ChatGPT,AIGC指利用人工智能技术来生成内容,其中包括文字、语音、代码、图像、视频、机器人动作等等。被认为是继PGC、UGC之后的新型内容创作方式。AIGC作为元宇宙的新方向,近几年迭代速度呈现指数级爆发,谷歌、Meta、百度等平台型巨头持续布局
文章搜索
热门文章
清库存!DeepSeek突然补全R1技术报告,训练路径首次详细公开

清库存!DeepSeek突然补全R1技术报告,训练路径首次详细公开

清库存!DeepSeek突然补全R1技术报告,训练路径首次详细公开 Jay 2026-01-08 20:18:...
2025最大AI赢家的凡尔赛年度总结,哈萨比斯Jeff Dean联手执笔

2025最大AI赢家的凡尔赛年度总结,哈萨比斯Jeff Dean联手执笔

2025最大AI赢家的凡尔赛年度总结,哈萨比斯Jeff Dean联手执笔 鹭羽 2025-12-24 09:1...
AI Coding新王登场!MiniMax M2.1拿下多语言编程SOTA

AI Coding新王登场!MiniMax M2.1拿下多语言编程SOTA

AI C++oding新王登场!MiniMax M2.1拿下多语言编程SOTA 克雷西 2025-12-24 ...
国产AI4S创业头雁再获8亿投资!深势科技完成C轮,产品已服务300万科学家

国产AI4S创业头雁再获8亿投资!深势科技完成C轮,产品已服务300万科学家

国产AI4S创业头雁再获8亿投资!深势科技完成C轮,产品已服务300万科学家 思邈 2025-12-24 14...
最新评论
ufabet ufabet มีเกมให้เลือกเล่นมากมาย: เกมเดิมพันหลากหลาย ครบทุกค่ายดัง
tornado crypto mixer tornado crypto mixer Discover the power of privacy with TornadoCash! Learn how this decentralized mixer ensures your transactions remain confidential.
ดูบอลสด ดูบอลสด Very well presented. Every quote was awesome and thanks for sharing the content. Keep sharing and keep motivating others.
ดูบอลสด ดูบอลสด Pretty! This has been a really wonderful post. Many thanks for providing these details.
ดูบอลสด ดูบอลสด Pretty! This has been a really wonderful post. Many thanks for providing these details.
ดูบอลสด ดูบอลสด Hi there to all, for the reason that I am genuinely keen of reading this website’s post to be updated on a regular basis. It carries pleasant stuff.
Obrazy Sztuka Nowoczesna Obrazy Sztuka Nowoczesna Thank you for this wonderful contribution to the topic. Your ability to explain complex ideas simply is admirable.
ufabet ufabet Hi there to all, for the reason that I am genuinely keen of reading this website’s post to be updated on a regular basis. It carries pleasant stuff.
ufabet ufabet You’re so awesome! I don’t believe I have read a single thing like that before. So great to find someone with some original thoughts on this topic. Really.. thank you for starting this up. This website is something that is needed on the internet, someone with a little originality!
ufabet ufabet Very well presented. Every quote was awesome and thanks for sharing the content. Keep sharing and keep motivating others.
热评文章
樱智α·医疗可信平台全新发布,北电数智与中日友好医院联合打造

樱智α·医疗可信平台全新发布,北电数智与中日友好医院联合打造

樱智α·医疗可信平台全新发布,北电数智与中日友好医院联合打造 十三 2026-01-04 14:02:42 来...
OpenAI推理第一人离职,7年打造了o3/o1/GPT-4/Codex

OpenAI推理第一人离职,7年打造了o3/o1/GPT-4/Codex

OpenAI推理第一人离职,7年打造了o3/o1/GPT-4/Codex 衡宇 2026-01-06 13:0...
老黄All in物理AI!最新GPU性能5倍提升,还砸掉了智驾门槛

老黄All in物理AI!最新GPU性能5倍提升,还砸掉了智驾门槛

老黄All in物理AI!最新GPU性能5倍提升,还砸掉了智驾门槛 闻乐 2026-01-06 09:09:0...
悲报!Stack Overflow彻底凉了,比18年前上线首月问题数量还少

悲报!Stack Overflow彻底凉了,比18年前上线首月问题数量还少

悲报!Stack Overflow彻底凉了,比18年前上线首月问题数量还少 闻乐 2026-01-05 19:...