math-skill 2.0.1 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en-US.md +167 -175
- package/README.md +167 -175
- package/agents/math-critic.en.md +235 -0
- package/agents/math-critic.md +10 -8
- package/commands/ask.md +3 -12
- package/design-patterns/attention/equivariant-attention.en.md +72 -0
- package/design-patterns/attention/equivariant-attention.md +72 -0
- package/design-patterns/attention/geometry-aware-attention.en.md +73 -0
- package/design-patterns/attention/geometry-aware-attention.md +72 -0
- package/design-patterns/attention/information-bottleneck-attention.en.md +72 -0
- package/design-patterns/attention/information-bottleneck-attention.md +72 -0
- package/design-patterns/attention/projection-attention.en.md +68 -0
- package/design-patterns/attention/projection-attention.md +68 -0
- package/design-patterns/attention/spectral-attention.en.md +71 -0
- package/design-patterns/attention/spectral-attention.md +71 -0
- package/design-patterns/compression/leverage-score-selection.en.md +71 -0
- package/design-patterns/compression/leverage-score-selection.md +71 -0
- package/design-patterns/compression/low-rank-kv-cache.en.md +60 -0
- package/design-patterns/compression/low-rank-kv-cache.md +60 -0
- package/design-patterns/compression/spectral-token-pruning.en.md +61 -0
- package/design-patterns/compression/spectral-token-pruning.md +61 -0
- package/design-patterns/compression/topology-preserving-compression.en.md +64 -0
- package/design-patterns/compression/topology-preserving-compression.md +64 -0
- package/design-patterns/loss/constraint-penalty.en.md +67 -0
- package/design-patterns/loss/constraint-penalty.md +78 -0
- package/design-patterns/loss/contrastive-loss.en.md +59 -0
- package/design-patterns/loss/contrastive-loss.md +68 -0
- package/design-patterns/loss/information-bottleneck-loss.en.md +69 -0
- package/design-patterns/loss/information-bottleneck-loss.md +74 -0
- package/design-patterns/loss/orthogonality-loss.en.md +56 -0
- package/design-patterns/loss/orthogonality-loss.md +60 -0
- package/design-patterns/loss/variational-loss.en.md +61 -0
- package/design-patterns/loss/variational-loss.md +71 -0
- package/design-patterns/representation/equivariant-split.en.md +87 -0
- package/design-patterns/representation/equivariant-split.md +89 -0
- package/design-patterns/representation/manifold-representation.en.md +85 -0
- package/design-patterns/representation/manifold-representation.md +87 -0
- package/design-patterns/representation/shared-private-decomposition.en.md +84 -0
- package/design-patterns/representation/shared-private-decomposition.md +86 -0
- package/design-patterns/representation/subspace-alignment.en.md +90 -0
- package/design-patterns/representation/subspace-alignment.md +92 -0
- package/design-patterns/routing/graph-routing.en.md +79 -0
- package/design-patterns/routing/graph-routing.md +81 -0
- package/design-patterns/routing/moe-routing.en.md +85 -0
- package/design-patterns/routing/moe-routing.md +87 -0
- package/design-patterns/routing/optimal-transport-routing.en.md +68 -0
- package/design-patterns/routing/optimal-transport-routing.md +72 -0
- package/design-patterns/routing/spectral-clustering-routing.en.md +88 -0
- package/design-patterns/routing/spectral-clustering-routing.md +90 -0
- package/knowledge-base/differential-geometry/connection.en.md +51 -0
- package/knowledge-base/differential-geometry/connection.md +51 -0
- package/knowledge-base/differential-geometry/curvature.en.md +49 -0
- package/knowledge-base/differential-geometry/curvature.md +49 -0
- package/knowledge-base/differential-geometry/geodesic.en.md +51 -0
- package/knowledge-base/differential-geometry/geodesic.md +51 -0
- package/knowledge-base/differential-geometry/manifold.en.md +47 -0
- package/knowledge-base/differential-geometry/manifold.md +47 -0
- package/knowledge-base/differential-geometry/metric-tensor.en.md +50 -0
- package/knowledge-base/differential-geometry/metric-tensor.md +50 -0
- package/knowledge-base/differential-geometry/tangent-space.en.md +48 -0
- package/knowledge-base/differential-geometry/tangent-space.md +48 -0
- package/knowledge-base/information-geometry/fisher-metric.en.md +56 -0
- package/knowledge-base/information-geometry/fisher-metric.md +56 -0
- package/knowledge-base/information-geometry/natural-gradient.en.md +54 -0
- package/knowledge-base/information-geometry/natural-gradient.md +54 -0
- package/knowledge-base/lie-theory/equivariance.en.md +54 -0
- package/knowledge-base/lie-theory/equivariance.md +54 -0
- package/knowledge-base/lie-theory/group-action.en.md +51 -0
- package/knowledge-base/lie-theory/group-action.md +51 -0
- package/knowledge-base/lie-theory/lie-algebra.en.md +51 -0
- package/knowledge-base/lie-theory/lie-algebra.md +51 -0
- package/knowledge-base/lie-theory/lie-group.en.md +51 -0
- package/knowledge-base/lie-theory/lie-group.md +51 -0
- package/knowledge-base/lie-theory/representation.en.md +52 -0
- package/knowledge-base/lie-theory/representation.md +52 -0
- package/knowledge-base/matrix-analysis/low-rank-approximation.en.md +49 -0
- package/knowledge-base/matrix-analysis/low-rank-approximation.md +49 -0
- package/knowledge-base/matrix-analysis/matrix-perturbation.en.md +49 -0
- package/knowledge-base/matrix-analysis/matrix-perturbation.md +49 -0
- package/knowledge-base/matrix-analysis/positive-semidefinite.en.md +50 -0
- package/knowledge-base/matrix-analysis/positive-semidefinite.md +50 -0
- package/knowledge-base/matrix-analysis/projection.en.md +47 -0
- package/knowledge-base/matrix-analysis/projection.md +47 -0
- package/knowledge-base/matrix-analysis/spectral-decomposition.en.md +48 -0
- package/knowledge-base/matrix-analysis/spectral-decomposition.md +48 -0
- package/knowledge-base/optimization/constrained-optimization.en.md +53 -0
- package/knowledge-base/optimization/constrained-optimization.md +53 -0
- package/knowledge-base/optimization/convex-optimization.en.md +50 -0
- package/knowledge-base/optimization/convex-optimization.md +50 -0
- package/knowledge-base/optimization/lagrangian-duality.en.md +50 -0
- package/knowledge-base/optimization/lagrangian-duality.md +50 -0
- package/knowledge-base/optimization/proximal-method.en.md +52 -0
- package/knowledge-base/optimization/proximal-method.md +52 -0
- package/knowledge-base/optimization/riemannian-optimization.en.md +51 -0
- package/knowledge-base/optimization/riemannian-optimization.md +51 -0
- package/knowledge-base/overview.en.md +39 -0
- package/knowledge-base/overview.md +29 -218
- package/knowledge-base/probability/concentration-inequality.en.md +45 -0
- package/knowledge-base/probability/concentration-inequality.md +45 -0
- package/knowledge-base/probability/entropy.en.md +47 -0
- package/knowledge-base/probability/entropy.md +47 -0
- package/knowledge-base/probability/fisher-information.en.md +48 -0
- package/knowledge-base/probability/fisher-information.md +48 -0
- package/knowledge-base/probability/information-bottleneck.en.md +49 -0
- package/knowledge-base/probability/information-bottleneck.md +49 -0
- package/knowledge-base/probability/kl-divergence.en.md +51 -0
- package/knowledge-base/probability/kl-divergence.md +51 -0
- package/knowledge-base/topology/euler-characteristic.en.md +54 -0
- package/knowledge-base/topology/euler-characteristic.md +54 -0
- package/knowledge-base/topology/fundamental-group.en.md +52 -0
- package/knowledge-base/topology/fundamental-group.md +52 -0
- package/knowledge-base/topology/persistent-homology.en.md +54 -0
- package/knowledge-base/topology/persistent-homology.md +54 -0
- package/lenses/algorithmic.en.md +49 -0
- package/lenses/algorithmic.md +49 -0
- package/lenses/axiomatization.en.md +48 -0
- package/lenses/axiomatization.md +48 -0
- package/lenses/categorical.en.md +48 -0
- package/lenses/categorical.md +48 -0
- package/lenses/causal.en.md +49 -0
- package/lenses/causal.md +49 -0
- package/lenses/duality.en.md +47 -0
- package/lenses/duality.md +47 -0
- package/lenses/game.en.md +50 -0
- package/lenses/game.md +50 -0
- package/lenses/geometric.en.md +53 -0
- package/lenses/geometric.md +53 -0
- package/lenses/local-to-global.en.md +52 -0
- package/lenses/local-to-global.md +52 -0
- package/lenses/perturbation.en.md +51 -0
- package/lenses/perturbation.md +51 -0
- package/lenses/probabilistic.en.md +48 -0
- package/lenses/probabilistic.md +48 -0
- package/lenses/projection.en.md +50 -0
- package/lenses/projection.md +50 -0
- package/lenses/spectral.en.md +52 -0
- package/lenses/spectral.md +52 -0
- package/lenses/symmetry.en.md +49 -0
- package/lenses/symmetry.md +49 -0
- package/lenses/topological.en.md +48 -0
- package/lenses/topological.md +48 -0
- package/lenses/variational.en.md +48 -0
- package/lenses/variational.md +48 -0
- package/package.json +11 -3
- package/references/agentic-workflow.en.md +53 -0
- package/references/agentic-workflow.md +2 -0
- package/references/books/abstract-algebra.md +9 -5
- package/references/books/algebraic-geometry-rising-sea.md +9 -5
- package/references/books/differential-geometry.md +7 -3
- package/references/books/matrix-analysis.md +8 -4
- package/references/books/micro-lie-theory.md +7 -3
- package/references/books/optimization-ml.md +5 -1
- package/references/books/smooth-manifolds.md +7 -3
- package/references/gpu-friendly-math.en.md +65 -0
- package/references/gpu-friendly-math.md +4 -2
- package/references/inspiration.en.md +113 -0
- package/references/inspiration.md +4 -2
- package/skills/math-research-activator/SKILL.en.md +187 -0
- package/skills/math-research-activator/SKILL.md +162 -108
- package/skills/math-research-activator/original-texts.en.md +105 -0
- package/skills/math-research-activator/original-texts.md +11 -11
- package/commands/abstraction.md +0 -13
- package/commands/algorithmic-thinking.md +0 -13
- package/commands/axiomatization.md +0 -13
- package/commands/causal-inference.md +0 -13
- package/commands/discrete-combinatorial.md +0 -13
- package/commands/game-theory.md +0 -13
- package/commands/induction-analogy.md +0 -13
- package/commands/information-theory.md +0 -13
- package/commands/logic-deduction.md +0 -13
- package/commands/modeling.md +0 -13
- package/commands/optimization.md +0 -13
- package/commands/probability-statistics.md +0 -13
- package/commands/symmetry-invariance.md +0 -13
- package/commands/topological-thinking.md +0 -13
- package/commands/transformation.md +0 -13
- package/skills/abstraction/SKILL.md +0 -119
- package/skills/abstraction/original-texts.md +0 -175
- package/skills/algorithmic-thinking/SKILL.md +0 -136
- package/skills/algorithmic-thinking/original-texts.md +0 -256
- package/skills/axiomatization/SKILL.md +0 -149
- package/skills/axiomatization/original-texts.md +0 -160
- package/skills/causal-inference/SKILL.md +0 -149
- package/skills/causal-inference/original-texts.md +0 -167
- package/skills/discrete-combinatorial/SKILL.md +0 -129
- package/skills/discrete-combinatorial/original-texts.md +0 -185
- package/skills/game-theory/SKILL.md +0 -121
- package/skills/game-theory/original-texts.md +0 -131
- package/skills/induction-analogy/SKILL.md +0 -150
- package/skills/induction-analogy/original-texts.md +0 -154
- package/skills/information-theory/SKILL.md +0 -138
- package/skills/information-theory/original-texts.md +0 -127
- package/skills/logic-deduction/SKILL.md +0 -133
- package/skills/logic-deduction/original-texts.md +0 -173
- package/skills/modeling/SKILL.md +0 -137
- package/skills/modeling/original-texts.md +0 -165
- package/skills/optimization/SKILL.md +0 -133
- package/skills/optimization/original-texts.md +0 -168
- package/skills/probability-statistics/SKILL.md +0 -149
- package/skills/probability-statistics/original-texts.md +0 -193
- package/skills/symmetry-invariance/SKILL.md +0 -137
- package/skills/symmetry-invariance/original-texts.md +0 -221
- package/skills/topological-thinking/SKILL.md +0 -126
- package/skills/topological-thinking/original-texts.md +0 -164
- package/skills/transformation/SKILL.md +0 -122
- package/skills/transformation/original-texts.md +0 -216
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# 近端方法 (Proximal Methods)
|
|
2
|
+
|
|
3
|
+
## 最小定义
|
|
4
|
+
|
|
5
|
+
对不可微或非光滑目标函数 $f(x) = g(x) + h(x)$($g$ 光滑、$h$ 可能不可微但"简单"),用近端算子 $\text{prox}_{\eta h}(v) = \arg\min_x \{h(x) + \frac{1}{2\eta}\|x - v\|^2\}$ 代替对 $h$ 的梯度。近端方法将不可微部分封装为一个闭式子问题。
|
|
6
|
+
|
|
7
|
+
## 核心公式
|
|
8
|
+
|
|
9
|
+
- 近端算子:$\text{prox}_{\eta h}(v) = \arg\min_x \left\{h(x) + \frac{1}{2\eta}\|x - v\|^2\right\}$
|
|
10
|
+
- 近端梯度下降 (ISTA):$x_{k+1} = \text{prox}_{\eta h}(x_k - \eta \nabla g(x_k))$
|
|
11
|
+
- 加速近端梯度 (FISTA):$y_k = x_k + \frac{k-1}{k+2}(x_k - x_{k-1})$,$x_{k+1} = \text{prox}_{\eta h}(y_k - \eta \nabla g(y_k))$,收敛率 $O(1/k^2)$ vs. ISTA 的 $O(1/k)$
|
|
12
|
+
- Soft-thresholding($\ell_1$ 近端):$\text{prox}_{\eta\|\cdot\|_1}(v)_i = \text{sign}(v_i)\max(|v_i| - \eta, 0)$
|
|
13
|
+
- 投影(指示函数近端):$\text{prox}_{\eta \delta_\mathcal{C}}(v) = \text{proj}_\mathcal{C}(v)$
|
|
14
|
+
- 核范数近端(奇异值软阈值):$\text{prox}_{\eta\|\cdot\|_*}(A) = U(\Sigma - \eta I)_+ V^H$
|
|
15
|
+
- Moreau envelope:$h_\eta(v) = \min_x \{h(x) + \frac{1}{2\eta}\|x-v\|^2\}$($h$ 的光滑近似)
|
|
16
|
+
- ADMM 分裂:$\min f(x) + g(z)$ s.t. $Ax + Bz = c$,交替更新 $x, z, u$(对偶变量)
|
|
17
|
+
|
|
18
|
+
## 适用问题
|
|
19
|
+
|
|
20
|
+
- 稀疏训练 / $\ell_1$ 正则化:权重稀疏化、特征选择
|
|
21
|
+
- 低秩矩阵恢复:核范数正则化(矩阵补全、鲁棒 PCA)
|
|
22
|
+
- 分组稀疏 / Group Lasso:$\sum_g \|w_g\|_2$ 正则化(结构化剪枝)
|
|
23
|
+
- 约束优化的算子分裂:ADMM 将复杂约束分解为简单子问题
|
|
24
|
+
- 量化感知训练:将权重量化建模为近端算子(round + straight-through gradient)
|
|
25
|
+
|
|
26
|
+
## AI 设计翻译
|
|
27
|
+
|
|
28
|
+
- **Soft-thresholding 做稀疏训练**:$\text{prox}_{\eta\lambda\|\cdot\|_1}(w) = \text{sign}(w) \odot \max(|w| - \eta\lambda, 0)$,实现为 `w.sign() * (w.abs() - eta * lam).clamp(min=0)`,纯 elementwise,$O(d)$,零额外显存。每次 SGD 更新后做一次 soft-thresholding 即可得到稀疏权重。
|
|
29
|
+
- **奇异值软阈值做低秩正则**:$\text{prox}_{\eta\|\cdot\|_*}(W) = U(\Sigma - \eta)_+ V^H$。需 SVD,大矩阵用随机化 SVD 近似:先做 randomized SVD 到 rank $r$,再对 $\Sigma$ 做 elementwise soft-threshold,重构。核心是 matmul 链 + elementwise。
|
|
30
|
+
- **Group Lasso 结构化剪枝**:$\text{prox}_{\eta\sum_g\|w_g\|_2}(w)_g = w_g \cdot \max(1 - \eta/\|w_g\|_2, 0)$。按通道/头分组后,每组独立做 soft-thresholding(norm + elementwise scale),$O(d)$。实现为 reshape + norm(dim) + clamp + mul。
|
|
31
|
+
- **ADMM 做分布式训练**:$\min \sum_i f_i(x_i) + g(z)$ s.t. $x_i = z$。各节点独立更新 $x_i$(本地 SGD),server 更新 $z = \text{prox}_{g/\rho}(\bar{x} + u)$(聚合 + 近端),$u$ 对偶变量更新。通信效率高于 all-reduce(只需传 $x_i$ 和 $z$)。
|
|
32
|
+
- **量化近端算子**:将权重量化建模为 $\text{prox}(w) = \Delta \cdot \text{round}(w/\Delta)$,反向传播用 straight-through estimator(STE):$\partial \text{prox}/\partial w \approx 1$。实现为 `w_q = (w / delta).round() * delta`,forward 是 elementwise round + mul,backward 是 identity。
|
|
33
|
+
|
|
34
|
+
## 工程可行性
|
|
35
|
+
|
|
36
|
+
- **主要操作**:近端算子多为 elementwise(soft-thresholding、clamp、group norm)或 matmul + 小 SVD(核范数)。梯度步 = 标准反向传播。
|
|
37
|
+
- **GPU 友好度**:极高。$\ell_1$ 近端 = elementwise;group lasso 近端 = reshape + norm + scale = elementwise;核范数近端 = matmul + 小 SVD。FISTA 的动量项也是 elementwise。ADMM 的通信模式适配数据并行。
|
|
38
|
+
- **复杂度**:ISTA/FISTA 每步 = 一次梯度计算 + 一次近端算子($O(d)$ elementwise);核范数近端 = $O(nd^2)$(随机化 SVD 降到 $O(ndk)$);ADMM 每节点 = 本地 SGD + $O(d)$ 通信。
|
|
39
|
+
- **低精度**:elementwise 近端算子在 bf16 下稳定(不涉及精细数值运算)。SVD 类近端需在 fp32 下计算。FISTA 的动量累积在 bf16 下可能丢精度,建议用 fp32 存储 $y_k$。
|
|
40
|
+
|
|
41
|
+
## 风险与失效条件
|
|
42
|
+
|
|
43
|
+
- **核范数近端的 SVD 开销**:大矩阵每步完整 SVD 是 $O(n^3)$,不可行。解决:(1) 随机化 SVD 近似;(2) 因子化 $\|W\|_* = \min_{W=UV^T} \frac{1}{2}(\|U\|_F^2 + \|V\|_F^2)$ 转为对 $U, V$ 的光滑优化,无需 SVD。
|
|
44
|
+
- **FISTA 的重启问题**:FISTA 的 $y_k$ 序列可能振荡(非单调),导致实际收敛慢于理论。解决:adaptive restart(当 $f(x_{k+1}) > f(x_k)$ 时重置动量 $t_k = 1$),实现为简单的 if 判断。
|
|
45
|
+
- **ADMM 的 $\rho$ 参数敏感**:$\rho$ 过大导致子问题病态,$\rho$ 过小导致对偶收敛慢。解决:adaptive $\rho$(根据 primal/dual residual 比值自动调整),每若干步 $\rho \leftarrow \rho \cdot \tau$($\tau > 1$ 若 primal residual $>$ dual residual)。
|
|
46
|
+
- **近端算子无闭式解**:并非所有 $h(x)$ 都有闭式 prox。复杂正则项(如 TV 正则、重叠 group lasso)需内层迭代求解。解决:用 Dykstra 算法分裂为多个简单 prox 的组合,或改用 ADMM 分裂。
|
|
47
|
+
- **Straight-Through Estimator 的偏差**:量化 prox 的 STE 梯度有偏($\partial \text{round}/\partial w = 0$ 几乎处处),长期训练可能发散。解决:用 learnable scale factor 补偿,或加噪声的量化(stochastic rounding)。
|
|
48
|
+
|
|
49
|
+
## 深入参考
|
|
50
|
+
|
|
51
|
+
- 蒸馏稿:references/books/optimization-ml.md(Ch 8 梯度法 §8.3 收敛分析、Ch 11 拟牛顿 §11.5 BFGS、Ch 24 约束算法 §24.5 增广 Lagrange)
|
|
52
|
+
- 原书:Chong, Lu, Zak, *An Introduction to Optimization* 5th Ed., Chapter 24 (Constrained Algorithms §24.5 Augmented Lagrangian) + Parikh & Boyd, *Proximal Algorithms*, Foundations and Trends in Optimization, 2014
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Riemannian Optimization
|
|
2
|
+
|
|
3
|
+
## Minimal Definition
|
|
4
|
+
|
|
5
|
+
Optimization on smooth manifolds $\mathcal{M}$ (e.g., the orthogonal group $O(n)$, Stiefel manifold, Grassmann manifold, hyperbolic space). Core idea: project the Euclidean gradient onto the tangent space of the manifold, update along geodesics (or retractions), and ensure iterates remain on the manifold.
|
|
6
|
+
|
|
7
|
+
## Core Formulas
|
|
8
|
+
|
|
9
|
+
- Riemannian gradient: $\text{grad} f(x) = \text{proj}_{T_x\mathcal{M}}(\nabla f(x))$ (Euclidean gradient projected onto the tangent space)
|
|
10
|
+
- Riemannian gradient descent: $x_{k+1} = R_{x_k}(-\alpha_k \cdot \text{grad} f(x_k))$, where $R$ is a retraction
|
|
11
|
+
- Tangent space of the orthogonal group $O(n)$: $T_Q O(n) = \{Q\Omega : \Omega^T = -\Omega\}$ (left multiplication by skew-symmetric matrices)
|
|
12
|
+
- Cayley retraction for the orthogonal group: $R_Q(\xi) = Q(I + \frac{1}{2}\Omega)^{-1}(I - \frac{1}{2}\Omega)$, $\xi = Q\Omega$
|
|
13
|
+
- Polar decomposition retraction: $R_Q(\xi) = (Q + \xi)(I + \xi^T\xi)^{-1/2}$ (projection onto the nearest orthogonal matrix)
|
|
14
|
+
- Newton-Schulz orthogonalization: $X_{k+1} = \frac{1}{2}X_k(3I - X_k^T X_k)$, converging to the nearest orthogonal matrix
|
|
15
|
+
- Hyperbolic space (Poincaré ball): $\text{grad}_{\mathcal{H}} f = \frac{(1-\|x\|^2)^2}{4} \nabla f(x)$
|
|
16
|
+
|
|
17
|
+
## Applicable Problems
|
|
18
|
+
|
|
19
|
+
- Orthogonal weight constraints: $W^TW = I$ preserves eigenvalue moduli at 1, stabilizing RNN/SSM training
|
|
20
|
+
- Muon optimizer: projects the gradient onto the nearest orthogonal matrix as the update direction (a cheap surrogate with "second-order flavor")
|
|
21
|
+
- Low-rank subspace tracking: online PCA on the Grassmann manifold
|
|
22
|
+
- Hyperbolic embeddings: Poincaré embeddings for hierarchical structures (trees, taxonomies)
|
|
23
|
+
- Metric learning: distance metrics on the SPD matrix manifold (covariance matrix space)
|
|
24
|
+
|
|
25
|
+
## AI Design Translation
|
|
26
|
+
|
|
27
|
+
- **Muon optimizer (orthogonalized gradient updates)**: Projects the momentum matrix $M$ onto the nearest orthogonal matrix via Newton-Schulz iteration: $X_{k+1} = \frac{1}{2}X_k(3I - X_k^TX_k)$, converging in 5 steps. Update $W \leftarrow W - \alpha \cdot U$ ($U$ being the orthogonalized result). The core is a pure matmul chain, 2 matmul operations per step, fully tensor-core-friendly, stable under bf16.
|
|
28
|
+
- **Manifold perspective on spectral normalization**: The constraint $\sigma_{\max}(W) = 1$ is equivalent to projection onto a tangent direction of the Stiefel manifold. Power iteration for direction estimation + normalization = an approximate Riemannian gradient projection. Implementation is identical to standard spectral norm.
|
|
29
|
+
- **Orthogonal RNN**: Hidden state recurrence $h_t = \sigma(W h_{t-1} + U x_t)$, constraining $W \in O(n)$ to avoid vanishing/exploding gradients. During training, uses the Cayley parameterization $W = (I-A)(I+A)^{-1}$ ($A$ skew-symmetric), with backpropagation computing unconstrained gradients with respect to $A$. The core is matrix inversion $O(n^3)$ (acceptable for small layer dimensions).
|
|
30
|
+
- **Poincaré embeddings (hyperbolic space)**: Embeds hierarchical data into the Poincaré ball $\mathcal{B}^n = \{x : \|x\| < 1\}$. Distance $d(x,y) = \text{arcosh}(1 + 2\|x-y\|^2 / ((1-\|x\|^2)(1-\|y\|^2)))$. The gradient is simply scaled by the metric factor $(1-\|x\|^2)^2/4$. Implemented as elementwise scaling, $O(d)$.
|
|
31
|
+
- **Subspace learning on the Grassmann manifold**: Treats low-rank subspaces as points on the Grassmann manifold, updated online via Riemannian SGD. More suitable for streaming data than SVD. The projection $P = QQ^T$ update is implemented via QR decomposition, with the core being matmul + thin QR.
|
|
32
|
+
|
|
33
|
+
## Engineering Feasibility
|
|
34
|
+
|
|
35
|
+
- **Primary operations**: Riemannian gradient projection = matmul ($Q^T \nabla$ to obtain the tangent space component); retraction = matmul + small-matrix inversion / Newton-Schulz (pure matmul); hyperbolic metric = elementwise.
|
|
36
|
+
- **GPU friendliness**: High (Newton-Schulz orthogonalization = pure matmul chain) to moderate (Cayley retraction requires $n \times n$ matrix inversion, where $n$ is the layer dimension; feasible via cuSOLVER when $n \leq 1024$). The metric scaling for hyperbolic embeddings is pure elementwise.
|
|
37
|
+
- **Complexity**: Newton-Schulz per step $O(n^3)$ (where $n$ is the layer dimension, not total model parameters); Cayley $O(n^3)$; hyperbolic gradient $O(d)$; Grassmann QR $O(nd^2)$.
|
|
38
|
+
- **Low precision**: Newton-Schulz is stable under bf16 (pure matmul iteration, no division or square roots); Cayley retraction's matrix inversion may fail under bf16 (fp32 required); the hyperbolic metric's denominator approaches zero as $\|x\| \to 1$, requiring clamping to prevent overflow.
|
|
39
|
+
|
|
40
|
+
## Risks and Failure Conditions
|
|
41
|
+
|
|
42
|
+
- **Inversion overhead of Cayley / matrix exponential maps**: $O(n^3)$ matrix inversion per step becomes a bottleneck when layer dimension $> 4096$. Solution: switch to Newton-Schulz orthogonalization (pure matmul) or approximate retractions via polar decomposition.
|
|
43
|
+
- **Numerical overflow in hyperbolic space**: As $\|x\| \to 1$, $d(x,y) \to \infty$ and the metric factor $(1-\|x\|^2)^{-2} \to \infty$, causing gradient explosion. Solution: clamp $\|x\| \leq 1 - \epsilon$ ($\epsilon \sim 10^{-5}$), or use the Lorentz model (a numerically more stable hyperbolic parameterization).
|
|
44
|
+
- **Retraction vs. exponential map**: Retraction is a first-order approximation of the exponential map, with reduced accuracy at large step sizes. For learning-rate-sensitive optimization problems, the true exponential map may be needed (at higher cost).
|
|
45
|
+
- **Unboundedness of non-compact manifolds**: SPD manifolds / hyperbolic space are non-compact, and optimization paths may diverge to infinity. Regularization or trust-region constraints are needed.
|
|
46
|
+
- **Conflict between orthogonal constraints and BatchNorm**: The affine transformation in BatchNorm breaks orthogonality. Either disable BN scale/shift after orthogonally constrained layers, or switch to GroupNorm.
|
|
47
|
+
|
|
48
|
+
## Further References
|
|
49
|
+
|
|
50
|
+
- Distilled notes: references/books/matrix-analysis.md (Section 7.3 Polar Decomposition, Newton-Schulz Iteration, Section 2.6 SVD and Orthogonal Factors)
|
|
51
|
+
- Original text: Horn & Johnson, *Matrix Analysis* 2nd Ed., Chapter 7 Section 7.3 (Polar Decomposition) + Absil, Mahony, Sepulchre, *Optimization Algorithms on Matrix Manifolds*, Princeton University Press, 2008
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# 黎曼优化 (Riemannian Optimization)
|
|
2
|
+
|
|
3
|
+
## 最小定义
|
|
4
|
+
|
|
5
|
+
在光滑流形 $\mathcal{M}$(如正交群 $O(n)$、Stiefel 流形、Grassmann 流形、双曲空间)上做优化。核心思想:将欧氏空间的梯度投影到流形的切空间,沿测地线(或收缩映射)更新,保证迭代始终在流形上。
|
|
6
|
+
|
|
7
|
+
## 核心公式
|
|
8
|
+
|
|
9
|
+
- 黎曼梯度:$\text{grad} f(x) = \text{proj}_{T_x\mathcal{M}}(\nabla f(x))$(欧氏梯度投影到切空间)
|
|
10
|
+
- 黎曼梯度下降:$x_{k+1} = R_{x_k}(-\alpha_k \cdot \text{grad} f(x_k))$,$R$ 为收缩映射(retraction)
|
|
11
|
+
- 正交群 $O(n)$ 的切空间:$T_Q O(n) = \{Q\Omega : \Omega^T = -\Omega\}$(反对称矩阵左乘)
|
|
12
|
+
- 正交群收缩映射(Cayley):$R_Q(\xi) = Q(I + \frac{1}{2}\Omega)^{-1}(I - \frac{1}{2}\Omega)$,$\xi = Q\Omega$
|
|
13
|
+
- 极分解收缩:$R_Q(\xi) = (Q + \xi)(I + \xi^T\xi)^{-1/2}$(投影到最近正交矩阵)
|
|
14
|
+
- Newton-Schulz 正交化:$X_{k+1} = \frac{1}{2}X_k(3I - X_k^T X_k)$,收敛到最近正交矩阵
|
|
15
|
+
- 双曲空间(Poincaré ball):$\text{grad}_{\mathcal{H}} f = \frac{(1-\|x\|^2)^2}{4} \nabla f(x)$
|
|
16
|
+
|
|
17
|
+
## 适用问题
|
|
18
|
+
|
|
19
|
+
- 正交权重约束:$W^TW = I$ 保持特征值模长为 1,稳定 RNN/SSM 训练
|
|
20
|
+
- Muon 优化器:将梯度投影到最近正交矩阵作为更新方向("二阶味"的廉价替代)
|
|
21
|
+
- 低秩子空间追踪:Grassmann 流形上的在线 PCA
|
|
22
|
+
- 双曲嵌入:层次结构(树、taxonomy)的 Poincaré 嵌入
|
|
23
|
+
- 度量学习:SPD 矩阵流形(协方差矩阵空间)上的距离度量
|
|
24
|
+
|
|
25
|
+
## AI 设计翻译
|
|
26
|
+
|
|
27
|
+
- **Muon 优化器 (正交化梯度更新)**:将动量矩阵 $M$ 通过 Newton-Schulz 迭代投影到最近正交矩阵:$X_{k+1} = \frac{1}{2}X_k(3I - X_k^TX_k)$,5 步收敛。更新 $W \leftarrow W - \alpha \cdot U$($U$ 为正交化结果)。核心是纯 matmul 链,每步 2 次 matmul,完全 tensor core 友好,bf16 稳定。
|
|
28
|
+
- **谱归一化的流形视角**:约束 $\sigma_{\max}(W) = 1$ 等价于在 Stiefel 流形的某个切方向上做投影。Power iteration 估计方向 + 归一化 = 一种近似的黎曼梯度投影。实现同标准 spectral norm。
|
|
29
|
+
- **正交 RNN (orthogonal RNN)**:隐藏状态递推 $h_t = \sigma(W h_{t-1} + U x_t)$,约束 $W \in O(n)$ 避免梯度消失/爆炸。训练时用 Cayley 参数化 $W = (I-A)(I+A)^{-1}$($A$ 反对称),反向传播走 $A$ 的无约束梯度。核心是矩阵求逆 $O(n^3)$(层维度小,可接受)。
|
|
30
|
+
- **Poincaré 嵌入 (双曲空间)**:将层次数据嵌入 Poincaré ball $\mathcal{B}^n = \{x : \|x\| < 1\}$。距离 $d(x,y) = \text{arcosh}(1 + 2\|x-y\|^2 / ((1-\|x\|^2)(1-\|y\|^2)))$。梯度乘以度量因子 $(1-\|x\|^2)^2/4$ 即可。实现为 elementwise 缩放,$O(d)$。
|
|
31
|
+
- **Grassmann 流形上的子空间学习**:将低秩子空间视为 Grassmann 流形上的点,用黎曼 SGD 在线更新。比 SVD 更适合 streaming 数据。投影 $P = QQ^T$ 的更新通过 QR 分解实现,核心是 matmul + thin QR。
|
|
32
|
+
|
|
33
|
+
## 工程可行性
|
|
34
|
+
|
|
35
|
+
- **主要操作**:黎曼梯度投影 = matmul($Q^T \nabla$ 得切空间分量);收缩映射 = matmul + 小矩阵求逆 / Newton-Schulz(纯 matmul);双曲度量 = elementwise。
|
|
36
|
+
- **GPU 友好度**:高(Newton-Schulz 正交化 = 纯 matmul 链)到中等(Cayley 映射需 $n \times n$ 矩阵求逆,$n$ 为层维度,$n \leq 1024$ 时 cuSOLVER 可行)。双曲嵌入的度量缩放是纯 elementwise。
|
|
37
|
+
- **复杂度**:Newton-Schulz 每步 $O(n^3)$(但 $n$ 为层维度,非模型总参数量);Cayley $O(n^3)$;双曲梯度 $O(d)$;Grassmann QR $O(nd^2)$。
|
|
38
|
+
- **低精度**:Newton-Schulz 在 bf16 下稳定(纯 matmul 迭代,不涉及除法/开方);Cayley 映射的求逆在 bf16 下可能失败(需 fp32);双曲度量在 $\|x\| \to 1$ 时分母趋零,需 clamp 防溢出。
|
|
39
|
+
|
|
40
|
+
## 风险与失效条件
|
|
41
|
+
|
|
42
|
+
- **Cayley / 矩阵指数映射的求逆开销**:每步 $O(n^3)$ 矩阵求逆,层维度 $> 4096$ 时成为瓶颈。解决:改用 Newton-Schulz 正交化(纯 matmul)或 polar decomposition 的近似收缩。
|
|
43
|
+
- **双曲空间的数值溢出**:$\|x\| \to 1$ 时 $d(x,y) \to \infty$,度量因子 $(1-\|x\|^2)^{-2} \to \infty$,梯度爆炸。解决:clamp $\|x\| \leq 1 - \epsilon$($\epsilon \sim 10^{-5}$),或用 Lorentz 模型(数值更稳定的双曲参数化)。
|
|
44
|
+
- **收缩映射 vs. 指数映射**:收缩映射(retraction)是指数映射的一阶近似,大步长时精度下降。对学习率敏感的优化问题,可能需要真正的指数映射(更贵)。
|
|
45
|
+
- **非紧凑流形的无界性**:SPD 流形 / 双曲空间非紧,优化路径可能跑到无穷远。需加正则化或信赖域约束。
|
|
46
|
+
- **正交约束与 BatchNorm 冲突**:BatchNorm 的仿射变换破坏正交性。需在正交约束层后禁用 BN 的 scale/shift,或改用 GroupNorm。
|
|
47
|
+
|
|
48
|
+
## 深入参考
|
|
49
|
+
|
|
50
|
+
- 蒸馏稿:references/books/matrix-analysis.md(§7.3 极分解、Newton-Schulz 迭代、§2.6 SVD 与正交因子)
|
|
51
|
+
- 原书:Horn & Johnson, *Matrix Analysis* 2nd Ed., Chapter 7 §7.3 (Polar Decomposition) + Absil, Mahony, Sepulchre, *Optimization Algorithms on Matrix Manifolds*, Princeton University Press, 2008
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Knowledge Base Navigation
|
|
2
|
+
|
|
3
|
+
> This file is the v3 knowledge base index, helping you find specific knowledge cards from problem types.
|
|
4
|
+
|
|
5
|
+
## Knowledge Base Structure
|
|
6
|
+
|
|
7
|
+
The knowledge base is organized by mathematical domain, with 7 domains and 31 knowledge cards. Each card contains: minimal definition, core formulas, applicable problems, AI design translation, engineering feasibility, risks and failure conditions.
|
|
8
|
+
|
|
9
|
+
| Domain | Directory | Cards | Typical Applications |
|
|
10
|
+
|--------|-----------|-------|---------------------|
|
|
11
|
+
| Matrix Analysis | `matrix-analysis/` | projection, spectral-decomposition, low-rank-approximation, positive-semidefinite, matrix-perturbation | LoRA, spectral normalization, condition number monitoring |
|
|
12
|
+
| Optimization | `optimization/` | lagrangian-duality, convex-optimization, constrained-optimization, riemannian-optimization, proximal-method | GAN minimax, weight constraints, Muon optimizer |
|
|
13
|
+
| Differential Geometry | `differential-geometry/` | manifold, tangent-space, metric-tensor, geodesic, curvature, connection | Natural gradient, manifold optimization, K-FAC |
|
|
14
|
+
| Lie Theory | `lie-theory/` | group-action, lie-group, lie-algebra, representation, equivariance | Equivariant networks, SO(3) parameterization, spherical harmonics |
|
|
15
|
+
| Topology | `topology/` | persistent-homology, euler-characteristic, fundamental-group | Topological regularization, latent space monitoring |
|
|
16
|
+
| Probability & Information | `probability/` | concentration-inequality, entropy, kl-divergence, information-bottleneck, fisher-information | VAE, knowledge distillation, generalization bounds |
|
|
17
|
+
| Information Geometry | `information-geometry/` | natural-gradient, fisher-metric | Natural gradient descent, Fisher-Rao metric |
|
|
18
|
+
|
|
19
|
+
## From Problem to Knowledge Card
|
|
20
|
+
|
|
21
|
+
| Problem Type | Recommended Cards |
|
|
22
|
+
|-------------|-------------------|
|
|
23
|
+
| Need dimensionality reduction/compression | low-rank-approximation, projection |
|
|
24
|
+
| Need constrained optimization | constrained-optimization, lagrangian-duality |
|
|
25
|
+
| Need equivariance/symmetry | group-action, equivariance, representation |
|
|
26
|
+
| Need stable training | matrix-perturbation, positive-semidefinite, fisher-information |
|
|
27
|
+
| Need manifold parameterization | manifold, riemannian-optimization, tangent-space |
|
|
28
|
+
| Need information compression | information-bottleneck, entropy, kl-divergence |
|
|
29
|
+
| Need topological regularization | persistent-homology, euler-characteristic |
|
|
30
|
+
|
|
31
|
+
## Relationship to Thinking Lenses
|
|
32
|
+
|
|
33
|
+
Thinking lenses (`../../lenses/`) handle "what perspective to use"; the knowledge base provides "concrete mathematical tools." Typical chain:
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
Lens diagnosis → Knowledge card provides tools → Design pattern translates to AI module
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
For deeper study, `../../references/books/*.md` provides 7 book distillations.
|
|
@@ -1,228 +1,39 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 数学知识库导航 / Knowledge Base Navigation
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> 本文件是 v3 知识库的索引,帮助你从问题类型找到具体的知识卡片。
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## 知识库结构
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
知识库按数学领域组织,共 7 个领域、31 张知识卡片。每张卡片包含:最小定义、核心公式、适用问题、AI 设计翻译、工程可行性、风险与失效条件。
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
-
|
|
9
|
+
| 领域 | 目录 | 卡片 | 典型应用 |
|
|
10
|
+
|------|------|------|---------|
|
|
11
|
+
| 矩阵分析 | `matrix-analysis/` | projection, spectral-decomposition, low-rank-approximation, positive-semidefinite, matrix-perturbation | LoRA、谱归一化、条件数监控 |
|
|
12
|
+
| 最优化 | `optimization/` | lagrangian-duality, convex-optimization, constrained-optimization, riemannian-optimization, proximal-method | GAN minimax、权重约束、Muon 优化器 |
|
|
13
|
+
| 微分几何 | `differential-geometry/` | manifold, tangent-space, metric-tensor, geodesic, curvature, connection | 自然梯度、流形优化、K-FAC |
|
|
14
|
+
| 李理论 | `lie-theory/` | group-action, lie-group, lie-algebra, representation, equivariance | 等变网络、SO(3) 参数化、球谐特征 |
|
|
15
|
+
| 拓扑 | `topology/` | persistent-homology, euler-characteristic, fundamental-group | 拓扑正则、隐空间监控 |
|
|
16
|
+
| 概率与信息 | `probability/` | concentration-inequality, entropy, kl-divergence, information-bottleneck, fisher-information | VAE、知识蒸馏、泛化界 |
|
|
17
|
+
| 信息几何 | `information-geometry/` | natural-gradient, fisher-metric | 自然梯度下降、Fisher-Rao 度量 |
|
|
12
18
|
|
|
13
|
-
|
|
19
|
+
## 从问题找知识卡
|
|
14
20
|
|
|
15
|
-
|
|
21
|
+
| 问题类型 | 推荐知识卡 |
|
|
22
|
+
|---------|-----------|
|
|
23
|
+
| 需要降维/压缩 | low-rank-approximation, projection |
|
|
24
|
+
| 需要约束优化 | constrained-optimization, lagrangian-duality |
|
|
25
|
+
| 需要等变/对称 | group-action, equivariance, representation |
|
|
26
|
+
| 需要稳定训练 | matrix-perturbation, positive-semidefinite, fisher-information |
|
|
27
|
+
| 需要流形参数化 | manifold, riemannian-optimization, tangent-space |
|
|
28
|
+
| 需要信息压缩 | information-bottleneck, entropy, kl-divergence |
|
|
29
|
+
| 需要拓扑正则 | persistent-homology, euler-characteristic |
|
|
16
30
|
|
|
17
|
-
|
|
31
|
+
## 与思想透镜的关系
|
|
18
32
|
|
|
19
|
-
|
|
33
|
+
思想透镜(`../../lenses/`)负责"用什么视角看问题",知识库负责"提供具体数学工具"。典型链路:
|
|
20
34
|
|
|
21
|
-
|
|
35
|
+
```
|
|
36
|
+
透镜诊断 → 知识卡片提供工具 → 设计模式翻译成 AI 模块
|
|
37
|
+
```
|
|
22
38
|
|
|
23
|
-
|
|
24
|
-
|------|------|---------|
|
|
25
|
-
| 初等代数 | 方程、不等式、多项式运算 | 变量、等式、运算律 |
|
|
26
|
-
| 高等代数(线性代数) | 向量空间、线性变换、矩阵 | 线性空间、基、维数、特征值 |
|
|
27
|
-
| 抽象代数 | 群、环、域 | 代数结构、同态、同构 |
|
|
28
|
-
| 范畴论 | 对象与态射的抽象理论 | 函子、自然变换、泛性质 |
|
|
29
|
-
|
|
30
|
-
### 几何学(Geometry)
|
|
31
|
-
|
|
32
|
-
研究空间、形状、结构及其关系。
|
|
33
|
-
|
|
34
|
-
| 层次 | 内容 | 核心概念 |
|
|
35
|
-
|------|------|---------|
|
|
36
|
-
| 欧几里得几何 | 平面与立体几何 | 点、线、面、角、距离 |
|
|
37
|
-
| 解析几何 | 用代数方法研究几何 | 坐标系、方程、曲线 |
|
|
38
|
-
| 非欧几何 | 改变平行公理的几何 | 双曲几何、椭圆几何 |
|
|
39
|
-
| 微分几何 | 用微积分研究几何 | 曲率、测地线、流形 |
|
|
40
|
-
| 分形几何 | 自相似的几何结构 | 分形维数、迭代函数系统 |
|
|
41
|
-
|
|
42
|
-
### 分析学(Analysis)
|
|
43
|
-
|
|
44
|
-
研究函数、极限、连续、微分、积分等。
|
|
45
|
-
|
|
46
|
-
| 层次 | 内容 | 核心概念 |
|
|
47
|
-
|------|------|---------|
|
|
48
|
-
| 微积分 | 极限、导数、积分 | 连续、可微、可积 |
|
|
49
|
-
| 数学分析 | 严格的极限理论 | ε-δ语言、一致收敛 |
|
|
50
|
-
| 实分析 | 测度论、Lebesgue 积分 | 测度空间、L^p 空间 |
|
|
51
|
-
| 复分析 | 复变函数理论 | 解析函数、留数、共形映射 |
|
|
52
|
-
| 泛函分析 | 无限维空间上的分析 | Banach 空间、Hilbert 空间、算子 |
|
|
53
|
-
| 微分方程 | ODE 与 PDE | 存在唯一性、稳定性、数值解法 |
|
|
54
|
-
|
|
55
|
-
## 二、主要分支
|
|
56
|
-
|
|
57
|
-
### 1. 数论(Number Theory)
|
|
58
|
-
|
|
59
|
-
研究整数性质,如素数分布、同余、丢番图方程等。
|
|
60
|
-
|
|
61
|
-
- **初等数论**:整除、同余、素数
|
|
62
|
-
- **解析数论**:用分析方法研究数论问题(如素数定理)
|
|
63
|
-
- **代数数论**:用代数方法研究数论问题(如代数数域)
|
|
64
|
-
- **几何数论**:用几何方法研究数论问题
|
|
65
|
-
|
|
66
|
-
### 2. 概率论与数理统计(Probability & Statistics)
|
|
67
|
-
|
|
68
|
-
研究随机现象和数据分析,广泛应用于金融、生物、社会科学等。对应思想武器:**概率与统计**、**信息论思想**、**因果推断思想**。
|
|
69
|
-
|
|
70
|
-
- **概率论**:随机变量、分布、极限定理 → 详见 **概率与统计**(Kolmogorov 公理)
|
|
71
|
-
- **数理统计**:参数估计、假设检验、回归分析 → 详见 **概率与统计**(回归建模、实验设计)
|
|
72
|
-
- **随机过程**:马尔可夫链、布朗运动、鞅论
|
|
73
|
-
- **贝叶斯统计**:先验、后验、MCMC → 详见 **信息论思想**(最大熵原则)
|
|
74
|
-
|
|
75
|
-
### 3. 拓扑学(Topology)
|
|
76
|
-
|
|
77
|
-
研究空间在连续变形下的不变性质。对应思想武器:**拓扑思想**。
|
|
78
|
-
|
|
79
|
-
- **点集拓扑**:开集、闭集、连通性、紧致性 → 详见 **对称与不变性**(不变量视角)
|
|
80
|
-
- **代数拓扑**:同伦、同调、上同调 → 详见 **拓扑思想**(基本群、Betti 数)
|
|
81
|
-
- **微分拓扑**:流形、切空间、微分形式
|
|
82
|
-
|
|
83
|
-
### 4. 离散数学(Discrete Mathematics)
|
|
84
|
-
|
|
85
|
-
集合论、图论、数理逻辑等,是计算机科学的数学基础。对应思想武器:**算法与计算思想**、**离散与组合思想**。
|
|
86
|
-
|
|
87
|
-
- **集合论**:集合、关系、函数、基数、序数
|
|
88
|
-
- **图论**:图、路径、连通性、着色、网络流
|
|
89
|
-
- **数理逻辑**:命题逻辑、谓词逻辑、可计算性 → 详见 **公理化思想**、**逻辑演绎**
|
|
90
|
-
- **组合数学**:计数、排列组合、生成函数 → 详见 **离散与组合思想**
|
|
91
|
-
- **算法与复杂度**:排序、搜索、P/NP、可判定性 → 详见 **算法与计算思想**
|
|
92
|
-
|
|
93
|
-
### 5. 应用数学分支
|
|
94
|
-
|
|
95
|
-
将数学方法应用于实际问题。对应思想武器:**优化思想**、**信息论思想**、**博弈论思想**、**算法与计算思想**、**因果推断思想**。
|
|
96
|
-
|
|
97
|
-
- **运筹学**:线性规划、整数规划、动态规划、排队论 → 详见 **优化思想**(LP/IP/DP 分类)、**算法与计算思想**(求解算法)
|
|
98
|
-
- **控制理论**:系统控制、最优控制、鲁棒控制 → 详见 **优化思想**(最优控制即变分优化)
|
|
99
|
-
- **信息论**:熵、信道容量、数据压缩、编码理论 → 详见 **信息论思想**(Shannon 熵、编码定理)
|
|
100
|
-
- **博弈论**:策略互动、均衡分析、机制设计 → 详见 **博弈论思想**(Nash 均衡、minimax)
|
|
101
|
-
- **因果推断**:因果图模型、干预分析、反事实推理 → 详见 **因果推断思想**(DAG、do 算子)
|
|
102
|
-
- **金融数学**:期权定价、风险管理、随机微积分 → 详见 **建模思想**(Black-Scholes)、**概率与统计**
|
|
103
|
-
- **计算数学**:数值分析、有限元、蒙特卡洛方法 → 详见 **算法与计算思想**(数值算法)
|
|
104
|
-
- **机器学习数学基础**:优化、统计学习理论、核方法 → 详见 **优化思想**、**概率与统计**、**信息论思想**(MDL/AIC)
|
|
105
|
-
|
|
106
|
-
## 三、知识体系的层次结构
|
|
107
|
-
|
|
108
|
-
从学习路径看,数学知识可分层次:
|
|
109
|
-
|
|
110
|
-
### 地基层
|
|
111
|
-
|
|
112
|
-
数感、逻辑与分类、算术与基础几何。
|
|
113
|
-
|
|
114
|
-
- 数的概念与运算
|
|
115
|
-
- 基本逻辑推理
|
|
116
|
-
- 算术运算(加减乘除)
|
|
117
|
-
- 基础几何图形与性质
|
|
118
|
-
|
|
119
|
-
### 代数层
|
|
120
|
-
|
|
121
|
-
变量、方程、函数、几何证明。
|
|
122
|
-
|
|
123
|
-
- 代数表达式与方程
|
|
124
|
-
- 函数概念与基本函数族
|
|
125
|
-
- 平面几何证明
|
|
126
|
-
- 向量与坐标
|
|
127
|
-
|
|
128
|
-
### 综合层
|
|
129
|
-
|
|
130
|
-
函数与导数、微积分、数列、立体几何、概率统计深化。
|
|
131
|
-
|
|
132
|
-
- 极限与连续
|
|
133
|
-
- 微分与积分
|
|
134
|
-
- 数列与级数
|
|
135
|
-
- 立体几何
|
|
136
|
-
- 概率分布与统计推断
|
|
137
|
-
|
|
138
|
-
### 前沿层
|
|
139
|
-
|
|
140
|
-
数学分析、高等代数、解析/微分几何、数论、拓扑学等。
|
|
141
|
-
|
|
142
|
-
- 严格的分析理论(ε-δ)
|
|
143
|
-
- 抽象代数结构(群环域)
|
|
144
|
-
- 流形与微分几何
|
|
145
|
-
- 代数/解析数论
|
|
146
|
-
- 点集/代数拓扑
|
|
147
|
-
- 泛函分析与算子理论
|
|
148
|
-
|
|
149
|
-
## 四、数学思想方法的层次
|
|
150
|
-
|
|
151
|
-
| 层次 | 思想方法 | 说明 |
|
|
152
|
-
|------|---------|------|
|
|
153
|
-
| 基础层 | 逻辑演绎、归纳类比 | 所有数学思维的基础 |
|
|
154
|
-
| 方法层 | 公理化、抽象化、建模 | 构建数学理论的方法 |
|
|
155
|
-
| 工具层 | 优化、变换、概率统计 | 解决具体问题的工具 |
|
|
156
|
-
| 拓展层 | 算法与计算、信息论、博弈论、因果推断 | 应用于计算、信息、互动和因果的工具 |
|
|
157
|
-
| 哲学层 | 对称不变性、拓扑思想、离散组合 | 理解结构与本质的哲学视角 |
|
|
158
|
-
|
|
159
|
-
## 五、数学与其他学科的联系
|
|
160
|
-
|
|
161
|
-
| 学科 | 使用的数学工具 | 典型应用 |
|
|
162
|
-
|------|--------------|---------|
|
|
163
|
-
| 物理学 | 微积分、线性代数、群论 | 力学、量子力学、相对论 |
|
|
164
|
-
| 计算机科学 | 离散数学、图论、概率 | 算法分析、密码学、AI |
|
|
165
|
-
| 经济学 | 优化、博弈论、微分方程 | 市场均衡、定价模型 |
|
|
166
|
-
| 生物学 | 微分方程、统计、图论 | 种群动力学、系统生物学 |
|
|
167
|
-
| 工程学 | 微分方程、傅里叶分析、数值方法 | 控制系统、信号处理 |
|
|
168
|
-
| 社会科学 | 统计、博弈论、网络分析 | 社会网络、决策分析 |
|
|
169
|
-
|
|
170
|
-
## 六、思维武器与数学分支的映射
|
|
171
|
-
|
|
172
|
-
本项目的 16 种思想武器(15 种专业武器 + 1 个 math-research-activator 自动触发入口)不是孤立存在的,它们与数学分支形成了互补的工具集。下面展示一个简化映射,帮助你从问题类型直接找到适合的数学方法。v2 另有 `references/books/*.md` × 7 把代数几何 / 微分几何 / 李理论 / 抽象代数 / 矩阵分析 / 最优化 / 流形等现代数学结构按需激活进算法设计(见 README「三层渐进式披露」)。
|
|
173
|
-
|
|
174
|
-
| 思维武器 | 对应数学分支 | 典型方法/概念 |
|
|
175
|
-
|---------|-------------|--------------|
|
|
176
|
-
| 🧭 数学研究激活器 | 元认知、问题分类、现代数学映射 | 诊断→映射→路由→GPU 筛选、双验收门 |
|
|
177
|
-
| 📐 公理化思想 | 数理逻辑、集合论 | 公理体系、形式语言、相容性、独立性 |
|
|
178
|
-
| 🧩 抽象化思想 | 代数、范畴论、拓扑学 | 抽象结构、同构、泛性质 |
|
|
179
|
-
| 🧠 逻辑演绎 | 数理逻辑、证明论 | 命题逻辑、谓词逻辑、推理规则 |
|
|
180
|
-
| 🌉 建模思想 | 应用数学、统计 | 方程建模、量纲分析、验证 |
|
|
181
|
-
| ⚖️ 优化思想 | 最优化、运筹学 | 凸优化、KKT、动态规划 |
|
|
182
|
-
| 🎲 概率与统计 | 概率论、数理统计 | 随机变量、假设检验、回归分析 |
|
|
183
|
-
| 🔄 变换思想 | 分析学、生成函数 | 傅里叶、拉普拉斯、代数变换 |
|
|
184
|
-
| ⚛️ 对称与不变性 | 群论、几何 | 群作用、不变量、商空间 |
|
|
185
|
-
| 📈 归纳与类比 | 初等数学、数论 | 归纳证明、类比推理、模式识别 |
|
|
186
|
-
| 🖥️ 算法与计算思想 | 计算理论、离散数学 | 复杂度、可计算性、算法范式 |
|
|
187
|
-
| 📡 信息论思想 | 信息论、统计学习 | 熵、互信息、编码极限 |
|
|
188
|
-
| 🎯 博弈论思想 | 数理经济学、机制设计 | 纳什均衡、激励相容、最优策略 |
|
|
189
|
-
| 🔗 因果推断思想 | 因果推断、统计学 | DAG、do-演算、干预分析 |
|
|
190
|
-
| 🌀 拓扑思想 | 拓扑学、代数拓扑 | 同伦、同调、拓扑不变量 |
|
|
191
|
-
| 🧮 离散与组合思想 | 组合数学、图论 | 鸽巢原理、生成函数、枚举 |
|
|
192
|
-
|
|
193
|
-
## 七、如何选择思想武器
|
|
194
|
-
|
|
195
|
-
面对一个问题时,最重要的第一步不是”用力分析”,而是”选对工具”。以下是选择指南:
|
|
196
|
-
|
|
197
|
-
### 快速选择指南
|
|
198
|
-
|
|
199
|
-
| 问题核心特征 | 最可能适合的思想武器 |
|
|
200
|
-
|-------------|-------------------|
|
|
201
|
-
| 多方互动,我的最优取决于他人 | 🎯 博弈论 |
|
|
202
|
-
| 不确定性/随机性 | 🎲 概率与统计 |
|
|
203
|
-
| 在限制下做最优选择 | ⚖️ 优化 |
|
|
204
|
-
| 当前视角下难以处理 | 🔄 变换 |
|
|
205
|
-
| 需要提取本质结构 | 🧩 抽象化 |
|
|
206
|
-
| 需要严格推理验证 | 🧠 逻辑演绎 |
|
|
207
|
-
| 需要从经验中发现规律 | 📈 归纳与类比 |
|
|
208
|
-
| 需要构建模型预测 | 🌉 建模 |
|
|
209
|
-
| 变化中的不变性 | ⚛️ 对称与不变性 |
|
|
210
|
-
| 需要可执行步骤 | 🖥️ 算法与计算 |
|
|
211
|
-
| 有限对象的计数/结构 | 🧮 离散与组合 |
|
|
212
|
-
|
|
213
|
-
### 使用激活器
|
|
214
|
-
|
|
215
|
-
如果不确定该用哪个工具,直接使用 `/ask` 命令调用 math-research-activator,它会诊断问题、映射现代数学结构、推荐 1–3 个最合适的思想武器并做 GPU 可行性筛选。工作区出现算法 / kernel / 模型代码时,激活器也会自动介入。
|
|
216
|
-
|
|
217
|
-
### 路径
|
|
218
|
-
|
|
219
|
-
v2 已移除「科研 / 生活双路径」,统一为单一研究 / 算法路径:保留完整数学符号与推导,并在用于算法 / 算子设计时强制过 GPU 八维门。
|
|
220
|
-
|
|
221
|
-
## 八、如何使用本概述
|
|
222
|
-
|
|
223
|
-
- 先从问题特征出发:判断它是”结构性””动态性””随机性””交互性”还是”可数性”。
|
|
224
|
-
- 对照快速选择指南或使用 `/ask` 命令,找到最贴近的思想武器。
|
|
225
|
-
- 结合”知识体系层次结构”,判断当前问题更适合基础思路还是前沿方法。
|
|
226
|
-
- 若问题横跨多个类别,可同时调用多个思想武器,例如"建模+优化"、"概率+因果"、"抽象+算法"。
|
|
227
|
-
- 算法 / 算子设计问题可让激活器把现代数学结构(代数几何 / 李理论 / 拓扑等)迁移进来,并过 GPU 八维门。
|
|
228
|
-
- 在学习或阅读文献时,把本概述作为归纳框架,将零散概念归入统一的知识地图。
|
|
39
|
+
深入查阅时,`../../references/books/*.md` 提供 7 本书的蒸馏稿。
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Concentration Inequality
|
|
2
|
+
|
|
3
|
+
## Minimal Definition
|
|
4
|
+
Concentration inequalities bound the **probability that a sum of independent random variables (or a Lipschitz function) deviates from its expectation**. The core intuition: when many independent random factors are superimposed, the outcome is highly concentrated around the mean, with tail probabilities decaying exponentially. They serve as a "quantitative strengthening of the law of large numbers."
|
|
5
|
+
|
|
6
|
+
## Core Formulas
|
|
7
|
+
|
|
8
|
+
**Markov's Inequality** (weakest, most general):
|
|
9
|
+
$$P(X \geq a) \leq \frac{\mathbb{E}[X]}{a}, \quad X \geq 0$$
|
|
10
|
+
|
|
11
|
+
**Hoeffding's Inequality** (sum of bounded independent variables):
|
|
12
|
+
$$P\left(\left|\frac{1}{n}\sum_{i=1}^n X_i - \mathbb{E}\left[\frac{1}{n}\sum X_i\right]\right| \geq t\right) \leq 2\exp\left(-\frac{2n^2 t^2}{\sum(b_i - a_i)^2}\right)$$
|
|
13
|
+
|
|
14
|
+
**Bernstein's Inequality** (exploits variance information, tighter tails):
|
|
15
|
+
$$P\left(\sum X_i \geq t\right) \leq \exp\left(-\frac{t^2/2}{\sigma^2 + Mt/3}\right)$$
|
|
16
|
+
|
|
17
|
+
**McDiarmid's Inequality** (bounded-difference functions): If $f$ has sensitivity $c_i$ to changes in the $i$-th variable, then
|
|
18
|
+
$$P(|f(X_1,\ldots,X_n) - \mathbb{E}[f]| \geq t) \leq 2\exp\left(-\frac{2t^2}{\sum c_i^2}\right)$$
|
|
19
|
+
|
|
20
|
+
## Applicable Problems
|
|
21
|
+
- **Generalization bound derivation**: Given training set size $n$, with what probability does the gap between model predictions and true risk fall within $\epsilon$
|
|
22
|
+
- **Stochastic algorithm reliability**: Probabilistic control of the deviation between mini-batch gradients and full-batch gradients
|
|
23
|
+
- **Sampling estimation accuracy**: Quantitative computation of confidence intervals for Monte Carlo estimators
|
|
24
|
+
|
|
25
|
+
## AI Design Translation
|
|
26
|
+
- **PAC learning bounds / generalization bounds**: Hoeffding/McDiarmid provides probabilistic bounds on the gap between empirical risk and true risk
|
|
27
|
+
- **Variance control for Dropout / Stochastic Depth**: Bernstein's inequality guarantees output concentration under stochastic regularization
|
|
28
|
+
- **Gradient compression / communication efficiency**: Concentration bounds on gradient deviation after quantization or sparsification, ensuring convergence of distributed training
|
|
29
|
+
|
|
30
|
+
## Engineering Feasibility
|
|
31
|
+
- **Dimension 1 Tensorization ✅**: The bounds themselves are scalar formulas with no tensor operations; zero overhead as an analytical tool
|
|
32
|
+
- **Dimension 2 GEMM-mappability ✅**: Does not directly participate in GEMM, but can serve as a theoretical basis for hyperparameter selection (batch size, compression ratio)
|
|
33
|
+
- **Dimension 3 Complexity ✅**: Computing the bound itself is $O(1)$ or $O(n)$, very low cost
|
|
34
|
+
- **Dimension 5 Low Precision ✅**: Bounds can be computed in fp32; does not enter the training backbone
|
|
35
|
+
- **Dimension 8 Operator Fusion ✅**: Does not enter the computation graph; no fusion overhead
|
|
36
|
+
|
|
37
|
+
## Risks and Failure Conditions
|
|
38
|
+
- **Independence assumption violated**: In sequential data and autoregressive models, tokens are strongly correlated, and Hoeffding's exponential decay guarantee fails. Martingale versions (Azuma-Hoeffding) or mixing-time corrections are required.
|
|
39
|
+
- **Boundedness assumption violated**: Under heavy-tailed distributions (e.g., power laws), Hoeffding does not apply; Bernstein or truncation tricks are needed. In LLM training, when gradients occasionally take extreme values, naive concentration bounds yield a false sense of security.
|
|
40
|
+
|
|
41
|
+
## Further References
|
|
42
|
+
- Distillation draft: `references/books/` — no dedicated probability distillation draft at present; this card is based on standard probability theory textbooks
|
|
43
|
+
- Boucheron, Lugosi, Massart. *Concentration Inequalities: A Nonasymptotic Theory of Independence*. Oxford, 2013
|
|
44
|
+
- Vershynin. *High-Dimensional Probability*. Cambridge, 2018 (Chapters 2-3)
|
|
45
|
+
- Related knowledge cards: `probability/entropy.md`, `probability/fisher-information.md`
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# 浓度不等式 / Concentration Inequality
|
|
2
|
+
|
|
3
|
+
## 最小定义
|
|
4
|
+
浓度不等式界定了**独立随机变量之和(或 Lipschitz 函数)偏离其期望的概率上界**。核心直觉:大量独立随机因素叠加后,结果高度集中在期望附近,尾部概率指数衰减。它是"大数定律的定量加强版"。
|
|
5
|
+
|
|
6
|
+
## 核心公式
|
|
7
|
+
|
|
8
|
+
**Markov 不等式**(最弱、最通用):
|
|
9
|
+
$$P(X \geq a) \leq \frac{\mathbb{E}[X]}{a}, \quad X \geq 0$$
|
|
10
|
+
|
|
11
|
+
**Hoeffding 不等式**(有界独立变量之和):
|
|
12
|
+
$$P\left(\left|\frac{1}{n}\sum_{i=1}^n X_i - \mathbb{E}\left[\frac{1}{n}\sum X_i\right]\right| \geq t\right) \leq 2\exp\left(-\frac{2n^2 t^2}{\sum(b_i - a_i)^2}\right)$$
|
|
13
|
+
|
|
14
|
+
**Bernstein 不等式**(利用方差信息,尾部更紧):
|
|
15
|
+
$$P\left(\sum X_i \geq t\right) \leq \exp\left(-\frac{t^2/2}{\sigma^2 + Mt/3}\right)$$
|
|
16
|
+
|
|
17
|
+
**McDiarmid 不等式**(有界差分函数):若 $f$ 对第 $i$ 个变量的变化敏感度为 $c_i$,则
|
|
18
|
+
$$P(|f(X_1,\ldots,X_n) - \mathbb{E}[f]| \geq t) \leq 2\exp\left(-\frac{2t^2}{\sum c_i^2}\right)$$
|
|
19
|
+
|
|
20
|
+
## 适用问题
|
|
21
|
+
- **泛化界推导**:给定训练集大小 $n$,模型预测与真实风险之差以多大概率落在 $\epsilon$ 内
|
|
22
|
+
- **随机算法可靠性**:Mini-batch 梯度与全量梯度的偏差概率控制
|
|
23
|
+
- **采样估算精度**:Monte Carlo 估计的置信区间定量计算
|
|
24
|
+
|
|
25
|
+
## AI 设计翻译
|
|
26
|
+
- **PAC 学习界 / 泛化界**:Hoeffding/McDiarmid → 经验风险与真实风险之差的概率界
|
|
27
|
+
- **Dropout / Stochastic Depth 的方差控制**:Bernstein 不等式给出随机正则化后输出集中度的保证
|
|
28
|
+
- **梯度压缩 / 通信效率**:量化或稀疏化后梯度偏差的浓度界,确保分布式训练收敛
|
|
29
|
+
|
|
30
|
+
## 工程可行性
|
|
31
|
+
- **维度 1 张量化 ✅**:界本身是标量公式,不涉及张量运算,作为分析工具零开销
|
|
32
|
+
- **维度 2 GEMM 可映射 ✅**:不直接参与 GEMM,但可作为超参数选择(batch size、压缩率)的理论依据
|
|
33
|
+
- **维度 3 复杂度 ✅**:计算界本身 $O(1)$ 或 $O(n)$,极低
|
|
34
|
+
- **维度 5 低精度 ✅**:界用 fp32 计算即可,不进入训练主干
|
|
35
|
+
- **维度 8 算子融合 ✅**:不进入计算图,无融合负担
|
|
36
|
+
|
|
37
|
+
## 风险与失效条件
|
|
38
|
+
- **独立性假设不成立**:序列数据、自回归模型中 token 间强相关,Hoeffding 的指数衰减保证失效。需用 Martingale 版本(Azuma-Hoeffding)或混合时间修正。
|
|
39
|
+
- **有界性假设违反**:重尾分布(如幂律)下 Hoeffding 不适用,需改用 Bernstein 或截断技巧。在 LLM 训练中梯度偶尔出现极大值时,朴素浓度界给出虚假安全感。
|
|
40
|
+
|
|
41
|
+
## 深入参考
|
|
42
|
+
- 蒸馏稿:`references/books/` 暂无专用概率蒸馏稿,本卡基于标准概率论教材
|
|
43
|
+
- Boucheron, Lugosi, Massart. *Concentration Inequalities: A Nonasymptotic Theory of Independence*. Oxford, 2013
|
|
44
|
+
- Vershynin. *High-Dimensional Probability*. Cambridge, 2018(第 2-3 章)
|
|
45
|
+
- 关联知识卡:`probability/entropy.md`、`probability/fisher-information.md`
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Entropy
|
|
2
|
+
|
|
3
|
+
## Minimal Definition
|
|
4
|
+
Shannon entropy measures the **total uncertainty** of a random variable — that is, the minimum average number of bits required to describe it. It is the cornerstone of information theory and the unifying quantity underlying maximum likelihood, variational inference, regularization, and other AI methods.
|
|
5
|
+
|
|
6
|
+
## Core Formulas
|
|
7
|
+
|
|
8
|
+
**Shannon Entropy** (discrete):
|
|
9
|
+
$$H(X) = -\sum_{x} p(x) \log p(x)$$
|
|
10
|
+
|
|
11
|
+
**Differential Entropy** (continuous):
|
|
12
|
+
$$h(X) = -\int p(x) \log p(x)\, dx$$
|
|
13
|
+
|
|
14
|
+
**Joint Entropy and Conditional Entropy**:
|
|
15
|
+
$$H(X, Y) = H(X) + H(Y|X), \quad H(Y|X) = -\sum_{x,y} p(x,y) \log p(y|x)$$
|
|
16
|
+
|
|
17
|
+
**Mutual Information** (the amount of information shared by two variables):
|
|
18
|
+
$$I(X; Y) = H(X) - H(X|Y) = H(Y) - H(Y|X) = \sum_{x,y} p(x,y) \log \frac{p(x,y)}{p(x)p(y)}$$
|
|
19
|
+
|
|
20
|
+
**Maximum Entropy Principle**: Among all distributions satisfying the constraints $\mathbb{E}[f_i(X)] = c_i$, the distribution that maximizes $H(X)$ belongs to the exponential family $p(x) \propto \exp\left(\sum \lambda_i f_i(x)\right)$.
|
|
21
|
+
|
|
22
|
+
## Applicable Problems
|
|
23
|
+
- **Feature selection**: Use mutual information $I(X; Y)$ to select the most informative features with respect to the target variable
|
|
24
|
+
- **Model compression and quantization**: Entropy provides the theoretical lower bound for lossless compression (Shannon's coding theorem)
|
|
25
|
+
- **Regularization design**: Maximum entropy regularization encourages the model to output "uncertain yet fair" distributions, preventing overconfidence
|
|
26
|
+
|
|
27
|
+
## AI Design Translation
|
|
28
|
+
- **Cross-Entropy Loss**: $H(p, q) = -\sum p(x)\log q(x)$, the default loss function for classification tasks; it is essentially the "coding redundancy" between the true distribution $p$ and the model distribution $q$
|
|
29
|
+
- **KL Divergence** (see `kl-divergence.md`): $D_{KL}(p\|q) = H(p,q) - H(p)$, i.e., the difference between cross-entropy and entropy
|
|
30
|
+
- **Variational Autoencoder (VAE)**: ELBO = reconstruction likelihood $-$ KL regularization term; it fundamentally balances information compression (low $H(Z)$) against reconstruction fidelity
|
|
31
|
+
|
|
32
|
+
## Engineering Feasibility
|
|
33
|
+
- **Dimension 1 Tensorization ✅**: $-\sum p \log p$ is an element-wise operation, perfectly vectorizable
|
|
34
|
+
- **Dimension 2 GEMM-mappability ⚠️**: Entropy itself is not a GEMM, but the gradient computation of the cross-entropy loss involves a softmax-to-matmul chain
|
|
35
|
+
- **Dimension 3 Complexity ✅**: $O(|\mathcal{X}|)$ linear; acceptable for vocabulary-level computation
|
|
36
|
+
- **Dimension 5 Low Precision ✅**: $\log$ and exp are stable in bf16; softmax benefits from the log-sum-exp trick
|
|
37
|
+
- **Dimension 8 Operator Fusion ✅**: softmax + cross-entropy is a classic fused operator (FusedSoftmaxCrossEntropy)
|
|
38
|
+
|
|
39
|
+
## Risks and Failure Conditions
|
|
40
|
+
- **Continuous entropy can be negative**: Differential entropy $h(X)$ is not constrained by $H(X) \geq 0$; directly comparing differential entropies of different dimensions can be misleading. Mutual information or KL divergence (which are non-negative) should be used instead.
|
|
41
|
+
- **Sensitive to vocabulary size**: With large vocabularies (e.g., 128K tokenizers for LLMs), the peak memory usage of softmax + cross-entropy can reach tens of GB, requiring chunked/online softmax or label smoothing for mitigation.
|
|
42
|
+
|
|
43
|
+
## Further References
|
|
44
|
+
- Distillation draft: `references/books/` — no dedicated information theory distillation draft at present
|
|
45
|
+
- Cover & Thomas. *Elements of Information Theory*, 2nd Edition. Wiley, 2006
|
|
46
|
+
- MacKay. *Information Theory, Inference, and Learning Algorithms*. Cambridge, 2003
|
|
47
|
+
- Related knowledge cards: `probability/kl-divergence.md`, `probability/information-bottleneck.md`
|