← 深度学习导航
FOUNDATION · REVIEW · KEY POINTS

重点

把已经学过的基础知识压缩成三样东西:能直接作答的一句话、必须能默写的公式、不能混淆的边界。主要面向基础概念,不引入新的高阶主题。

7 大基础模块7 组易混淆对照10 个高频错误可打印
PRIORITY 01

一句话定义:先写规范中文名称与英文名称,再用一句中文说明概念边界。

PRIORITY 02

公式表:Softmax、熵(Entropy)、KL 散度、卷积输出与参数量、贝尔曼方程、Q-learning 更新。

PRIORITY 03

易混淆点:看清“算什么、更新什么、作用在哪里”,再记名字。

目前复习进度判断

统一术语规则:中文名称(English Name, ABBR)。同一概念首次出现时给出中英文全称与缩写;后文优先使用中文或通用缩写,避免在同一句中无规则切换语言。

神经网络核心基础

激活函数、前向传播、损失函数、反向传播、梯度下降与线性网络。

概率与信息论

贝叶斯推断(Bayesian Inference)、熵(Entropy)、KL 散度、高斯微分熵、高斯 KL 散度与 Wasserstein 距离。

神经网络训练基础

Softmax、反向传播(Backpropagation)、隐藏单元动态(Hidden Unit Dynamics)与线性网络(Linear Network)。

卷积神经网络与训练技术

卷积神经网络(CNN)、权重初始化、批量归一化、残差网络(ResNet)与密集连接网络(DenseNet)。

强化学习基础

策略(Policy)、状态价值函数、动作价值函数、贝尔曼方程与 Q-learning 更新。

序列模型与生成模型

RNN、LSTM、注意力机制、Word2Vec、自动编码器(AE)、变分自动编码器(VAE)与生成对抗网络(GAN)。

判断:主要知识范围已经覆盖。剩下的高价值任务不是追加新知识,而是练习简要解释、公式默写和概念辨析。

根据当前掌握情况重新评估:已覆盖约 80%,剩余是基础补漏

第一梯队 · 必须补

  1. Perceptron Learning Algorithm · 计算与更新
  2. Bayes theorem · 条件概率计算
  3. XOR + Threshold Network · 不可线性分

第二梯队 · 高可能

  1. Hidden Unit Dynamics / Hidden Space
  2. Maximum Likelihood (MLE) vs Bayesian

第三梯队 · 保持熟悉

  1. Linear Perceptron / Threshold Activation
  2. Gaussian KL / Wasserstein

第一部分 · 神经网络基础(Neural Network Basics)

Forward计算 prediction
Loss衡量 prediction 与 target
Backprop用 chain rule 算 gradients
Optimizer使用 gradients 改 parameters
BACKPROPAGATION

一句话

Backpropagation calculates gradients of the loss with respect to network parameters using the chain rule.

中文:反向传播负责计算 loss 对 weight / bias 的梯度,不负责执行权重更新。
GRADIENT DESCENT

一句话

Gradient descent updates parameters using calculated gradients to reduce the loss.

W ← W − α ∂L/∂Wα:learning rate;梯度指向 loss 上升最快方向,所以向反方向更新。
ACTIVATION FUNCTION

一句话

Nonlinear activation functions allow neural networks to learn complex nonlinear patterns.

核心:Linear ∘ Linear 仍然是 Linear。没有层间非线性,网络再深也可合并成一个线性变换。
HIDDEN UNIT DYNAMICS

隐单元怎样改变?

Hidden Unit Dynamics 关注训练中隐藏单元的 pre-activation、activation 与 gradient 如何随 input 和 weights 变化。饱和、dead ReLU 与梯度消失都是其动态表现。

LINEAR NETWORK

多层线性网络的表达能力

Linear Network 中若每层都只做线性变换,则 W₃(W₂(W₁x)) = Wx;深度不会增加非线性表达能力。这也是 hidden layers 之间需要 nonlinear activation 的直接理由。

Softmax

softmax(zᵢ) = ezᵢ / Σⱼ ezⱼ把 logits 转换为非负且总和为 1 的概率分布;数值实现常先减 max(z)。

没有 Activation

Linear + Linear = Linear深度只重新参数化了同一类线性函数。

基础补漏 · Perceptron、XOR 与 Hidden Space

PERCEPTRON LEARNING ALGORITHM

从 score 到 prediction

A perceptron computes a weighted sum, applies a threshold, and updates its weights when the prediction is wrong.

s = w₀ + w₁x₁ + w₂x₂ = wTx把 bias 写进 vector 时令 x₀=1。
Threshold Activation
ŷ = 1 if s ≥ 0, otherwise 0threshold 的具体位置可不是 0,但可吸收进 bias。
UPDATE RULE

统一记法

w ← w + η(t − ŷ)x分量形式:wᵢ ← wᵢ + η(t−ŷ)xᵢ。prediction 正确时 t−ŷ=0,不更新。
  • target=1 但预测 0:沿 +x 方向移动 weights。
  • target=0 但预测 1:沿 −x 方向移动 weights。
  • 若标签用 −1/+1,对 misclassified point 常写 w ← w + ηtx。

计算题固定流程

01 · Score代入 x 与当前 w 计算 s
02 · Predict对 s 应用 threshold
03 · Compare比较 ŷ 与 target t
04 · Update错了才用 η(t−ŷ)x

XOR Truth Table

x₁x₂XOR
000
011
101
110

XOR + Threshold Network

XOR is not linearly separable:一条直线无法把两个 positive points 与两个 negative points 分开,所以单个 linear perceptron 做不了。Hidden layer 可以先组合多条 boundaries,把 input 重表示后再线性分类。

Input(x₁,x₂)
Hiddenh₁=OR,h₂=NAND
OutputAND(h₁,h₂)=XOR

Hidden Unit Dynamics:“重新表示数据”是什么?

6D Input每个 sample 是六维坐标
Weighted Sums两个 hidden units 各算一个 projection
2D Hidden Space每个 input 变成 (h₁,h₂) 中的点
Sigmoid Output在 hidden space 上学一条 decision boundary
考理解:hidden layer 不只是“多算一层”,而是把原空间的数据映射到更容易分类的 representation space。训练时 hidden points 会随 weights 改变,这就是 Hidden Unit Dynamics 的直观核心。

第二部分 · 训练问题(Training Problems)

OVERFITTING

Overfitting:一句话

The model performs well on training data but poorly on unseen data.

  • Dropout
  • L2 regularization
  • Early stopping
  • Data augmentation
DROPOUT

一句话

Randomly disables units during training to reduce co-adaptation and overfitting.

  • Training:随机 mask 部分 units。
  • Testing:不再随机关闭;使用完整网络。
WEIGHT INITIALIZATION

一句话

Initializes weights at an appropriate scale to reduce vanishing or exploding activations and gradients.

关键词:训练开始前,直接作用于 weights。Xavier / He 根据 fan-in / fan-out 选择尺度。

BATCH NORMALIZATION

一句话

Normalizes activations using mini-batch statistics, then applies learnable scale and shift to stabilize training.

关键词:主要管 activation,使用 γ / β 恢复可学表达能力。

INITIALIZATION vs BATCHNORM

一眼分清

  • Initialization:训练开始前设置 weight 尺度。
  • BatchNorm:训练过程中处理 activations,并学习 γ / β。
COMMON FAILURE

不要这样说

  • ❌ Initialization “找到最优 weight”。
  • ✓ 它只选择合理的初始范围。
  • ❌ BatchNorm 只是把 weights 归一化。
  • ✓ 它标准化中间 activations。

第三部分 · 卷积神经网络(CNN)

LOCAL CONNECTIVITY

局部感受野

神经元每次只看 input 的局部区域,适合捕捉边缘、纹理和局部组合。

WEIGHT SHARING

权重共享

同一个 filter 扫描所有位置,大幅减少 parameters,并在不同位置检测同一 pattern。

SPATIAL BEHAVIOUR

位置移动

卷积本身更严格地说具有 translation equivariance;输入移动,feature map 随之移动。Pooling / global aggregation 才能增强近似 translation invariance。

Convolution Output

⌊(N + 2P − F) / S⌋ + 1基础版:dilation = 1。一般版将 F 换成 D(F−1)+1;若不整除必须向下取整(Math.floor)。

Filter Parameters

(F × F × Cin + 1) × Cout+1 是每个 filter 的 bias(若该层不用 bias 就去掉);Cout = number of filters = output depth。
CNN ARCHITECTURE

基础流程

Input → Convolution → Activation → Pooling / Downsampling → 更高层 features → Head。深层逐渐从边缘组合出更抽象的结构。

POOLING

与 Dropout 不同

Pooling 在 spatial dimensions 上聚合局部特征,常用于下采样和增强局部不变性;它不是随机关闭 neuron 的 regularization。

RESNET

Shortcut Connection

Shortcut connections provide a direct path for information and gradient flow, allowing deeper networks to train.

y = x + F(x)
DENSENET

Dense Connectivity

DenseNet 将每一层的 feature maps 传给后面所有层,通常用 concatenation 而非 addition,促进 feature reuse 与 gradient flow。

PARAMETER COUNT

为什么参数少?

CNN 并非天生“网络小”;它相对 fully connected image model 参数少,主要来自 local connectivity 和 weight sharing。

OUTPUT DEPTH

秒答

Output depth 等于 number of filters。每个 filter 产生一个 output channel / feature map。

第四部分 · 概率与信息论(Probability & Information Theory)

BAYES

从 prior 到 posterior

Bayes' rule updates prior belief using observed evidence.

p(θ|D) = p(D|θ)p(θ) / p(D)posterior ∝ likelihood × prior
ENTROPY

一句话

Entropy measures the uncertainty of a probability distribution. 分布越均匀,离散 entropy 通常越大。

KL DIVERGENCE

一句话

KL divergence measures the expected log-density mismatch from a reference distribution p to an approximation q. 左边 p 负责加权。

贝叶斯推断(Bayesian Inference):先有先验,再用数据更新

Bayesian inference combines prior knowledge with observed data to obtain a posterior distribution.
贝叶斯推断把先验知识(prior knowledge)和观察到的数据(observed data)结合起来,得到后验分布(posterior distribution)。

Prior看数据前:硬币可能约 50% 正面
Observed data实际观察:连续 10 次都是正面
Likelihood不同 θ 下,这组数据有多可能
Posterior原来的相信 + 新数据:硬币可能更偏正面
P(θ|D) ∝ P(D|θ)P(θ)后验 ∝ 似然 × 先验;完整等式的归一化常数是 evidence P(D)。

Bayes theorem

P(A|B) = P(B|A)P(A) / P(B)P(A):prior;P(B|A):likelihood;P(B):evidence;P(A|B):posterior。条件方向不能倒置。

硬币中的 Likelihood

L(θ;D) = θH(1−θ)TH 个正面、T 个反面。Likelihood 把数据视为已知,比较不同 parameter θ 对数据的解释能力。

Maximum Likelihood (MLE) vs Bayesian

核心问题

Maximum Likelihood (MLE)“哪一个 parameter value 最能解释已观察数据?”

贝叶斯推断(Bayesian Inference)“加入先验后,参数的完整后验分布是什么?”

输出

point estimateMLE chooses the parameters that maximize the likelihood of observed data. 例如 100 次抛币有 60 次正面,则 θ̂MLE=0.6。

DistributionBayesian 把 parameter 也当作不确定量,输出 p(θ|D),可表达“最可能在哪里”以及“有多不确定”。

一句话对照:MLE 是不加 prior 的 likelihood maximization,常给出一个最优参数值;Bayesian 结合 prior 与 likelihood,得到 parameter 的 posterior distribution。

Discrete Entropy

H(p) = −Σᵢ pᵢ log₂ pᵢlog base 2 时单位是 bits;natural log 时是 nats。必须看清题目使用的 log base。

KL Divergence

DKL(p‖q) = Σᵢ pᵢ log(pᵢ/qᵢ)非负、不对称,因此不是 metric distance;若 pᵢ>0 但 qᵢ=0,则发散。

Gaussian Differential Entropy

h(X) = ½ ln[(2πe)k|Σ|]关键看 covariance determinant |Σ|;它是 continuous differential entropy,不能把离散 entropy 的所有性质直接照搬。

Gaussian KL

DKL(p‖q)=½[tr(Σq−1Σp)+ΔμTΣq−1Δμ−k+ln(|Σq|/|Σp|)]同时看 mean difference 和 covariance difference;方向交换后 inverse 与 determinant ratio 也会变。

Gaussian Wasserstein-2

W₂² = ‖μp−μq‖² + tr(Σpq−2(Σq½ΣpΣq½)½)Measures the transport cost of transforming one distribution into another;看 mean 和 shape。

KL Direction

D(p‖q) ≠ D(q‖p)p 是 expectation / weighting distribution。先问“用谁的 samples 平均?”再决定方向。

第五部分 · 强化学习(Reinforcement Learning)

POLICY

Policy π(a|s)

Policy tells the agent how to choose an action in each state. 它可以是 deterministic 动作,也可以是 action distribution。

VALUE FUNCTION

Value Function V(s)

V(s) is the expected discounted return starting from state s and following a policy.

Q FUNCTION

Q Function Q(s,a)

Q(s,a) is the expected discounted return after taking action a in state s and then following a policy.

DISCOUNT

γ

Controls how strongly future rewards affect the current return. 小 γ 更看当下;大 γ 更看未来。

Bellman Expectation Equation

Vᵖ(s)=Σₐπ(a|s)Σs′,rp(s′,r|s,a)[r+γVᵖ(s′)]V(s)=r+γV(s′) 是单步、确定性 transition / reward 下的简化直觉,不是完整通用公式。

Q-learning TD Target

y = r + γ maxa′Q(s′,a′)这是 TD target,不是完整 parameter / table update。Terminal state 通常不再加 bootstrap 项。

Q-learning Update

Q(s,a) ← Q(s,a) + α[r+γ maxa′Q(s′,a′)−Q(s,a)]旧估计 + learning rate × TD error。Q-learning 是 off-policy,target 使用 greedy max。

V 与 Q

V*(s)=maxaQ*(s,a)V 只评估 state;Q 评估 state–action pair。max 给 value,argmax 给 action。
EXPERIENCE REPLAY

Experience Replay:一句话

Stores past transitions and samples mini-batches to reduce temporal correlation and reuse data. 它使 DQN 的更新更接近 i.i.d. mini-batch training。

DOUBLE Q

一句话

Decouples action selection from action evaluation to reduce max-operator overestimation. Double DQN 常用 online network 选 action,target network 评估该 action。

第六部分 · 序列模型与词向量(Sequence Models & Word Vectors)

RNN PROBLEM

长程依赖

RNNs can suffer from vanishing or exploding gradients when learning long-range dependencies. 问题来自 BPTT 中 Jacobians 的反复相乘,不是简单的“memory 小”。

LSTM

一句话

LSTM uses gates and a cell state to control information flow and preserve useful long-term information.

  • Forget gate:保留/忘记旧 cell information
  • Input gate:写入新 information
  • Output gate:决定暴露的 hidden output
ATTENTION

一句话

Attention computes relevance weights so the model can focus on important parts of the input. 它是加权聚合,不是硬删除其他 tokens。

POSITIONAL ENCODING

Positional Encoding:为什么需要?

Self-attention alone has no built-in notion of token order, so positional information must be added or encoded.

CBOW

Context → Center

Predict the target / center word from surrounding context words. 口诀:大家猜中间。

SKIP-GRAM

Skip-Gram:Center → Context

Predict surrounding context words from the target / center word. 口诀:中间猜大家。

WORD2VEC

预测是手段

Word2Vec 通过 context prediction task 学习 dense embeddings。最终要保留的是 weight matrix 中的 word vectors,而不是 prediction task 本身。

SVD

一句话

SVD compresses a high-dimensional co-occurrence matrix into lower-dimensional word representations.

X = UΣVT
WORD2VEC SOFTMAX

Score → Probability

对 candidate words 的 scores 应用 Softmax,训练时提高真实 context word 的 probability;大 vocabulary 下常用 Negative Sampling 等方法加速。

第七部分 · 生成模型(Generative Models)

AUTOENCODER

一句话

An encoder maps input to a latent representation and a decoder reconstructs the input. 普通 AE 的 encoder 通常为每个 input 给出一个 deterministic latent vector。

VAE

一句话

VAE learns a conditional probability distribution in latent space and samples latent variables for reconstruction/generation. Encoder 输出 μ 与 variance / log-variance,参数化 q(z|x)。

KL[q(z|x) ‖ N(0,I)]将 approximate posterior 拉近 prior。
GAN

一句话

The generator creates fake samples while the discriminator distinguishes real samples from generated ones. 二者进行 adversarial training;这与 Double Q 的动作选择/评估解耦无关。

AE

一个确定点

x → z → x̂;主要目标是 reconstruction。

VAE

一个 distribution

x → (μ,σ) → sample z → x̂;目标同时包含 reconstruction 与 KL regularization。

七组必须分清的概念

反向传播与梯度下降(Backpropagation vs Gradient Descent)

反向传播使用链式法则计算梯度。

梯度下降使用梯度更新参数。

权重初始化与批量归一化(Weight Initialization vs Batch Normalization)

权重初始化在训练前设置权重的初始尺度。

批量归一化在训练中标准化激活值,并学习缩放与平移参数。

丢弃法与池化(Dropout vs Pooling)

Dropout是一种正则化方法;训练时随机屏蔽神经元。

池化用于空间聚合与降采样,处理特征图的局部区域。

自动编码器与变分自动编码器(Autoencoder vs VAE)

AE通常输出确定性的潜在向量,并直接优化重构误差。

VAE参数化 q(z|x),采样潜变量,并加入 KL 约束。

生成对抗网络与 Double Q(GAN vs Double Q)

GAN通过生成器与判别器进行对抗训练。

Double Q解耦动作选择与动作评估,以减少 Q 值过估计。

状态价值与动作价值(V(s) vs Q(s,a))

V(s)表示从状态 s 出发的期望回报。

Q(s,a)表示在状态 s 先执行动作 a 后的期望回报。

KL 方向(KL direction)

D(p‖q)由 p 加权,对 q 在 p 有概率质量的位置给出零概率非常敏感。

D(q‖p)由 q 加权,优化行为不同;方向不能随意交换。

最容易错 TOP 10

❌ Backprop 更新 weight

✓ Backprop 算 gradient;optimizer 更新 weight。

❌ BatchNorm 管 weight

✓ BatchNorm 主要标准化 activation。

❌ Weight Initialization 找最优 weight

✓ 它只选择合理的初始范围。

❌ Dropout 减少图片大小

✓ Dropout 训练时随机 mask units;Pooling 才会聚合 spatial region。

❌ VAE 只输出一个 latent 变量

✓ VAE encoder 输出分布参数,常为 mean + variance / log-variance。

❌ Double Q 是生成和判别

✓ GAN 才是 Generator / Discriminator;Double Q 解耦选择与评估。

❌ KL 是普通距离

✓ KL 不对称,不满足 metric 的对称性。

❌ Q 和 V 一样

✓ Q 多一个 action 条件;V 只条件于 state。

❌ CNN 一定参数很多

✓ 卷积通过 local connectivity 和 weight sharing 减少参数。

❌ RNN 忘记只是因为 memory 小

✓ 长程依赖的关键训练问题是 BPTT 中的 vanishing gradient。

“可能会误导”或“可能不懂”的地方

1. “Testing 时 Dropout 全部打开”还少了什么?

严谨版:inference 时不再随机 mask。常见 inverted dropout 已在 training 时按 1/(1−p) 缩放,因此 testing 时无需再缩放。

2. BatchNorm 不是 train / test 完全一样

严谨版:training 使用 mini-batch mean / variance;inference 通常使用训练期累积的 running mean 和 running variance。

3. CNN 是 invariant 还是 equivariant?

严谨版:convolution 对平移主要是 equivariant。Pooling、stride 和 global aggregation 可带来一定的近似 invariance,但不应笼统说 CNN 对任意移动完全不变。

4. Conv output 公式为什么要 floor?

严谨版:只有 filter 完整落在 padded input 上才算一个位置。当 stride 不整除时,位置数必须向下取整;还要注意 dilation。

5. “Entropy 越平均越大”的边界

严谨版:对固定有限类别数的离散分布,uniform distribution 取最大 entropy。Gaussian 这里讨论的是 differential entropy,性质不能全部照搬。

6. KL 不只是“差多少”

严谨版:KL 是对 log density ratio 的期望,方向决定由谁加权。D(p‖q) 与 D(q‖p) 对 mode covering / seeking 的倾向可不同。

7. Bellman 简式不是通用式

严谨版:V(s)=r+γV(s′) 适合说明 deterministic one-step intuition。一般情况必须对 policy actions 与 environment transitions 取 expectation。

8. Q-learning 右边是 target,不是 update 全部

严谨版:r+γmax Q(s′,a′) 是 TD target。完整的 tabular update 还需要旧 Q、learning rate α 和 TD error。

9. RNN 是“can suffer”,不是必然完全失败

严谨版:梯度消失/爆炸取决于 recurrent Jacobian、activation、参数与 sequence length。LSTM / GRU、gradient clipping 和合理 initialization 都可缓解。

10. VAE 不是“直接输出随机数”

严谨版:encoder 输出分布参数,通过 reparameterization z=μ+σ⊙ε 采样,使 gradient 能穿过 sampling path。

11. Attention “聚焦”不等于只看一个 token

严谨版:attention 通常对多个 values 做加权和。权重可以集中,也可以分散;其目的是按相关性聚合信息。

12. Double Q 与 target network 不是同一定义

严谨版:target network 主要稳定 bootstrap target;Double Q 的核心是解耦 selection 和 evaluation。Double DQN 常将两者结合。