Files
research-notes/docs/papers/attention-is-all-you-need.md
2026-03-18 17:38:01 +08:00

64 lines
1.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: Attention Is All You Need
authors: Ashish Vaswani et al.
year: 2017
venue: NeurIPS
tags:
- transformer
- attention
- sequence-modeling
status: published
---
# Attention Is All You Need
> [论文链接](https://arxiv.org/abs/1706.03762)
## 一句话总结
这篇论文提出了 Transformer用纯注意力机制替代 RNN/CNN显著提升了序列建模的并行性与性能。
## 研究问题
传统序列模型RNN、LSTM难以并行而且建模长距离依赖时效率较低。作者希望找到一种更高效的序列到序列建模方式。
## 核心方法
Transformer 的核心由以下模块组成:
1. **Multi-Head Self-Attention**
2. **Position-wise Feed-Forward Network**
3. **Residual Connection + LayerNorm**
4. **Positional Encoding**
注意力计算的核心公式:
$$
\mathrm{Attention}(Q, K, V) = \mathrm{softmax}\left(\frac{QK^T}{\sqrt{d_k}}\right)V
$$
## 关键创新点
- 用 self-attention 替代循环结构
- 多头注意力让模型从不同子空间捕获关系
- 编码器/解码器结构具有极强的并行性
## 实验结果
在机器翻译任务上Transformer 达到了当时非常强的结果,同时训练速度明显快于循环模型。
## 优点
- 并行友好
- 长程依赖建模更直接
- 架构清晰,易扩展
## 局限
- 位置编码不是天然内生的
- 注意力复杂度随序列长度平方增长
## 我的理解 / 启发
这篇论文最重要的意义不只是“效果更好”,而是把序列建模的主干从“递归”切换成了“基于关系的全局交互”,从而开启了后续大语言模型的主流范式。