-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathquiz.json
More file actions
78 lines (78 loc) · 3.29 KB
/
Copy pathquiz.json
File metadata and controls
78 lines (78 loc) · 3.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
{
"lesson": "35-gpt-model-assembly",
"title": "顶点课 35 —— GPT 模型组装",
"questions": [
{
"stage": "pre",
"question": "本课复现的 GPT-2 small 参考配置是什么?",
"options": [
"vocab 30000, context 512, d_model 512, 6 heads, 6 layers",
"vocab 50257, context 1024, d_model 768, 12 heads, 12 layers, 参数量约 1.24 亿",
"vocab 100000, context 2048, d_model 1024, 16 heads, 24 layers",
"vocab 50000, context 4096, d_model 4096, 32 heads, 32 layers"
],
"correct": 1,
"explanation": "GPT-2 small 是 124M 参数的配置;对上数字就能确认接线正确。"
},
{
"stage": "check",
"question": "在模型组装中,weight tying 是什么意思?",
"options": [
"token embedding 和 LM head 共享同一个参数 tensor;优化器更新的是一个矩阵,同时服务于查表和输出投影",
"两个形状相同的不同 tensor,每一步互相拷贝",
"跨层共享的 bias 项",
"对 attention head 的约束"
],
"correct": 0,
"explanation": "设置 lm_head.weight = tok_embed.weight 共享的是存储;拷贝则不是。节省了 vocab × d_model 个参数。"
},
{
"stage": "check",
"question": "生成时如何滑动上下文窗口?",
"options": [
"每步截断到上下文的一半",
"每一步取当前序列(prompt 加上已生成部分)的最后 context_length 个 token 送入模型",
"用零 pad 到最大上下文长度",
"每步都从 prompt 重新开始"
],
"correct": 1,
"explanation": "当序列超出上下文长度时,sliding window 丢弃最早的 token。"
},
{
"stage": "check",
"question": "为什么 attention 输出投影和第二个 MLP linear 的初始化 std 比其他层更小?",
"options": [
"节省内存",
"两者都直接接到 residual add 上。把 std 缩放 1/sqrt(2 × num_layers) 可以让 residual stream 在 12 层中保持尺度稳定",
"数据集要求的",
"top-k sampling 需要更小的权重"
],
"correct": 1,
"explanation": "不做缩放的话,residual stream 会随深度增长,把最后的 LayerNorm 推到危险区域。"
},
{
"stage": "post",
"question": "采样时 temperature 起什么作用?",
"options": [
"选择优化器的学习率",
"在 softmax 前对 logits 做除法。T < 1 使分布更尖锐趋向 greedy,T = 1 保持模型原始分布,T > 1 使分布更平坦",
"给 head 加 dropout",
"缩放 embedding"
],
"correct": 1,
"explanation": "temperature 是最简单的旋钮;配合 top-k 一起控制生成的探索性。"
},
{
"stage": "post",
"question": "采样前 top-k 过滤做了什么?",
"options": [
"选出最低的 k 个 logits",
"保留值最大的 k 个 logits,其余设为负无穷,然后在幸存者上做 softmax,多项式采样只在 top k 个 token 中选",
"移除所有小于零的 logits",
"把 logits 限幅在 k"
],
"correct": 1,
"explanation": "top-k 在 softmax 前截断长尾;top_k=1 就是 greedy,k 越大保留的多样性越多。"
}
]
}