math-skill 3.2.0 → 3.3.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 (63) hide show
  1. package/README.en-US.md +45 -14
  2. package/README.md +45 -14
  3. package/SKILL.en.md +122 -0
  4. package/SKILL.md +122 -0
  5. package/agents/math-critic.en.md +32 -18
  6. package/agents/math-critic.md +33 -18
  7. package/commands/ask.en.md +2 -2
  8. package/commands/ask.md +2 -2
  9. package/design-patterns/compression/low-rank-kv-cache.en.md +1 -0
  10. package/design-patterns/loss/orthogonality-loss.en.md +7 -7
  11. package/design-patterns/loss/orthogonality-loss.md +7 -7
  12. package/knowledge-base/algebraic-geometry/grassmannian-plucker.en.md +71 -0
  13. package/knowledge-base/algebraic-geometry/grassmannian-plucker.md +71 -0
  14. package/knowledge-base/algebraic-geometry/index.en.md +47 -0
  15. package/knowledge-base/algebraic-geometry/index.md +47 -0
  16. package/knowledge-base/algebraic-geometry/sheaf-cohomology.en.md +72 -0
  17. package/knowledge-base/algebraic-geometry/sheaf-cohomology.md +72 -0
  18. package/knowledge-base/cryptography/attack-game-framework.en.md +56 -0
  19. package/knowledge-base/cryptography/attack-game-framework.md +56 -0
  20. package/knowledge-base/cryptography/cca-cpa-ae-hierarchy.en.md +57 -0
  21. package/knowledge-base/cryptography/cca-cpa-ae-hierarchy.md +57 -0
  22. package/knowledge-base/cryptography/index.en.md +54 -0
  23. package/knowledge-base/cryptography/index.md +54 -0
  24. package/knowledge-base/cryptography/prf-prg-owf.en.md +62 -0
  25. package/knowledge-base/cryptography/prf-prg-owf.md +62 -0
  26. package/knowledge-base/cryptography/reduction-proof-template.en.md +60 -0
  27. package/knowledge-base/cryptography/reduction-proof-template.md +60 -0
  28. package/knowledge-base/matrix-analysis/low-rank-approximation.en.md +2 -2
  29. package/knowledge-base/matrix-analysis/low-rank-approximation.md +2 -2
  30. package/knowledge-base/matrix-analysis/projection.en.md +11 -12
  31. package/knowledge-base/matrix-analysis/projection.md +11 -12
  32. package/knowledge-base/overview.en.md +8 -4
  33. package/knowledge-base/overview.md +8 -4
  34. package/knowledge-base/probability/kl-divergence.en.md +6 -6
  35. package/knowledge-base/probability/kl-divergence.md +6 -6
  36. package/package.json +4 -2
  37. package/references/agentic-workflow.en.md +2 -2
  38. package/references/agentic-workflow.md +2 -2
  39. package/references/books/abstract-algebra.en.md +18 -29
  40. package/references/books/abstract-algebra.md +18 -29
  41. package/references/books/algebraic-geometry-rising-sea.en.md +1 -1
  42. package/references/books/algebraic-geometry-rising-sea.md +2 -2
  43. package/references/books/applied-cryptography.en.md +112 -0
  44. package/references/books/applied-cryptography.md +18 -19
  45. package/references/books/differential-geometry.md +1 -1
  46. package/references/books/foundations-of-cryptography.en.md +112 -0
  47. package/references/books/foundations-of-cryptography.md +20 -20
  48. package/references/books/introduction-to-modern-cryptography.en.md +130 -0
  49. package/references/books/introduction-to-modern-cryptography.md +21 -21
  50. package/references/books/micro-lie-theory.en.md +1 -1
  51. package/references/books/micro-lie-theory.md +1 -1
  52. package/references/books/smooth-manifolds.en.md +1 -1
  53. package/references/books/smooth-manifolds.md +1 -1
  54. package/references/gpu-friendly-math.en.md +8 -8
  55. package/references/gpu-friendly-math.md +8 -8
  56. package/references/inspiration.en.md +8 -84
  57. package/references/inspiration.md +8 -84
  58. package/references/musings.en.md +87 -0
  59. package/references/musings.md +87 -0
  60. package/references/skill-index.en.md +32 -22
  61. package/references/skill-index.md +29 -19
  62. package/skills/math-research-activator/SKILL.en.md +4 -193
  63. package/skills/math-research-activator/SKILL.md +4 -214
@@ -4,25 +4,25 @@
4
4
 
5
5
  ## 概要
6
6
 
7
- 本书最深的贡献不是任何具体构造,而是**定义方法论**:使严格安全分析成为可能的哲学转变——从信息论安全(Shannon:敌手信息不足)到**计算安全**(敌手有信息但无法高效提取)。这一转变建立在"PPT = 可行计算"的工作假设之上,整座现代密码学大厦都依赖它。
7
+ 本书最深的贡献不是任何具体构造,而是**定义方法论**:使严格安全分析成为可能的哲学转变——从信息论安全(Shannon:敌手信息不足)到**计算安全**(敌手有信息但无法高效提取)。这一转变通常用 PPT 敌手刻画“经典高效计算”;PPT 是建模约定,不等同于现实世界全部可行攻击,量子、非一致电路、侧信道与具体资源都需另行建模。
8
8
 
9
9
  **核心论点**:密码学是定义即创造的领域。好的定义同时形式化直觉、开放构造、允许归约证明、排除平凡构造。全书建立原语间的偏序蕴含链(OWF⇒PRG⇒PRF⇒...),每条箭头都是构造性归约。
10
10
 
11
11
  **激活边界**:本书是**理论与元定理优先**——讲定义、归约、可构造性、不可能性,**不是实用方案手册**。很多构造效率太低不可直接落地。这里给的是"密码学的概念骨架与假设依赖图"的**激活索引**,实用构造回查 Boneh-Shoup / Katz-Lindell。
12
12
 
13
- ## 可迁移到 AI/理论分析的核心结构
13
+ ## 核心结构与跨域边界
14
14
 
15
15
  | 理论结构(章节) | 迁移到 AI/ML/系统设计 |
16
16
  |---|---|
17
- | **计算不可区分(§2.2)** | "伪随机"的形式化定义;分布距离 vs 可识别性的区分;ML 中"生成分布逼近真实"的严格语言 |
18
- | **PPT + 忽略函数框架(§2.1, §2.3)** | "高效算法 + 实际不可能事件"的形式化;ML 中"多项式时间敌手 + 概率可忽略"威胁模型 |
19
- | **OWF PRG PRF 等价链(§III, §V)** | "最小假设 最大功能"的等价定理模板;AI 中"弱学习器↔强学习器"PAC 提升的类比 |
17
+ | **计算不可区分(§2.2)** | 用高效区分器定义“看不出差异”;它不同于统计距离。迁移到 ML 时必须重新指定安全参数、区分器类与采样接口 |
18
+ | **PPT + 忽略函数框架(§2.1, §2.3)** | 渐近安全的量词框架;部署还需要具体时间、查询数与成功概率 |
19
+ | **OWF / PRG / PRF 构造链(§III, §V)** | 在标准定义下,这些原语的存在性有深刻联系;这不是 boosting ML 定理的证明 |
20
20
  | **归约论证 vs 经典归约(§4.1)** | 分布保持的归约;不能喂敌手任意输入,必须匹配其成功分布——迁移到 ML 安全证明要小心分布漂移 |
21
21
  | **Hybrid 技术(§4.2)** | 把多步不可区分性拆成单步;hybrid 数须 poly(n),相邻差异须可界——ML 分布漂移分析的通用工具 |
22
- | **弱→强放大(§4.3)** | "弱假设 → 强结论"的非平凡放大;证明不能假设独立性——AI 中 boosting/集成 的理论镜像 |
23
- | **模拟范式(§4.4, §VI)** | "零知识"= 可被模拟则未学到的认识论定义;迁移到隐私 ML:模型可被模拟则未泄露训练数据 |
24
- | **不可预测性 ⇔ 伪随机性(§4.5)** | "下一 bit 不可预测 整体伪随机"的深刻等价;迁移到序列模型评估:不可预测即伪随机 |
25
- | **Goldreich-Levin hardcore bit(§5.1)** | 从 OWF 提取一个"完美隐藏 bit"——伪随机性的种子;列表解码 + 配对独立采样 |
22
+ | **弱→强放大(§4.3)** | 展示如何强化密码学性质且控制归约损失;与 boosting 只有高层结构类比,假设与证明不可互换 |
23
+ | **模拟范式(§4.4, §VI)** | 在明确的真实/理想实验中定义零知识;“存在某种模拟器”本身不推出训练数据隐私或差分隐私 |
24
+ | **不可预测性 ⇔ 伪随机性(§4.5)** | Yao 的 next-bit 刻画针对二进制分布族、高效预测器和明确安全参数;不能直接套到自然语言 next-token |
25
+ | **Goldreich-Levin hardcore bit(§5.1)** | 从 OWF 构造计算上不可预测的 bit;不是信息论意义的“完美隐藏” |
26
26
  | **黑盒 vs 非黑盒(§7.3)** | 构造与分离的技术分类;黑盒更鲁棒但可能本质受限 |
27
27
 
28
28
  **激活家族**:
@@ -36,14 +36,14 @@
36
36
 
37
37
  - **信息论安全 ⇔ 计算安全的鸿沟**:信息论上破但计算上安全是现代密码学的本质;敌手"有信息但提不出来"。
38
38
  - **计算不可区分 ⇏ 统计接近**:存在伪随机但统计上远离均匀的总体(支持集 2^{n/2} vs 2^n)。
39
- - **多抽样不可区分需要可高效构造**:无此条件,单抽样不可区分 多抽样——纯计算现象,无信息论对应。
39
+ - **多抽样提升需要采样条件**:对可高效、独立采样的分布族,可用 hybrid 从单样本不可区分推出多项式个样本不可区分;不能省略可采样性与独立性条件。
40
40
  - **OWF ⇔ PRG(HILL 定理)**:最小密码假设 ⇔ 最基本原语,深刻等价。
41
41
  - **弱 OWF ⇒ 强 OWF(放大定理)**:构造 g(x₁..x_t)=(f(x₁)..f(x_t)),但证明不可假设块独立性。
42
42
  - **不可预测 ⇔ 伪随机(Yao 定理)**:hybrid H^i = i-bit 前缀 + (n-i) 均匀 bit;区分器 ⇒ 预测器,优势 ≥ ε/n。
43
43
  - **Goldreich-Levin:任何 OWF 可加 hardcore bit**:g(x,r)=(f(x),r),b(x,r)=⟨x,r⟩ mod 2;列表解码 + 配对独立。
44
- - **GGM 树:PRG ⇒ PRF**:二叉树深度 poly(n),叶节点 = 伪随机函数表;指数域大小来自多项式 key。
45
- - **ZK = 可模拟性**:存在 PPT 模拟器生成 V\* 视图 ⇒ 交互未带来新知识;三档:完美/统计/计算 ZK。
46
- - **BPP ⊆ PZK ⊆ SZK ⊆ CZK IP=PSPACE**;假设 OWF 存在则 CZK=IP。
44
+ - **GGM 树:PRG ⇒ PRF**:用输入 bit 选择树路径,按需计算一个叶值;指数大的定义域并不意味着显式存储整张函数表。
45
+ - **ZK 的模拟定义**:对定义允许的验证者及辅助输入,存在相应模拟器使其视图相同、统计接近或计算不可区分;量词与模型不能省略。
46
+ - **零知识类的关系依赖定义与假设**:PZK ⊆ SZK ⊆ CZK,且它们位于交互证明框架内;关于哪些 IP 语言具有计算零知识证明的结论必须注明设置、完备性与密码学假设,不能只写一条无条件等号链。
47
47
 
48
48
  ## 适合激活的问题类型
49
49
 
@@ -52,18 +52,18 @@
52
52
  - **假设最小化**:方案依赖哪些假设?能否弱化到 OWF?是否依赖非一致硬假设?
53
53
  - **放大证明**:弱性质如何放大到强性质?能否避免独立性假设?放大常数多大?
54
54
  - **模拟范式应用**:能否构造模拟器证明"未泄露"?模拟器是严格还是期望多项式时间?
55
- - **不可预测性分析**:序列模型的下一 token 不可预测 整体伪随机?hybrid 链有多长?
55
+ - **不可预测性分析**:若想借用 next-bit 定理,是否已定义二进制编码、分布族、安全参数与高效预测器?自然语言 next-token 指标通常不满足这些前提。
56
56
  - **迁移到隐私 ML**:差分隐私的可合成性、模型反演攻击的"信息论 vs 计算"边界、合成安全分析。
57
57
 
58
58
  ## 可能的算法启发
59
59
 
60
60
  > 本书方法论产出远多于具体算法,但其思想可迁移:
61
61
 
62
- 1. **Goldreich-Levin hardcore bit 迁移**:从任何"难逆"映射提取一个不可预测 bit——可用作 ML 中的"难特征"提取。*落点:方法论。*
62
+ 1. **Goldreich-Levin 作为构造范例**:展示如何从明确的 OWF 假设构造 hardcore predicate;普通“难优化/难预测”的 ML 映射不自动满足 OWF 定义。*落点:证明方法。*
63
63
  2. **GGM 树式构造迁移**:用短 seed 生成指数级"伪随机"结构——可启发参数共享与伪随机路由表。*落点:D4——小 key 大表。*
64
64
  3. **Hybrid argument 迁移到分布漂移分析**:把多步训练的分布漂移拆成单步可界——理论分析工具。*落点:方法论。*
65
- 4. **模拟范式迁移到可验证隐私**:构造模拟器证明"模型输出可被独立生成"——隐私证书。*落点:方法论。*
66
- 5. **弱→强放大迁移到集成学习**:弱学习器放大为强学习器是 PAC-boosting 的镜像,但证明不能假设基学习器独立。*落点:方法论。*
65
+ 4. **模拟范式用于定义真实/理想实验**:可帮助组织隐私论证,但只有满足所声明的模拟定义时才形成保证;它不自动蕴含 DP。*落点:方法论。*
66
+ 5. **弱→强放大只作结构类比**:密码学 amplification 与 PAC boosting 的假设、接口和结论不同,不能相互替代证明。*落点:研究启发。*
67
67
 
68
68
  ## GPU 友好性警告
69
69
 
@@ -82,7 +82,7 @@
82
82
  **反模式警告:**
83
83
  - 把 HILL/GGM 通用构造当实用方案——常数灾难性,只证存在性。
84
84
  - 用计算不可 distinguishability 直接做 ML loss——不可导,只能做评估指标。
85
- - 假设"PPT = 可行"在量子/专用硬件下仍成立——需扩展到 BQP 敌手。
85
+ - 把经典 PPT 敌手当成量子或侧信道模型——量子安全通常需明确 QPT 敌手及其 oracle 访问方式;实现攻击还需单独建模。
86
86
 
87
87
  ## 该调用哪个思想透镜
88
88
 
@@ -101,9 +101,9 @@
101
101
  - **把定义当构造**:定义只说"该是什么",构造才说"怎么做";只有定义没有构造等于空话。
102
102
  - **假设独立性强放大**:弱→强放大证明不能假设块独立,否则证明错;计算设置中独立性是奢侈品。
103
103
  - **混淆黑盒与非黑盒**:黑盒分离结果只对黑盒构造有效;非黑盒可能突破分离。
104
- - **把 asymptotic 当 concrete**:渐近安全 ⇒ 具体安全需要多项式常数小;不查常数就部署是赌博。
104
+ - **把 asymptotic 当 concrete**:渐近安全不提供某个固定参数下的实际界;部署必须计算时间、查询数、归约损失和成功概率。
105
105
  - **把 ZK 的 HVZK 当通用 ZK**:诚实验证者 ZK 弱于恶意验证者 ZK;并行合成 ZK 不闭,WI 才闭。
106
- - **把 PPT 假设当永恒**:量子计算(BQP)与侧信道不在 PPT 模型内;部署前要扩展敌手模型。
106
+ - **把经典 PPT 假设当永恒**:量子敌手需 QPT/量子 oracle 模型,侧信道与非一致硬件也需额外资源参数。
107
107
  - **堆元定理而不诊断假设**:先问"方案依赖哪条假设、能否弱化、是否有黑盒分离",再选工具。
108
108
 
109
109
  ## 深挖入口
@@ -0,0 +1,130 @@
1
+ # Introduction to Modern Cryptography
2
+
3
+ > Jonathan Katz and Yehuda Lindell, *Introduction to Modern Cryptography*, 2nd Edition, CRC Press, 2015. An introduction organized around three principles: **formal definitions, explicit assumptions, and security proofs**.
4
+
5
+ ## Overview
6
+
7
+ Modern cryptography defines the adversary and failure event before selecting a construction. A proof is normally a reduction: an adversary that breaks the scheme yields an algorithm contradicting a stated assumption. Kerckhoffs's principle treats every system detail except the secret key as public.
8
+
9
+ **Activation boundary:** This book balances definitions and engineering-oriented construction patterns—EAV/CPA/CCA/AE notions, SPNs, Feistel networks, Merkle–Damgård, KEM/DEM, Fiat–Shamir, attack models, and implementation pitfalls. Use this distillation to choose a definition, construction family, and proof obligation; use current standards and implementation guidance for deployment decisions.
10
+
11
+ ## Core Structures and Cross-Domain Boundaries
12
+
13
+ | Definition or construction | What transfers—and what does not |
14
+ |---|---|
15
+ | **Definition/assumption/proof discipline (§1)** | Formalize the threat, state assumptions, then prove a relative claim. |
16
+ | **Kerckhoffs's principle (§1.3)** | Design for public algorithms and secret keys. It is a design principle, not an automatic theorem about another system. |
17
+ | **Probability as the security language (§2.1)** | Random experiments, conditional probability, and leakage analysis. |
18
+ | **Asymptotic vs concrete security (§2.3)** | Asymptotics organize theory; deployment requires explicit resources and advantage. |
19
+ | **Entropy and min-entropy (§2.4)** | Min-entropy measures best one-shot guessing probability; the modeled distribution must be stated. |
20
+ | **Perfect secrecy (§3.1–3.2)** | Under standard finite-space assumptions, perfect secrecy imposes a key-space lower bound; computational security relaxes the adversary. |
21
+ | **CPA/CCA/AE families (§3.2–3.5)** | Different adversarial interfaces and encryption goals. Authenticated encryption combines confidentiality and ciphertext integrity; exact equivalences depend on definitions. |
22
+ | **MAC unforgeability (§3.4)** | Strong unforgeability, constant-time verification, and the fact that replay protection belongs to a protocol layer. |
23
+ | **Hash security and birthday bounds (§3.6)** | Collision, second-preimage, and preimage resistance are distinct notions. A generic collision attack on an ideal n-bit hash takes about `2^(n/2)` queries. |
24
+ | **Reduction template (§5)** | Build B around adversary A and account for simulation error and success loss. |
25
+ | **Hybrid arguments and game hopping (§5.3–5.4)** | Bound adjacent games and sum the losses; do not hide a large number of transitions. |
26
+ | **OWF/PRG/PRF existence relations (§6)** | Standard constructions and implication results, not production recommendations. |
27
+ | **Number-theoretic assumptions (§7)** | Reduction directions among factoring/RSA and DL/CDH/DDH must be stated precisely and depend on the group. |
28
+ | **SPN and Feistel constructions (§8.1–8.2)** | Confusion/diffusion and Feistel structure; the round function need not be invertible. |
29
+ | **Merkle–Damgård (§8.3)** | Lifts collision resistance from a compression function under stated padding; does not behave as a random oracle and permits length extension in common forms. |
30
+ | **KEM/DEM (§8.4)** | A KEM establishes key material and a DEM protects data. End-to-end security depends on matching definitions, KDF/context binding, and composition. |
31
+ | **Hash-and-sign and Fiat–Shamir (§8.5–8.6)** | Hash before signing; transform an interactive identification protocol only in a model and construction for which the proof applies. |
32
+ | **Random-oracle methodology (§9)** | Programmability and extraction can enable proofs; a ROM proof is not a standard-model proof. |
33
+
34
+ **Activation families:**
35
+
36
+ - **Definitions (§3):** EAV, CPA, CCA, AE, MAC unforgeability, and hash properties.
37
+ - **Proofs (§5):** reductions, distinguishers, hybrids, and game hopping.
38
+ - **Primitives (§6):** OWFs, hardcore predicates, PRGs, PRFs, and PRPs.
39
+ - **Assumptions (§7):** factoring/RSA and DL/CDH/DDH families.
40
+ - **Constructions (§8):** SPNs, Feistel, Merkle–Damgård, KEM/DEM, hash-and-sign, and Fiat–Shamir.
41
+
42
+ ## Key Facts
43
+
44
+ - **Definition first:** without a game and adversary interface, “secure” has no testable meaning.
45
+ - **Shannon lower bound:** with the standard finite message/key spaces and correctness assumptions, perfect secrecy requires `|K| ≥ |M|`. OTP meets the bound, but this does not make it the only scheme in a literal structural sense.
46
+ - **Eavesdropping indistinguishability and semantic security:** standard formulations are equivalent under the appropriate setting and quantifiers.
47
+ - **Deterministic encryption is not IND-CPA secure** for ordinary nontrivial message spaces under the standard public-key or private-key games.
48
+ - **Multi-message IND-CPA security** is normally derived by a hybrid under the matching encryption definition and randomness/nonce conditions.
49
+ - **CCA security and non-malleability are closely related,** but the exact implication or equivalence depends on the selected definitions.
50
+ - **Encrypt-then-MAC is a robust generic route** when the encryption and MAC assumptions, independent keys, and verification order match the theorem. MtE/EaM require construction-specific analysis.
51
+ - **Birthday bound:** an ideal n-bit hash provides roughly n/2 bits of generic collision resistance.
52
+ - **OWFs, PRGs, and PRFs have deep existence relations;** AES is a block cipher and SHA is a hash family, not interchangeable “practical versions” of one primitive.
53
+ - **Goldreich–Levin:** the inner-product predicate is hardcore in the stated OWF construction.
54
+ - **PRP switching:** the bound scales quadratically with the number of queries and inversely with the permutation domain, up to convention-dependent constants.
55
+ - **Reduction directions matter:** solving DL generally gives CDH, and solving CDH gives a DDH decision procedure; factoring an RSA modulus enables RSA inversion, while the converse is not generally known.
56
+ - **Luby–Rackoff:** three Feistel rounds with suitable independent PRFs give a PRP under chosen-plaintext-style access; four rounds give a strong PRP under forward/inverse access.
57
+ - **KEM/DEM composition depends on the target notion:** CPA and CCA goals require compatible KEM/DEM definitions, derivation, and context binding.
58
+ - **ROM is useful but model-relative:** it is stronger than having no proof and weaker than a standard-model guarantee.
59
+
60
+ ## Suitable Questions
61
+
62
+ - Which of CPA, CCA, ciphertext integrity, or AE matches the threat model?
63
+ - Which current standardized construction fits the required interface? Verify current recommendations externally before deployment.
64
+ - Is the reduction simulation correct, and what is its concrete loss?
65
+ - How do key/output length, birthday effects, quantum resources, and reduction loss affect parameters?
66
+ - Are comparisons constant-time, nonces unique, keys separated, and errors uniform?
67
+ - Is protocol context—identities, roles, transcript, version—cryptographically bound?
68
+ - In AI×crypto work, have the adversary interface, winning event, and assumptions been redefined? CPA/CCA cannot simply be renamed as black-box/white-box ML access.
69
+
70
+ ## Possible Design Inspiration
71
+
72
+ 1. **AES-CTR plus EtM as a composition case study:** illustrates separation of confidentiality and integrity, independent keys, and verify-before-decrypt discipline. AES-NI is a CPU feature, not evidence of GPU/GEMM suitability.
73
+ 2. **KEM/DEM responsibility separation:** can inspire interface decomposition, but provides no automatic ML security or performance guarantee.
74
+ 3. **Hash-and-sign and content addressing:** hashing maps arbitrary-length data to a fixed-length digest, useful for fingerprints and version binding subject to the chosen hash property.
75
+ 4. **Fiat–Shamir and verifiable inference:** a noninteractive proof requires an actual proof-system construction and model; it is not obtained by naming a model output a proof.
76
+ 5. **Random oracles remain formal cryptographic interfaces:** an ordinary ML black box is not an independent programmable random oracle.
77
+
78
+ ## Implementation and GPU Boundary
79
+
80
+ Pure cryptographic security is not decided by GPU friendliness. For performance questions, inspect only the applicable dimensions in `../gpu-friendly-math.en.md`.
81
+
82
+ - AES and SHA-3 use bitwise/permutation operations, SIMD, dedicated instructions, or specialized kernels rather than ordinary GEMM. AES-NI and SHA extensions are CPU ISA features.
83
+ - RSA and ElGamal implementations use large-integer or finite-field arithmetic.
84
+ - Elliptic-curve scalar multiplication uses finite-field and point operations, not standard GEMM.
85
+ - DEM operations can often be batched but normally remain cryptographic kernels.
86
+ - Hashing can be parallelized; CPU and GPU use different implementation paths.
87
+
88
+ Avoid treating AES/SHA as GEMM, repeatedly invoking non-measured cryptographic kernels in a hot training loop, using a cryptographic hash as a differentiable loss, or treating a Merkle–Damgård hash as both a MAC and a random oracle.
89
+
90
+ ## Relevant Thinking Lenses
91
+
92
+ - **`axiomatization`:** definition before construction and explicit assumptions.
93
+ - **`algorithmic`:** reductions as algorithms; complexity and iterative constructions.
94
+ - **`probabilistic`:** advantage, negligible functions, birthday bounds, and leakage experiments.
95
+ - **`duality`:** information-theoretic vs computational security; adversary vs simulator.
96
+ - **`symmetry`:** Feistel/SPN structure and group-based assumptions, without confusing visual symmetry with security.
97
+ - **`categorical`:** implication relations among primitives, with reduction direction stated.
98
+ - **`game`:** attack games and adversarial interfaces.
99
+ - **`perturbation`:** concrete reduction loss and parameter compensation.
100
+
101
+ ## Anti-Patterns
102
+
103
+ - Claiming security without a definition.
104
+ - Replacing separate key-length, collision, second-preimage, and preimage requirements with an unconditional implication chain.
105
+ - Equating resistance to key recovery with encryption security.
106
+ - Reusing one key for encryption and MAC without a theorem supporting the composition.
107
+ - Using deterministic public-key encryption under an IND-CPA claim.
108
+ - Reusing CTR/GCM nonces; GCM nonce reuse can also compromise authentication.
109
+ - Using early-exit MAC comparison.
110
+ - Treating Merkle–Damgård as a random oracle or a raw MAC.
111
+ - Using textbook RSA signatures without a secure encoding such as PSS/FDH in the corresponding model.
112
+ - Reusing DSA/ECDSA nonces.
113
+
114
+ ## Deep-Dive Entry
115
+
116
+ > Jonathan Katz and Yehuda Lindell, *Introduction to Modern Cryptography*, 2nd Edition, CRC Press, 2015. ISBN 978-1-4665-7026-1.
117
+ >
118
+ > Place `Introduction to Modern Cryptography.pdf` under `math_book/` for targeted local full-text lookup.
119
+
120
+ Useful sections:
121
+
122
+ - **§1:** modern-cryptography methodology and Kerckhoffs's principle.
123
+ - **§2:** probability, asymptotic/concrete security, and entropy.
124
+ - **§3:** perfect secrecy, EAV/CPA/CCA, MACs, AE, and hash properties.
125
+ - **§4:** computational indistinguishability and experiment syntax.
126
+ - **§5:** reductions, hybrids, and game hopping.
127
+ - **§6:** OWFs, hardcore predicates, PRGs, PRFs/PRPs, and switching bounds.
128
+ - **§7:** factoring/RSA, DL/CDH/DDH, CRT, and group selection.
129
+ - **§8:** SPN, Feistel, Luby–Rackoff, Merkle–Damgård, KEM/DEM, hash-and-sign, and Fiat–Shamir.
130
+ - **§9:** random-oracle methodology and limitations.
@@ -13,22 +13,22 @@
13
13
  | 定义/构造(章节) | 迁移到 AI/ML/系统设计 |
14
14
  |---|---|
15
15
  | **三原则(定义/假设/证明,§1)** | 任何安全系统的科学方法论:先形式化威胁,再声明假设,再归约证明 |
16
- | **Kerckhocks 原则(§1.3)** | 安全不依赖算法保密;可审计、可标准化、可替换——ML 模型安全的同构原则 |
16
+ | **Kerckhoffs 原则(§1.3)** | 系统除密钥外均可公开;迁移到其他安全系统时这是设计原则,不是自动成立的定理 |
17
17
  | **概率论即安全语言(§2.1)** | Bayes 定理分析信息泄露;K 与 M 独立;随机化加密的必要性 |
18
18
  | **渐近 vs 具体安全(§2.3)** | asymptotic 给理论,concrete 给部署;ML 安全分析需要具体 bit 级界 |
19
19
  | **熵与最小熵(§2.4)** | 最小熵 = 一次猜测成功率;ML 中的"可猜性"量化 |
20
20
  | **完美保密层级(§3.1-3.2)** | 信息论安全(|K|≥|M|)⇒ 计算安全(PPT + negl)的放松链 |
21
- | **CPA/CCA/AE 定义族(§3.2-3.5)** | 威胁模型层级化;AE = CCA + 密文完整性,是工程标准 |
21
+ | **CPA/CCA/AE 定义族(§3.2-3.5)** | 加密安全的不同敌手接口与目标;AE 同时提供机密性与密文完整性,具体等价关系依定义而定 |
22
22
  | **MAC 不可伪造性(§3.4)** | 强不可伪造(不允许新 tag on 已签消息);常数时间验证;重放需上层处理 |
23
- | **Hash 与 birthday(§3.6)** | 碰撞抗性⇒第二原像⇒原像(单向);n-bit 输出给 n/2-bit 碰撞抗性 |
23
+ | **Hash 与 birthday(§3.6)** | 碰撞、第二原像和原像抗性是不同性质,一般不能写成无条件蕴含链;理想 n-bit 哈希的通用碰撞攻击约为 2^(n/2) 次查询 |
24
24
  | **归约证明范式(§5)** | 假设矛盾→构造 B 用 A→B 成功概率非忽略;模拟须完美 |
25
25
  | **Hybrid argument(§5.3)** | 相邻 hybrid 差异 ≤ ε,poly·ε 仍忽略;渐近安全的基石 |
26
26
  | **Game-hopping(§5.4)** | 现代版 hybrid:G₀→G₁→...→G_k,相邻用假设,末态敌手优势=1/2 |
27
- | **OWF PRG PRF ⇔ 对称密码(§6)** | 对称密码的统一归约链;通用构造低效,实际用 AES/SHA |
27
+ | **OWF / PRG / PRF 的存在性关系(§6)** | 标准定义下的构造与归约链;通用构造通常不作为实际密码实现 |
28
28
  | **数论假设族(§7)** | DL/CDH/DDH 严格强弱;RSA ≤ factoring;群选择影响 DDH |
29
29
  | **SPN/Feistel 构造(§8.1-8.2)** | confusion-diffusion 范式;Feistel 不要求 f 可逆;Luby-Rackoff 3/4 轮 |
30
30
  | **Merkle-Damgård(§8.3)** | 抗碰撞压缩函数 ⇒ 抗碰撞哈希;但 length-extension 攻击,非 ROM |
31
- | **KEM/DEM 混合加密(§8.4)** | 公钥建密钥、对称加密消息;~700x 加速;DEM 只需 EAV |
31
+ | **KEM/DEM 混合加密(§8.4)** | KEM 封装会话密钥、DEM 保护消息;整体安全取决于目标安全级别及 KEM、DEM 的匹配定义,不能用固定倍数概括性能 |
32
32
  | **Hash-and-Sign + Fiat-Shamir(§8.5-8.6)** | 签名先哈再签;FS 把交互识别转非交互签名(ROM) |
33
33
  | **ROM 方法论与争议(§9)** | extractability + programmability;Canetti 反例;比无证明强 |
34
34
 
@@ -43,21 +43,21 @@
43
43
  ## 关键桥接事实(激活速记)
44
44
 
45
45
  - **三原则:定义先、假设明、证明归约**(§1.1):缺一定义则"是否安全"无从谈起。
46
- - **Shannon:完美保密 ⇒ |K|≥|M|**(§3.1):信息论安全的代价,OTP 是唯一最优。
46
+ - **Shannon:完美保密 ⇒ |K|≥|M|**(§3.1):在相应有限消息/密钥空间和正确性条件下的下界;OTP 达到该界,但不能据此声称所有最优方案字面上都唯一等于 OTP。
47
47
  - **EAV ⇔ 语义安全**(§3.2):敌手对 c 能算的,无 c 也能算——计算不可区分的具象化。
48
48
  - **确定性加密 ⇏ CPA 安全**(§3.2):公钥/对称下都破,LR-oracle 一查即破。
49
- - **CPA 多重加密(公钥);对称下不自动**(§3.3):公钥敌手本可任意加密。
50
- - **CCA ⇒ 不可延展**(§3.2):变换密文成相关明文不可行;拍卖/投票/金融必需。
51
- - **AE = CCA + 密文完整性;EtM 是 AE 的推荐路径**(§3.5):MtE 用于 SSL 有 padding oracle。
49
+ - **IND-CPA 的多消息安全可由标准 hybrid 推出**:对公钥和私钥加密都需在相应定义及随机性/nonce 条件下陈述,不能把对称情形一概排除。
50
+ - **CCA 与不可延展性紧密相关**(§3.2):精确蕴含或等价需固定不可延展定义与设置,不能只凭直觉替换安全游戏。
51
+ - **EtM 是通用而稳健的组合路径**:在合适的 IND-CPA 加密、强不可伪造 MAC、独立密钥与验证顺序下可得到认证加密;MtE/EaM 不能脱离具体方案和实现笼统判定。
52
52
  - **生日攻击:n-bit hash 抗碰撞仅 n/2-bit**(§3.6): Floyd 循环查找 O(2^{n/2}) 时间常量空间。
53
- - **OWFPRGPRF ⇔ 对称密码**(§6.5):统一归约链,通用构造低效,实际用 AES/SHA
53
+ - **OWFPRGPRF 的存在性关系**(§6.5):通用构造主要是理论存在性结果;AES 是分组密码,SHA 家族是哈希函数,不能把二者当作同一种原语的“实际版本”。
54
54
  - **Goldreich-Levin:任何 OWF 可加 hardcore bit**(§6.2):⟨x,r⟩ mod 2 是 hardcore;列表解码。
55
55
  - **PRP Switching Lemma:Q 查询区分 PRP/随机函数 ≤ Q²/2^{n+1}**(§6.4):AES 当 PRF。
56
- - **DDH CDH DL;factoring RSA**(§7):假设严格强弱,群选择影响 DDH(Z_p\* 全群 DDH 易,用 QR 子群)。
56
+ - **DL/CDH/DDH RSA/factoring 的关系要按归约方向陈述**(§7):能解 DL 通常可解 CDH、能解 CDH 可判定 DDH;能分解 RSA 模数可反演 RSA,但反向一般未知。群选择会改变 DDH 难度。
57
57
  - **CRT:Z_N ≅ Z_p × Z_q**(§7.4):结构分解,加速 RSA 解密,Hastad 广播攻击根因。
58
58
  - **Luby-Rackoff:3 轮 Feistel + PRF = PRP;4 轮 = 强 PRP**(§8.2):Feistel 不要求 f 可逆。
59
59
  - **Merkle-Damgård:抗碰撞压缩函数 ⇒ 抗碰撞哈希;但 length-extension 攻击**(§8.3):非 ROM。
60
- - **KEM/DEMCPA-secure KEM + EAV-secure DEM ⇒ CPA-secure 混合**(§8.4):~700x 加速。
60
+ - **KEM/DEM 合成依安全目标而定**(§8.4):CPA/CCA 等目标要求相应的 KEM DEM 定义、密钥派生和上下文绑定;不要以固定“加速倍数”替代复杂度或基准。
61
61
  - **ROM:extractability + programmability;存在反例但实用**(§9):比无证明强,比标准模型弱。
62
62
 
63
63
  ## 适合激活的问题类型
@@ -68,31 +68,31 @@
68
68
  - **参数计算**:n-bit 安全需多大 key/输出?生日/量子下打几折?归约紧度补偿?
69
69
  - **实现陷阱诊断**:常数时间比较?IV/nonce 唯一?密钥独立?padding oracle?length-extension?
70
70
  - **协议合成审查**:EtM/MtE/EaM?独立密钥?上下文绑定?降级防护(transcript hash)?
71
- - **迁移到 ML 安全**:对抗样本的 CPA 类比?模型水印的 commitment 类比?差分隐私的归约风格?
71
+ - **AI×密码交叉**:若借用攻击游戏、commitment 或归约,是否重新定义了敌手接口、成功事件与假设?CPA/CCA 不能直接改名为黑盒/白盒 ML 攻击。
72
72
 
73
73
  ## 可能的算法启发
74
74
 
75
75
  > 本书工程导向,可迁移的算法启发比 Goldreich 更具体:
76
76
 
77
- 1. **AES-CTR + EtM 作为可验证流水线**:加密 + 认证用独立密钥,PRF 提供两路——可迁移到 ML 数据流水线的完整性保护。*落点:D1/D2——AES-NI 加速。*
78
- 2. **KEM/DEM 混合范式迁移**:用"重计算建 key + 轻计算处理数据"的模式——ML 中可迁移到"昂贵的初始化 + 廉价的批处理"。*落点:D2/D3——批处理友好。*
77
+ 1. **AES-CTR + EtM 作为组合案例**:说明机密性与完整性职责分离、独立密钥和先验 MAC 验证的重要性;AES-NI CPU 加速特性,不是 GPU/GEMM 证据。
78
+ 2. **KEM/DEM 的职责分离**:可启发接口分层,但不直接证明 ML 系统的安全或性能;性能必须按具体原语、硬件与消息规模实测。
79
79
  3. **Hash-and-Sign 迁移到内容寻址**:先哈希再处理,任意长输入压到固定长——ML 数据指纹、模型版本管理。*落点:D1——哈希廉价。*
80
80
  4. **Fiat-Shamir 迁移到可验证推理**:交互证明转非交互,让 AI 推理产出可独立验证的证明。*落点:D3——验证端廉价。*
81
- 5. **ROM 可编程性迁移到"随机预言机测试"**:设计 ML 评估时把"模型当黑盒预言机",测试其可编程性——对抗鲁棒性评估方法。*落点:方法论。*
81
+ 5. **ROM 只在密码学证明中按其形式接口使用**:把普通 ML 黑盒称为“随机预言机”不会获得 ROM 的独立随机性或可编程性。
82
82
 
83
83
  ## GPU 友好性警告
84
84
 
85
85
  > 本书涉及的多数密码学原语不在 GPU 友好维度,与 AI 方向书稿相反:
86
86
 
87
87
  **天然不友好但可专用硬件加速:**
88
- - **AES(SPN)/SHA-3(sponge)**:走 AES-NI/SHA-NI 专用指令,不走 GEMM。*违反 D1/D2。*
88
+ - **AES(SPN)/SHA-3(sponge)**:通常使用位运算、SIMD 或专用指令/内核,不走 GEMM;AES-NI/SHA 扩展是 CPU ISA,GPU 需不同实现。D1/D2 对纯密码任务通常是 `N/A`,不是安全否决项。
89
89
  - **RSA/ElGamal 大数模乘**:bigint,非张量化。*违反 D1/D2/D3。*
90
- - **EC 标量乘**:点加非 GEMM 化。*违反 D2。*
90
+ - **EC 标量乘**:通常由有限域算术和点运算实现,而非 GEMM;纯密码任务中 D2 通常为 `N/A`。
91
91
 
92
92
  **方法论层面友好:**
93
93
  - **归约/hybrid/game-hopping**:纯逻辑推理,不涉及 GPU。
94
- - **KEM/DEM 分离**:DEM 部分可 GEMM 化(对称加密批量)。
95
- - **Hash-and-Sign**:哈希部分可批量 SIMD(SHA-NI)。
94
+ - **KEM/DEM 分离**:DEM 常可批量并行,但通常仍是密码专用位运算内核,并非 GEMM
95
+ - **Hash-and-Sign**:哈希可批量并行;SHA 扩展是 CPU ISA,GPU 需使用相应批量内核。
96
96
 
97
97
  **反模式警告:**
98
98
  - 把 AES/SHA 当 GEMM 算子优化——南辕北辙,走专用指令。
@@ -116,7 +116,7 @@
116
116
  ## 反模式
117
117
 
118
118
  - **无定义就谈安全**:"直觉上安全"是空话;先写攻击游戏再谈构造。
119
- - **混淆必要与充分**:大密钥必要非充分;碰撞抗性⇒第二原像⇒原像,反方向不成立。
119
+ - **混淆必要与充分**:密钥长度、碰撞抗性、第二原像抗性和原像抗性必须按各自定义与参数分析,不能用一条无条件蕴含链替代证明。
120
120
  - **假设"密钥难恢复=安全"**:Enc_k(m)=m 密钥不可恢复但零安全。
121
121
  - **加密与 MAC 共用密钥**:EtM 要独立密钥,否则跨原语交互致破。
122
122
  - **确定性公钥加密**:公钥场景下确定性必破(加密-比对)。
@@ -62,7 +62,7 @@ Two additional directly usable "components":
62
62
 
63
63
  ## GPU Friendliness Warning
64
64
 
65
- > The sole authority for the acceptance gate: [`../gpu-friendly-math.en.md`](../gpu-friendly-math.en.md) (eight dimensions: D1 Tensorization, D2 GEMM-mappability, D3 Complexity, D4 Memory/KV, D5 Low-precision stability, D6 Parallelism & communication, D7 Sparse structure, D8 Operator fusion). Dimension-by-dimension scoring follows.
65
+ > For implementation reviews, select and quantify only the decision-relevant dimensions from [`../gpu-friendly-math.en.md`](../gpu-friendly-math.en.md); mark the rest `N/A`. The expanded table below is for full candidate comparisons.
66
66
 
67
67
  | # | Dimension | Rating | Notes |
68
68
  |---|---|---|---|
@@ -62,7 +62,7 @@
62
62
 
63
63
  ## GPU 友好性警告
64
64
 
65
- > 验收门唯一权威:[`../gpu-friendly-math.md`](../gpu-friendly-math.md)(八维:①张量化 ②GEMM 可映射 ③复杂度 ④显存/KV ⑤低精度稳定 ⑥并行与通信 ⑦稀疏结构 ⑧算子融合)。逐维打分如下。
65
+ > 实现审查从 [`../gpu-friendly-math.md`](../gpu-friendly-math.md) 选择会影响决策的维度并量化;无关项标 `N/A`。下表是完整候选比较时才使用的展开版。
66
66
 
67
67
  | # | 维度 | 评级 | 说明 |
68
68
  |---|---|---|---|
@@ -53,7 +53,7 @@ Actual chapter map (2nd ed., chapter numbers match the book):
53
53
 
54
54
  ## GPU Friendliness Warning
55
55
 
56
- > The sole authority for the acceptance gate: the **eight dimensions** in `../gpu-friendly-math.en.md`. The success or failure of manifold methods almost entirely hinges on one point: **whether the retraction / exponential map can be tensorized and expressed as GEMM, or must be solved iteratively.**
56
+ > For implementation reviews, select the applicable dimensions from `../gpu-friendly-math.en.md` and mark the rest `N/A`. Manifold methods usually require close attention to batched retractions/exponential maps, iteration cost, numerical stability, and memory; GEMM-mappability is not the sole success criterion.
57
57
 
58
58
  Dimension-by-dimension comparison:
59
59
 
@@ -53,7 +53,7 @@
53
53
 
54
54
  ## GPU 友好性警告
55
55
 
56
- > 验收门唯一权威:`../gpu-friendly-math.md` **八维**。流形方法的成败几乎全卡在一个点上:**retraction / 指数映射能不能张量化并 GEMM 化,还是必须迭代求解。**
56
+ > 实现审查按 `../gpu-friendly-math.md` 选择相关维度,无关项标 `N/A`。流形方法通常要重点检查 retraction / 指数映射的批处理方式、迭代成本、数值稳定性和内存,而不应把 GEMM 可映射性当成唯一成败标准。
57
57
 
58
58
  逐维对照:
59
59
 
@@ -18,7 +18,7 @@
18
18
 
19
19
  ## Quantitative Checklist
20
20
 
21
- When evaluating each dimension, provide concrete numbers rather than just labels:
21
+ Evaluate only dimensions relevant to the candidate and deployment target; mark others `N/A`. For decision-changing dimensions, provide concrete numbers rather than labels:
22
22
 
23
23
  | Dimension | Quantitative Questions to Answer |
24
24
  |-----------|--------------------------------|
@@ -42,24 +42,24 @@ Many "beautiful on paper" modern mathematical structures cannot run at high perf
42
42
 
43
43
  ## The 8-Dimension Scorecard
44
44
 
45
- For any candidate structure (operator, attention variant, routing mechanism, regularization term, compression scheme…) rate each dimension as `Friendly / Retrofittable / Unfriendly` and provide adaptation recommendations.
45
+ Rate candidate structures as `Friendly / Retrofittable / Unfriendly / N/A`. State shapes, baseline, and deployment constraints first, then select relevant dimensions. Do not force KV-cache, sparsity, or communication analysis onto an ordinary scalar loss merely to fill eight rows.
46
46
 
47
47
  | # | Dimension | Key Question | Friendly [v] | Unfriendly [x] |
48
48
  |---|-----------|-------------|------------|--------------|
49
49
  | 1 | **Tensorization** | Can it be expressed as dense tensor operations, avoiding element-wise irregular control flow? | Batched tensor algebra | Scalar loops, data-dependent branches |
50
- | 2 | **GEMM-mappability** | Can it be reduced to matrix multiplication / batched GEMM / convolution to fully utilize Tensor Cores? | Expressible as a GEMM chain | Irregular computations that cannot be expressed as matrix operations |
51
- | 3 | **Complexity** | Is the forward/backward pass sub-quadratic? How does it scale with sequence length / model size? | Linear / sub-quadratic, blockable | $O(n^2)$ or worse memory/compute blowup |
50
+ | 2 | **GEMM-mappability** | Can it use matrix multiplication / batched GEMM / convolution, and are shapes large enough for efficient utilization? | Large regular GEMM or mature library kernel | Irregular work, or tiny launch-bound GEMMs |
51
+ | 3 | **Complexity** | What are forward/backward FLOPs and scaling relative to the baseline? | Meets target-scale latency/throughput budgets | Exceeds deployment budgets or has an unacceptable scaling bottleneck |
52
52
  | 4 | **Memory & KV-Cache** | Peak memory usage; activation / state / KV footprint; can it be compressed? | Low-rank / quantized / block-summary compressible | Must materialize large intermediate tensors |
53
53
  | 5 | **Low-Precision Stability** | Is it stable under fp16/bf16/fp8 with deterministic reproducibility? | Controlled dynamic range, numerically robust | Catastrophic cancellation, ill-conditioned, requires fp64 |
54
54
  | 6 | **Parallelism & Communication** | Can it be parallelized across SMs / devices? Communication-to-compute ratio; can overlap be achieved? | Highly parallel, communication overlap-able | Long serial recurrences, communication bottleneck |
55
55
  | 7 | **Sparse structure** | Structured or unstructured sparsity? | Block / banded structured sparsity | Random gather/scatter |
56
56
  | 8 | **Operator Fusion** | Can kernels be fused to avoid materializing large intermediates (FlashAttention-style)? | Fusible, recomputable | Frequent small kernels, divergent control flow |
57
57
 
58
- **Scoring conclusion**: Retain only candidates that are **mathematically beautiful AND (all eight dimensions friendly or retrofittable)**; any dimension rated "unfriendly and non-retrofittable" means the candidate must be adapted or eliminated.
58
+ **Scoring conclusion**: Separate hard constraints from optimization goals. Eliminate a candidate only when it violates a task-critical hard constraint and cannot be adapted; otherwise report the main bottleneck and validation plan. `N/A` is not a failure, and GEMM expressibility is not evidence of measured speed.
59
59
 
60
60
  ## Common "Beautiful but Non-Computable" Anti-Patterns
61
61
 
62
- - **Dense global $O(n^2)$ operators**: Naive softmax attention explodes with context length.
62
+ - **Dense global operators without a target-scale analysis**: $O(n^2)$ is not automatically infeasible, but materializing $n\times n$ tensors often exceeds long-context budgets. Compare against the baseline, target $n$, and fused implementation.
63
63
  - **Unstructured sparsity / irregular graph traversal**: Random memory access destroys locality.
64
64
  - **High-precision dependency**: Ill-conditioned problems that require fp64 for correctness (most training runs only bf16/fp16/fp8).
65
65
  - **Serial recurrence**: Long-range dependencies that cannot be parallelized (naive RNN-style).
@@ -83,9 +83,9 @@ Drawn from the auto-research directions cited in `agentic-workflow.en.md`, demon
83
83
 
84
84
  | Component | Mathematical Source | GPU Friendliness |
85
85
  |-----------|-------------------|-----------------|
86
- | Tropical Gating | Tropical semiring, piecewise-linear | Replaces Top-K: element-wise max-plus D1[v] / D2[x] Not a Tensor Core GEMM (runs on CUDA cores) / D3[v] Per-token gating only, sub-quadratic (min-plus matmul is APSP-hard, not sub-quadratic); sub-differentiable, kinks require LogSumExp smoothing (smoothing recovers standard softmax) |
86
+ | Tropical Gating | Tropical semiring, piecewise-linear | Element-wise max-plus gating is tensorizable but is not a GEMM; full min-plus matrix multiplication is closely related to APSP-type complexity. Kinks admit subgradients, while LogSumExp is a smoothing approximation that changes the operator. |
87
87
  | Cellular Sheaf Diffusion | Algebraic geometry / topology (sheaves, restriction maps) | Each edge is a low-rank linear transform = small GEMM (D2/D4) |
88
- | Čech Cohomology Regularization | Algebraic topology (first cohomology $H^1$) | Local, inexpensive; serves as an algebraic criterion for hallucination (D3/D8) |
88
+ | Candidate Čech Cohomology Regularizer | Algebraic topology (first cohomology $H^1$) | Unvalidated: complex construction and homology computation may be expensive. “Hallucination criterion is a research hypothesis requiring a computable surrogate, complexity analysis, and effectiveness experiments. |
89
89
  | Low-Rank Basis KV Compression (Plücker/Grassmannian perspective) | Projective geometry | Store the basis rather than Plücker coordinates (the latter expands when low-rank); block-summary candidate — compression ratio / error / throughput must be benchmarked (D4) |
90
90
 
91
91
  Do not treat the table above as validated conclusions. The correct approach is to enter each component into the test plan: prove or estimate complexity, measure peak memory and throughput, check bf16/fp8 stability, and confirm whether it can be mapped to GEMM / batched GEMM / fused kernels. Only after both empirical benchmarks and theoretical derivations pass should a component be labeled "math beautiful × GPU friendly."
@@ -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** | 能否落到 矩阵乘 / batched GEMM / 卷积,吃满 Tensor Core? | 可写成 GEMM | 无法矩阵化的不规则运算 |
55
- | 3 | **复杂度 / Complexity** | 前向/反向是否亚二次?随序列/规模如何增长? | 线性/亚二次、可分块 | O(n²) 起的显存/算力爆炸 |
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
- **评分结论**:只保留**数学美 AND(八维全部友好或可改造)**的候选;任何一维"不友好且不可改造",要么改造、要么淘汰。
62
+ **评分结论**:先区分硬约束与优化项。若候选违反任务的硬约束且不可改造,则淘汰;否则报告主要瓶颈与验证计划。`N/A` 不计分,GEMM 可写性也不等于实际高性能。
63
63
 
64
64
  ## 常见「美但不可算」反模式 / Anti-Patterns
65
65
 
66
- - **稠密全局算子 O(n²)**:朴素 softmax 注意力随上下文爆炸。
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 | 热带半环分段线性 | 替代 Top-K:逐元素 max-plus——D1[v] / D2[x] 非 Tensor Core GEMM(落 CUDA core)/ D3[v] 仅逐 token 门控亚二次(min-plus matmul APSP-hard 非亚二次);次可微,折点需 LogSumExp 软化(软化退回标准 softmax)|
90
+ | 热带门控 Tropical Gating | 热带半环分段线性 | 逐元素 max-plus 门控可张量化但不等于 GEMM;完整 min-plus 矩阵乘的复杂度与 APSP 类问题紧密相关。折点处只具次梯度,LogSumExp 是一种平滑近似但会改变原算子 |
91
91
  | 胞腔层扩散 Cellular Sheaf Diffusion | 代数几何/拓扑(层、限制映射)| 每边低秩线性变换 = 小 GEMM(D2/D4)|
92
- | Čech 上同调正则 | 代数拓扑(一阶上同调 H¹)| 局部、廉价;作幻觉的代数判据(D3/D8)|
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"。