math-skill 3.0.1 → 3.1.1
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 +72 -47
- package/README.md +40 -15
- package/agents/math-critic.en.md +6 -6
- package/agents/math-critic.md +6 -6
- package/commands/ask.en.md +6 -1
- package/commands/ask.md +6 -1
- package/design-patterns/attention/equivariant-attention.en.md +8 -2
- package/design-patterns/attention/equivariant-attention.md +7 -1
- package/design-patterns/attention/geometry-aware-attention.en.md +2 -2
- package/design-patterns/attention/geometry-aware-attention.md +1 -1
- package/design-patterns/attention/information-bottleneck-attention.en.md +32 -12
- package/design-patterns/attention/information-bottleneck-attention.md +32 -12
- package/design-patterns/attention/projection-attention.en.md +3 -3
- package/design-patterns/attention/projection-attention.md +2 -2
- package/design-patterns/attention/spectral-attention.en.md +19 -5
- package/design-patterns/attention/spectral-attention.md +18 -4
- package/design-patterns/compression/leverage-score-selection.en.md +13 -13
- package/design-patterns/compression/leverage-score-selection.md +13 -13
- package/design-patterns/compression/low-rank-kv-cache.en.md +39 -12
- package/design-patterns/compression/low-rank-kv-cache.md +38 -12
- package/design-patterns/compression/spectral-token-pruning.en.md +16 -14
- package/design-patterns/compression/spectral-token-pruning.md +16 -14
- package/design-patterns/compression/topology-preserving-compression.en.md +10 -10
- package/design-patterns/compression/topology-preserving-compression.md +10 -10
- package/design-patterns/loss/constraint-penalty.en.md +8 -4
- package/design-patterns/loss/constraint-penalty.md +9 -6
- package/design-patterns/loss/contrastive-loss.en.md +37 -11
- package/design-patterns/loss/contrastive-loss.md +38 -12
- package/design-patterns/loss/information-bottleneck-loss.en.md +5 -5
- package/design-patterns/loss/information-bottleneck-loss.md +6 -6
- package/design-patterns/loss/orthogonality-loss.en.md +24 -17
- package/design-patterns/loss/orthogonality-loss.md +24 -18
- package/design-patterns/loss/variational-loss.en.md +4 -4
- package/design-patterns/loss/variational-loss.md +5 -5
- package/design-patterns/overview.en.md +36 -0
- package/design-patterns/overview.md +36 -0
- package/design-patterns/representation/equivariant-split.en.md +4 -4
- package/design-patterns/representation/equivariant-split.md +4 -5
- package/design-patterns/representation/manifold-representation.en.md +12 -12
- package/design-patterns/representation/manifold-representation.md +13 -14
- package/design-patterns/representation/shared-private-decomposition.en.md +12 -7
- package/design-patterns/representation/shared-private-decomposition.md +12 -9
- package/design-patterns/representation/subspace-alignment.en.md +12 -12
- package/design-patterns/representation/subspace-alignment.md +12 -12
- package/design-patterns/routing/graph-routing.en.md +11 -11
- package/design-patterns/routing/graph-routing.md +11 -11
- package/design-patterns/routing/moe-routing.en.md +12 -12
- package/design-patterns/routing/moe-routing.md +12 -14
- package/design-patterns/routing/optimal-transport-routing.en.md +5 -5
- package/design-patterns/routing/optimal-transport-routing.md +6 -6
- package/design-patterns/routing/spectral-clustering-routing.en.md +26 -15
- package/design-patterns/routing/spectral-clustering-routing.md +26 -17
- package/knowledge-base/differential-geometry/connection.en.md +17 -2
- package/knowledge-base/differential-geometry/connection.md +17 -2
- package/knowledge-base/differential-geometry/curvature.en.md +14 -1
- package/knowledge-base/differential-geometry/curvature.md +14 -1
- package/knowledge-base/differential-geometry/geodesic.en.md +16 -2
- package/knowledge-base/differential-geometry/geodesic.md +16 -2
- package/knowledge-base/differential-geometry/index.en.md +52 -0
- package/knowledge-base/differential-geometry/index.md +52 -0
- package/knowledge-base/differential-geometry/manifold.en.md +15 -2
- package/knowledge-base/differential-geometry/manifold.md +15 -2
- package/knowledge-base/differential-geometry/metric-tensor.en.md +16 -2
- package/knowledge-base/differential-geometry/metric-tensor.md +16 -2
- package/knowledge-base/differential-geometry/tangent-space.en.md +17 -3
- package/knowledge-base/differential-geometry/tangent-space.md +17 -3
- package/knowledge-base/information-geometry/fisher-metric.en.md +24 -5
- package/knowledge-base/information-geometry/fisher-metric.md +24 -5
- package/knowledge-base/information-geometry/index.en.md +45 -0
- package/knowledge-base/information-geometry/index.md +45 -0
- package/knowledge-base/information-geometry/natural-gradient.en.md +17 -3
- package/knowledge-base/information-geometry/natural-gradient.md +17 -3
- package/knowledge-base/lie-theory/equivariance.en.md +18 -3
- package/knowledge-base/lie-theory/equivariance.md +18 -3
- package/knowledge-base/lie-theory/group-action.en.md +16 -2
- package/knowledge-base/lie-theory/group-action.md +16 -2
- package/knowledge-base/lie-theory/index.en.md +52 -0
- package/knowledge-base/lie-theory/index.md +52 -0
- package/knowledge-base/lie-theory/lie-algebra.en.md +17 -2
- package/knowledge-base/lie-theory/lie-algebra.md +17 -2
- package/knowledge-base/lie-theory/lie-group.en.md +17 -3
- package/knowledge-base/lie-theory/lie-group.md +17 -3
- package/knowledge-base/lie-theory/representation.en.md +17 -2
- package/knowledge-base/lie-theory/representation.md +17 -2
- package/knowledge-base/matrix-analysis/index.en.md +49 -0
- package/knowledge-base/matrix-analysis/index.md +49 -0
- package/knowledge-base/matrix-analysis/low-rank-approximation.en.md +20 -7
- package/knowledge-base/matrix-analysis/low-rank-approximation.md +20 -7
- package/knowledge-base/matrix-analysis/matrix-perturbation.en.md +13 -1
- package/knowledge-base/matrix-analysis/matrix-perturbation.md +13 -1
- package/knowledge-base/matrix-analysis/positive-semidefinite.en.md +20 -6
- package/knowledge-base/matrix-analysis/positive-semidefinite.md +20 -6
- package/knowledge-base/matrix-analysis/projection.en.md +14 -1
- package/knowledge-base/matrix-analysis/projection.md +14 -1
- package/knowledge-base/matrix-analysis/spectral-decomposition.en.md +14 -1
- package/knowledge-base/matrix-analysis/spectral-decomposition.md +14 -1
- package/knowledge-base/optimization/constrained-optimization.en.md +17 -3
- package/knowledge-base/optimization/constrained-optimization.md +17 -3
- package/knowledge-base/optimization/convex-optimization.en.md +15 -2
- package/knowledge-base/optimization/convex-optimization.md +15 -2
- package/knowledge-base/optimization/index.en.md +50 -0
- package/knowledge-base/optimization/index.md +50 -0
- package/knowledge-base/optimization/lagrangian-duality.en.md +18 -4
- package/knowledge-base/optimization/lagrangian-duality.md +18 -4
- package/knowledge-base/optimization/proximal-method.en.md +15 -1
- package/knowledge-base/optimization/proximal-method.md +15 -1
- package/knowledge-base/optimization/riemannian-optimization.en.md +18 -4
- package/knowledge-base/optimization/riemannian-optimization.md +18 -4
- package/knowledge-base/overview.en.md +20 -8
- package/knowledge-base/overview.md +20 -8
- package/knowledge-base/probability/concentration-inequality.en.md +16 -2
- package/knowledge-base/probability/concentration-inequality.md +16 -2
- package/knowledge-base/probability/entropy.en.md +19 -3
- package/knowledge-base/probability/entropy.md +18 -2
- package/knowledge-base/probability/fisher-information.en.md +17 -3
- package/knowledge-base/probability/fisher-information.md +17 -3
- package/knowledge-base/probability/index.en.md +51 -0
- package/knowledge-base/probability/index.md +51 -0
- package/knowledge-base/probability/information-bottleneck.en.md +18 -2
- package/knowledge-base/probability/information-bottleneck.md +18 -2
- package/knowledge-base/probability/kl-divergence.en.md +15 -2
- package/knowledge-base/probability/kl-divergence.md +15 -2
- package/knowledge-base/topology/euler-characteristic.en.md +15 -2
- package/knowledge-base/topology/euler-characteristic.md +15 -2
- package/knowledge-base/topology/fundamental-group.en.md +16 -2
- package/knowledge-base/topology/fundamental-group.md +16 -2
- package/knowledge-base/topology/index.en.md +48 -0
- package/knowledge-base/topology/index.md +48 -0
- package/knowledge-base/topology/persistent-homology.en.md +17 -2
- package/knowledge-base/topology/persistent-homology.md +17 -2
- package/lenses/spectral.en.md +1 -1
- package/lenses/spectral.md +1 -1
- package/lenses/topological.en.md +1 -1
- package/lenses/topological.md +1 -1
- package/package.json +6 -6
- package/references/agentic-workflow.en.md +2 -2
- package/references/books/abstract-algebra.en.md +12 -12
- package/references/books/abstract-algebra.md +9 -9
- package/references/books/algebraic-geometry-rising-sea.en.md +2 -2
- package/references/books/differential-geometry.en.md +16 -16
- package/references/books/differential-geometry.md +14 -14
- package/references/books/matrix-analysis.en.md +3 -3
- package/references/books/matrix-analysis.md +24 -24
- package/references/books/micro-lie-theory.en.md +1 -1
- package/references/books/optimization-ml.en.md +15 -15
- package/references/books/optimization-ml.md +14 -14
- package/references/books/smooth-manifolds.en.md +3 -3
- package/references/books/smooth-manifolds.md +6 -6
- package/references/gpu-friendly-math.en.md +21 -8
- package/references/gpu-friendly-math.md +19 -4
- package/references/skill-index.en.md +106 -0
- package/references/skill-index.md +106 -0
- package/skills/math-research-activator/SKILL.en.md +76 -118
- package/skills/math-research-activator/SKILL.md +69 -109
|
@@ -46,7 +46,21 @@ Low GPU friendliness. Computation of the fundamental group is inherently combina
|
|
|
46
46
|
|
|
47
47
|
## Further References
|
|
48
48
|
|
|
49
|
-
- Distillation notes: references/books/smooth-manifolds.md (Ch 17--18 De Rham Cohomology, cohomology and topological invariants)
|
|
50
|
-
- Distillation notes: references/books/algebraic-geometry-rising-sea.md (Section 18 Cech Cohomology, local gluing and global obstructions)
|
|
49
|
+
- Distillation notes: ../../references/books/smooth-manifolds.en.md (Ch 17--18 De Rham Cohomology, cohomology and topological invariants)
|
|
50
|
+
- Distillation notes: ../../references/books/algebraic-geometry-rising-sea.en.md (Section 18 Cech Cohomology, local gluing and global obstructions)
|
|
51
51
|
- Original text: John M. Lee, *Introduction to Smooth Manifolds*, Ch 17 (de Rham cohomology, the loop integral perspective)
|
|
52
52
|
- Extended reading: Hatcher, *Algebraic Topology*, Ch 1 (standard textbook treatment of the fundamental group, including the Seifert-van Kampen theorem)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
## Routing Extensions
|
|
56
|
+
- If higher-dimensional homology is needed -> `persistent-homology.en.md` (higher homology groups)
|
|
57
|
+
- If geometric structure is involved -> `../differential-geometry/curvature.md` (relationship between geometry and topology)
|
|
58
|
+
|
|
59
|
+
## Extensible Directions
|
|
60
|
+
- Covering space theory: Galois correspondence between fundamental group and coverings
|
|
61
|
+
- Van Kampen theorem: computational tool for fundamental groups
|
|
62
|
+
- Higher homotopy groups: computation and obstructions of pi_n
|
|
63
|
+
- Hurewicz theorem: relationship between homotopy and homology groups
|
|
64
|
+
- Loop space: space of all loops based at a point
|
|
65
|
+
- Braid group: algebraic structure of braids
|
|
66
|
+
- Knot group: invariants of knots
|
|
@@ -46,7 +46,21 @@ GPU 友好度低。基本群的计算本质上是组合/代数的,而非数值
|
|
|
46
46
|
|
|
47
47
|
## 深入参考
|
|
48
48
|
|
|
49
|
-
-
|
|
50
|
-
-
|
|
49
|
+
- 蒸馏稿:../../references/books/smooth-manifolds.md(Ch 17-18 De Rham Cohomology,上同调与拓扑不变量)
|
|
50
|
+
- 蒸馏稿:../../references/books/algebraic-geometry-rising-sea.md(§18 Cech Cohomology,局部黏合与全局障碍)
|
|
51
51
|
- 原书:John M. Lee, *Introduction to Smooth Manifolds*, Ch 17(de Rham 上同调,环路积分的视角)
|
|
52
52
|
- 延伸:Hatcher, *Algebraic Topology*, Ch 1(基本群的标准教材处理,含 Seifert-van Kampen 定理)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
## 路由扩展
|
|
56
|
+
- 若需要更高维同调 → `persistent-homology.md`(高阶同调群)
|
|
57
|
+
- 若涉及几何结构 → `../differential-geometry/curvature.md`(几何与拓扑的关系)
|
|
58
|
+
|
|
59
|
+
## 可扩展方向
|
|
60
|
+
- 覆叠空间理论(covering space theory):基本群与覆叠的 Galois 对应
|
|
61
|
+
- Van Kampen 定理:基本群的计算工具
|
|
62
|
+
- 高阶同伦群(higher homotopy groups):pi_n 的计算与障碍
|
|
63
|
+
- Hurewicz 定理:同伦群与同调群的关系
|
|
64
|
+
- 环路空间(loop space):基于某点的环路全体
|
|
65
|
+
- 辫群(braid group):辫子的代数结构
|
|
66
|
+
- 纽群(knot group):纽结的不变量
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Topology Activation Index
|
|
2
|
+
|
|
3
|
+
## Domain Signals
|
|
4
|
+
Activate this domain direction when the problem involves:
|
|
5
|
+
- Connectivity preservation: need to maintain or detect connectivity structure of a space
|
|
6
|
+
- Representation space tearing: latent space or representation space exhibits topological tearing
|
|
7
|
+
- Local-to-global consistency: whether local information can be consistently glued into a global structure
|
|
8
|
+
- Multimodal alignment obstruction: whether topological obstructions exist for multimodal alignment
|
|
9
|
+
- Whether compression destroys structure: whether dimensionality reduction or compression alters the topological features of data
|
|
10
|
+
|
|
11
|
+
## Core Anchors
|
|
12
|
+
- `persistent-homology.en.md` — Persistent homology
|
|
13
|
+
- `euler-characteristic.en.md` — Euler characteristic
|
|
14
|
+
- `fundamental-group.en.md` — Fundamental group
|
|
15
|
+
|
|
16
|
+
## Extended Concepts
|
|
17
|
+
When core anchors are insufficient, the following concepts may need temporary activation:
|
|
18
|
+
- simplicial complex: simplicial complexes (Vietoris-Rips, alpha complex, etc.)
|
|
19
|
+
- Cech complex: Cech complex and coverings
|
|
20
|
+
- sheaf theory (section, restriction map, gluing, Cech cohomology): sheaf theory basics and Cech cohomology
|
|
21
|
+
- covering space: covering spaces and covering maps
|
|
22
|
+
- homotopy group: higher homotopy groups
|
|
23
|
+
- CW complex: CW complexes and cell structure
|
|
24
|
+
- Morse theory: Morse theory and critical point analysis
|
|
25
|
+
- Betti numbers: Betti numbers and topological invariants
|
|
26
|
+
- topological data analysis (Mapper algorithm): topological data analysis and Mapper algorithm
|
|
27
|
+
- obstruction theory: obstruction theory
|
|
28
|
+
- classifying space: classifying spaces
|
|
29
|
+
- K-theory: K-theory
|
|
30
|
+
- cobordism: cobordism theory
|
|
31
|
+
|
|
32
|
+
## Reference Book Directions
|
|
33
|
+
- `../../references/books/smooth-manifolds.en.md`: Chapters 17-18, covering homology theory basics
|
|
34
|
+
- `../../references/books/algebraic-geometry-rising-sea.en.md`: Cech cohomology sections
|
|
35
|
+
|
|
36
|
+
## AI Translation Directions
|
|
37
|
+
- persistent homology → representation topology monitor / topological regularization loss
|
|
38
|
+
- euler characteristic → complexity metric / model selection criterion
|
|
39
|
+
- fundamental group → loop structure detection / cycle-preserving compression
|
|
40
|
+
- sheaf / gluing → cross-modal consistency loss / multi-view alignment
|
|
41
|
+
- obstruction theory → alignment failure signal / topological bottleneck detection
|
|
42
|
+
- simplicial complex → higher-order token relation graph / hypergraph attention
|
|
43
|
+
|
|
44
|
+
## Temporary Activation Rules
|
|
45
|
+
When the problem requires mathematics not in the core anchors:
|
|
46
|
+
1. First check whether extended concepts contain a match
|
|
47
|
+
2. If yes, generate a temporary knowledge card based on the lens
|
|
48
|
+
3. If no, enter the Knowledge Gap Protocol
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# 拓扑 激活索引 / Topology Activation Index
|
|
2
|
+
|
|
3
|
+
## 领域信号
|
|
4
|
+
当问题涉及以下信号时,激活本领域方向:
|
|
5
|
+
- 连通性保持:需要保持或检测空间的连通性结构
|
|
6
|
+
- 表示空间断裂:隐空间或表示空间出现拓扑断裂
|
|
7
|
+
- 局部到全局一致性:局部信息是否能一致地拼接成全局结构
|
|
8
|
+
- 多模态对齐 obstruction:多模态对齐是否存在拓扑障碍
|
|
9
|
+
- 压缩是否破坏结构:降维或压缩是否改变了数据的拓扑特征
|
|
10
|
+
|
|
11
|
+
## 核心锚点
|
|
12
|
+
- `persistent-homology.md` — 持续同调
|
|
13
|
+
- `euler-characteristic.md` — Euler 示性数
|
|
14
|
+
- `fundamental-group.md` — 基本群
|
|
15
|
+
|
|
16
|
+
## 扩展概念
|
|
17
|
+
当核心锚点不够时,以下概念可能需要临时激活:
|
|
18
|
+
- simplicial complex:单纯复形(Vietoris-Rips, alpha complex 等)
|
|
19
|
+
- Cech complex:Cech 复形与覆盖
|
|
20
|
+
- sheaf theory(section, restriction map, gluing, Cech cohomology):层论基础与 Cech 上同调
|
|
21
|
+
- covering space:覆叠空间与覆叠映射
|
|
22
|
+
- homotopy group:高阶同伦群
|
|
23
|
+
- CW complex:CW 复形与胞腔结构
|
|
24
|
+
- Morse theory:Morse 理论与临界点分析
|
|
25
|
+
- Betti numbers:Betti 数与拓扑不变量
|
|
26
|
+
- topological data analysis(Mapper algorithm):拓扑数据分析与 Mapper 算法
|
|
27
|
+
- obstruction theory:障碍理论
|
|
28
|
+
- classifying space:分类空间
|
|
29
|
+
- K-theory:K 理论
|
|
30
|
+
- cobordism:配边理论
|
|
31
|
+
|
|
32
|
+
## 参考书方向
|
|
33
|
+
- `../../references/books/smooth-manifolds.md`:第 17-18 章,覆盖同调论基础
|
|
34
|
+
- `../../references/books/algebraic-geometry-rising-sea.md`:Cech 上同调部分
|
|
35
|
+
|
|
36
|
+
## AI 翻译方向
|
|
37
|
+
- persistent homology → representation topology monitor / topological regularization loss
|
|
38
|
+
- euler characteristic → complexity metric / model selection criterion
|
|
39
|
+
- fundamental group → loop structure detection / cycle-preserving compression
|
|
40
|
+
- sheaf / gluing → cross-modal consistency loss / multi-view alignment
|
|
41
|
+
- obstruction theory → alignment failure signal / topological bottleneck detection
|
|
42
|
+
- simplicial complex → higher-order token relation graph / hypergraph attention
|
|
43
|
+
|
|
44
|
+
## 临时激活规则
|
|
45
|
+
当问题需要的数学不在核心锚点中时:
|
|
46
|
+
1. 先检查扩展概念中是否有匹配
|
|
47
|
+
2. 若有,根据透镜生成临时知识卡
|
|
48
|
+
3. 若无,进入 Knowledge Gap Protocol
|
|
@@ -48,7 +48,22 @@ Limited GPU friendliness, which is the main bottleneck for deploying persistent
|
|
|
48
48
|
|
|
49
49
|
## Further References
|
|
50
50
|
|
|
51
|
-
- Distillation notes: references/books/smooth-manifolds.md (Ch 17--18 De Rham Cohomology, conceptual origin of topological invariants)
|
|
52
|
-
- Distillation notes: references/books/algebraic-geometry-rising-sea.md (Section 18 Cech Cohomology, Section 23 Derived Functors, cohomology computations)
|
|
51
|
+
- Distillation notes: ../../references/books/smooth-manifolds.en.md (Ch 17--18 De Rham Cohomology, conceptual origin of topological invariants)
|
|
52
|
+
- Distillation notes: ../../references/books/algebraic-geometry-rising-sea.en.md (Section 18 Cech Cohomology, Section 23 Derived Functors, cohomology computations)
|
|
53
53
|
- Original text: John M. Lee, *Introduction to Smooth Manifolds*, Ch 17--18 (de Rham cohomology)
|
|
54
54
|
- Extended reading: Edelsbrunner & Harer, *Computational Topology: An Introduction* (standard textbook on persistent homology)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
## Routing Extensions
|
|
58
|
+
- If topological invariant computation is needed -> `euler-characteristic.en.md` (Euler characteristic as alternating sum of Betti numbers)
|
|
59
|
+
- If 1-dimensional topology analysis is needed -> `fundamental-group.en.md` (fundamental group captures loop structure)
|
|
60
|
+
- If used for information-preserving compression -> `../probability/information-bottleneck.md` (topology-preserving information compression)
|
|
61
|
+
|
|
62
|
+
## Extensible Directions
|
|
63
|
+
- Simplicial complex types (Cech, Vietoris-Rips, alpha): advantages and disadvantages of different constructions
|
|
64
|
+
- Sheaf theory: local-to-global consistent data structures
|
|
65
|
+
- Mapper algorithm: visualization and clustering based on persistent homology
|
|
66
|
+
- Topological data analysis (TDA): complete TDA methodology
|
|
67
|
+
- Persistence image / landscape: vectorized representations of persistence diagrams
|
|
68
|
+
- Multiparameter persistence: homology with multi-scale filtrations
|
|
69
|
+
- Zigzag persistence: persistent homology allowing bidirectional filtrations
|
|
@@ -48,7 +48,22 @@ GPU 友好度有限,是持续同调落地的主要瓶颈:
|
|
|
48
48
|
|
|
49
49
|
## 深入参考
|
|
50
50
|
|
|
51
|
-
-
|
|
52
|
-
-
|
|
51
|
+
- 蒸馏稿:../../references/books/smooth-manifolds.md(Ch 17-18 De Rham Cohomology,拓扑不变量概念来源)
|
|
52
|
+
- 蒸馏稿:../../references/books/algebraic-geometry-rising-sea.md(§18 Cech Cohomology, §23 Derived Functors,上同调计算)
|
|
53
53
|
- 原书:John M. Lee, *Introduction to Smooth Manifolds*, Ch 17-18(de Rham 上同调)
|
|
54
54
|
- 延伸:Edelsbrunner & Harer, *Computational Topology: An Introduction*(持续同调标准教材)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
## 路由扩展
|
|
58
|
+
- 若需要拓扑不变量的计算 → `euler-characteristic.md`(Euler 示性数作为 Betti 数的交替和)
|
|
59
|
+
- 若需要 1 维拓扑分析 → `fundamental-group.md`(基本群捕捉环路结构)
|
|
60
|
+
- 若用于信息保持压缩 → `../probability/information-bottleneck.md`(拓扑保持的信息压缩)
|
|
61
|
+
|
|
62
|
+
## 可扩展方向
|
|
63
|
+
- 单纯复形类型(Cech, Vietoris-Rips, alpha):不同复形构造的优缺点
|
|
64
|
+
- 层论(sheaf theory):局部到全局的一致数据结构
|
|
65
|
+
- Mapper 算法:基于持续同调的可视化与聚类
|
|
66
|
+
- 拓扑数据分析(topological data analysis):TDA 的完整方法论
|
|
67
|
+
- 持续图像/景观(persistence image / landscape):持续图的向量化表示
|
|
68
|
+
- 多参数持续(multiparameter persistence):多尺度过滤的同调
|
|
69
|
+
- zigzag 持续(zigzag persistence):允许双向过滤的持续同调
|
package/lenses/spectral.en.md
CHANGED
|
@@ -17,7 +17,7 @@ This is a "decomposer's" perspective — breaking complex linear operators (matr
|
|
|
17
17
|
## What Problems It Is Not Suited For
|
|
18
18
|
|
|
19
19
|
- Problems dominated by nonlinear effects — spectral decomposition is a linear tool
|
|
20
|
-
- Operators that are
|
|
20
|
+
- Operators that are non-diagonalizable or non-normal — Jordan form is mainly theoretical; for numerical / engineering use prefer Schur decomposition, SVD, or pseudospectral stability analysis
|
|
21
21
|
- Problems that require preserving global topological structure — spectral methods may destroy topology
|
|
22
22
|
|
|
23
23
|
## Which Knowledge Domains It Routes To
|
package/lenses/spectral.md
CHANGED
package/lenses/topological.en.md
CHANGED
|
@@ -23,7 +23,7 @@ Topology is a way of "ignoring precise measurements and focusing only on qualita
|
|
|
23
23
|
|
|
24
24
|
- `topology/persistent-homology`: Fundamental group, homology groups, Betti numbers, and cohomology — computational tools for topological invariants
|
|
25
25
|
- **tda**: Persistent homology, filtrations, and simplicial complexes — extracting topological features from data
|
|
26
|
-
- `topology/fundamental-group`:
|
|
26
|
+
- `topology/fundamental-group`: Fundamental group, loop homotopy classes, covering spaces — detecting non-contractible loops and path-connectivity structure
|
|
27
27
|
|
|
28
28
|
## What AI Designs It May Inspire
|
|
29
29
|
|
package/lenses/topological.md
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
|
|
24
24
|
- `topology/persistent-homology`:基本群、同调群、Betti 数、上同调——拓扑不变量的计算工具
|
|
25
25
|
- **tda**:持续同调、滤流、单纯复形——从数据中提取拓扑特征
|
|
26
|
-
- `topology/fundamental-group
|
|
26
|
+
- `topology/fundamental-group`:基本群、环路同伦类、覆盖空间——检测不可收缩环路与路径连通性结构
|
|
27
27
|
|
|
28
28
|
## 可能产生哪些 AI 设计
|
|
29
29
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "math-skill",
|
|
3
|
-
"version": "3.
|
|
4
|
-
"description": "面向 AI 架构创新的数学研究操作系统 v3
|
|
3
|
+
"version": "3.1.1",
|
|
4
|
+
"description": "面向 AI 架构创新的数学研究操作系统 v3.1:思想透镜 / 激活锚点 / 设计翻译原型,支持知识缺口协议与临时知识卡。Math Research OS for AI architecture design: thinking lenses + activation anchors + design translation prototypes with Knowledge Gap Protocol.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"math",
|
|
7
7
|
"mathematics",
|
|
@@ -71,10 +71,10 @@
|
|
|
71
71
|
"references/"
|
|
72
72
|
],
|
|
73
73
|
"scripts": {
|
|
74
|
-
"validate": "
|
|
75
|
-
"validate:sh": "bash tests/validate.sh",
|
|
76
|
-
"validate:win": "powershell -ExecutionPolicy Bypass -
|
|
74
|
+
"validate": "node -e \"const fs=require('fs'),cp=require('child_process');if(fs.existsSync('tests/validate.sh'))process.exit(cp.spawnSync('bash',['tests/validate.sh'],{stdio:'inherit'}).status||0);if(fs.existsSync('tests/validate.ps1'))process.exit(cp.spawnSync('powershell',['-ExecutionPolicy','Bypass','-File','tests/validate.ps1'],{stdio:'inherit'}).status||0);console.log('tests/ not available in published package');\"",
|
|
75
|
+
"validate:sh": "test -f tests/validate.sh && bash tests/validate.sh || echo 'tests/ not available in published package'",
|
|
76
|
+
"validate:win": "powershell -ExecutionPolicy Bypass -Command \"if (Test-Path tests/validate.ps1) { & tests/validate.ps1 } else { Write-Host 'tests/ not available in published package' }\"",
|
|
77
77
|
"pack": "npm pack",
|
|
78
78
|
"prepublishOnly": "npm run validate"
|
|
79
79
|
}
|
|
80
|
-
}
|
|
80
|
+
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
1. **The mathematical foundation of this AI revolution is the first time 20th-century mathematics has stepped onto the commercial computing stage** — category theory, algebraic topology, algebraic geometry. The mathematical foundations of most mainstream algorithms still largely rest on the calculus and linear algebra of 1800–1900. Activating modern mathematics in algorithm design is the most important task during the algorithm exploration phase.
|
|
9
9
|
2. **Humility**: The breadth of knowledge from the pre-training stage already surpasses any individual. **More knowledge is learned from the model than taught to it.** Letting go of the bias toward "teaching the model" usually yields better results.
|
|
10
|
-
3. **Mathematical beauty ≠ computability**: Many mathematically elegant constructs break down in the face of GPU parallelism and low-precision arithmetic errors. Every deliverable must pass the acceptance gate defined in `gpu-friendly-math.md`.
|
|
10
|
+
3. **Mathematical beauty ≠ computability**: Many mathematically elegant constructs break down in the face of GPU parallelism and low-precision arithmetic errors. Every deliverable must pass the acceptance gate defined in `gpu-friendly-math.en.md`.
|
|
11
11
|
|
|
12
12
|
## Division of Labor
|
|
13
13
|
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
|
|
29
29
|
1. **Diagnosis**: What is the algorithmic structure / bottleneck of the problem? (Do not start by piling on math tutorials.)
|
|
30
30
|
2. **Cross-domain activation**: Scan `books/*.md` for transferable modern mathematical structures, **enumerate multiple candidates** (leveraging the model's large-context advantage).
|
|
31
|
-
3. **Dual acceptance gate**: Each candidate passes two gates — (1) Mathematically correct (differentiable, self-consistent, with correctness guarantees); (2) GPU-feasible (the eight dimensions of `gpu-friendly-math.md`).
|
|
31
|
+
3. **Dual acceptance gate**: Each candidate passes two gates — (1) Mathematically correct (differentiable, self-consistent, with correctness guarantees); (2) GPU-feasible (the eight dimensions of `gpu-friendly-math.en.md`).
|
|
32
32
|
4. **Iterative tracking**: Record candidates, scores, and status in a markdown test plan, converging step by step.
|
|
33
33
|
|
|
34
34
|
## Markdown Test Plan Template / Tracking Template
|
|
@@ -51,7 +51,7 @@ Actual chapter map (grouped by topic; chapter numbers taken from the book's tabl
|
|
|
51
51
|
## Possible Algorithmic Inspirations
|
|
52
52
|
|
|
53
53
|
1. **G-equivariant layer** (source: 5, 6, 10): Implement the symmetry group G's action as permutation/rotation matrices rho(g), with weights shared along orbits, enforcing f(g x)=rho(g) f(x). In practice, for each g in G the input is transformed by rho(g) then passed through the same set of weights, and the results are aggregated -- equivalent to expanding the convolution kernel into a [\|G\|, C_out, C_in] batched GEMM, reducing independent parameters by a factor of \|G\|. Deployed models: CNN (translation), G-CNN (D_n steerable filters), DeepSets/Set Transformer (S_n), E(3)-equivariant GNN (point clouds/molecules).
|
|
54
|
-
2. **Tropical / min-plus attention and routing** (source: 12-14 ring axiom relaxation): Replace softmax's (x,)+exp with (+, min/max) min-plus matmul: score(+) = min_k(Q_ik + K_kj). Hard Top-K routing -> tropical semiring **piecewise-linear gating** (sub-differentiable -- breakpoints need LogSumExp smoothing, which recovers standard softmax; an alternative to the non-differentiable argmax). Viterbi, DTW, and shortest paths are all instances of this min-plus matmul -- see the Tropical Gating example in `../gpu-friendly-math.md` (used only for low-dimensional gating and **not on Tensor Cores** -- max/min runs on CUDA cores, while the main trunk still uses standard (x,+) GEMM).
|
|
54
|
+
2. **Tropical / min-plus attention and routing** (source: 12-14 ring axiom relaxation): Replace softmax's (x,)+exp with (+, min/max) min-plus matmul: score(+) = min_k(Q_ik + K_kj). Hard Top-K routing -> tropical semiring **piecewise-linear gating** (sub-differentiable -- breakpoints need LogSumExp smoothing, which recovers standard softmax; an alternative to the non-differentiable argmax). Viterbi, DTW, and shortest paths are all instances of this min-plus matmul -- see the Tropical Gating example in `../gpu-friendly-math.en.md` (used only for low-dimensional gating and **not on Tensor Cores** -- max/min runs on CUDA cores, while the main trunk still uses standard (x,+) GEMM).
|
|
55
55
|
3. **Permutation-invariant aggregation** (source: 9, 29): Quotienting by the S_n action yields sum/max/mean pooling -- naturally O(n) and parallel-friendly, the algebraic foundation for DeepSets rho(Sigma phi(x_i)) and GNN message passing. Burnside counting (Ch 29) can estimate "how many essentially distinct configurations exist" at design time, for predicting parameter savings and data deduplication benefits.
|
|
56
56
|
4. **Finite-field coding for Infra** (source: 22, 31): Linear codes c=mG (generator matrix G over GF(q)) for fault-tolerant storage and gradient compression, with Hamming distance providing a lower bound on error-correcting capability; Shamir secret sharing (polynomial interpolation over GF(p), recoverable from t shards) for secure aggregation in federated learning; finite-field hashing/CRC for deduplication and consistency verification. Commonality: pure int/bitwise operations, placed in pre/post-processing on data flows.
|
|
57
57
|
5. **Cyclic group representations -> Frequency-domain token mixing** (source: 4, 11): The irreducible representations of Z_n are the DFT basis, giving rise to FFT convolution (O(n log n) replacing O(n^2)), RoPE (encoding positions as SO(2) rotations, i.e., unitary representations of Z), and cyclic/relative positional encodings. The finite abelian group classification theorem (Ch 11) guarantees that any such periodic structure can be decomposed into cyclic components for FFT.
|
|
@@ -59,22 +59,22 @@ Actual chapter map (grouped by topic; chapter numbers taken from the book's tabl
|
|
|
59
59
|
|
|
60
60
|
## GPU Friendliness Warning
|
|
61
61
|
|
|
62
|
-
> The sole source for eight-dimension criteria and scoring rules: `../gpu-friendly-math.md` (Tensorization / GEMM-mappability / Complexity / Memory / Low-precision / Parallelism / Sparsity / Operator fusion). Here we give only per-dimension verdicts for the book's structures.
|
|
62
|
+
> The sole source for eight-dimension criteria and scoring rules: `../gpu-friendly-math.en.md` (Tensorization / GEMM-mappability / Complexity / Memory / Low-precision / Parallelism / Sparsity / Operator fusion). Here we give only per-dimension verdicts for the book's structures.
|
|
63
63
|
|
|
64
64
|
**Focus A: Can semiring GEMM run on Tensor Cores? -- Not by default.**
|
|
65
65
|
|
|
66
|
-
- **
|
|
67
|
-
- **
|
|
68
|
-
- **
|
|
69
|
-
- **
|
|
70
|
-
- **Adaptations (-> eight-dimension friendly)**: (1) log-sum-exp smoothing of min/max recovers (x,+) stable softmax, back on Tensor Cores; (2) confine tropical operations **to low-dimensional gating only**, keeping the main trunk on standard (x,+) GEMM (the Tropical Gating example in the reference file =
|
|
66
|
+
- **D2 GEMM-mappability ([x] unfriendly)**: Tensor Core hardware only performs (x,+) MAC (fp16/bf16/fp8 accumulated into fp32). Min-plus / max-plus uses (+, min/max), which is **not natively supported**; naive tropical GEMM degenerates to CUDA core scalar comparisons and cannot leverage Tensor Cores.
|
|
67
|
+
- **D3 Complexity ([x])**: Min-plus matrix multiplication has no Strassen-style sub-cubic speedup (equivalent to the APSP hard problem); naive O(n^3).
|
|
68
|
+
- **D5 Low-precision ([v])**: Tropical uses max/min, no exp overflow risk; numerically robust.
|
|
69
|
+
- **D8 Differentiability / Operator fusion ([~] adaptable)**: min/max is non-differentiable; requires relaxation.
|
|
70
|
+
- **Adaptations (-> eight-dimension friendly)**: (1) log-sum-exp smoothing of min/max recovers (x,+) stable softmax, back on Tensor Cores; (2) confine tropical operations **to low-dimensional gating only**, keeping the main trunk on standard (x,+) GEMM (the Tropical Gating example in the reference file = D1 [v] Tensorization / D2 [x] not Tensor Core GEMM / D3 [v] per-token gating sub-quadratic, D8 needs LogSumExp smoothing); (3) blocking -- standard GEMM within blocks, min-plus reduction between blocks.
|
|
71
71
|
|
|
72
72
|
**Focus B: Can group operations be tensorized? -- Small groups yes, large groups and exact arithmetic no.**
|
|
73
73
|
|
|
74
|
-
- **Finite group actions (
|
|
75
|
-
- **Large group enumeration (
|
|
76
|
-
- **Permutation = gather/scatter (
|
|
77
|
-
- **Finite fields / modular arithmetic (
|
|
74
|
+
- **Finite group actions (D1/D2 [v])**: Permutation matrices / dense representation matrices -> batched GEMM; G-CNN has been engineered. Orthogonal rotation/permutation matrices are numerically stable under bf16 (D5 [v]).
|
|
75
|
+
- **Large group enumeration (D3/D4 [x])**: \|S_n\|=n! explodes; explicitly enumerating group elements -> memory and compute blow up. **Adaptation**: Use only generators (Ch 26 Generators and Relations) + Cayley graphs (Ch 30) for local propagation, without materializing the entire group.
|
|
76
|
+
- **Permutation = gather/scatter (D7/D1/D8 [x])**: Implementation as irregular gather/scatter causes warp divergence. **Adaptation**: Pre-compile fixed permutation patterns into structured sparsity or dense indexing.
|
|
77
|
+
- **Finite fields / modular arithmetic (D2 [x], D1/D6 [v])**: mod p, GF(2^n), XOR, table lookups **are not floating-point MAC** and cannot use Tensor Cores, but are highly parallel on int/bitwise kernels. Conclusion: **suitable for pre/post-processing in coding/hashing, never to be placed in the training main-trunk GEMM**. Galois / exact-field arithmetic requires int, is non-differentiable, violating D8.
|
|
78
78
|
|
|
79
79
|
**Scoring conclusion**: Group equivariance (small groups, dense representations) and frequency-domain structures = mathematical beauty x GPU friendliness, can enter the main trunk; semirings, finite fields, exact Galois = require relaxation/isolation first, otherwise can only serve as auxiliary operators or offline tools.
|
|
80
80
|
|
|
@@ -96,7 +96,7 @@ Actual chapter map (grouped by topic; chapter numbers taken from the book's tabl
|
|
|
96
96
|
- **Secondary: `duality`** -- homomorphisms/isomorphisms as equivalence transformations, FFT/frequency-domain transforms to simplify problems.
|
|
97
97
|
- **Secondary: `algorithmic`** -- finite group counting (Burnside, Ch 29), coding (Ch 31), finite field enumeration (Ch 22).
|
|
98
98
|
|
|
99
|
-
Typical combination chain: First `symmetry` to identify the group and invariants in the problem -> `categorical` to extract the common algebraic structure -> `axiomatization` to verify axioms truly hold (guard against false symmetry, guard against misusing subtraction) -> `duality` to realize as a learnable linear map -> finally pass through the `../gpu-friendly-math.md` eight-dimension acceptance gate.
|
|
99
|
+
Typical combination chain: First `symmetry` to identify the group and invariants in the problem -> `categorical` to extract the common algebraic structure -> `axiomatization` to verify axioms truly hold (guard against false symmetry, guard against misusing subtraction) -> `duality` to realize as a learnable linear map -> finally pass through the `../gpu-friendly-math.en.md` eight-dimension acceptance gate.
|
|
100
100
|
|
|
101
101
|
## Anti-patterns
|
|
102
102
|
|
|
@@ -63,18 +63,18 @@
|
|
|
63
63
|
|
|
64
64
|
**焦点 A:半环 GEMM 能上 Tensor Core 吗?——默认不能。**
|
|
65
65
|
|
|
66
|
-
-
|
|
67
|
-
-
|
|
68
|
-
-
|
|
69
|
-
-
|
|
70
|
-
- **改造(→ 八维转友好)**:① log-sum-exp 软化 min/max 退回 (×,+) 稳定 softmax,重上 Tensor Core;② 把热带运算**只放在低维门控**,主干仍走标准 (×,+) GEMM(范例文件中 Tropical Gating =
|
|
66
|
+
- **D2 GEMM 可映射([x]不友好)**:Tensor Core 硬件只做 (×,+) 的 MAC(fp16/bf16/fp8 累加到 fp32)。min-plus / max-plus 用的是 (+, min/max),**非原生**,朴素 tropical GEMM 退化到 CUDA core 标量比较,吃不到 Tensor Core。
|
|
67
|
+
- **D3 复杂度([x])**:min-plus 矩阵乘没有 Strassen 式亚立方加速(等价于 APSP 难题),朴素 O(n³)。
|
|
68
|
+
- **D5 低精度([v])**:tropical 用 max/min,无 exp 上溢,反而数值稳健。
|
|
69
|
+
- **D8 可微/融合([~]可改造)**:min/max 不可微,需松弛。
|
|
70
|
+
- **改造(→ 八维转友好)**:① log-sum-exp 软化 min/max 退回 (×,+) 稳定 softmax,重上 Tensor Core;② 把热带运算**只放在低维门控**,主干仍走标准 (×,+) GEMM(范例文件中 Tropical Gating = D1[v] / D2[x] 非 Tensor Core GEMM / D3[v] 逐 token 门控亚二次,D8 需 LogSumExp 软化);③ 分块——块内标准 GEMM、块间 min-plus 归约。
|
|
71
71
|
|
|
72
72
|
**焦点 B:群操作能张量化吗?——小群能,大群和精确算术不能。**
|
|
73
73
|
|
|
74
|
-
-
|
|
75
|
-
-
|
|
76
|
-
- **置换 = gather/scatter
|
|
77
|
-
- **有限域 /
|
|
74
|
+
- **有限群作用(D1/D2 [v])**:置换矩阵 / 稠密表示矩阵 → batched GEMM,G-CNN 已工程化。正交的旋转/置换矩阵在 bf16 下数值稳定(D5 [v])。
|
|
75
|
+
- **大群枚举(D3/D4 [x])**:\|Sₙ\|=n! 爆炸,显式枚举群元素 → 显存与算力爆。**改造**:只用生成元(26 Generators and Relations)+ Cayley 图(30)做局部传播,不物化整群。
|
|
76
|
+
- **置换 = gather/scatter(D7/D1/D8 [x])**:实现为不规则 gather/scatter 会 warp divergence。**改造**:固定置换模式预编译为结构化稀疏或 dense 索引。
|
|
77
|
+
- **有限域 / 模算术(D2 [x]、D1/D6 [v])**:mod p、GF(2ⁿ)、XOR、查表**不是浮点 MAC**,吃不到 Tensor Core,但在 int/bitwise kernel 上高并行。结论:**适合放编码/哈希的前后处理,绝不放进训练主干 GEMM**。Galois/精确域算术要求 int、不可微,违反 D8。
|
|
78
78
|
|
|
79
79
|
**判分结论**:群等变(小群、稠密表示)与频域结构 = 数学美 × GPU 友好,可进主干;半环、有限域、精确 Galois = 需先松弛/隔离,否则只能当辅助算子或离线工具。
|
|
80
80
|
|
|
@@ -92,7 +92,7 @@ First the overview mapping, then detailed expansion:
|
|
|
92
92
|
|
|
93
93
|
## Possible Algorithmic Inspirations
|
|
94
94
|
|
|
95
|
-
**Tropical Sheaf Attention Trilogy** (consistent with the candidate validation examples in `../gpu-friendly-math.md`):
|
|
95
|
+
**Tropical Sheaf Attention Trilogy** (consistent with the candidate validation examples in `../gpu-friendly-math.en.md`):
|
|
96
96
|
|
|
97
97
|
1. **Tropical Gating**
|
|
98
98
|
- Replace hard Top-K routing with **piecewise-linear** scoring on the max-plus semiring.
|
|
@@ -112,7 +112,7 @@ First the overview mapping, then detailed expansion:
|
|
|
112
112
|
|
|
113
113
|
## GPU Friendliness Warning
|
|
114
114
|
|
|
115
|
-
> **Required reading and sole authority**: `../gpu-friendly-math.md`
|
|
115
|
+
> **Required reading and sole authority**: `../gpu-friendly-math.en.md`
|
|
116
116
|
> Eight-dimension scorecard: D1 Tensorization, D2 GEMM-mappability, D3 Complexity, D4 Memory/KV, D5 Low-precision stability, D6 Parallelism & communication, D7 Sparse structure, D8 Operator fusion.
|
|
117
117
|
> **Mathematical beauty != computable**; any dimension that is "unfriendly and not reformable" means elimination.
|
|
118
118
|
|
|
@@ -74,27 +74,27 @@ Each entry follows **geometric concept -> mathematical core -> AI transfer**, ma
|
|
|
74
74
|
|
|
75
75
|
## GPU Friendliness Warning
|
|
76
76
|
|
|
77
|
-
> Evaluate item by item using the **eight-dimension scorecard** from `../gpu-friendly-math.md`. The biggest pitfall in differential geometry is "inversion and materialization of metric / curvature matrices."
|
|
77
|
+
> Evaluate item by item using the **eight-dimension scorecard** from `../gpu-friendly-math.en.md`. The biggest pitfall in differential geometry is "inversion and materialization of metric / curvature matrices."
|
|
78
78
|
|
|
79
|
-
- **
|
|
79
|
+
- **D2/D3**: Inversion is the make-or-break line. Naive natural gradient requires inverting the N x N Fisher, where N is the parameter count (~10^9); O(N^3) inversion + O(N^2) memory means **immediate disqualification**.
|
|
80
80
|
- **Adaptable [v]**: **K-FAC** blocks F into a Kronecker product A (x) B, exploiting (A (x) B)^{-1} = A^{-1} (x) B^{-1}; only two small factors need inversion, and applying the preconditioner to the gradient **is a GEMM**. This is the affirmative answer to "can Kronecker factorization reduce to GEMM" -- yes, and this is the only form that can scale to a cluster.
|
|
81
|
-
- **
|
|
82
|
-
- **
|
|
83
|
-
- **
|
|
84
|
-
- **
|
|
81
|
+
- **D4**: Do not materialize the full Hessian / full curvature tensor. The Riemann curvature tensor is order 4; full materialization blows up memory. Use **Hessian-vector products (HVP)** to extract curvature information in O(N) via a single backward pass, avoiding N x N.
|
|
82
|
+
- **D5**: Fisher / metric matrices are often ill-conditioned. Inversion under bf16/fp16 catastrophically amplifies errors; **must add damping (Tikhonov, F + lambda I)** and keep inversion in fp32; otherwise it violates "low-precision stability."
|
|
83
|
+
- **D6**: Parallel transport / geodesics are serial ODEs. Integrating the connection equation along a curve is a long serial recurrence with poor parallelism; in practice, one uses **single-step retractions / closed-form parallel transport** (analytic formulas exist for specific manifolds) instead of step-by-step integration.
|
|
84
|
+
- **D1/D2**: Group convolution can be friendly, but continuous groups require caution. Discrete groups (e.g., C_n, octahedral group) admit group convolutions that expand into GEMM [v]; continuous Lie groups require discretization by sampling, and improper sampling can break equivariance + produce irregular gather/scatter (D7 Sparsity unfriendly).
|
|
85
85
|
|
|
86
86
|
**Natural gradient / K-FAC eight-dimension scorecard (worked example):**
|
|
87
87
|
|
|
88
|
-
|
|
|
88
|
+
| D | Naive Natural Gradient (full Fisher inversion) | K-FAC (Kronecker factorization) |
|
|
89
89
|
|-----------|------------------------------------------------|--------------------------------|
|
|
90
|
-
|
|
|
91
|
-
|
|
|
92
|
-
|
|
|
93
|
-
|
|
|
94
|
-
|
|
|
95
|
-
|
|
|
96
|
-
|
|
|
97
|
-
|
|
|
90
|
+
| D1 | [x] explicit large-matrix inverse | [v] batched small-matrix algebra |
|
|
91
|
+
| D2 | [x] N x N inversion, not GEMM-able | [v] A^{-1} (x) B^{-1} application = GEMM chain |
|
|
92
|
+
| D3 | [x] O(N^3) | [v] two small factors, sub-cubic |
|
|
93
|
+
| D4 | [x] materialize N x N | [v] store only two small factors |
|
|
94
|
+
| D5 | [x] ill-conditioned, needs fp64 | [~] add damping + fp32 inversion, adaptable |
|
|
95
|
+
| D6 | [~] single large inversion hard to parallelize | [v] per-layer factors independent, parallelizable |
|
|
96
|
+
| D7 | -- | [v] block-diagonal structure |
|
|
97
|
+
| D8 | [x] | [v] preconditioner can be fused into optimizer kernel |
|
|
98
98
|
|
|
99
99
|
**Conclusion**: Riemannian / information-geometric methods **become GPU-feasible only when the metric is structurally factored (Kronecker / block-diagonal / low-rank)**; exact inversion and exact parallel transport are "beautiful but incomputable" and must be adapted or eliminated.
|
|
100
100
|
|
|
@@ -106,7 +106,7 @@ Each entry follows **geometric concept -> mathematical core -> AI transfer**, ma
|
|
|
106
106
|
- **geometric**: Explicitly model parameter / data spaces as manifolds, then translate back to algorithms.
|
|
107
107
|
- **topological**: Auxiliary -- de Rham cohomology / global invariants for conservation laws and integrability diagnostics.
|
|
108
108
|
|
|
109
|
-
Recommended combination: First `symmetry` to establish the symmetry structure -> `variational` to arrive at natural gradient / Riemannian optimization -> `duality` to handle retractions -> pass through the `../gpu-friendly-math.md` acceptance gate.
|
|
109
|
+
Recommended combination: First `symmetry` to establish the symmetry structure -> `variational` to arrive at natural gradient / Riemannian optimization -> `duality` to handle retractions -> pass through the `../gpu-friendly-math.en.md` acceptance gate.
|
|
110
110
|
|
|
111
111
|
## Anti-patterns
|
|
112
112
|
|
|
@@ -76,25 +76,25 @@
|
|
|
76
76
|
|
|
77
77
|
> 用 `../gpu-friendly-math.md` 的**八维记分卡**逐项评判。微分几何最大的坑是"度量 / 曲率矩阵的求逆与物化"。
|
|
78
78
|
|
|
79
|
-
-
|
|
79
|
+
- **D2/D3**:求逆是生死线。 朴素自然梯度要算 N×N Fisher 的逆,N 是参数量(~10⁹),O(N³) 求逆 + O(N²) 显存,**直接出局**。
|
|
80
80
|
- **可改造 [v]**:**K-FAC** 把 F 分块为 Kronecker 积 A⊗B,利用 (A⊗B)⁻¹ = A⁻¹⊗B⁻¹,只需对两个小因子求逆,且预条件作用到梯度上**就是 GEMM**。这就是"能否 Kronecker 因子化为 GEMM"的肯定答案——能,且这是它唯一可上集群的形态。
|
|
81
|
-
-
|
|
82
|
-
-
|
|
83
|
-
-
|
|
84
|
-
-
|
|
81
|
+
- **D4**:不要物化全 Hessian / 全曲率张量。 Riemann 曲率张量是 4 阶,全物化爆显存。用 **Hessian-vector product(HVP)** 经一次反向以 O(N) 拿到曲率信息,避免 N×N。
|
|
82
|
+
- **D5**:Fisher / 度量矩阵常病态。 bf16/fp16 下求逆灾难性放大误差,**必须加阻尼(damping / Tikhonov,F+λI)** 并把求逆留在 fp32;否则违反"低精度稳定"。
|
|
83
|
+
- **D6**:平行移动 / 测地线是串行 ODE。 沿曲线积分联络方程是长串行递推,并行性差;工程上用**一步 retraction / 闭式平行移动**(特定流形有解析公式)替代逐步积分。
|
|
84
|
+
- **D1/D2**:群卷积可友好,但连续群要当心。 离散群(如 C_n、八面体群)的群卷积可展开成 GEMM [v];连续李群需采样离散化,采样不当会导致等变性破缺 + 不规则 gather/scatter(D7 稀疏不友好)。
|
|
85
85
|
|
|
86
86
|
**自然梯度 / K-FAC 八维记分卡(worked example):**
|
|
87
87
|
|
|
88
|
-
|
|
|
88
|
+
| D | 朴素自然梯度(全 Fisher 求逆)| K-FAC(Kronecker 因子化)|
|
|
89
89
|
|------|------------------------------|--------------------------|
|
|
90
|
-
|
|
|
91
|
-
|
|
|
92
|
-
|
|
|
93
|
-
|
|
|
94
|
-
|
|
|
95
|
-
|
|
|
96
|
-
|
|
|
97
|
-
|
|
|
90
|
+
| D1 | [x] 大矩阵显式逆 | [v] 批量小矩阵代数 |
|
|
91
|
+
| D2 | [x] N×N 求逆无法 GEMM | [v] A⁻¹⊗B⁻¹ 作用 = GEMM 链 |
|
|
92
|
+
| D3 | [x] O(N³) | [v] 两个小因子,亚立方 |
|
|
93
|
+
| D4 | [x] 物化 N×N | [v] 只存两个小因子 |
|
|
94
|
+
| D5 | [x] 病态、需 fp64 | [~] 加阻尼 + fp32 求逆可改造 |
|
|
95
|
+
| D6 | [~] 单次大求逆难并行 | [v] 各层因子独立、可并行 |
|
|
96
|
+
| D7 | — | [v] 块对角结构化 |
|
|
97
|
+
| D8 | [x] | [v] 预条件可融进优化器 kernel |
|
|
98
98
|
|
|
99
99
|
**结论**:黎曼 / 信息几何方法**只有在度量被结构化因子化(Kronecker / 块对角 / 低秩)后才 GPU 可行**;精确求逆与精确平行移动都属于"美但不可算",须改造或淘汰。
|
|
100
100
|
|
|
@@ -67,7 +67,7 @@ When "activating" this book into algorithms, these are the most frequently used
|
|
|
67
67
|
|
|
68
68
|
## Possible Algorithmic Inspirations
|
|
69
69
|
|
|
70
|
-
> Each item is tagged with the **eight-dimension touchpoint** (corresponding to the dimension numbers in `../gpu-friendly-math.md`) for direct entry into the GPU acceptance gate.
|
|
70
|
+
> Each item is tagged with the **eight-dimension touchpoint** (corresponding to the dimension numbers in `../gpu-friendly-math.en.md`) for direct entry into the GPU acceptance gate.
|
|
71
71
|
|
|
72
72
|
1. **Randomized numerical linear algebra (randomized NLA)**: using random projections + QR (Sec. 2.1) for randomized SVD, reducing the O(n^3) full decomposition to sub-quadratic, producing low-rank sketches of very large weights/activations. *Touchpoint: D2/D3 -- all GEMM, manageable complexity.*
|
|
73
73
|
2. **Low-rank attention / KV compression**: using Eckart-Young (Sec. 7.4) to guarantee truncated SVD is the optimal low-rank approximation; using the **nuclear norm (dual of spectral norm, Sec. 5.5)** as low-rank regularization, projecting the KV-Cache into a low-dimensional subspace. *Touchpoint: D2/D4 -- GEMM chains + memory compression.*
|
|
@@ -81,7 +81,7 @@ When "activating" this book into algorithms, these are the most frequently used
|
|
|
81
81
|
|
|
82
82
|
## GPU Friendliness Warning
|
|
83
83
|
|
|
84
|
-
> The scoring dimensions reference the **eight-dimension checklist** in `../gpu-friendly-math.md` (Tensorization / GEMM-mappability / Complexity / Memory / Low-precision / Parallelism / Sparsity / Operator fusion); definitions are not repeated here.
|
|
84
|
+
> The scoring dimensions reference the **eight-dimension checklist** in `../gpu-friendly-math.en.md` (Tensorization / GEMM-mappability / Complexity / Memory / Low-precision / Parallelism / Sparsity / Operator fusion); definitions are not repeated here.
|
|
85
85
|
|
|
86
86
|
**Natively friendly (math beautiful x GPU friendly):**
|
|
87
87
|
- **Truncated SVD / low-rank**: expressed as GEMM chains (D2), compressing KV-Cache/weights (D4).
|
|
@@ -98,7 +98,7 @@ When "activating" this book into algorithms, these are the most frequently used
|
|
|
98
98
|
- **Serial dependencies in QR / Cholesky (Sec. 2.1, 3.5)** -- naive implementations are long serial recurrences (violates D6), requiring blocked / communication-avoiding variants.
|
|
99
99
|
- **Serial iteration in power iteration** -- single-vector iteration has low parallelism; must be blocked (block / subspace iteration) to saturate SMs (D6).
|
|
100
100
|
|
|
101
|
-
**Reform strategies (echoing the Make-It-Computable Toolkit in `../gpu-friendly-math.md`):**
|
|
101
|
+
**Reform strategies (echoing the Make-It-Computable Toolkit in `../gpu-friendly-math.en.md`):**
|
|
102
102
|
- Full EVD/SVD -> **randomized + truncated** to reduce complexity (D3);
|
|
103
103
|
- Exact decompositions -> **blocked / GEMM-ified** to eliminate serial dependencies (D2/D6);
|
|
104
104
|
- Ill-conditioned/non-normal -> **reparameterization + spectral normalization** to stabilize low precision (D5);
|