跳到主要内容Skip to main content

注意力机制Attention

Attention

  • 核心概念Core concepts
  • 第四段 · 看懂Stage 4 · Under the Hood
  • 引用核验 2026-11-09refs checked 2026-11-09
解决什么问题What problem it solves

让模型在处理一个词时,自动看向句子里最相关的其他词。When processing one word, the model automatically looks at the most relevant other words in the sentence.

这是什么What it is

计算每个词与句中所有其他词的关联程度,据此加权聚合信息。

「Transformer 里的注意力」与「模型注意力不集中」是同一个词的不同含义。前者是算法组件,后者是行为描述。

Computing how related each word is to every other word, and aggregating information weighted by that.

"Attention" inside a Transformer and "the model isn't paying attention" in everyday speech are the same word meaning different things.

How a query weights candidates: Q–K scores, softmax normalisation, then a weighted sum over V.
一个查询如何给候选分配权重:Q 与 K 打分,softmax 归一,再对 V 加权求和。How a query weights candidates: Q–K scores, softmax normalisation, then a weighted sum over V.
为什么需要知道Why it matters

它解释了为什么模型能理解长句里的指代关系。它也是上下文长度受限的技术根源之一。It explains why models can resolve references across a long sentence — and is one technical root of the context length limit.

出处Sources
  • Attention Is All You Need(论文)Attention Is All You Need (paper) ↗
  • Bahdanau 注意力论文(ICLR 2015)Bahdanau Attention (Neural Machine Translation) ↗
用这个术语做任务Use this term in a task

别停在定义:去任务手册看按什么顺序做、验收什么;或者按你手头的任务,筛 3 个工具候选。Don’t stop at the definition: use the task handbook for the order and checks, or filter three tool candidates for the job at hand.

任务手册 →Task handbooks → · 按任务筛 3 个候选 →Filter three candidates →