math-skill 3.2.0 → 3.3.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 +74 -39
- package/README.md +81 -46
- package/SKILL.en.md +122 -0
- package/SKILL.md +122 -0
- package/agents/math-critic.en.md +32 -18
- package/agents/math-critic.md +33 -18
- package/commands/ask.en.md +3 -2
- package/commands/ask.md +3 -2
- package/design-patterns/compression/low-rank-kv-cache.en.md +1 -0
- package/design-patterns/loss/orthogonality-loss.en.md +7 -7
- package/design-patterns/loss/orthogonality-loss.md +7 -7
- package/knowledge-base/algebraic-geometry/grassmannian-plucker.en.md +71 -0
- package/knowledge-base/algebraic-geometry/grassmannian-plucker.md +71 -0
- package/knowledge-base/algebraic-geometry/index.en.md +47 -0
- package/knowledge-base/algebraic-geometry/index.md +47 -0
- package/knowledge-base/algebraic-geometry/sheaf-cohomology.en.md +72 -0
- package/knowledge-base/algebraic-geometry/sheaf-cohomology.md +72 -0
- package/knowledge-base/cryptography/attack-game-framework.en.md +56 -0
- package/knowledge-base/cryptography/attack-game-framework.md +56 -0
- package/knowledge-base/cryptography/cca-cpa-ae-hierarchy.en.md +57 -0
- package/knowledge-base/cryptography/cca-cpa-ae-hierarchy.md +57 -0
- package/knowledge-base/cryptography/index.en.md +54 -0
- package/knowledge-base/cryptography/index.md +54 -0
- package/knowledge-base/cryptography/prf-prg-owf.en.md +62 -0
- package/knowledge-base/cryptography/prf-prg-owf.md +62 -0
- package/knowledge-base/cryptography/reduction-proof-template.en.md +60 -0
- package/knowledge-base/cryptography/reduction-proof-template.md +60 -0
- package/knowledge-base/matrix-analysis/low-rank-approximation.en.md +2 -2
- package/knowledge-base/matrix-analysis/low-rank-approximation.md +2 -2
- package/knowledge-base/matrix-analysis/projection.en.md +11 -12
- package/knowledge-base/matrix-analysis/projection.md +11 -12
- package/knowledge-base/overview.en.md +8 -4
- package/knowledge-base/overview.md +8 -4
- package/knowledge-base/probability/kl-divergence.en.md +6 -6
- package/knowledge-base/probability/kl-divergence.md +6 -6
- package/package.json +8 -35
- package/references/agentic-workflow.en.md +2 -2
- package/references/agentic-workflow.md +2 -2
- package/references/books/abstract-algebra.en.md +18 -29
- package/references/books/abstract-algebra.md +18 -29
- package/references/books/algebraic-geometry-rising-sea.en.md +1 -1
- package/references/books/algebraic-geometry-rising-sea.md +2 -2
- package/references/books/applied-cryptography.en.md +112 -0
- package/references/books/applied-cryptography.md +18 -19
- package/references/books/differential-geometry.md +1 -1
- package/references/books/foundations-of-cryptography.en.md +112 -0
- package/references/books/foundations-of-cryptography.md +20 -20
- package/references/books/introduction-to-modern-cryptography.en.md +130 -0
- package/references/books/introduction-to-modern-cryptography.md +21 -21
- package/references/books/micro-lie-theory.en.md +1 -1
- package/references/books/micro-lie-theory.md +1 -1
- package/references/books/smooth-manifolds.en.md +1 -1
- package/references/books/smooth-manifolds.md +1 -1
- package/references/gpu-friendly-math.en.md +8 -8
- package/references/gpu-friendly-math.md +8 -8
- package/references/inspiration.en.md +8 -84
- package/references/inspiration.md +8 -84
- package/references/musings.en.md +87 -0
- package/references/musings.md +87 -0
- package/references/skill-index.en.md +32 -22
- package/references/skill-index.md +29 -19
- package/skills/math-research-activator/SKILL.en.md +4 -193
- package/skills/math-research-activator/SKILL.md +4 -214
- package/skills/math-research-activator/original-texts.en.md +6 -4
- package/skills/math-research-activator/original-texts.md +2 -0
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
|
|
23
23
|
## 量化检查清单
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
只评估与候选和部署目标有关的维度;不适用项标 `N/A`。对会改变决策的维度,应填写具体数值而非只给标签:
|
|
26
26
|
|
|
27
27
|
| 维度 | 需回答的量化问题 |
|
|
28
28
|
|------|----------------|
|
|
@@ -46,24 +46,24 @@
|
|
|
46
46
|
|
|
47
47
|
## 八维检查 / The 8-Dimension Scorecard
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
对候选结构评 `友好 / 可改造 / 不友好 / N/A`。先写 shape、baseline 与部署约束,再选相关维度;不要为了凑八项把 KV-Cache、稀疏或通信强加给普通标量 loss。
|
|
50
50
|
|
|
51
51
|
| # | 维度 | 关键问题 | 友好 [v] | 不友好 [x] |
|
|
52
52
|
|---|------|---------|--------|----------|
|
|
53
53
|
| 1 | **张量化 / Tensorization** | 能否表达为稠密张量运算,避免逐元素不规则控制流? | 批量张量代数 | 标量循环、数据相关分支 |
|
|
54
|
-
| 2 | **GEMM 可映射 / GEMM mappability** |
|
|
55
|
-
| 3 | **复杂度 / Complexity** |
|
|
54
|
+
| 2 | **GEMM 可映射 / GEMM mappability** | 能否落到矩阵乘 / batched GEMM / 卷积?shape 是否足以高效利用硬件? | 大而规则的 GEMM 或成熟库算子 | 不规则运算;或虽是 GEMM 但过小、受 launch 限制 |
|
|
55
|
+
| 3 | **复杂度 / Complexity** | 前向/反向相对 baseline 的 FLOPs 和扩展率如何? | 满足目标规模与延迟/吞吐预算 | 超出部署预算或产生不可接受的扩展瓶颈 |
|
|
56
56
|
| 4 | **显存与 KV-Cache / Memory** | 峰值显存、激活/状态/KV 占用;能否压缩? | 低秩/量化/块摘要可压 | 必须物化巨大中间张量 |
|
|
57
57
|
| 5 | **低精度稳定 / Low-precision** | fp16/bf16/fp8 下是否稳定、可确定性复现? | 动态范围可控、数值稳健 | 灾难性抵消、病态、需 fp64 |
|
|
58
58
|
| 6 | **并行与通信 / Parallelism** | 能否跨 SM/设备并行?通信 vs 计算、能否 overlap? | 高并行、通信可 overlap | 长串行递推、通信瓶颈 |
|
|
59
59
|
| 7 | **稀疏结构 / Sparsity** | 是结构化还是非结构化稀疏? | 块/带状结构化稀疏 | 随机 gather/scatter |
|
|
60
60
|
| 8 | **算子融合 / Kernel fusion** | 能否融合、避免物化大中间量(FlashAttention 式)? | 可融合、可重计算 | 频繁小 kernel、发散控制流 |
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
**评分结论**:先区分硬约束与优化项。若候选违反任务的硬约束且不可改造,则淘汰;否则报告主要瓶颈与验证计划。`N/A` 不计分,GEMM 可写性也不等于实际高性能。
|
|
63
63
|
|
|
64
64
|
## 常见「美但不可算」反模式 / Anti-Patterns
|
|
65
65
|
|
|
66
|
-
-
|
|
66
|
+
- **无视目标规模的稠密全局算子**:$O(n^2)$ 并非自动不可行,但长上下文下物化 $n\times n$ 张量常超预算;必须与 baseline、目标 $n$ 和融合实现比较。
|
|
67
67
|
- **非结构化稀疏 / 不规则图遍历**:随机访存毁掉访存局部性。
|
|
68
68
|
- **高精度依赖**:病态问题,需 fp64 才正确(绝大多数训练只有 bf16/fp16/fp8)。
|
|
69
69
|
- **串行递推**:长程依赖无法并行(朴素 RNN 式)。
|
|
@@ -87,9 +87,9 @@
|
|
|
87
87
|
|
|
88
88
|
| 组件 | 数学来源 | GPU 友好性 |
|
|
89
89
|
|------|---------|-----------|
|
|
90
|
-
| 热带门控 Tropical Gating | 热带半环分段线性 |
|
|
90
|
+
| 热带门控 Tropical Gating | 热带半环分段线性 | 逐元素 max-plus 门控可张量化但不等于 GEMM;完整 min-plus 矩阵乘的复杂度与 APSP 类问题紧密相关。折点处只具次梯度,LogSumExp 是一种平滑近似但会改变原算子 |
|
|
91
91
|
| 胞腔层扩散 Cellular Sheaf Diffusion | 代数几何/拓扑(层、限制映射)| 每边低秩线性变换 = 小 GEMM(D2/D4)|
|
|
92
|
-
| Čech
|
|
92
|
+
| Čech 上同调候选正则 | 代数拓扑(一阶上同调 $H^1$)| 未验证:构复形与求同调可能昂贵;“可作幻觉判据”只是研究假说,需先定义可计算代理、复杂度和有效性实验 |
|
|
93
93
|
| 低秩基底 KV 压缩(Plücker/Grassmannian 视角) | 射影几何 | 存基底而非 Plücker 坐标(后者低秩时反扩张);块摘要候选,压缩率/误差/吞吐需实测(D4)|
|
|
94
94
|
|
|
95
95
|
使用时不要把上表当作已验证结论。正确做法是把每个组件写进 testplan:证明或估计复杂度,测峰值显存和吞吐,检查 bf16/fp8 稳定性,确认能否落到 GEMM / batched GEMM / fused kernel。只有实测和推导都通过后,才标为 "math beautiful × GPU friendly"。
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Inspiration
|
|
2
2
|
|
|
3
|
-
> Mathematics is more than a computational tool — it is a way of thinking.
|
|
3
|
+
> Mathematics is more than a computational tool — it is a way of thinking. This file records the technical inspiration of math-skill — the cross-domain activation value of mathematical tools far exceeding their original intent. For philosophical and life reflections (split in v3.2.1), see `musings.en.md`.
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -22,92 +22,16 @@ Mathematical thinking works the same way — you may learn it to review a paper
|
|
|
22
22
|
|
|
23
23
|
---
|
|
24
24
|
|
|
25
|
-
##
|
|
25
|
+
## Connection to This Project
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
The inspiration for this project stems precisely from this insight:
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
**The value of mathematical tools far exceeds their original intent** — Sophus Lie's dragon-slaying blade story teaches us that a tool invented for solving differential equations ultimately became the universal language for describing symmetry. This is the core idea behind math-skill's "thinking lenses" and "activation anchors": every mathematical concept carries transferable value far beyond its original application domain. The skill's job is to guide the activation of such cross-domain transfer, not to fixate on specific application scenarios.
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
> After the v3.2.1 design philosophy refinement, this idea is made explicit: knowledge-base/ anchors describe mathematical structures themselves (manifolds, spectra, sheaf cohomology, etc.), not specific AI architectures; design-patterns/ is translation-prototype demonstration, not a template library. This is exactly what the "dragon-slaying blade" story reflects in the skill's positioning — **the true value of a tool lies in cross-domain activation, not in being fixated on a single application**.
|
|
32
32
|
|
|
33
|
-
The
|
|
34
|
-
|
|
35
|
-
### Initial Point and Resource Constraints
|
|
36
|
-
|
|
37
|
-
$x_0$ is your origin, talent, and starting point.
|
|
38
|
-
|
|
39
|
-
Constraint conditions: time, money, health, social rules… These are like the constraints $g(x) \leq 0$ in an optimization problem, delineating the feasible region.
|
|
40
|
-
|
|
41
|
-
### Step Size and Direction: Everyday Decisions
|
|
42
|
-
|
|
43
|
-
**Direction**: The direction you choose to invest effort — career, relationships, fields of study.
|
|
44
|
-
|
|
45
|
-
**Step size**: The intensity and time you devote to a given direction.
|
|
46
|
-
|
|
47
|
-
Precision requirement: if every step only pursues immediate returns (e.g., short-term profit maximization), you may fall into a "local optimum" trap — for example, a high-paying but meaningless job, or a busy but stagnant life.
|
|
48
|
-
|
|
49
|
-
### Local Optimum vs. Global Optimum
|
|
50
|
-
|
|
51
|
-
This is the core dilemma of "life optimization":
|
|
52
|
-
|
|
53
|
-
- **Local optimum**: The seemingly best choice within your city, industry, and social circle.
|
|
54
|
-
- **Global optimum**: Perhaps in another country, another field, or another lifestyle, there exists a life that better aligns with your true nature. But you cannot foresee the global landscape, just as an optimization algorithm can only access local information at its current position.
|
|
55
|
-
|
|
56
|
-
### Randomness and Noise
|
|
57
|
-
|
|
58
|
-
Life is not a smooth numerical function — it is full of random noise:
|
|
59
|
-
|
|
60
|
-
Luck, opportunities, unexpected events… These are equivalent to stochastic perturbations $f(x) + \epsilon$ on the objective function.
|
|
61
|
-
|
|
62
|
-
Therefore, pursuing excessive precision is often uneconomical; what you need is **robustness and adaptability**.
|
|
63
|
-
|
|
64
|
-
### The Exploration–Exploitation Trade-off
|
|
65
|
-
|
|
66
|
-
This is the fundamental tension of life:
|
|
67
|
-
|
|
68
|
-
- **Exploration**: Trying new fields, new relationships, new knowledge — risky, but potentially discovering an entirely new "basin of attraction."
|
|
69
|
-
- **Exploitation**: Deepening your current domain to harvest stable returns.
|
|
70
|
-
|
|
71
|
-
Explore more when young, exploit more in middle age? But the rule is not fixed.
|
|
72
|
-
|
|
73
|
-
### Dynamic Objectives and Lifelong Learning
|
|
74
|
-
|
|
75
|
-
Life goals change: passion at 20, meaning at 40, legacy at 60…
|
|
76
|
-
|
|
77
|
-
This means the objective function $f(x)$ itself is constantly evolving. Therefore, "optimizing yourself" is more important than "optimizing a fixed target" — this is **meta-optimization** (learning how to learn, adapting how to adapt).
|
|
78
|
-
|
|
79
|
-
### Algorithm Choice: Your Life Strategy
|
|
80
|
-
|
|
81
|
-
| Algorithm | Life Strategy |
|
|
82
|
-
|-----------|--------------|
|
|
83
|
-
| Gradient Descent | Follow the most pressing direction at each step (salary, social pressure) |
|
|
84
|
-
| Momentum | Maintain historical inertia (persist in long-term goals, resist short-term fluctuations) |
|
|
85
|
-
| Stochastic Gradient Descent | Accept mini-batch random samples, adjust flexibly |
|
|
86
|
-
| Evolutionary Algorithms | Try multiple life paths, discard ineffective strategies, retain effective patterns |
|
|
87
|
-
|
|
88
|
-
No single algorithm is universally best; what matters is knowing which strategy you are using and adjusting it at the right time.
|
|
89
|
-
|
|
90
|
-
### The Most Important Insight
|
|
91
|
-
|
|
92
|
-
In mathematical optimization, we assume a global optimum $x^*$ exists. But in life, there may be no "absolutely optimal life" at all.
|
|
93
|
-
|
|
94
|
-
We are merely "participants" in our own lives, searching for a satisfactory solution and striving to make the process full of learning, growth, and meaning.
|
|
95
|
-
|
|
96
|
-
What matters is not finding the legendary "global optimum," but rather, at each iteration:
|
|
97
|
-
|
|
98
|
-
- Keeping the general direction roughly correct
|
|
99
|
-
- Balancing exploration and exploitation
|
|
100
|
-
- Accepting noise and constraints
|
|
101
|
-
- Allowing the objective function to evolve gracefully as experience grows
|
|
102
|
-
|
|
103
|
-
**The process itself is the meaning; optimization is life.**
|
|
33
|
+
> The philosophical and life reflection part ("Life as an Optimization Problem," etc.) has been moved to `musings.en.md`, separated from the skill's rigorous technical core.
|
|
104
34
|
|
|
105
35
|
---
|
|
106
36
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
The inspiration for this project stems precisely from these two insights:
|
|
110
|
-
|
|
111
|
-
1. **The value of mathematical tools far exceeds their original intent** — Sophus Lie's dragon-slaying blade story teaches us that a tool invented for solving differential equations ultimately became the universal language for describing symmetry. This is the core idea behind "thinking lenses": every mathematical concept carries transferable value far beyond its original application domain.
|
|
112
|
-
|
|
113
|
-
2. **Mathematics is a lens for understanding life** — Optimization theory is not just about algorithms; it is a framework for understanding the structure of life decisions. When you transfer the "exploration–exploitation trade-off" from reinforcement learning to career choices, or the "local optimum trap" from convex optimization to everyday decisions, mathematics steps off the blackboard and into daily life.
|
|
37
|
+
> **The "Life as an Optimization Problem" section below has been moved to `musings.en.md`.** For philosophical reflections, see `musings.en.md`.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
> **语言路由**:若用户消息为英文,请读取并遵循同目录下的 `inspiration.en.md`。
|
|
2
2
|
|
|
3
|
-
#
|
|
3
|
+
# 灵感来源 / Inspiration
|
|
4
4
|
|
|
5
|
-
>
|
|
5
|
+
> 数学不只是一种计算工具,更是一种思想方法。本文件记录 math-skill 的技术灵感来源——数学工具远超初衷的跨领域激活价值。哲学与人生感悟部分(v3.2.1 拆分)见 `musings.md`。
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -24,92 +24,16 @@ Sophus Lie 是一个想打造一把**屠龙刀**(解通微分方程)的铁
|
|
|
24
24
|
|
|
25
25
|
---
|
|
26
26
|
|
|
27
|
-
##
|
|
27
|
+
## 与本项目的联系
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
本项目的灵感来源,正是这段感悟:
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
**数学工具的价值远超初衷** —— Sophus Lie 的屠龙刀故事告诉我们,一个为解微分方程而发明的工具,最终成为描述对称性的通用语言。这正是 math-skill "思想透镜"与"激活锚点"的核心理念:每个数学思想方法都有远超其原始应用场景的迁移价值,skill 的工作是引导激活这种跨域迁移,而不是固化具体应用场景。
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
> v3.2.1 设计哲学修正后,这一理念进一步明确:knowledge-base/ 锚点描述数学结构本身(流形、谱、层上同调等),不固化具体 AI 架构;design-patterns/ 是翻译范式示范,不是模板库。这正是"屠龙刀"故事在 skill 定位上的体现——**工具的真正价值在跨域激活,而非固化为某一种应用**。
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
### 初始点与资源约束
|
|
38
|
-
|
|
39
|
-
$x_0$ 是你的出身、天赋、起点。
|
|
40
|
-
|
|
41
|
-
约束条件:时间、金钱、健康、社会规则……这些像优化问题中的约束 $g(x) \leq 0$,限定了可行域。
|
|
42
|
-
|
|
43
|
-
### 步长与方向:日常决策
|
|
44
|
-
|
|
45
|
-
**方向**:你选择努力的方向——职业、关系、学习领域。
|
|
46
|
-
|
|
47
|
-
**步长**:你在某个方向上投入的强度和时间。
|
|
48
|
-
|
|
49
|
-
精确度要求:如果每一步都只追求眼前收益(比如短期利益最大化),可能会陷入"局部最优"的人生陷阱——例如高薪但无意义的工作,忙碌但无成长的生活。
|
|
50
|
-
|
|
51
|
-
### 局部最优 vs 全局最优
|
|
52
|
-
|
|
53
|
-
这是"人生最优化"的核心困境:
|
|
54
|
-
|
|
55
|
-
- **局部最优**:你所在的城市、行业、社交圈中看似最好的选择。
|
|
56
|
-
- **全局最优**:也许在另一个国家、另一个领域、另一种生活方式里,有更契合你本质的人生。但你无法预知全局,就像优化算法只能看到当前位置的局部信息。
|
|
57
|
-
|
|
58
|
-
### 随机性与噪声
|
|
59
|
-
|
|
60
|
-
人生不是平滑的数字函数,而是充满随机噪声:
|
|
61
|
-
|
|
62
|
-
运气、机遇、意外事件……相当于目标函数有随机扰动 $f(x) + \epsilon$。
|
|
63
|
-
|
|
64
|
-
因此,过分追求精确化往往不经济,你需要的是**鲁棒性和适应力**。
|
|
65
|
-
|
|
66
|
-
### 探索与利用的权衡
|
|
67
|
-
|
|
68
|
-
这是人生的根本张力:
|
|
69
|
-
|
|
70
|
-
- **探索**:尝试新领域、新关系、新知识,可能失败,但可能发现全新的"磁场"。
|
|
71
|
-
- **利用**:深耕现有领域,获取稳定收益。
|
|
72
|
-
|
|
73
|
-
年轻时多探索,中年后多利用?但规则并非固定。
|
|
74
|
-
|
|
75
|
-
### 动态目标与终身学习
|
|
76
|
-
|
|
77
|
-
人生目标会变:20 岁追求激情,40 岁追求意义,60 岁追求传承……
|
|
78
|
-
|
|
79
|
-
这意味着目标函数 $f(x)$ 本身在不断变化。因此,"优化自己"比"优化某个固定目标"更重要——也就是**元优化**(学习如何学习,调整如何调整)。
|
|
80
|
-
|
|
81
|
-
### 算法选择:你的人生策略
|
|
82
|
-
|
|
83
|
-
| 算法 | 人生策略 |
|
|
84
|
-
|------|---------|
|
|
85
|
-
| 梯度下降 | 跟随当前最迫切的方向(薪资、社会压力)一步步走 |
|
|
86
|
-
| 动量法 | 保持一定的历史惯性(坚持长期目标,抵抗短期波动) |
|
|
87
|
-
| 随机梯度下降 | 接受小批量随机样本,灵活调整 |
|
|
88
|
-
| 进化算法 | 尝试多种人生路径,淘汰无效策略,保留有效模式 |
|
|
89
|
-
|
|
90
|
-
没有一种算法绝对最好,重要的是知道自己在用什么策略,并适时调整。
|
|
91
|
-
|
|
92
|
-
### 最重要的启示
|
|
93
|
-
|
|
94
|
-
数学优化中,我们假设存在一个全局最优解 $x^*$。但在人生中,可能根本不存在一个"绝对最优的人生"。
|
|
95
|
-
|
|
96
|
-
我们只是生活的"局中人",寻找一个满意解,并努力让这个过程充满学习、成长和意义。
|
|
97
|
-
|
|
98
|
-
重要的不是找到那个传说中的"全局最优",而是在每一步迭代中:
|
|
99
|
-
|
|
100
|
-
- 保持方向的大致正确
|
|
101
|
-
- 在探索与利用间平衡
|
|
102
|
-
- 接受噪声与约束
|
|
103
|
-
- 允许目标函数随着阅历增长而优雅地演变
|
|
104
|
-
|
|
105
|
-
**过程即意义,优化本身就是生活。**
|
|
35
|
+
> 哲学与人生感悟部分("人生就是一场最优化"等)已移至 `musings.md`,与 skill 的严谨技术核心分离。
|
|
106
36
|
|
|
107
37
|
---
|
|
108
38
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
本项目的灵感来源,正是这两段感悟:
|
|
112
|
-
|
|
113
|
-
1. **数学工具的价值远超初衷** —— Sophus Lie 的屠龙刀故事告诉我们,一个为解微分方程而发明的工具,最终成为描述对称性的通用语言。这正是"思想透镜"的核心理念:每个数学思想方法,都有远超其原始应用场景的迁移价值。
|
|
114
|
-
|
|
115
|
-
2. **数学是理解生活的透镜** —— 最优化理论不只是算法,它还是一种理解人生决策结构的方式。当你把"探索与利用的权衡"从强化学习迁移到职业选择,把"局部最优陷阱"从凸优化迁移到生活决策,数学就从黑板走进了日常。
|
|
39
|
+
> **以下"人生就是一场最优化"部分已移至 `musings.md`**。如需查阅哲学感悟,请见 `musings.md`。
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
> **Language Routing**: If the user's message is in English, please read and follow `musings.en.md` in the same directory.
|
|
2
|
+
|
|
3
|
+
# Musings: Mathematics and Life
|
|
4
|
+
|
|
5
|
+
> This file was split from `inspiration.en.md` (v3.2.1) and preserves the philosophical reflections on mathematics and life. These contents are **not part of the skill's core mechanism** — the Domain Router will not auto-load this file — it is referenced only when the user explicitly seeks inspiration or philosophical reflection. The skill's rigorous technical core lives in `inspiration.en.md` and the anchor cards.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Life as an Optimization
|
|
10
|
+
|
|
11
|
+
If you treat a person as a high-dimensional, non-linear, dynamic optimization problem with a shifting objective function, you find a striking philosophical resonance between optimization theory and the path of life.
|
|
12
|
+
|
|
13
|
+
### Objective Function: What Do You "Optimize" For?
|
|
14
|
+
|
|
15
|
+
In mathematics, we first define the objective function $f(x)$. In life, this is the value you pursue: happiness, achievement, meaning, wealth, balance...
|
|
16
|
+
|
|
17
|
+
The difficulty: life goals are often **multi-objective, fuzzy, time-varying, and even mutually conflicting**.
|
|
18
|
+
|
|
19
|
+
### Initial Point and Resource Constraints
|
|
20
|
+
|
|
21
|
+
$x_0$ is your origin, talent, starting point.
|
|
22
|
+
|
|
23
|
+
Constraints: time, money, health, social rules... these are like the constraints $g(x) \le 0$ in optimization problems, defining the feasible region.
|
|
24
|
+
|
|
25
|
+
### Step Size and Direction: Daily Decisions
|
|
26
|
+
|
|
27
|
+
**Direction**: the direction you choose to exert effort — career, relationships, learning domains.
|
|
28
|
+
|
|
29
|
+
**Step size**: the intensity and time you invest in a direction.
|
|
30
|
+
|
|
31
|
+
Precision requirement: if every step only pursues immediate gains (e.g., short-term profit maximization), you may fall into the "local optimum" trap of life — such as high-paying but meaningless work, busy but growthless living.
|
|
32
|
+
|
|
33
|
+
### Local Optimum vs Global Optimum
|
|
34
|
+
|
|
35
|
+
This is the core dilemma of "life optimization":
|
|
36
|
+
|
|
37
|
+
- **Local optimum**: the seemingly best choice in your current city, industry, social circle.
|
|
38
|
+
- **Global optimum**: perhaps in another country, another field, another lifestyle, there is a life more aligned with your essence. But you cannot know the global picture, just as optimization algorithms only see local information at the current position.
|
|
39
|
+
|
|
40
|
+
### Randomness and Noise
|
|
41
|
+
|
|
42
|
+
Life is not a smooth numerical function but full of random noise:
|
|
43
|
+
|
|
44
|
+
Luck, opportunity, accidents... equivalent to the objective function having random perturbation $f(x) + \epsilon$.
|
|
45
|
+
|
|
46
|
+
Therefore, excessive pursuit of precision is often uneconomical; what you need is **robustness and adaptability**.
|
|
47
|
+
|
|
48
|
+
### Exploration vs Exploitation Trade-off
|
|
49
|
+
|
|
50
|
+
This is the fundamental tension in life:
|
|
51
|
+
|
|
52
|
+
- **Exploration**: trying new fields, new relationships, new knowledge, possibly failing, but possibly discovering entirely new "fields."
|
|
53
|
+
- **Exploitation**: deepening existing fields for stable gains.
|
|
54
|
+
|
|
55
|
+
More exploration when young, more exploitation in midlife? But the rules are not fixed.
|
|
56
|
+
|
|
57
|
+
### Dynamic Objectives and Lifelong Learning
|
|
58
|
+
|
|
59
|
+
Life goals change: passion at 20, meaning at 40, legacy at 60...
|
|
60
|
+
|
|
61
|
+
This means the objective function $f(x)$ itself is constantly changing. Therefore, "optimizing yourself" is more important than "optimizing a fixed objective" — that is, **meta-optimization** (learning how to learn, adjusting how to adjust).
|
|
62
|
+
|
|
63
|
+
### Algorithm Choice: Your Life Strategy
|
|
64
|
+
|
|
65
|
+
| Algorithm | Life Strategy |
|
|
66
|
+
|-----------|---------------|
|
|
67
|
+
| Gradient descent | Follow the most pressing direction (salary, social pressure) step by step |
|
|
68
|
+
| Momentum | Maintain historical inertia (persist in long-term goals, resist short-term fluctuations) |
|
|
69
|
+
| Stochastic gradient descent | Accept small-batch random samples, flexibly adjust |
|
|
70
|
+
| Evolutionary algorithm | Try multiple life paths, eliminate ineffective strategies, retain effective patterns |
|
|
71
|
+
|
|
72
|
+
No algorithm is absolutely best; what matters is knowing which strategy you're using and adjusting in time.
|
|
73
|
+
|
|
74
|
+
### The Most Important Insight
|
|
75
|
+
|
|
76
|
+
In mathematical optimization, we assume the existence of a global optimum $x^*$. But in life, there may be no "absolutely optimal life."
|
|
77
|
+
|
|
78
|
+
We are merely "players" in life, seeking a satisfying solution and striving to make the process full of learning, growth, and meaning.
|
|
79
|
+
|
|
80
|
+
What matters is not finding the legendary "global optimum," but in each iteration:
|
|
81
|
+
|
|
82
|
+
- Keeping the direction roughly correct
|
|
83
|
+
- Balancing exploration and exploitation
|
|
84
|
+
- Accepting noise and constraints
|
|
85
|
+
- Allowing the objective function to gracefully evolve as experience grows
|
|
86
|
+
|
|
87
|
+
**The process is the meaning; optimization itself is life.**
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
> **语言路由**:若用户消息为英文,请读取并遵循同目录下的 `musings.en.md`。
|
|
2
|
+
|
|
3
|
+
# 杂谈:数学与人生 / Musings: Mathematics and Life
|
|
4
|
+
|
|
5
|
+
> 本文件从 `inspiration.md` 拆分而来(v3.2.1),保留数学与人生的哲学感悟部分。这些内容**不属于 skill 的核心机制**,Domain Router 不会自动加载本文件——只在用户显式查阅灵感或哲学思考时引用。skill 的严谨技术核心在 `inspiration.md` 与各锚点卡。
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 人生就是一场最优化 / Life as an Optimization
|
|
10
|
+
|
|
11
|
+
如果你把人看作一个高维、非线性、动态且目标函数还在变化的复杂优化问题,你会发现——最优化理论和人生路径有着惊人的哲学共鸣。
|
|
12
|
+
|
|
13
|
+
### 目标函数:你想"优化"什么?
|
|
14
|
+
|
|
15
|
+
在数学中,首先要定义目标函数 $f(x)$。在人生中,这就是你追求的价值:幸福、成就、意义、财富、平衡……
|
|
16
|
+
|
|
17
|
+
难点在于:人生目标往往是**多目标的、模糊的、随时间变化的**,甚至可能相互冲突。
|
|
18
|
+
|
|
19
|
+
### 初始点与资源约束
|
|
20
|
+
|
|
21
|
+
$x_0$ 是你的出身、天赋、起点。
|
|
22
|
+
|
|
23
|
+
约束条件:时间、金钱、健康、社会规则……这些像优化问题中的约束 $g(x) \leq 0$,限定了可行域。
|
|
24
|
+
|
|
25
|
+
### 步长与方向:日常决策
|
|
26
|
+
|
|
27
|
+
**方向**:你选择努力的方向——职业、关系、学习领域。
|
|
28
|
+
|
|
29
|
+
**步长**:你在某个方向上投入的强度和时间。
|
|
30
|
+
|
|
31
|
+
精确度要求:如果每一步都只追求眼前收益(比如短期利益最大化),可能会陷入"局部最优"的人生陷阱——例如高薪但无意义的工作,忙碌但无成长的生活。
|
|
32
|
+
|
|
33
|
+
### 局部最优 vs 全局最优
|
|
34
|
+
|
|
35
|
+
这是"人生最优化"的核心困境:
|
|
36
|
+
|
|
37
|
+
- **局部最优**:你所在的城市、行业、社交圈中看似最好的选择。
|
|
38
|
+
- **全局最优**:也许在另一个国家、另一个领域、另一种生活方式里,有更契合你本质的人生。但你无法预知全局,就像优化算法只能看到当前位置的局部信息。
|
|
39
|
+
|
|
40
|
+
### 随机性与噪声
|
|
41
|
+
|
|
42
|
+
人生不是平滑的数字函数,而是充满随机噪声:
|
|
43
|
+
|
|
44
|
+
运气、机遇、意外事件……相当于目标函数有随机扰动 $f(x) + \epsilon$。
|
|
45
|
+
|
|
46
|
+
因此,过分追求精确化往往不经济,你需要的是**鲁棒性和适应力**。
|
|
47
|
+
|
|
48
|
+
### 探索与利用的权衡
|
|
49
|
+
|
|
50
|
+
这是人生的根本张力:
|
|
51
|
+
|
|
52
|
+
- **探索**:尝试新领域、新关系、新知识,可能失败,但可能发现全新的"磁场"。
|
|
53
|
+
- **利用**:深耕现有领域,获取稳定收益。
|
|
54
|
+
|
|
55
|
+
年轻时多探索,中年后多利用?但规则并非固定。
|
|
56
|
+
|
|
57
|
+
### 动态目标与终身学习
|
|
58
|
+
|
|
59
|
+
人生目标会变:20 岁追求激情,40 岁追求意义,60 岁追求传承……
|
|
60
|
+
|
|
61
|
+
这意味着目标函数 $f(x)$ 本身在不断变化。因此,"优化自己"比"优化某个固定目标"更重要——也就是**元优化**(学习如何学习,调整如何调整)。
|
|
62
|
+
|
|
63
|
+
### 算法选择:你的人生策略
|
|
64
|
+
|
|
65
|
+
| 算法 | 人生策略 |
|
|
66
|
+
|------|---------|
|
|
67
|
+
| 梯度下降 | 跟随当前最迫切的方向(薪资、社会压力)一步步走 |
|
|
68
|
+
| 动量法 | 保持一定的历史惯性(坚持长期目标,抵抗短期波动) |
|
|
69
|
+
| 随机梯度下降 | 接受小批量随机样本,灵活调整 |
|
|
70
|
+
| 进化算法 | 尝试多种人生路径,淘汰无效策略,保留有效模式 |
|
|
71
|
+
|
|
72
|
+
没有一种算法绝对最好,重要的是知道自己在用什么策略,并适时调整。
|
|
73
|
+
|
|
74
|
+
### 最重要的启示
|
|
75
|
+
|
|
76
|
+
数学优化中,我们假设存在一个全局最优解 $x^*$。但在人生中,可能根本不存在一个"绝对最优的人生"。
|
|
77
|
+
|
|
78
|
+
我们只是生活的"局中人",寻找一个满意解,并努力让这个过程充满学习、成长和意义。
|
|
79
|
+
|
|
80
|
+
重要的不是找到那个传说中的"全局最优",而是在每一步迭代中:
|
|
81
|
+
|
|
82
|
+
- 保持方向的大致正确
|
|
83
|
+
- 在探索与利用间平衡
|
|
84
|
+
- 接受噪声与约束
|
|
85
|
+
- 允许目标函数随着阅历增长而优雅地演变
|
|
86
|
+
|
|
87
|
+
**过程即意义,优化本身就是生活。**
|
|
@@ -1,20 +1,28 @@
|
|
|
1
1
|
# Skill Index: Lens Library, Activation Anchors, Design Translation Prototypes, Workflow Examples
|
|
2
2
|
|
|
3
|
-
> This
|
|
3
|
+
> This is the on-demand catalog for `../SKILL.md`. The main entry keeps only selection rules; do not load this index by default for a clear request.
|
|
4
4
|
|
|
5
|
-
## Domain Router Overview (v3.2.0)
|
|
5
|
+
## Domain Router Overview (v3.2.0+; routing rules follow root `../SKILL.md`)
|
|
6
6
|
|
|
7
|
-
> Full definition: see the Domain Router section in `../
|
|
7
|
+
> Full definition: see the Domain Router section in `../SKILL.md`. Only a summary table appears here:
|
|
8
8
|
|
|
9
9
|
| Domain | Loaded Content | Signal Keywords |
|
|
10
10
|
|--------|----------------|------------------|
|
|
11
|
-
| **
|
|
12
|
-
| **
|
|
13
|
-
| **
|
|
11
|
+
| **Shared Mathematics** | 33 anchors across 8 non-cryptography domains plus relevant lenses | probability/information/algebra/geometry/matrix/spectral/optimization/topology/complexity |
|
|
12
|
+
| **AI Research** | Shared mathematics on demand + `../design-patterns/` (5 types, 22 patterns); books only for deep checks | attention/loss/routing/representation/compression/MoE/transformer/KV-cache/LoRA/SSM/diffusion/RL |
|
|
13
|
+
| **Cryptography** | 4 crypto anchors; only then 3 crypto books if needed; shared mathematics on demand | encryption/signature/MAC/PRF/PRG/PRP/OWF/CCA/CPA/AE/ZK/reduction/DL/CDH/DDH/RSA/ECC/lattice |
|
|
14
14
|
| **AI×Crypto** | dual-domain load + intersection annotation | "PRF for watermarking," "adversarial example reduction," "verifiable inference" |
|
|
15
15
|
|
|
16
16
|
> Core rules: domain judgment precedes lens invocation; shared math loads on demand by problem structure (not by domain tag); no pollution across non-cross domains; gap-protocol temporary cards are domain-tagged.
|
|
17
17
|
|
|
18
|
+
## v3.2.1 Design Philosophy Refinement
|
|
19
|
+
|
|
20
|
+
> Full definition: see the objective, Domain Router, and progressive-loading sections in `../SKILL.md`. Key points:
|
|
21
|
+
>
|
|
22
|
+
> 1. knowledge-base/ anchors describe mathematical structures themselves (manifolds, spectra, sheaf cohomology, pseudorandom function families, etc.), not specific AI architectures (diffusion, SSM, transformer variants).
|
|
23
|
+
> 2. design-patterns/ is a paradigmatic demonstration of "math→AI module" translation, not a copy-paste template library; for new problems, generate temporary design candidates from the mathematical structure.
|
|
24
|
+
> 3. Compatibility principle: research problems with architectures the skill did not pre-specify (e.g., future paradigms) are handled through lens-routing + anchor-activation + temporary-knowledge-card pipeline, not declared "not covered."
|
|
25
|
+
|
|
18
26
|
## Language Routing & Mixed-Input Rules (Full Version)
|
|
19
27
|
|
|
20
28
|
Language routing only determines "which language version to read" and "what language to respond in." It does NOT affect whether the math system triggers or the A/B/C/D/E scenario classification.
|
|
@@ -36,8 +44,8 @@ Language routing only determines "which language version to read" and "what lang
|
|
|
36
44
|
- If there is no prior context, default to Chinese.
|
|
37
45
|
|
|
38
46
|
5. **Output language matches primary language**
|
|
39
|
-
-
|
|
40
|
-
- English
|
|
47
|
+
- Codex always reads canonical `../SKILL.md` and answers in the user's primary language; it does not load a second body for English input.
|
|
48
|
+
- An explicit English command entry may read `../SKILL.en.md` directly, but must not also load the Chinese entry.
|
|
41
49
|
- If the user explicitly requests "in English" / "in Chinese," follow the explicit request.
|
|
42
50
|
|
|
43
51
|
## Lens Library (15 Mathematical Perspectives)
|
|
@@ -75,6 +83,7 @@ Each anchor is not a closed knowledge card but answers: what math structure to a
|
|
|
75
83
|
| Topology | `../knowledge-base/topology/` | persistent-homology, euler-characteristic, fundamental-group |
|
|
76
84
|
| Probability & Information | `../knowledge-base/probability/` | concentration-inequality, entropy, kl-divergence, information-bottleneck, fisher-information |
|
|
77
85
|
| Information Geometry | `../knowledge-base/information-geometry/` | natural-gradient, fisher-metric |
|
|
86
|
+
| Algebraic Geometry | `../knowledge-base/algebraic-geometry/` | sheaf-cohomology, grassmannian-plucker |
|
|
78
87
|
|
|
79
88
|
## Design Pattern Library (Organized by AI Component)
|
|
80
89
|
|
|
@@ -90,15 +99,17 @@ Each design pattern answers: Mathematical origin, AI module form, implementable
|
|
|
90
99
|
|
|
91
100
|
## Cryptography Book Distillations (3 New Books)
|
|
92
101
|
|
|
93
|
-
The reference layer
|
|
102
|
+
The reference layer covers 10 books, all paired in Chinese and English. The three cryptography distillations below support security definitions, constructions, reductions, and protocol analysis. English requests use the .en.md files and load them only when anchors are insufficient.
|
|
94
103
|
|
|
95
104
|
| Book | File | Primary Use | Activation Family |
|
|
96
105
|
|------|------|-------------|--------------------|
|
|
97
|
-
| Boneh & Shoup, *A Graduate Course in Applied Cryptography* | `books/applied-cryptography.md` | Attack games, reduction proofs, symmetric/public-key constructions, zero knowledge, and protocols | Definitions/Reductions/Primitives/Protocols |
|
|
98
|
-
| Goldreich, *Foundations of Cryptography, Volume 1: Basic Tools* | `books/foundations-of-cryptography.md` | Computational indistinguishability, OWF/PRG/PRF, zero knowledge, and commitments | Definitions/Proofs/Constructions/Meta-theorems |
|
|
99
|
-
| Katz & Lindell, *Introduction to Modern Cryptography*, 2nd ed. | `books/introduction-to-modern-cryptography.md` | Formal security definitions, IND/CCA, MACs, hashing, and digital signatures | Definitions/Proofs/Primitives/Assumptions/Constructions |
|
|
106
|
+
| Boneh & Shoup, *A Graduate Course in Applied Cryptography* | `books/applied-cryptography.en.md` | Attack games, reduction proofs, symmetric/public-key constructions, zero knowledge, and protocols | Definitions/Reductions/Primitives/Protocols |
|
|
107
|
+
| Goldreich, *Foundations of Cryptography, Volume 1: Basic Tools* | `books/foundations-of-cryptography.en.md` | Computational indistinguishability, OWF/PRG/PRF, zero knowledge, and commitments | Definitions/Proofs/Constructions/Meta-theorems |
|
|
108
|
+
| Katz & Lindell, *Introduction to Modern Cryptography*, 2nd ed. | `books/introduction-to-modern-cryptography.en.md` | Formal security definitions, IND/CCA, MACs, hashing, and digital signatures | Definitions/Proofs/Primitives/Assumptions/Constructions |
|
|
100
109
|
|
|
101
110
|
> **Domain Router note**: These three books belong to the **Cryptography Layer** and are loaded only when Domain Router determines the problem is cryptography or AI×crypto intersection. Pure AI problems do not load them. Shared math anchors (probability/information/algebra) are loaded on demand without redundancy.
|
|
111
|
+
>
|
|
112
|
+
> **v3.2.1 backfill**: new knowledge-base/cryptography/ anchor directory (with prf-prg-owf, reduction-proof-template, attack-game-framework, cca-cpa-ae-hierarchy cards) and knowledge-base/algebraic-geometry/ directory (with sheaf-cohomology, grassmannian-plucker cards). The cryptography layer no longer has only books — it has structured anchors for light consultation.
|
|
102
113
|
|
|
103
114
|
## Workflow Example
|
|
104
115
|
|
|
@@ -109,23 +120,22 @@ Step 1 — Diagnosis: Scenario B (Mechanism Design)
|
|
|
109
120
|
Problem type: Sequence memory compression + information preservation + long-range structure
|
|
110
121
|
Core tension: Compressing token count vs. preserving long-range dependencies
|
|
111
122
|
|
|
112
|
-
Step 2 — Lens Selection:
|
|
123
|
+
Step 2 — Lens Selection (default ≤2):
|
|
113
124
|
1. Spectral Decomposition (preserve dominant subspace)
|
|
114
|
-
2. Information
|
|
115
|
-
|
|
125
|
+
2. Probabilistic / Information (retain mutual-information-sensitive states)
|
|
126
|
+
(Add Topology only if the user emphasizes connectivity/bridging; it is outside the default budget)
|
|
116
127
|
|
|
117
128
|
Step 3 — Activation Anchors:
|
|
118
129
|
→ low-rank-approximation (Matrix Analysis anchor)
|
|
119
|
-
→ leverage-score-selection (Design Pattern: compression)
|
|
120
130
|
→ information-bottleneck (Probability & Information anchor)
|
|
131
|
+
→ leverage-score-selection or low-rank-kv-cache (0–2 compression design patterns)
|
|
121
132
|
If existing anchors are insufficient, enter Knowledge Gap Protocol to generate a temporary knowledge card.
|
|
122
133
|
|
|
123
134
|
Step 4 — Design Translation:
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
Candidate C: Topology-Preserving Cache (graph bridge-node retention)
|
|
135
|
+
Primary: Spectral KV Compression (low-rank + leverage score)
|
|
136
|
+
Alternative only by decisive difference: Information-Preserving Cache (depends on future-query estimates)
|
|
127
137
|
|
|
128
|
-
Step 5 —
|
|
129
|
-
|
|
130
|
-
|
|
138
|
+
Step 5 — Compact Review (do not load the full critic for ordinary tasks):
|
|
139
|
+
Primary is most GPU-friendly; alternative needs future-query estimates and is more uncertain
|
|
140
|
+
Conclusion: Prefer the primary design; add a lightweight gate only when query-sensitive retention is required
|
|
131
141
|
```
|