跳到主要内容Skip to main content

多头注意力Multi-Head Attention

Multi-Head Attention

  • 核心概念Core concepts
  • 第四站 · 看懂Station 4 · Under the Hood
解决什么问题What problem it solves

让模型同时从好几个角度去看一句话,而不是只盯一种关系。Lets a model look at a sentence from several angles at once, instead of tracking only one kind of relation.

这是什么What it is

把注意力计算重复多遍,每遍关注句子里不同种类的关系,最后把结果合在一起。

原论文用了 8 个「头」——相当于 8 个视角同时读同一句话。

Repeats the attention computation several times, each pass focusing on a different kind of relation, then combines the results.

The original paper used 8 heads — like 8 readers examining the same sentence simultaneously.

为什么需要知道Why it matters

单看一个词只有一种理解方式。多个头一起看,语法关系、指代关系、邻近关系才能同时被抓住。A single attention pass yields a single kind of understanding. Multiple heads capture grammar, coreference, and adjacency at the same time.

出处Sources
  • Attention Is All You Need(论文 §3.2)Attention Is All You Need §3.2 (paper) ↗