← COMP5541 全部讲次
Q07

Final 选择题|D 第 4–7 讲

非官方期末自拟单选题 16 道:XOR 与隐藏层、输出层配对、反向传播、梯度消失、动量、正则化、卷积与经典 CNN、RNN 结构、LSTM 与注意力,逐项解析错因并附课件页码。

手机上宽表格可左右滑动;自测答案默认收起,点击题目下方按钮查看。

使用边界:期末复习,非官方材料。课程信息写期末闭卷、3 小时、选择题加数学计算题;日期、地点与范围尚未公布,以讲师通知和课堂公告为准。本页是按第 4–7 讲课件自拟的单选题。

复习资料:考试形式与范围地图 · 闭卷公式默写表 · 算法横向对照

先做题再看解析:A 计算:第 1–3 讲 · B 选择:第 1–3 讲 · C 计算:第 4–7 讲 · D 选择:第 4–7 讲 · E 计算:第 8–10 讲 · F 选择:第 8–10 讲

怎么做:每题先排除再选,四个选项都要能说出对错的理由,再展开对照。

D 选择题:第 4–7 讲

单选,题面用英文。D1–D4 第 4 讲,D5–D10 第 5 讲,D11–D12 第 6 讲,D13–D16 第 7 讲。第 11、12 讲待补。

D1 · Why a hidden layer solves XOR

Why can a network with one hidden layer of two sigmoid units solve XOR, while logistic regression cannot?

  • A. Training logistic regression for more epochs eventually drives its loss below ln 2.
  • B. The hidden layer maps the inputs to new features (such as OR and AND) on which the classes become linearly separable.
  • C. Logistic regression fails only because its output is not passed through a non-linear function.
  • D. The hidden network needs exactly one set of weights; any other weights fail.
D1 · 查看答案与解析

答案:B。A 错,逻辑回归在 XOR 上卡在 ln 2 ≈ 0.693,多训练也没用;C 错,逻辑回归本来就有 sigmoid,边界仍是线性的;D 错,课件给了多组不同的解。

English:B. The hidden units turn the inputs into new features such as OR and AND, and on these features XOR is linearly separable.

回查:L04 p.7、p.15、p.16–17。L04a XOR 与隐藏层

D2 · Output layer for a price

A model predicts house prices, which are never negative. Which output layer and loss match the lecture’s pairing table?

  • A. Linear (or ReLU) output with MSE or MAE.
  • B. Softmax output with cross-entropy.
  • C. Sigmoid output with cross-entropy.
  • D. Softmax output with MSE.
D2 · 查看答案与解析

答案:A。回归输出层不加非线性,目标非负时可加 ReLU,损失用 MSE/MAE。B 是多分类配对;C 是二分类配对;D 表里没有,MSE 用于回归。

English:A. For regression the output is linear (ReLU if the target cannot be negative) and the loss is MSE or MAE.

回查:L04 p.22。L04b 宽度、深度与输出层

D3 · Counting parameters

A fully connected network has widths 3 → 4 → 4 → 1 and a bias on every non-input neuron. How many trainable parameters does it have?

  • A. 32
  • B. 36
  • C. 41
  • D. 56
D3 · 查看答案与解析

答案:C。(3+1)×4 + (4+1)×4 + (4+1)×1 = 16 + 20 + 5 = 41。A 是不计偏置的 12 + 16 + 4;B 漏了输出层的 5;D 把输出层也当成 4 个神经元,(4+1)×4 = 20,合计 56。

English:C. (3+1)·4 + (4+1)·4 + (4+1)·1 = 41.

回查:L04 p.12、p.13。L04b 宽度、深度与输出层

D4 · A factor shared by all gradients

In the L04 example network (ℓ = (y − ȳ)², linear output y = w₉h₃ + w₁₀h₄), which factor appears in the gradient of every one of the 10 weights?

  • A. σ′(s₃)
  • B. h₃
  • C. 2(y − ȳ)
  • D. w₉
D4 · 查看答案与解析

答案:C。A、D 错,dℓ/dw₁₀ = 2(y − ȳ)·h₄ 不经过 s₃,也不含 w₉;B 错,h₃ 只在部分梯度里作为上游激活出现。

English:C. Every gradient starts from the raw error dℓ/dy = 2(y − ȳ), which is computed once and reused.

回查:L04 p.28、p.35。L04d 反向传播

D5 · Sigmoid derivatives in a deep network

Each sigmoid hidden layer contributes a factor σ′(s) to the chain. What is the largest possible value of the product of these factors across 5 sigmoid layers?

  • A. 1
  • B. 1.25
  • C. 0.25⁵ ≈ 0.000977
  • D. 0.25
D5 · 查看答案与解析

答案:C。σ′(s) = σ(s)(1 − σ(s)) 最大 0.25,连乘 5 次。A 是 ReLU 正区间的导数;B 把 5 个 0.25 相加了,链式法则是相乘;D 只算了一层。

English:C. The sigmoid derivative is at most 0.25, so five layers give at most 0.25⁵; the gradient vanishes for early layers.

回查:L04 p.27;L05 p.15。L05b 梯度消失与 ReLU

D6 · Momentum with α = 0

In the update v ← αv − εg, θ ← θ + v, what happens when α = 0?

  • A. The parameters stop moving.
  • B. The update becomes θ ← θ − εg, plain (mini-batch) gradient descent.
  • C. The velocity v stays equal to its initial value.
  • D. α takes over the role of the learning rate.
D6 · 查看答案与解析

答案:B。A 错,v = −εg 不为零;C 错,v 每步被 −εg 改写;D 错,学习率始终是 ε,α 是动量参数。

English:B. With α = 0, v = −εg and θ ← θ − εg.

回查:L05 p.12。L05a mini-batch 与动量

D7 · A ReLU unit that never activates

A ReLU hidden unit receives s < 0 for every training example. What happens to its incoming weights during training?

  • A. Their gradients are scaled by 0.25 at most, so they update slowly.
  • B. The unit output saturates at 1, so the gradient is small.
  • C. Their gradients explode because ReLU is unbounded.
  • D. Their gradients are 0, so they are never updated (a dead neuron); Leaky ReLU with a small slope such as 0.02 avoids this.
D7 · 查看答案与解析

答案:D。A 的 0.25 是 sigmoid 导数上限;B 饱和到 1 是 sigmoid 的情形,ReLU 负区间输出 0;C 错,负区间导数为 0,不会爆炸。

English:D. ReLU has derivative 0 for s < 0, so the weights get no gradient; Leaky ReLU keeps a small slope a in the negative region.

回查:L05 p.16、p.17。L05b 梯度消失与 ReLU

D8 · L1 versus L2

Which statement about the gradient contributed by the regularization term is correct?

  • A. L2 adds α·sign(w), a constant pull, so L2 gives sparse weights.
  • B. L1 adds α·sign(w), a pull of constant size towards zero, which tends to make many weights exactly zero.
  • C. L1 adds 2αw, so small weights are barely affected.
  • D. L1 and L2 add the same term; they differ only in the value of α.
D8 · 查看答案与解析

答案:B。A 错,L2 加的是 2αw,按比例缩小,只压小不压到 0;C 错,2αw 是 L2 的项;D 错,两者梯度项形式不同。

English:B. L1 adds α·sign(w), a constant pull, which tends to give a sparse W; L2 adds 2αw and only shrinks the weights.

回查:L05 p.19、p.20、p.21。L05c 正则化

D9 · Which is not a regularization method

Which of the following is NOT one of the lecture’s methods against overfitting?

  • A. Data augmentation
  • B. Early stopping
  • C. Dropout
  • D. SGD with momentum
D9 · 查看答案与解析

答案:D。动量是「优化低效」的对策。A、B、C 都在 Other Regularization 页:early stopping 停在验证误差最低点,dropout 训练时随机关掉部分单元。

English:D. Momentum addresses ineffective optimization; the other three are regularization methods against overfitting.

回查:L05 p.8、p.12、p.22。L05c 正则化

D10 · Universal approximation

Which statement matches the lecture’s slide on the universal approximation theorem?

  • A. In theory a single hidden layer can represent any function, but it may be infeasibly large and may fail to learn or generalize.
  • B. A network of ReLU units is a smooth non-linear function with no corners.
  • C. The theorem guarantees that gradient descent will find the right weights.
  • D. The theorem shows that only deep networks can represent non-linear functions.
D10 · 查看答案与解析

答案:A。B 错,ReLU 网络是分段线性函数,每个 ReLU 单元贡献一个拐点;C 错,课件明说可能学不出;D 错,定理说单隐藏层理论上就够。

English:A. One hidden layer suffices in theory, but the layer may be infeasibly large and may not learn or generalize well.

回查:L05 p.25、p.26。L05d 万能逼近与分段线性

D11 · Output size with stride and padding

A 15×15 input is convolved with a 3×3 kernel, stride 2, one pixel of zero padding on each side. What is the output size?

  • A. 7×7
  • B. 8×8
  • C. 13×13
  • D. 15×15
D11 · 查看答案与解析

答案:B。(15 + 2×1 − 3)/2 + 1 = 8。A 漏了 padding;C 漏了 padding 也把 stride 当成 1;D 是 stride 1 加 padding 时的尺寸。

English:B. (N + 2p − k)/s + 1 = (15 + 2 − 3)/2 + 1 = 8.

回查:L06 p.12、p.18;T02 p.24。L06b 通道、参数与 padding

D12 · Matching the CNN milestones

Which pairing of architecture and key idea is correct?

  • A. AlexNet: skip connections that add the block input to its output.
  • B. VGG: uniform 3×3 kernels stacked to reach a large receptive field with fewer weights.
  • C. ResNet: replacing sigmoid with ReLU, the first such network.
  • D. VGG: a different kernel size in every layer.
D12 · 查看答案与解析

答案:B。A 错,F(x) + x 的 skip connection 是 ResNet;C 错,ReLU 替代 sigmoid 是 AlexNet;D 错,各层核大小不同是 AlexNet,VGG 统一 3×3。

English:B. VGG stacks 3×3 kernels: two layers see a 5×5 region with 18 instead of 25 weights per channel pair.

回查:L06 p.24、p.25、p.26。L06d AlexNet、VGG 与 ResNet

D13 · Sequence task structures

Generating a label for every frame of a video, as the frames arrive, is which structure?

  • A. One to Many
  • B. Many to One
  • C. Many to Many (synchronised: one output per input step)
  • D. Many to Many (read the whole input first, then output, as in machine translation)
D13 · 查看答案与解析

答案:C。A 是看图说话;B 是情感分类,整段只出一个输出;D 是机器翻译。

English:C. Video description produces one output per input frame, a synchronised many-to-many task.

回查:L07 p.11。L07a 序列任务结构

D14 · Reading the LSTM gates

In an LSTM step, the forget gate f_t ≈ 1 and the input gate i_t ≈ 0. What is the cell state c_t approximately?

  • A. c_{t−1}: the old memory is kept and almost nothing new is written.
  • B. 0: the cell is reset.
  • C. g_t: the candidate replaces the old memory.
  • D. h_t, because the output gate copies the hidden state into the cell.
D14 · 查看答案与解析

答案:A。c_t = f_t c_{t−1} + i_t g_t ≈ c_{t−1}。B 需要 f_t ≈ 0;C 需要 f_t ≈ 0、i_t ≈ 1;D 方向反了,h_t = o_t tanh(c_t),输出门从 cell 里读。

English:A. With f_t ≈ 1 and i_t ≈ 0, c_t = f_t c_{t−1} + i_t g_t ≈ c_{t−1}.

回查:L07 p.15。L07c LSTM

D15 · Self-attention versus RNN attention

Compared with the attention used with an RNN (Bahdanau et al.), the Transformer’s self-attention layer:

  • A. scores each pair with a small learnable network a(s_{i−1}, h_j) and must run step by step.
  • B. scores with dot products between queries and keys taken from the same input, so all positions can be computed at the same time.
  • C. drops the softmax, so the weights need not sum to 1.
  • D. uses only the last encoder state, like the Encoder Vector of seq2seq.
D15 · 查看答案与解析

答案:B。A 是 RNN + attention 的做法,课件说顺序处理很耗时;C 错,两者都有 softmax;D 是 seq2seq 不加 attention 的情形。

English:B. Self-attention uses dot products of queries and keys from the same input, so every position is computed in parallel.

回查:L07 p.16、p.21、p.22、p.23。L07d seq2seq 与注意力 · L07e Transformer 自注意力

D16 · Multi-head attention and padding

Which statement about the lecture’s Transformer slides is correct?

  • A. Multi-head attention averages the outputs of the heads and needs no linear layers.
  • B. Padding positions added to equalise sequence lengths are included in the loss like real tokens.
  • C. Multi-head attention passes Q, K, V through linear layers, runs h scaled dot-product attentions in parallel, concatenates them and applies a final linear layer.
  • D. Each head must use a different d_k, otherwise the heads learn the same thing.
D16 · 查看答案与解析

答案:C。A 错,课件是 Concat 后再过 Linear;B 错,补齐位置在计算损失时会被 mask 掉;D 课件没有这个要求,各头靠各自的线性变换关注不同位置关系。

English:C. Linear projections, h parallel scaled dot-product attentions, concatenation, then a final linear layer.

回查:L07 p.23、p.24;T03 p.5、p.13。L07e Transformer 自注意力 · T03a 注意力与多头代码

下一页 →
Q08 Final 计算题|E 第 8–10 讲

个人整理的学习笔记,不是官方材料;数字与结论以课件和讲师为准。