跳到主要内容Skip to main content

位置编码Positional Encoding

Positional Encoding

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

让模型知道每个词在句子里的先后顺序。Lets the model know the order of words in a sentence.

这是什么What it is

给每个位置附加一组数字,使模型能分辨「猫追狗」和「狗追猫」。

Attaching a set of numbers to each position so the model can tell "the cat chased the dog" from "the dog chased the cat".

为什么需要知道Why it matters

它解释了为什么上下文窗口超了之后,模型对长文的理解会明显退化。It explains why comprehension of long passages degrades noticeably once you exceed the context window.

出处Sources
  • RoFormer / RoPE(论文)RoFormer: Rotary Position Embedding (paper) ↗
  • Attention Is All You Need(正余弦编码)Attention Is All You Need (sinusoidal encoding, paper) ↗