Skip to content

Transformer

本模块服务央企 AI / 大模型、金融科技 AI 与相关技术面试。

目标不是背结构图,而是能够解释:

对象是什么 → 数学 / 机制怎么运作 → 为什么这样设计 → 不这样做会怎样 → 与现代 LLM 工程有什么关系。


Knowledge Structure

1. Transformer 基础

  • Token / Token ID
  • Embedding
  • Hidden Representation / d_model
  • 位置信息基本作用
  • Encoder / Decoder
  • Decoder-only
  • 训练并行 vs 自回归生成

2. Attention

  • Q / K / V
  • Attention Score
  • Scaled Dot-Product Attention
  • Softmax
  • Causal Mask
  • Self-Attention / Cross-Attention
  • Multi-Head Attention
  • Attention 手算

3. Transformer Block

  • Multi-Head 输出
  • Concat
  • Output Projection W_O
  • Residual Connection
  • Pre-Norm / Post-Norm
  • FFN
  • 完整 Block 数据流

4. 现代大语言模型组件

Transformer Lesson 2:

  • RMSNorm
  • RoPE
  • MQA / GQA
  • KV Cache
  • Training vs Inference Attention
  • SwiGLU
  • 现代 Decoder-only Block
  • Qwen / Llama / vLLM 工程联系

Current Checkpoint

text
Transformer Lesson 1 → completed
Transformer Lesson 2 → not_started

状态与 Confidence 只以:

00_Roadmap/progress.md

为准。


Core Mental Model

text
Embedding / Position
→ 初始 token representation

Attention
→ 跨 token 信息通信与聚合

FFN
→ 单个已上下文化 token 的内部计算

Residual
→ 信息与梯度主干

Norm
→ 稳定进入子层的 activation scale

Review Resources

Mistakes:

Interview:

Cross-session:


Current Weaknesses

  • Attention Matrix Shape 的快速判断;
  • Q/K/V 的精炼口头表达;
  • Scaling 的方差直觉;
  • Norm 数学细节;
  • Training Attention 与 Autoregressive Inference 的差异。

Next Lesson

Transformer Lesson 2 - Modern LLM Components

学习顺序:

  1. LayerNorm 快速复习;
  2. RMSNorm;
  3. 绝对 / 相对位置;
  4. RoPE;
  5. MHA → MQA → GQA;
  6. KV Cache;
  7. Training vs Inference Attention;
  8. SwiGLU;
  9. 现代 Decoder-only Block;
  10. 连接 Qwen / Llama / vLLM。

控制深度:以现代 LLM 技术面试与推理工程理解为目标,不继续扩展低收益的纯理论细节。