math-skill 2.1.0 → 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.
Files changed (234) hide show
  1. package/README.en-US.md +159 -200
  2. package/README.md +159 -200
  3. package/agents/math-critic.en.md +2 -2
  4. package/agents/math-critic.md +8 -8
  5. package/commands/ask.md +3 -10
  6. package/design-patterns/attention/equivariant-attention.en.md +72 -0
  7. package/design-patterns/attention/equivariant-attention.md +72 -0
  8. package/design-patterns/attention/geometry-aware-attention.en.md +73 -0
  9. package/design-patterns/attention/geometry-aware-attention.md +72 -0
  10. package/design-patterns/attention/information-bottleneck-attention.en.md +72 -0
  11. package/design-patterns/attention/information-bottleneck-attention.md +72 -0
  12. package/design-patterns/attention/projection-attention.en.md +68 -0
  13. package/design-patterns/attention/projection-attention.md +68 -0
  14. package/design-patterns/attention/spectral-attention.en.md +71 -0
  15. package/design-patterns/attention/spectral-attention.md +71 -0
  16. package/design-patterns/compression/leverage-score-selection.en.md +71 -0
  17. package/design-patterns/compression/leverage-score-selection.md +71 -0
  18. package/design-patterns/compression/low-rank-kv-cache.en.md +60 -0
  19. package/design-patterns/compression/low-rank-kv-cache.md +60 -0
  20. package/design-patterns/compression/spectral-token-pruning.en.md +61 -0
  21. package/design-patterns/compression/spectral-token-pruning.md +61 -0
  22. package/design-patterns/compression/topology-preserving-compression.en.md +64 -0
  23. package/design-patterns/compression/topology-preserving-compression.md +64 -0
  24. package/design-patterns/loss/constraint-penalty.en.md +67 -0
  25. package/design-patterns/loss/constraint-penalty.md +78 -0
  26. package/design-patterns/loss/contrastive-loss.en.md +59 -0
  27. package/design-patterns/loss/contrastive-loss.md +68 -0
  28. package/design-patterns/loss/information-bottleneck-loss.en.md +69 -0
  29. package/design-patterns/loss/information-bottleneck-loss.md +74 -0
  30. package/design-patterns/loss/orthogonality-loss.en.md +56 -0
  31. package/design-patterns/loss/orthogonality-loss.md +60 -0
  32. package/design-patterns/loss/variational-loss.en.md +61 -0
  33. package/design-patterns/loss/variational-loss.md +71 -0
  34. package/design-patterns/representation/equivariant-split.en.md +87 -0
  35. package/design-patterns/representation/equivariant-split.md +89 -0
  36. package/design-patterns/representation/manifold-representation.en.md +85 -0
  37. package/design-patterns/representation/manifold-representation.md +87 -0
  38. package/design-patterns/representation/shared-private-decomposition.en.md +84 -0
  39. package/design-patterns/representation/shared-private-decomposition.md +86 -0
  40. package/design-patterns/representation/subspace-alignment.en.md +90 -0
  41. package/design-patterns/representation/subspace-alignment.md +92 -0
  42. package/design-patterns/routing/graph-routing.en.md +79 -0
  43. package/design-patterns/routing/graph-routing.md +81 -0
  44. package/design-patterns/routing/moe-routing.en.md +85 -0
  45. package/design-patterns/routing/moe-routing.md +87 -0
  46. package/design-patterns/routing/optimal-transport-routing.en.md +68 -0
  47. package/design-patterns/routing/optimal-transport-routing.md +72 -0
  48. package/design-patterns/routing/spectral-clustering-routing.en.md +88 -0
  49. package/design-patterns/routing/spectral-clustering-routing.md +90 -0
  50. package/knowledge-base/differential-geometry/connection.en.md +51 -0
  51. package/knowledge-base/differential-geometry/connection.md +51 -0
  52. package/knowledge-base/differential-geometry/curvature.en.md +49 -0
  53. package/knowledge-base/differential-geometry/curvature.md +49 -0
  54. package/knowledge-base/differential-geometry/geodesic.en.md +51 -0
  55. package/knowledge-base/differential-geometry/geodesic.md +51 -0
  56. package/knowledge-base/differential-geometry/manifold.en.md +47 -0
  57. package/knowledge-base/differential-geometry/manifold.md +47 -0
  58. package/knowledge-base/differential-geometry/metric-tensor.en.md +50 -0
  59. package/knowledge-base/differential-geometry/metric-tensor.md +50 -0
  60. package/knowledge-base/differential-geometry/tangent-space.en.md +48 -0
  61. package/knowledge-base/differential-geometry/tangent-space.md +48 -0
  62. package/knowledge-base/information-geometry/fisher-metric.en.md +56 -0
  63. package/knowledge-base/information-geometry/fisher-metric.md +56 -0
  64. package/knowledge-base/information-geometry/natural-gradient.en.md +54 -0
  65. package/knowledge-base/information-geometry/natural-gradient.md +54 -0
  66. package/knowledge-base/lie-theory/equivariance.en.md +54 -0
  67. package/knowledge-base/lie-theory/equivariance.md +54 -0
  68. package/knowledge-base/lie-theory/group-action.en.md +51 -0
  69. package/knowledge-base/lie-theory/group-action.md +51 -0
  70. package/knowledge-base/lie-theory/lie-algebra.en.md +51 -0
  71. package/knowledge-base/lie-theory/lie-algebra.md +51 -0
  72. package/knowledge-base/lie-theory/lie-group.en.md +51 -0
  73. package/knowledge-base/lie-theory/lie-group.md +51 -0
  74. package/knowledge-base/lie-theory/representation.en.md +52 -0
  75. package/knowledge-base/lie-theory/representation.md +52 -0
  76. package/knowledge-base/matrix-analysis/low-rank-approximation.en.md +49 -0
  77. package/knowledge-base/matrix-analysis/low-rank-approximation.md +49 -0
  78. package/knowledge-base/matrix-analysis/matrix-perturbation.en.md +49 -0
  79. package/knowledge-base/matrix-analysis/matrix-perturbation.md +49 -0
  80. package/knowledge-base/matrix-analysis/positive-semidefinite.en.md +50 -0
  81. package/knowledge-base/matrix-analysis/positive-semidefinite.md +50 -0
  82. package/knowledge-base/matrix-analysis/projection.en.md +47 -0
  83. package/knowledge-base/matrix-analysis/projection.md +47 -0
  84. package/knowledge-base/matrix-analysis/spectral-decomposition.en.md +48 -0
  85. package/knowledge-base/matrix-analysis/spectral-decomposition.md +48 -0
  86. package/knowledge-base/optimization/constrained-optimization.en.md +53 -0
  87. package/knowledge-base/optimization/constrained-optimization.md +53 -0
  88. package/knowledge-base/optimization/convex-optimization.en.md +50 -0
  89. package/knowledge-base/optimization/convex-optimization.md +50 -0
  90. package/knowledge-base/optimization/lagrangian-duality.en.md +50 -0
  91. package/knowledge-base/optimization/lagrangian-duality.md +50 -0
  92. package/knowledge-base/optimization/proximal-method.en.md +52 -0
  93. package/knowledge-base/optimization/proximal-method.md +52 -0
  94. package/knowledge-base/optimization/riemannian-optimization.en.md +51 -0
  95. package/knowledge-base/optimization/riemannian-optimization.md +51 -0
  96. package/knowledge-base/overview.en.md +29 -218
  97. package/knowledge-base/overview.md +29 -220
  98. package/knowledge-base/probability/concentration-inequality.en.md +45 -0
  99. package/knowledge-base/probability/concentration-inequality.md +45 -0
  100. package/knowledge-base/probability/entropy.en.md +47 -0
  101. package/knowledge-base/probability/entropy.md +47 -0
  102. package/knowledge-base/probability/fisher-information.en.md +48 -0
  103. package/knowledge-base/probability/fisher-information.md +48 -0
  104. package/knowledge-base/probability/information-bottleneck.en.md +49 -0
  105. package/knowledge-base/probability/information-bottleneck.md +49 -0
  106. package/knowledge-base/probability/kl-divergence.en.md +51 -0
  107. package/knowledge-base/probability/kl-divergence.md +51 -0
  108. package/knowledge-base/topology/euler-characteristic.en.md +54 -0
  109. package/knowledge-base/topology/euler-characteristic.md +54 -0
  110. package/knowledge-base/topology/fundamental-group.en.md +52 -0
  111. package/knowledge-base/topology/fundamental-group.md +52 -0
  112. package/knowledge-base/topology/persistent-homology.en.md +54 -0
  113. package/knowledge-base/topology/persistent-homology.md +54 -0
  114. package/lenses/algorithmic.en.md +49 -0
  115. package/lenses/algorithmic.md +49 -0
  116. package/lenses/axiomatization.en.md +48 -0
  117. package/lenses/axiomatization.md +48 -0
  118. package/lenses/categorical.en.md +48 -0
  119. package/lenses/categorical.md +48 -0
  120. package/lenses/causal.en.md +49 -0
  121. package/lenses/causal.md +49 -0
  122. package/lenses/duality.en.md +47 -0
  123. package/lenses/duality.md +47 -0
  124. package/lenses/game.en.md +50 -0
  125. package/lenses/game.md +50 -0
  126. package/lenses/geometric.en.md +53 -0
  127. package/lenses/geometric.md +53 -0
  128. package/lenses/local-to-global.en.md +52 -0
  129. package/lenses/local-to-global.md +52 -0
  130. package/lenses/perturbation.en.md +51 -0
  131. package/lenses/perturbation.md +51 -0
  132. package/lenses/probabilistic.en.md +48 -0
  133. package/lenses/probabilistic.md +48 -0
  134. package/lenses/projection.en.md +50 -0
  135. package/lenses/projection.md +50 -0
  136. package/lenses/spectral.en.md +52 -0
  137. package/lenses/spectral.md +52 -0
  138. package/lenses/symmetry.en.md +49 -0
  139. package/lenses/symmetry.md +49 -0
  140. package/lenses/topological.en.md +48 -0
  141. package/lenses/topological.md +48 -0
  142. package/lenses/variational.en.md +48 -0
  143. package/lenses/variational.md +48 -0
  144. package/package.json +9 -3
  145. package/references/books/abstract-algebra.md +5 -5
  146. package/references/books/algebraic-geometry-rising-sea.md +5 -5
  147. package/references/books/differential-geometry.md +3 -3
  148. package/references/books/matrix-analysis.md +4 -4
  149. package/references/books/micro-lie-theory.md +3 -3
  150. package/references/books/optimization-ml.md +1 -1
  151. package/references/books/smooth-manifolds.md +3 -3
  152. package/references/gpu-friendly-math.en.md +8 -8
  153. package/references/gpu-friendly-math.md +2 -2
  154. package/references/inspiration.en.md +1 -1
  155. package/references/inspiration.md +2 -2
  156. package/skills/math-research-activator/SKILL.en.md +161 -106
  157. package/skills/math-research-activator/SKILL.md +162 -110
  158. package/skills/math-research-activator/original-texts.en.md +9 -9
  159. package/skills/math-research-activator/original-texts.md +11 -11
  160. package/commands/abstraction.md +0 -11
  161. package/commands/algorithmic-thinking.md +0 -11
  162. package/commands/axiomatization.md +0 -11
  163. package/commands/causal-inference.md +0 -11
  164. package/commands/discrete-combinatorial.md +0 -11
  165. package/commands/game-theory.md +0 -11
  166. package/commands/induction-analogy.md +0 -11
  167. package/commands/information-theory.md +0 -11
  168. package/commands/logic-deduction.md +0 -11
  169. package/commands/modeling.md +0 -11
  170. package/commands/optimization.md +0 -11
  171. package/commands/probability-statistics.md +0 -11
  172. package/commands/symmetry-invariance.md +0 -11
  173. package/commands/topological-thinking.md +0 -11
  174. package/commands/transformation.md +0 -11
  175. package/skills/abstraction/SKILL.en.md +0 -117
  176. package/skills/abstraction/SKILL.md +0 -121
  177. package/skills/abstraction/original-texts.en.md +0 -163
  178. package/skills/abstraction/original-texts.md +0 -175
  179. package/skills/algorithmic-thinking/SKILL.en.md +0 -132
  180. package/skills/algorithmic-thinking/SKILL.md +0 -138
  181. package/skills/algorithmic-thinking/original-texts.en.md +0 -253
  182. package/skills/algorithmic-thinking/original-texts.md +0 -256
  183. package/skills/axiomatization/SKILL.en.md +0 -144
  184. package/skills/axiomatization/SKILL.md +0 -151
  185. package/skills/axiomatization/original-texts.en.md +0 -154
  186. package/skills/axiomatization/original-texts.md +0 -160
  187. package/skills/causal-inference/SKILL.en.md +0 -147
  188. package/skills/causal-inference/SKILL.md +0 -151
  189. package/skills/causal-inference/original-texts.en.md +0 -136
  190. package/skills/causal-inference/original-texts.md +0 -167
  191. package/skills/discrete-combinatorial/SKILL.en.md +0 -124
  192. package/skills/discrete-combinatorial/SKILL.md +0 -131
  193. package/skills/discrete-combinatorial/original-texts.en.md +0 -184
  194. package/skills/discrete-combinatorial/original-texts.md +0 -185
  195. package/skills/game-theory/SKILL.en.md +0 -117
  196. package/skills/game-theory/SKILL.md +0 -123
  197. package/skills/game-theory/original-texts.en.md +0 -131
  198. package/skills/game-theory/original-texts.md +0 -131
  199. package/skills/induction-analogy/SKILL.en.md +0 -145
  200. package/skills/induction-analogy/SKILL.md +0 -152
  201. package/skills/induction-analogy/original-texts.en.md +0 -140
  202. package/skills/induction-analogy/original-texts.md +0 -154
  203. package/skills/information-theory/SKILL.en.md +0 -134
  204. package/skills/information-theory/SKILL.md +0 -140
  205. package/skills/information-theory/original-texts.en.md +0 -127
  206. package/skills/information-theory/original-texts.md +0 -127
  207. package/skills/logic-deduction/SKILL.en.md +0 -130
  208. package/skills/logic-deduction/SKILL.md +0 -135
  209. package/skills/logic-deduction/original-texts.en.md +0 -160
  210. package/skills/logic-deduction/original-texts.md +0 -173
  211. package/skills/modeling/SKILL.en.md +0 -135
  212. package/skills/modeling/SKILL.md +0 -139
  213. package/skills/modeling/original-texts.en.md +0 -162
  214. package/skills/modeling/original-texts.md +0 -165
  215. package/skills/optimization/SKILL.en.md +0 -129
  216. package/skills/optimization/SKILL.md +0 -135
  217. package/skills/optimization/original-texts.en.md +0 -167
  218. package/skills/optimization/original-texts.md +0 -168
  219. package/skills/probability-statistics/SKILL.en.md +0 -146
  220. package/skills/probability-statistics/SKILL.md +0 -151
  221. package/skills/probability-statistics/original-texts.en.md +0 -191
  222. package/skills/probability-statistics/original-texts.md +0 -193
  223. package/skills/symmetry-invariance/SKILL.en.md +0 -135
  224. package/skills/symmetry-invariance/SKILL.md +0 -139
  225. package/skills/symmetry-invariance/original-texts.en.md +0 -206
  226. package/skills/symmetry-invariance/original-texts.md +0 -221
  227. package/skills/topological-thinking/SKILL.en.md +0 -124
  228. package/skills/topological-thinking/SKILL.md +0 -128
  229. package/skills/topological-thinking/original-texts.en.md +0 -134
  230. package/skills/topological-thinking/original-texts.md +0 -164
  231. package/skills/transformation/SKILL.en.md +0 -120
  232. package/skills/transformation/SKILL.md +0 -124
  233. package/skills/transformation/original-texts.en.md +0 -204
  234. package/skills/transformation/original-texts.md +0 -216
@@ -0,0 +1,54 @@
1
+ # Equivariance
2
+
3
+ ## Minimal Definition
4
+
5
+ A map $f: X \to Y$ is equivariant with respect to the action of a group $G$ if $f(g \cdot x) = g \cdot f(x)$ holds for all $g \in G, x \in X$. Equivariance is a finer structure-preserving property than invariance ($f(g \cdot x) = f(x)$): the output "co-moves" with the input under the same group action.
6
+
7
+ ## Core Formulas
8
+
9
+ - Equivariance condition: $f(\rho_X(g) x) = \rho_Y(g) f(x), \quad \forall g \in G$
10
+ - Invariance = equivariance to the trivial representation: $f(g \cdot x) = f(x)$ ($\rho_Y = \text{id}$)
11
+ - Translation equivariance of convolution: $f(T_a x) = T_a f(x)$, where $T_a$ is the translation operator
12
+ - Gauge equivariance: $f(\alpha \cdot_\omega x) = \alpha \cdot_{f(\omega)} f(x)$, where $\alpha$ is a local gauge transformation and $\omega$ is a connection
13
+ - Adjoint equivariance: $f(X \oplus \tau) = f(X) \oplus (\text{Ad}_X \tau)$ (in the Lie group setting)
14
+
15
+ ## Applicable Problems
16
+
17
+ - 3D point clouds/molecules: when the input is rotated, the output (segmentation/forces/pose) should rotate accordingly
18
+ - Signal processing on spheres/manifolds: the choice of local coordinates should not affect prediction results
19
+ - Multi-view/multi-sensor: when camera orientation changes, features should covary rather than require relearning
20
+ - Physical simulation: vector quantities such as forces and velocities should rotate correctly under coordinate transformations
21
+
22
+ ## AI Design Translation
23
+
24
+ - **E(n)-equivariant GNN**: Node features + coordinates; message passing simultaneously updates scalar features and equivariantly updates coordinates $x_i \to x_i + \sum_j \phi(r_{ij}) \cdot (x_i - x_j)$
25
+ - **Gauge-equivariant CNN**: Each edge carries a $G$-connection to align local frames; convolution kernels are invariant to local coordinate choices; applicable to meshes/spheres/graphs
26
+ - **Steerable CNN**: Feature fields are direct sums of group representations $\bigoplus_l \rho_l$; convolution kernels are constrained by Schur's lemma to block structure, yielding few parameters with strict equivariance
27
+ - **Adjoint-equiv output head**: Pose regression $f: X \to SE(3)$ satisfying $f(g \cdot X) = g \cdot f(X)$, implemented using $\exp$ and the Lie algebra
28
+ - **Equivariance verification loss**: $L_{\text{eq}} = \|f(g \cdot x) - g \cdot f(x)\|^2$ as an auxiliary regularizer, enforcing approximate equivariance
29
+
30
+ ## Engineering Feasibility
31
+
32
+ GPU friendliness depends on the degree of group discretization:
33
+ - **Discrete groups ($C_n$, octahedral group, etc.)**: Group convolution can be expanded into GEMM; equivariance constraints block-diagonalize weights (reducing parameters), GPU-friendly
34
+ - **Translation group (standard CNN)**: Naturally equivariant; weight sharing is the engineering realization of equivariance, perfectly GPU-friendly
35
+ - **Continuous groups SO(3)/SE(3)**: Require frequency-domain expansion (spherical harmonics) or sampling-based discretization; fast algorithms exist for spherical harmonic transforms but implementation is complex
36
+ - **Gauge-equivariant**: One $G$-element action per edge equals small matrix-times-feature-vector, expressible as sparse matmul
37
+ - **Approximate equivariance (regularization)**: The equivariance loss $L_{\text{eq}}$ is a standard MSE, fully GPU-friendly, but equivariance is not exact
38
+ - Key trade-off: strict equivariance (structural constraints) vs. approximate equivariance (regularization) -- the former has fewer parameters but complex implementation, the latter is simple but not guaranteed
39
+
40
+ ## Risks and Failure Conditions
41
+
42
+ - **Continuous group discretization error**: Improper sampling causes equivariance to silently break, passing verification but failing at inference
43
+ - **Equivariance-expressiveness trade-off**: Strict equivariance constraints reduce the parameter space, potentially insufficient for fitting complex functions
44
+ - **Combinatorial explosion of multiple group actions**: Simultaneously requiring rotation + translation + permutation equivariance leads to complex cross-constraints
45
+ - **Data noise breaking equivariance**: Sensor noise makes the exact computation of $g \cdot x$ unreliable, invalidating the equivariance premise
46
+ - **Numerical precision in equivariant layers**: Floating-point errors in spherical harmonics/CG coefficients at large $l$ break equivariance, requiring fp32 accumulation
47
+ - **Over-constraining with equivariance**: When a task only requires approximate symmetry, enforcing strict equivariance is inferior to using soft regularization constraints
48
+
49
+ ## Further References
50
+
51
+ - Distillation notes: references/books/micro-lie-theory.md (Section II-F Adjoint $\text{Ad}_X$, algebraic realization of equivariance)
52
+ - Distillation notes: references/books/differential-geometry.md (Section 6.8 Principal Bundles, Section 12.12 G-Connections, gauge equivariance)
53
+ - Distillation notes: references/books/differential-geometry.md (Ch 5 Lie Groups, continuous symmetry as prior)
54
+ - Original text: Jeffrey M. Lee, *Manifolds and Differential Geometry*, Section 6.8 + Section 12.12 (geometric foundations of gauge equivariance)
@@ -0,0 +1,54 @@
1
+ # 等变性 (Equivariance)
2
+
3
+ ## 最小定义
4
+
5
+ 映射 $f: X \to Y$ 关于群 $G$ 的作用等变,若 $f(g \cdot x) = g \cdot f(x)$ 对所有 $g \in G, x \in X$ 成立。等变性是比不变性($f(g \cdot x) = f(x)$)更精细的结构保持:输出随输入按同一群作用"协动"。
6
+
7
+ ## 核心公式
8
+
9
+ - 等变性条件:$f(\rho_X(g) x) = \rho_Y(g) f(x), \quad \forall g \in G$
10
+ - 不变性 = 等变到平凡表示:$f(g \cdot x) = f(x)$($\rho_Y = \text{id}$)
11
+ - 卷积的平移等变性:$f(T_a x) = T_a f(x)$,其中 $T_a$ 是平移算子
12
+ - 规范等变性(gauge equivariance):$f(\alpha \cdot_\omega x) = \alpha \cdot_{f(\omega)} f(x)$,$\alpha$ 是局部规范变换,$\omega$ 是联络
13
+ - 伴随等变性:$f(X \oplus \tau) = f(X) \oplus (\text{Ad}_X \tau)$(李群场景)
14
+
15
+ ## 适用问题
16
+
17
+ - 3D 点云/分子:输入旋转后,输出(分割/力/位姿)应同样旋转
18
+ - 球面/流形上的信号处理:局部坐标选择不应影响预测结果
19
+ - 多视角/多传感器:相机朝向变化时,特征应协变而非重新学习
20
+ - 物理模拟:力、速度等矢量应随坐标系变换正确旋转
21
+
22
+ ## AI 设计翻译
23
+
24
+ - **E(n)-等变 GNN**:节点特征 + 坐标,消息传递同时更新标量特征和等变更新坐标 $x_i \to x_i + \sum_j \phi(r_{ij}) \cdot (x_i - x_j)$
25
+ - **Gauge-equivariant CNN**:每条边携带 $G$-联络对齐局部 frame,卷积核对局部坐标选择不变;适用于 mesh/球面/图
26
+ - **Steerable CNN**:特征场是群表示的直和 $\bigoplus_l \rho_l$,卷积核被 Schur 引理约束为块结构,参数少但严格等变
27
+ - **伴随等变输出头**:位姿回归 $f: X \to SE(3)$ 满足 $f(g \cdot X) = g \cdot f(X)$,用 $\exp$ 和李代数实现
28
+ - **等变性验证损失**:$L_{\text{eq}} = \|f(g \cdot x) - g \cdot f(x)\|^2$ 作为辅助正则,强制近似等变
29
+
30
+ ## 工程可行性
31
+
32
+ GPU 友好度取决于群的离散化程度:
33
+ - **离散群($C_n$, 八面体群等)**:群卷积可展开为 GEMM,等变约束使权重块对角化(参数减少),GPU 友好
34
+ - **平移群(标准 CNN)**:天然等变,weight sharing 就是等变性的工程实现,完美 GPU 友好
35
+ - **连续群 SO(3)/SE(3)**:需频域展开(球谐)或采样离散化;球谐变换有快速算法但实现复杂
36
+ - **Gauge-equivariant**:每边一个 $G$-元素作用 = 小矩阵乘特征向量,可表达为 sparse matmul
37
+ - **近似等变(正则化)**:等变性损失 $L_{\text{eq}}$ 是普通的 MSE,完全 GPU 友好,但等变性不严格
38
+ - 关键权衡:严格等变(结构约束)vs 近似等变(正则化)——前者参数少但实现复杂,后者简单但不保证
39
+
40
+ ## 风险与失效条件
41
+
42
+ - **连续群离散化误差**:采样不当导致等变性悄悄破缺,验证时通过但推理时失败
43
+ - **等变性与表达力的权衡**:严格等变约束减少参数空间,可能不足以拟合复杂函数
44
+ - **多群作用的组合爆炸**:同时要求旋转 + 平移 + 置换等变时,约束交叉复杂
45
+ - **数据噪声破坏等变性**:传感器噪声使 $g \cdot x$ 的精确计算不可靠,等变性前提失效
46
+ - **等变层的数值精度**:球谐/CG 系数在大 $l$ 下的浮点误差会破坏等变性,需 fp32 累加
47
+ - **过度等变约束**:任务只需近似对称时硬上严格等变,不如用正则化软约束
48
+
49
+ ## 深入参考
50
+
51
+ - 蒸馏稿:references/books/micro-lie-theory.md(§II-F 伴随 Ad_X,等变性的代数实现)
52
+ - 蒸馏稿:references/books/differential-geometry.md(§6.8 Principal Bundles, §12.12 G-Connections, 规范等变)
53
+ - 蒸馏稿:references/books/differential-geometry.md(Ch 5 Lie Groups, 连续对称作为先验)
54
+ - 原书:Jeffrey M. Lee, *Manifolds and Differential Geometry*, §6.8 + §12.12(规范等变的几何基础)
@@ -0,0 +1,51 @@
1
+ # Group Action
2
+
3
+ ## Minimal Definition
4
+
5
+ A group $G$ acting on a set $X$ is a homomorphism $\rho: G \to \text{Bij}(X)$ satisfying $\rho(e) = \text{id}$ and $\rho(g_1 g_2) = \rho(g_1) \circ \rho(g_2)$. It converts group elements into transformations on the set, providing the mathematical realization of "symmetry": the algebraic structure of the group determines the structure of geometric transformations.
6
+
7
+ ## Core Formulas
8
+
9
+ - Group action: $g \cdot x = \rho(g)(x)$, satisfying $e \cdot x = x$ and $(gh)\cdot x = g \cdot (h \cdot x)$
10
+ - Orbit: $\text{Orb}(x) = \{g \cdot x \mid g \in G\}$
11
+ - Stabilizer subgroup: $\text{Stab}(x) = \{g \in G \mid g \cdot x = x\}$
12
+ - Orbit-stabilizer theorem: $|G| = |\text{Orb}(x)| \cdot |\text{Stab}(x)|$
13
+ - Invariant function: $f(g \cdot x) = f(x), \forall g \in G$
14
+ - Equivariant map: $\phi(g \cdot x) = g \cdot \phi(x)$
15
+
16
+ ## Applicable Problems
17
+
18
+ - Data possesses known symmetries: rotations, translations, permutations, scale transformations; the model must respect these symmetries
19
+ - Output should covary with input: in pose estimation, when the object rotates, the output pose should rotate accordingly
20
+ - Theoretical foundation for data augmentation: sampling along group orbits is equivalent to traversing the group action
21
+ - Quotient space construction: modding out by the stabilizer subgroup yields an invariant feature space
22
+
23
+ ## AI Design Translation
24
+
25
+ - **Equivariant network layer**: $f(g \cdot x) = g \cdot f(x)$, hard-coding the group action into the network structure to obtain equivariance without data augmentation
26
+ - **Invariant pooling layer**: Average/max over orbits $\frac{1}{|G|}\sum_g f(g \cdot x)$ to extract invariants from equivariant features
27
+ - **Group convolution**: $(f * h)(g) = \sum_{g'} f(g') h(g'^{-1} g)$, performing convolution directly on the group itself, applicable when signals are defined on the group
28
+ - **Orbit-sampling data augmentation**: Use group actions to generate symmetry-equivalent training samples, effectively enlarging the training set
29
+
30
+ ## Engineering Feasibility
31
+
32
+ GPU friendliness depends on the type of group:
33
+ - **Finite/discrete groups**: Group convolution can be expanded into batched GEMM or sparse matmul, $O(|G|^2)$ or $O(|G| \cdot d)$, GPU-friendly
34
+ - **Continuous compact groups SO(n)/SU(n)**: Require discrete sampling or frequency-domain expansion (Peter-Weyl theorem); fast algorithms exist for spherical harmonic transforms
35
+ - **Permutation group $S_n$**: Order $n!$, cannot be enumerated; use sort pooling, symmetric functions, and other approximate invariants
36
+ - **Fourier-accelerated group convolution**: The FFT on finite groups reduces convolution from $O(|G|^2)$ to $O(|G| \log |G|)$, but implementation is complex
37
+ - Key bottleneck: if the discretization of a continuous group is not exact, equivariance silently breaks
38
+
39
+ ## Risks and Failure Conditions
40
+
41
+ - **Naive discretization of continuous groups**: Improper sampling leads to broken equivariance and irregular gather/scatter patterns, GPU-unfriendly
42
+ - **Incorrect group action definition**: Confusing left and right actions or inconsistent group multiplication order causes equivariance verification to pass but inference to fail
43
+ - **Infeasible orbit enumeration**: Orbits of large/continuous groups cannot be fully enumerated; approximate invariants introduce bias
44
+ - **Over-constraining**: Not all tasks require strict equivariance; enforcing group actions on weakly symmetric tasks may sacrifice expressiveness
45
+
46
+ ## Further References
47
+
48
+ - Distillation notes: references/books/micro-lie-theory.md (Section II-B Group Actions)
49
+ - Distillation notes: references/books/smooth-manifolds.md (Ch 7 Lie Groups)
50
+ - Original text: Joan Sola et al., *A micro Lie theory*, Section II-B (group action definition and applications in robotics)
51
+ - Original text: John M. Lee, *Introduction to Smooth Manifolds*, Ch 7 (Lie groups and group actions)
@@ -0,0 +1,51 @@
1
+ # 群作用 (Group Action)
2
+
3
+ ## 最小定义
4
+
5
+ 群 $G$ 作用在集合 $X$ 上是一个同态 $\rho: G \to \text{Bij}(X)$,满足 $\rho(e) = \text{id}$ 和 $\rho(g_1 g_2) = \rho(g_1) \circ \rho(g_2)$。它将群元素转化为集合上的变换,是"对称性"的数学实现:群的代数结构决定了几何变换的结构。
6
+
7
+ ## 核心公式
8
+
9
+ - 群作用:$g \cdot x = \rho(g)(x)$,满足 $e \cdot x = x$,$(gh)\cdot x = g \cdot (h \cdot x)$
10
+ - 轨道(orbit):$\text{Orb}(x) = \{g \cdot x \mid g \in G\}$
11
+ - 稳定子群(stabilizer):$\text{Stab}(x) = \{g \in G \mid g \cdot x = x\}$
12
+ - 轨道-稳定子定理:$|G| = |\text{Orb}(x)| \cdot |\text{Stab}(x)|$
13
+ - 不变函数:$f(g \cdot x) = f(x), \forall g \in G$
14
+ - 等变映射:$\phi(g \cdot x) = g \cdot \phi(x)$
15
+
16
+ ## 适用问题
17
+
18
+ - 数据具有已知对称性:旋转、平移、置换、尺度变换,需要模型尊重这些对称
19
+ - 输出应随输入协变:姿态估计中,物体旋转后输出位姿也应相应旋转
20
+ - 数据增广的理论基础:群轨道上的采样等价于群作用的遍历
21
+ - 商空间构造:模去稳定子群得到不变特征空间
22
+
23
+ ## AI 设计翻译
24
+
25
+ - **等变网络层**:$f(g \cdot x) = g \cdot f(x)$,将群作用硬编码进网络结构,无需数据增广即获得等变性
26
+ - **不变池化层**:对轨道求平均/最大 $\frac{1}{|G|}\sum_g f(g \cdot x)$,从等变特征中提取不变量
27
+ - **群卷积**:$(f * h)(g) = \sum_{g'} f(g') h(g'^{-1} g)$,在群本身上做卷积,适用于信号定义在群上的场景
28
+ - **轨道采样数据增广**:用群作用生成训练样本的对称等价类,扩大有效训练集
29
+
30
+ ## 工程可行性
31
+
32
+ GPU 友好度取决于群的类型:
33
+ - **有限群/离散群**:群卷积可展开为 batched GEMM 或稀疏 matmul,$O(|G|^2)$ 或 $O(|G| \cdot d)$,GPU 友好
34
+ - **连续紧群 SO(n)/SU(n)**:需离散采样或频域展开(Peter-Wigner 定理),球谐变换有快速算法
35
+ - **置换群 $S_n$**:$n!$ 阶,不可遍历;用排序池化、对称函数等近似不变化
36
+ - **群卷积的 Fourier 加速**:有限群的 FFT 将卷积从 $O(|G|^2)$ 降至 $O(|G| \log |G|)$,但实现复杂
37
+ - 关键瓶颈:连续群的离散化若不精确,等变性会悄悄破缺
38
+
39
+ ## 风险与失效条件
40
+
41
+ - **连续群无脑离散化**:采样不当导致等变性破缺 + 不规则 gather/scatter,GPU 不友好
42
+ - **群作用定义错误**:左右作用混淆、群乘法顺序不一致导致等变性验证通过但推理失败
43
+ - **轨道遍历不可行**:大群/连续群的轨道无法完整遍历,近似不变化引入偏差
44
+ - **过度约束**:不是所有任务都需要严格等变,弱对称任务硬上群作用可能牺牲表达力
45
+
46
+ ## 深入参考
47
+
48
+ - 蒸馏稿:references/books/micro-lie-theory.md(§II-B 群作用)
49
+ - 蒸馏稿:references/books/smooth-manifolds.md(Ch 7 Lie Groups)
50
+ - 原书:Joan Sola et al., *A micro Lie theory*, §II-B(群作用定义与机器人中的应用)
51
+ - 原书:John M. Lee, *Introduction to Smooth Manifolds*, Ch 7(李群与群作用)
@@ -0,0 +1,51 @@
1
+ # Lie Algebra
2
+
3
+ ## Minimal Definition
4
+
5
+ The Lie algebra $\mathfrak{g}$ is the tangent space $T_e G$ of a Lie group $G$ at the identity element $e$, equipped with a Lie bracket $[\cdot, \cdot]: \mathfrak{g} \times \mathfrak{g} \to \mathfrak{g}$ satisfying bilinearity, antisymmetry, and the Jacobi identity. It is the linear space of "infinitesimal generators" -- locally linearizing the curved, nonlinear group into a flat vector space.
6
+
7
+ ## Core Formulas
8
+
9
+ - Lie bracket: $[X, Y] = XY - YX$ (for matrix groups), satisfying $[X,[Y,Z]] + [Y,[Z,X]] + [Z,[X,Y]] = 0$
10
+ - $\text{so}(3)$: skew-symmetric matrices, $[\omega]_\times = \begin{pmatrix} 0 & -\omega_3 & \omega_2 \\ \omega_3 & 0 & -\omega_1 \\ -\omega_2 & \omega_1 & 0 \end{pmatrix}$
11
+ - hat/vee operators: $\hat{\cdot}: \mathbb{R}^n \to \mathfrak{g}$ (vector to skew-symmetric matrix), $\check{\cdot}: \mathfrak{g} \to \mathbb{R}^n$ (inverse)
12
+ - Baker-Campbell-Hausdorff formula: $\log(\exp(X)\exp(Y)) = X + Y + \frac{1}{2}[X,Y] + \cdots$
13
+ - Adjoint representation: $\text{ad}_X(Y) = [X,Y]$, which is the differential of $\text{Ad}$
14
+
15
+ ## Applicable Problems
16
+
17
+ - Local linearization of rotations/poses: approximate nonlinear group variations in a small neighborhood using Lie algebra vectors $\delta \in \mathbb{R}^n$
18
+ - Reparameterization for constrained optimization: convert orthogonality/rotation constraints into unconstrained Lie algebra parameters + exp map
19
+ - Infinitesimal description of symmetries: continuous symmetry groups are fully characterized by a small set of generators
20
+ - Error-state estimation: covariances are defined on the tangent space $\mathbb{R}^n$ rather than on the group
21
+
22
+ ## AI Design Translation
23
+
24
+ - **Lie algebra parameterization layer**: The network outputs $\delta \in \mathbb{R}^3$ (so(3)), then applies $\exp$ to obtain a valid rotation matrix; replaces quaternion normalization or 6D representations
25
+ - **Error-state EKF/optimization layer**: Parameterize the error around a nominal state $X$ as $\delta \in \mathfrak{g}$ with $X_{\text{true}} = X \oplus \delta$; Kalman filtering proceeds in the linear tangent space
26
+ - **Lie bracket regularization**: Penalize $[\xi_i, \xi_j] \neq 0$ to constrain the commutativity of generators, or use as a symmetry consistency loss
27
+ - **Generator learning**: Learn a Lie algebra basis $\{E_1, \ldots, E_n\}$ as trainable parameters, enabling data-driven symmetry discovery
28
+
29
+ ## Engineering Feasibility
30
+
31
+ High GPU friendliness. The core advantage of the Lie algebra is that it is a "linear space":
32
+ - **hat/vee maps**: Pure index operations + sign flips, $O(n)$, perfectly GPU-friendly
33
+ - **Lie bracket $[X,Y] = XY - YX$**: Two small matrix multiplications + subtraction, $O(n^3)$ for small matrices, batchable
34
+ - **Linear combination $\sum c_i E_i$**: Vector addition + scalar multiplication, $O(nd)$, perfectly GPU-friendly
35
+ - **BCH approximation**: The first few terms suffice for engineering precision; $[X,Y]$ computation is a small matrix multiplication
36
+ - Main cost lies in $\exp$ rather than algebra operations: algebra operations are all linear; the bottleneck is the subsequent exp map
37
+
38
+ ## Risks and Failure Conditions
39
+
40
+ - **BCH series truncation error**: Higher-order terms are non-negligible at large angles; the first-order approximation $X+Y$ is valid only for small perturbations
41
+ - **Misinterpreting non-zero Lie brackets**: $[X,Y] \neq 0$ for non-commutative groups means group composition is order-sensitive; operations cannot be freely interchanged
42
+ - **Basis selection affects optimization**: The choice of Lie algebra basis is not unique; poor conditioning leads to optimization difficulties
43
+ - **Using the Lie algebra as global coordinates**: The exp map is only a local diffeomorphism; global coverage requires multiple charts (an atlas)
44
+ - **Inconsistent left/right conventions**: Right Jacobian vs. left Jacobian, local vs. global frame -- inconsistency leads to misaligned gradients and covariances
45
+
46
+ ## Further References
47
+
48
+ - Distillation notes: references/books/micro-lie-theory.md (Section II-C Tangent Space and Lie Algebra, hat/vee operators)
49
+ - Distillation notes: references/books/differential-geometry.md (Ch 5 Lie Groups, Lie algebra section)
50
+ - Original text: Joan Sola et al., *A micro Lie theory*, Section II-C (Lie algebra definition and hat/vee), Section II-D (exp/log bridge)
51
+ - Original text: Jeffrey M. Lee, *Manifolds and Differential Geometry*, Ch 5 (Lie groups and Lie algebras)
@@ -0,0 +1,51 @@
1
+ # 李代数 (Lie Algebra)
2
+
3
+ ## 最小定义
4
+
5
+ 李代数 $\mathfrak{g}$ 是李群 $G$ 在单位元 $e$ 处的切空间 $T_e G$,配备李括号 $[\cdot, \cdot]: \mathfrak{g} \times \mathfrak{g} \to \mathfrak{g}$ 满足双线性、反对称性和 Jacobi 恒等式。它是"无穷小生成元"的线性空间——把曲的非线性群局部线性化为平的向量空间。
6
+
7
+ ## 核心公式
8
+
9
+ - 李括号:$[X, Y] = XY - YX$(矩阵群),满足 $[X,[Y,Z]] + [Y,[Z,X]] + [Z,[X,Y]] = 0$
10
+ - $\text{so}(3)$:反对称矩阵,$[\omega]_\times = \begin{pmatrix} 0 & -\omega_3 & \omega_2 \\ \omega_3 & 0 & -\omega_1 \\ -\omega_2 & \omega_1 & 0 \end{pmatrix}$
11
+ - hat/vee 算子:$\hat{\cdot}: \mathbb{R}^n \to \mathfrak{g}$(向量→反对称矩阵),$\check{\cdot}: \mathfrak{g} \to \mathbb{R}^n$(逆)
12
+ - Baker-Campbell-Hausdorff:$\log(\exp(X)\exp(Y)) = X + Y + \frac{1}{2}[X,Y] + \cdots$
13
+ - 伴随表示:$\text{ad}_X(Y) = [X,Y]$,是 $\text{Ad}$ 的微分
14
+
15
+ ## 适用问题
16
+
17
+ - 旋转/位姿的局部线性化:在小邻域内用李代数向量 $\delta \in \mathbb{R}^n$ 近似群上的非线性变化
18
+ - 约束优化的重参数化:将正交/旋转约束转化为无约束李代数参数 + exp 映射
19
+ - 对称性的无穷小描述:连续对称群由少数生成元完全刻画
20
+ - 误差状态估计:协方差定义在切空间 $\mathbb{R}^n$ 上而非群上
21
+
22
+ ## AI 设计翻译
23
+
24
+ - **李代数参数化层**:网络输出 $\delta \in \mathbb{R}^3$(so(3)),经 $\exp$ 得到合法旋转矩阵;替代四元数归一化或 6D 表示
25
+ - **误差状态 EKF/优化层**:在标称状态 $X$ 附近用 $\delta \in \mathfrak{g}$ 参数化误差 $X_{\text{true}} = X \oplus \delta$,卡尔曼滤波在线性切空间进行
26
+ - **李括号正则**:惩罚 $[\xi_i, \xi_j] \neq 0$ 来约束生成元的交换性,或用作对称性一致性损失
27
+ - **生成元学习**:学习一组李代数基 $\{E_1, \ldots, E_n\}$ 作为可训练参数,实现数据驱动的对称性发现
28
+
29
+ ## 工程可行性
30
+
31
+ GPU 友好度高。李代数的核心优势是"线性空间":
32
+ - **hat/vee 映射**:纯索引操作 + 符号翻转,$O(n)$,完美 GPU 友好
33
+ - **李括号 $[X,Y] = XY - YX$**:两次小矩阵乘法 + 减法,$O(n^3)$ 小矩阵,可 batched
34
+ - **线性组合 $\sum c_i E_i$**:向量加法 + 标量乘,$O(nd)$,完美 GPU 友好
35
+ - **BCH 近似**:取前几项即够工程精度,$[X,Y]$ 计算为小矩阵乘法
36
+ - 主要开销在 $\exp$ 而非代数运算本身:代数运算全部是线性操作,瓶颈在后续的 exp 映射
37
+
38
+ ## 风险与失效条件
39
+
40
+ - **BCH 级数截断误差**:高阶项在大角度时不可忽略,一阶近似 $X+Y$ 仅对小扰动有效
41
+ - **李括号非零的误读**:非交换群的 $[X,Y] \neq 0$ 意味着群合成顺序敏感,不能随意交换操作
42
+ - **基的选择影响优化**:李代数基的选取不唯一,差的条件数会导致优化困难
43
+ - **把李代数当全局坐标**:exp 映射只是局部微分同胚,大范围需要多张覆盖(atlas)
44
+ - **左右约定不统一**:右雅可比 vs 左雅可比、局部 vs 全局坐标系,不统一则梯度与协方差错位
45
+
46
+ ## 深入参考
47
+
48
+ - 蒸馏稿:references/books/micro-lie-theory.md(§II-C 切空间与李代数, hat/vee 算子)
49
+ - 蒸馏稿:references/books/differential-geometry.md(Ch 5 Lie Groups, 李代数部分)
50
+ - 原书:Joan Sola et al., *A micro Lie theory*, §II-C(李代数定义与 hat/vee)、§II-D(exp/log 桥梁)
51
+ - 原书:Jeffrey M. Lee, *Manifolds and Differential Geometry*, Ch 5(李群与李代数)
@@ -0,0 +1,51 @@
1
+ # Lie Group
2
+
3
+ ## Minimal Definition
4
+
5
+ A Lie group $G$ is a space endowed with both a smooth manifold structure and a group structure, such that group multiplication $\mu: G \times G \to G$ and inversion $\iota: G \to G$ are smooth maps. It is the precise mathematical object of "continuous symmetry transformation groups" -- simultaneously a differentiable space and a multiplicative algebra.
6
+
7
+ ## Core Formulas
8
+
9
+ - Exponential map: $\exp: \mathfrak{g} \to G$, $\exp(\xi) = \gamma_\xi(1)$, where $\gamma_\xi$ is the one-parameter subgroup
10
+ - SO(3) Rodrigues formula: $\exp([\theta]_\times) = I + \frac{\sin\|\theta\|}{\|\theta\|}[\theta]_\times + \frac{1-\cos\|\theta\|}{\|\theta\|^2}[\theta]_\times^2$
11
+ - SE(3): $\exp\begin{pmatrix} [\omega]_\times & v \\ 0 & 0 \end{pmatrix} = \begin{pmatrix} \exp([\omega]_\times) & V(\theta)v \\ 0 & 1 \end{pmatrix}$
12
+ - $\oplus/\ominus$ operators (right version): $X \oplus \tau = X \cdot \exp(\tau)$, $X \ominus Y = \log(Y^{-1} X)$
13
+ - Adjoint map: $\text{Ad}_X(\tau) = X \tau X^{-1}$ (for matrix groups), satisfying $X \oplus \tau = (\text{Ad}_X \tau) \oplus X$
14
+
15
+ ## Applicable Problems
16
+
17
+ - Predictions/regression targets carry geometric constraints: rotations, poses, unit quaternions -- forcing them into a Euclidean MLP violates constraints
18
+ - Equivariance/invariance is required: when the input undergoes a rigid-body transformation, the output should covary or remain invariant (point clouds, molecules, multi-view geometry)
19
+ - State evolves on a Lie group: inertial preintegration, motion models, differentiable physics/control
20
+ - Orthogonal/unitary constraints on weight matrices: optimization on the Stiefel manifold
21
+
22
+ ## AI Design Translation
23
+
24
+ - **Manifold-parameterized output head**: The network makes unconstrained predictions in the tangent space $\mathbb{R}^n$, then projects back to SO(3)/SE(3) via $\exp$, replacing the ad-hoc orthogonalization of 6D/9D rotation representations
25
+ - **Manifold loss function**: Use $\ominus$ (geodesic error) as the loss, $L = \|X_{\text{pred}} \ominus X_{\text{gt}}\|^2$, naturally handling manifold topology
26
+ - **Lie group RNN/ODE**: Hidden state $h_t \in G$, updated as $h_{t+1} = h_t \oplus f_\theta(h_t, x_t) = h_t \cdot \exp(f_\theta(h_t, x_t))$
27
+ - **Orthogonal weight constraints**: $W = \exp(A)$ where $A$ is skew-symmetric, guaranteeing $W^T W = I$; alternatively, the Cayley transform $W = (I-A)(I+A)^{-1}$
28
+
29
+ ## Engineering Feasibility
30
+
31
+ GPU friendliness: the key factor is whether exp/log has a closed form.
32
+ - **SO(3)/SE(3) closed forms**: The Rodrigues formula is a finite algebraic expression on 3x3/4x4 small matrices, batchable as $[B,3,3]$/ $[B,4,4]$ tensors, per-sample independent, GPU-friendly
33
+ - **General matrix exponential**: Taylor series + scaling-and-squaring iteration, with data-dependent step counts and divergent control flow, difficult to tensorize, GPU-unfriendly
34
+ - **Small-matrix GEMM**: 3x3/4x4 matrices are too small to saturate Tensor Cores; value lies in "batchable and fusible" rather than "maximizing compute throughput"
35
+ - **Low-precision critical issue**: $\sin\theta/\theta$ produces division by zero as $\theta \to 0$; $\log$ is singular as $\theta \to \pi$; fp16/bf16 yields NaN directly -- **must** implement Taylor expansion switching for small angles
36
+ - **Kinematic chain seriality**: Discrete integration via successive $\exp$ multiplication is serial; rewriting as a parallel scan is required for parallelism
37
+
38
+ ## Risks and Failure Conditions
39
+
40
+ - **Low-precision singularities**: Without Taylor expansion fallbacks at $\theta \to 0/\pi$, fp16 training produces NaN directly; fallback branches introduce warp divergence
41
+ - **Mixing left and right perturbations**: Mixing $\oplus_R$ (right version / local frame) with $\oplus_L$ (left version / global frame) causes misalignment of covariances and gradients
42
+ - **Treating SE(3) as T(3)xSO(3)**: Their tangent-space parameterizations differ; whether translation and rotation are coupled affects the Jacobian, and misuse introduces systematic bias
43
+ - **Treating general matrix exp as an $O(1)$ operator**: Closed forms exist only for a few groups such as SO(3)/SE(3)/SE(2)/S1/S3; general groups require iterative series
44
+ - **Over-application**: Imposing Lie group parameterization on tasks that do not need geometric constraints merely adds complexity and singularity risk
45
+
46
+ ## Further References
47
+
48
+ - Distillation notes: references/books/micro-lie-theory.md (Section II-A Lie Group Definition, Section II-D Exponential Map, Section II-E Plus/Minus Operators)
49
+ - Distillation notes: references/books/differential-geometry.md (Ch 5 Lie Groups)
50
+ - Distillation notes: references/books/smooth-manifolds.md (Ch 7 Lie Groups)
51
+ - Original text: Joan Sola et al., *A micro Lie theory*, Section II-A through Section II-F (complete Lie group toolkit)
@@ -0,0 +1,51 @@
1
+ # 李群 (Lie Group)
2
+
3
+ ## 最小定义
4
+
5
+ 李群 $G$ 是同时具有光滑流形结构和群结构的空间,使得群乘法 $\mu: G \times G \to G$ 和求逆 $\iota: G \to G$ 都是光滑映射。它是"连续对称变换群"的精确数学对象——既是可微的空间,又是可乘的代数。
6
+
7
+ ## 核心公式
8
+
9
+ - 指数映射:$\exp: \mathfrak{g} \to G$,$\exp(\xi) = \gamma_\xi(1)$,其中 $\gamma_\xi$ 是单参数子群
10
+ - SO(3) Rodrigues 公式:$\exp([\theta]_\times) = I + \frac{\sin\|\theta\|}{\|\theta\|}[\theta]_\times + \frac{1-\cos\|\theta\|}{\|\theta\|^2}[\theta]_\times^2$
11
+ - SE(3):$\exp\begin{pmatrix} [\omega]_\times & v \\ 0 & 0 \end{pmatrix} = \begin{pmatrix} \exp([\omega]_\times) & V(\theta)v \\ 0 & 1 \end{pmatrix}$
12
+ - $\oplus/\ominus$ 算子(右版本):$X \oplus \tau = X \cdot \exp(\tau)$,$X \ominus Y = \log(Y^{-1} X)$
13
+ - 伴随映射:$\text{Ad}_X(\tau) = X \tau X^{-1}$(矩阵群),满足 $X \oplus \tau = (\text{Ad}_X \tau) \oplus X$
14
+
15
+ ## 适用问题
16
+
17
+ - 预测/回归量带几何约束:旋转、位姿、单位四元数——硬塞进欧氏 MLP 会破坏约束
18
+ - 需要等变性/不变性:输入做刚体变换,输出应协变或不变(点云、分子、多视几何)
19
+ - 状态在李群上演化:惯性预积分、运动模型、可微物理/控制
20
+ - 正交/酉约束的权重矩阵:Stiefel 流形上的优化
21
+
22
+ ## AI 设计翻译
23
+
24
+ - **流形参数化输出头**:网络在切空间 $\mathbb{R}^n$ 自由预测,经 $\exp$ 投回 SO(3)/SE(3),替代 6D/9D 旋转表示的 ad-hoc 正交化
25
+ - **流形损失函数**:用 $\ominus$(测地误差)当 loss,$L = \|X_{\text{pred}} \ominus X_{\text{gt}}\|^2$,天然处理流形拓扑
26
+ - **李群 RNN/ODE**:隐状态 $h_t \in G$,更新 $h_{t+1} = h_t \oplus f_\theta(h_t, x_t) = h_t \cdot \exp(f_\theta(h_t, x_t))$
27
+ - **正交权重约束**:$W = \exp(A)$ 其中 $A$ 反对称,保证 $W^T W = I$;或用 Cayley 变换 $W = (I-A)(I+A)^{-1}$
28
+
29
+ ## 工程可行性
30
+
31
+ GPU 友好度:关键看 exp/log 是否有闭式。
32
+ - **SO(3)/SE(3) 闭式**:Rodrigues 公式是有限项代数表达式,3x3/4x4 小矩阵,可 batched 为 $[B,3,3]$/ $[B,4,4]$ 张量,逐样本独立,GPU 友好
33
+ - **通用矩阵指数**:Taylor 级数 + scaling-and-squaring 迭代,步数数据相关、控制流发散、难张量化,GPU 不友好
34
+ - **小矩阵 GEMM**:3x3/4x4 太小,吃不满 Tensor Core,价值在"可批量、可融合"而非"打满算力"
35
+ - **低精度致命点**:$\sin\theta/\theta$ 在 $\theta \to 0$ 除零,$\theta \to \pi$ 时 log 奇异;fp16/bf16 直接 NaN,**必须** 对小角做 Taylor 展开切换
36
+ - **运动链串行**:连乘 $\exp$ 的离散积分是串行递推,需改写成 parallel scan 才能并行
37
+
38
+ ## 风险与失效条件
39
+
40
+ - **低精度奇异点**:$\theta \to 0/\pi$ 处不做 Taylor 兜底,fp16 训练直接 NaN;兜底分支又引入 warp divergence
41
+ - **左右扰动混用**:$\oplus_R$(右版本/局部坐标系)和 $\oplus_L$(左版本/全局坐标系)混用导致协方差与梯度错位
42
+ - **把 SE(3) 当成 T(3)xSO(3)**:二者切空间参数化不同,平移-旋转是否耦合改变雅可比,误用导致系统性偏差
43
+ - **通用 matrix exp 当 O(1) 算子**:闭式只属于 SO(3)/SE(3)/SE(2)/S1/S3 等少数群,一般群需迭代级数
44
+ - **过度套用**:不需要几何约束的任务硬上李群参数化,徒增复杂度与奇异点风险
45
+
46
+ ## 深入参考
47
+
48
+ - 蒸馏稿:references/books/micro-lie-theory.md(§II-A 李群定义, §II-D 指数映射, §II-E 加减算子)
49
+ - 蒸馏稿:references/books/differential-geometry.md(Ch 5 Lie Groups)
50
+ - 蒸馏稿:references/books/smooth-manifolds.md(Ch 7 Lie Groups)
51
+ - 原书:Joan Sola et al., *A micro Lie theory*, §II-A ~ §II-F(完整李群工具链)
@@ -0,0 +1,52 @@
1
+ # Representation
2
+
3
+ ## Minimal Definition
4
+
5
+ A representation of a group $G$ on a vector space $V$ is a group homomorphism $\rho: G \to GL(V)$, realizing abstract group elements as computable linear transformations (matrices). The core problem of representation theory is decomposing a complex group action into a direct sum of irreducible representations (irreps), analogous to factoring integers into primes.
6
+
7
+ ## Core Formulas
8
+
9
+ - Representation: $\rho(g_1 g_2) = \rho(g_1)\rho(g_2)$, $\rho(e) = I$
10
+ - Character: $\chi_\rho(g) = \text{tr}(\rho(g))$, a class function encoding the essential information of the representation
11
+ - Peter-Weyl theorem (compact groups): $L^2(G) \cong \bigoplus_{\pi \in \hat{G}} \dim(\pi) \cdot \pi$
12
+ - Schur's lemma: $\rho_1, \rho_2$ irreducible and inequivalent $\Rightarrow$ $\text{Hom}_G(\rho_1, \rho_2) = 0$
13
+ - Irreducible representations of SO(3): dimension $2l+1$, $l = 0,1,2,\ldots$, with spherical harmonics $Y_l^m$ as basis functions
14
+ - Clebsch-Gordan decomposition: $\rho_1 \otimes \rho_2 \cong \bigoplus_k m_k \rho_k$
15
+
16
+ ## Applicable Problems
17
+
18
+ - Signals defined on groups/spheres: require spherical harmonic expansion for frequency-domain analysis
19
+ - Constructing equivariant feature spaces: each feature channel corresponds to an irreducible representation
20
+ - Accelerating group convolutions: using the Fourier transform (irreducible representations) to convert convolution into pointwise multiplication in the frequency domain
21
+ - Molecular/crystal symmetries: representations of point groups/space groups determine orbital symmetries and selection rules
22
+
23
+ ## AI Design Translation
24
+
25
+ - **Spherical harmonic feature layer**: Expand 3D point cloud/molecular features into a spherical harmonic basis $Y_l^m$; each $(l,m)$ channel transforms according to an SO(3) irreducible representation, achieving strict rotational equivariance
26
+ - **Group Fourier transform layer**: Transform a finite group signal $f: G \to \mathbb{R}$ to the frequency domain via $\hat{f}(\pi) = \sum_g f(g)\pi(g)$, converting convolution into per-irrep matrix multiplication
27
+ - **Schur-constrained weight matrices**: Equivariant inter-layer maps $W: V_1 \to V_2$ must commute with the group action $W\rho_1(g) = \rho_2(g)W$; Schur's lemma forces $W$ to be block-diagonal/scalar, drastically reducing parameters
28
+ - **Character pooling**: Extract invariants using $\chi_\rho(g) = \text{tr}(\rho(g))$ as input features for classification/regression
29
+
30
+ ## Engineering Feasibility
31
+
32
+ GPU friendliness depends on the group size and representation dimension:
33
+ - **Finite group representations**: Each irrep is a small matrix ($d \times d$); the group Fourier transform equals a batch of small GEMMs, $O(|G| \cdot d^2)$, batchable
34
+ - **SO(3) spherical harmonic transform**: Fast algorithms exist ($O(L^2 \log L)$), but implementation is complex; the real-space to frequency-domain transform can be expressed as sparse matmul
35
+ - **Clebsch-Gordan coefficients**: Once precomputed, they are fixed sparse tensors; contraction with features can be expressed as GEMM
36
+ - **Sparsity from Schur constraints**: Weight matrices of equivariant layers are constrained to be block-diagonal/scalar, greatly reducing parameters but requiring sparse/block GEMM
37
+ - Key bottleneck: the Clebsch-Gordan tensor size grows rapidly for high-dimensional irreps (large $l$ spherical harmonics)
38
+
39
+ ## Risks and Failure Conditions
40
+
41
+ - **High-frequency spherical harmonic numerical instability**: $Y_l^m$ for large $l$ oscillates violently near the poles, causing severe precision loss under fp16
42
+ - **Irrep completeness truncation**: Keeping only up to $l_{\max}$ spherical harmonics loses high-frequency information; truncation error must be determined experimentally
43
+ - **Infinite-dimensional representations of non-compact groups**: Irreducible representations of groups such as the Lorentz group are infinite-dimensional and must be truncated in practice
44
+ - **Freedom in representation selection**: Which irreps participate and to what order are hyperparameters with no automatic selection method
45
+ - **Clebsch-Gordan tensor storage**: The number of CG coefficients grows as $O(l^3)$ with increasing $l$, increasing precomputation and storage costs
46
+
47
+ ## Further References
48
+
49
+ - Distillation notes: references/books/micro-lie-theory.md (Section II-F Adjoint $\text{Ad}_X$ and Adjoint Matrix)
50
+ - Distillation notes: references/books/differential-geometry.md (Ch 5 Lie Groups, adjoint representation section)
51
+ - Original text: Joan Sola et al., *A micro Lie theory*, Section II-F (adjoint representation, equations 30--35)
52
+ - Original text: Jeffrey M. Lee, *Manifolds and Differential Geometry*, Ch 5 (representations of Lie groups)
@@ -0,0 +1,52 @@
1
+ # 表示 (Representation)
2
+
3
+ ## 最小定义
4
+
5
+ 群 $G$ 在向量空间 $V$ 上的表示是群同态 $\rho: G \to GL(V)$,将抽象群元素实现为可计算的线性变换(矩阵)。表示论的核心问题是:把复杂的群作用分解为不可约表示(irrep)的直和,如同整数分解为素数。
6
+
7
+ ## 核心公式
8
+
9
+ - 表示:$\rho(g_1 g_2) = \rho(g_1)\rho(g_2)$,$\rho(e) = I$
10
+ - 特征标:$\chi_\rho(g) = \text{tr}(\rho(g))$,是类函数,编码表示的核心信息
11
+ - Peter-Weyl 定理(紧群):$L^2(G) \cong \bigoplus_{\pi \in \hat{G}} \dim(\pi) \cdot \pi$
12
+ - Schur 引理:$\rho_1, \rho_2$ 不可约且不等价 $\Rightarrow$ $\text{Hom}_G(\rho_1, \rho_2) = 0$
13
+ - SO(3) 的不可约表示:维数 $2l+1$,$l = 0,1,2,\ldots$,基函数为球谐函数 $Y_l^m$
14
+ - Clebsch-Gordan 分解:$\rho_1 \otimes \rho_2 \cong \bigoplus_k m_k \rho_k$
15
+
16
+ ## 适用问题
17
+
18
+ - 信号定义在群/球面上:需要用球谐展开做频域分析
19
+ - 构建等变特征空间:每个特征通道对应一个不可约表示
20
+ - 群卷积的加速:利用 Fourier 变换(不可约表示)将卷积变为频域逐点乘法
21
+ - 分子/晶体对称性:点群/空间群的表示决定轨道对称性和选择定则
22
+
23
+ ## AI 设计翻译
24
+
25
+ - **球谐特征层**:将 3D 点云/分子特征展开为球谐基 $Y_l^m$,每个 $(l,m)$ 通道按 SO(3) 不可约表示变换,实现严格旋转等变
26
+ - **群 Fourier 变换层**:有限群信号 $f: G \to \mathbb{R}$ 经 $\hat{f}(\pi) = \sum_g f(g)\pi(g)$ 变换到频域,卷积变为逐 irrep 矩阵乘
27
+ - **Schur 约束的权重矩阵**:等变层间映射 $W: V_1 \to V_2$ 必须与群作用交换 $W\rho_1(g) = \rho_2(g)W$,Schur 引理强制 $W$ 为块对角/标量,大幅减少参数
28
+ - **特征标池化**:用 $\chi_\rho(g) = \text{tr}(\rho(g))$ 提取不变量作为分类/回归的输入特征
29
+
30
+ ## 工程可行性
31
+
32
+ GPU 友好度取决于群的规模和表示维数:
33
+ - **有限群表示**:每个 irrep 是小矩阵($d \times d$),群 Fourier 变换 = 一批小 GEMM,$O(|G| \cdot d^2)$,可 batched
34
+ - **SO(3) 球谐变换**:有快速算法($O(L^2 \log L)$),但实现复杂;实空间→频域的变换可表达为稀疏 matmul
35
+ - **Clebsch-Gordan 系数**:预计算后是固定的稀疏张量,与特征的缩并可 GEMM 化
36
+ - **Schur 约束的稀疏性**:等变层的权重矩阵被约束为块对角/标量,参数大幅减少,但需要稀疏/分块 GEMM
37
+ - 关键瓶颈:高维 irrep(大 $l$ 的球谐)的 Clebsch-Gordan 张量规模增长快
38
+
39
+ ## 风险与失效条件
40
+
41
+ - **高频球谐数值不稳定**:大 $l$ 的 $Y_l^m$ 在极点附近振荡剧烈,fp16 下精度损失严重
42
+ - **irrep 完备性截断**:只取到 $l_{\max}$ 阶球谐丢失高频信息,截断误差需要实验标定
43
+ - **非紧群的表示无穷维**:Lorentz 群等的不可约表示是无穷维的,工程上必须截断
44
+ - **表示选择的自由度**:哪些 irrep 参与、阶数多少是超参数,缺乏自动选择方法
45
+ - **Clebsch-Gordan 张量的存储**:$l$ 增大时 CG 系数数量 $O(l^3)$ 增长,预计算和存储开销上升
46
+
47
+ ## 深入参考
48
+
49
+ - 蒸馏稿:references/books/micro-lie-theory.md(§II-F 伴随 Ad_X 与伴随矩阵)
50
+ - 蒸馏稿:references/books/differential-geometry.md(Ch 5 Lie Groups, 伴随表示部分)
51
+ - 原书:Joan Sola et al., *A micro Lie theory*, §II-F(伴随表示,式 30-35)
52
+ - 原书:Jeffrey M. Lee, *Manifolds and Differential Geometry*, Ch 5(李群的表示)
@@ -0,0 +1,49 @@
1
+ # Low-Rank Approximation
2
+
3
+ ## Minimal Definition
4
+
5
+ Given a matrix $A \in \mathbb{R}^{m \times n}$, find a matrix $B$ with rank at most $k$ that minimizes $\|A - B\|$. The Eckart-Young-Mirsky theorem guarantees that the truncated SVD provides the unique optimal solution under both the Frobenius norm and the spectral norm: $B_k = \sum_{i=1}^k \sigma_i u_i v_i^H$.
6
+
7
+ ## Core Formulas
8
+
9
+ - SVD: $A = U\Sigma V^H = \sum_{i=1}^r \sigma_i u_i v_i^H$, $\sigma_1 \geq \sigma_2 \geq \cdots \geq \sigma_r > 0$
10
+ - Truncated SVD (optimal rank-$k$ approximation): $A_k = U_k \Sigma_k V_k^H$
11
+ - Eckart-Young error: $\|A - A_k\|_F = \sqrt{\sum_{i=k+1}^r \sigma_i^2}$, $\|A - A_k\|_2 = \sigma_{k+1}$
12
+ - Randomized SVD: $A \approx Q(Q^HA)$, where $Q$ is the $Q$-factor from the QR decomposition of $A\Omega$ ($\Omega$ random Gaussian)
13
+ - Effective rank: $r_{\text{eff}}(A) = \|A\|_F^2 / \|A\|_2^2 = \sum \sigma_i^2 / \sigma_1^2$
14
+ - Nuclear norm (convex relaxation of rank): $\|A\|_* = \sum \sigma_i$, the dual of the spectral norm
15
+
16
+ ## Applicable Problems
17
+
18
+ - LoRA weight compression: $W \approx W_0 + BA$, $B \in \mathbb{R}^{d \times r}, A \in \mathbb{R}^{r \times d}$, $r \ll d$
19
+ - KV-Cache compression: projecting Key/Value caches into a low-dimensional subspace, reducing memory from $O(n)$ to $O(k)$
20
+ - PCA / whitening: the top $k$ principal components of the data covariance matrix correspond to the truncated SVD
21
+ - Gradient compression: the effective rank of gradient matrices in large models is often much lower than the nominal rank, allowing safe truncation
22
+ - Recommender systems / matrix completion: low-rank factorization $R \approx UV^H$
23
+
24
+ ## AI Design Translation
25
+
26
+ - **LoRA (Low-Rank Adaptation)**: Freeze $W_0$, train $\Delta W = BA$ ($r \ll d$), and merge $W = W_0 + BA$ at inference time. Forward pass = two matmul operations ($x \to Ax \to BAx$), reducing trainable parameters from $O(d^2)$ to $O(dr)$. Implemented via `torch.mm(B, torch.mm(A, x))` or merged into a single matmul.
27
+ - **Randomized SVD operator**: For a large matrix $A \in \mathbb{R}^{m \times n}$, first sample $Y = A\Omega$ ($\Omega \in \mathbb{R}^{n \times (k+p)}$ random Gaussian), compute QR decomposition $Y = QR$, then form $B = Q^HA$ (small matrix $O(k \times n)$), and perform SVD on $B$. Total complexity $O(mnk)$ instead of $O(mn^2)$; all core operations are matmul.
28
+ - **KV-Cache low-rank reduction**: Maintain $K_k = K P_k$ ($P_k$ being the projection onto the top $k$ principal components), performing incremental PCA or streaming SVD updates for each new token. Attention computation $\text{softmax}(Q K_k^H / \sqrt{d}) V_k$ involves three matmul operations, reducing the sequence dimension from $L$ to $k$.
29
+ - **Nuclear norm regularization**: $\mathcal{L} = \mathcal{L}_{\text{task}} + \lambda \|W\|_*$ promotes low-rank solutions. However, nuclear norm computation requires full SVD ($O(n^3)$). Alternatives: (1) approximate with truncated SVD; (2) factorize $\|W\|_* = \min_{W=UV^H} \frac{1}{2}(\|U\|_F^2 + \|V\|_F^2)$, converting to Frobenius regularization on $U, V$.
30
+ - **Gradient low-rank compression (distributed training)**: Truncate gradient $G$ to $G_k$ (top-$k$ SVD) before all-reduce, reducing communication from $O(d)$ to $O(kd)$. Use randomized SVD locally on each device, then merge.
31
+
32
+ ## Engineering Feasibility
33
+
34
+ - **Primary operations**: matmul + small-matrix SVD. LoRA forward = two matmul operations; randomized SVD = three matmul operations + one small QR; truncated SVD = $O(k/n)$ fraction of full SVD (using Lanczos).
35
+ - **GPU friendliness**: Extremely high. LoRA forward/backward are all tensor core matmul operations; the dominant cost of randomized SVD is also matmul. Small-matrix SVD has cuSOLVER batched implementations.
36
+ - **Complexity**: LoRA forward $O(dk)$ per sample vs. $O(d^2)$ full rank; randomized SVD $O(mnk)$; full SVD $O(\min(m^2n, mn^2))$.
37
+ - **Memory**: LoRA storage $O(dr)$ vs. $O(d^2)$; KV-Cache low-rank reduction $O(Lk)$ vs. $O(Ld)$.
38
+
39
+ ## Risks and Failure Conditions
40
+
41
+ - **Incorrect rank selection**: $k$ too small causes information loss ($\sigma_{k+1}$ is non-negligible); $k$ too large negates the compression benefit. Solution: monitor the singular value decay curve and select the elbow point where $\sum_{i>k}\sigma_i^2 / \sum\sigma_i^2 < \epsilon$.
42
+ - **Insufficient randomized SVD accuracy**: When oversampling $p$ is too small (typically $p = 5 \sim 10$) or the number of power iteration steps is insufficient, low-order singular value estimates can be significantly biased. Solution: add $q = 1 \sim 2$ power iteration steps $Y = (AA^H)^q A\Omega$, at the cost of additional matmul operations.
43
+ - **LoRA not applicable to all layers**: Q/K/V in attention is typically effectively low-rank, but the effective rank of FFN layers and embeddings may be close to full rank, and applying LoRA forcefully degrades accuracy. Layer-by-layer effective rank diagnosis is required.
44
+ - **SVD overhead of nuclear norm proximal**: Soft-thresholding $\text{prox}_{\lambda\|\cdot\|_*}(A) = U(\Sigma - \lambda I)_+ V^H$ requires SVD, which is prohibitively expensive for large matrices at every step. Solution: use factorization alternatives or randomized approximations.
45
+
46
+ ## Further References
47
+
48
+ - Distilled notes: references/books/matrix-analysis.md (Section 2.6 SVD, Section 7.4 Polar Decomposition and SVD, nuclear norm-spectral norm duality Section 5.5)
49
+ - Original text: Horn & Johnson, *Matrix Analysis* 2nd Ed., Chapter 2 Section 2.6 (SVD) + Chapter 7 Section 7.3-7.4 (Polar Decomposition & SVD)