编码器与解码器Encoder & Decoder
Encoder & Decoder
解决什么问题What problem it solves
Transformer 的两种半机:一个读懂,一个生成。The two halves of a Transformer: one reads, one generates.
这是什么What it is
编码器读入整段文本、建立理解;解码器一边读已生成的部分、一边往下写。
BERT 基于编码器。GPT 一类模型只用解码器这半边。
论文里对它的说法是「只看左侧上下文的 Transformer」。
The encoder reads a whole passage and builds understanding; the decoder reads what has been generated so far and keeps writing.
BERT is built on the encoder. GPT-style models use only the decoder half.
The papers call it "a Transformer that attends only to left context".
为什么需要知道Why it matters
「读懂型」和「生成型」模型的分野就在这。它决定了模型擅长什么:理解检索,还是续写生成。The divide between "understanding models" and "generation models" sits right here. It decides what a model is good at: retrieval and comprehension, or continuation and generation.