
理解 transformer 中的 encoder + decoder
- 詳細的 transformer 教程見:【極速版 – 大模型入門到進階】Transformer
文章目錄
- 🌊 Encoder: 給一排向量輸出另外一排向量
- 🌊 Encoder vs. Decoder: multi-head attention vs. masked multi-head attention
- 🌊 Decoder: Cross attention

🌊 Encoder: 給一排向量輸出另外一排向量

🌊 Encoder vs. Decoder: multi-head attention vs. masked multi-head attention
- 從下圖可以看出,除了灰色遮住的區域, encoder 和 decoder 結構基本完全相同,除了在 decoder 中: multi-head attention 變為了 masked multi-head attention

- masked multi-head attention: 之和自己前面的做 attention

🌊 Decoder: Cross attention
- 另外,還差一部分就是 – cross attention

